From: Joshua Colp Date: Thu, 1 Aug 2019 10:07:45 +0000 (+0000) Subject: res_pjsip: Fix multiple of the same contact in "pjsip show contacts". X-Git-Tag: 17.0.0-rc1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02826c20f5014ef9a106608b7b1b5755727693ad;p=thirdparty%2Fasterisk.git res_pjsip: Fix multiple of the same contact in "pjsip show contacts". The code for gathering contacts could result in the same contact being retrieved and added to the list multiple times. The container which stores the contacts to display will now only allow a contact to be added to it once instead of multiple times. ASTERISK-28228 Change-Id: I805185cfcec03340f57d2b9e6cc43c49401812df --- diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 1ddf630948..a41128e040 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -1035,7 +1035,11 @@ static struct ao2_container *cli_contact_get_container(const char *regex) return NULL; } - contacts_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, + /* Retrieving all the contacts may result in finding the same contact multiple + * times. So that they don't get displayed multiple times we only allow a + * single one to be placed into the container. + */ + contacts_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, cli_contact_sort, cli_contact_compare); if (!contacts_container) { return NULL;