[Asterisk-code-review] res pjsip mwi: remove unneeded check on endpoint's contacts. (asterisk[13])

Anonymous Coward asteriskteam at digium.com
Wed Jul 20 09:58:00 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: res_pjsip_mwi: remove unneeded check on endpoint's contacts.
......................................................................


res_pjsip_mwi: remove unneeded check on endpoint's contacts.

The function create_mwi_subscriptions_for_endpoint checks
if there is active contacts by retrieving aors and contacts.

This function is used to create all unsolicited mwi subscriptions
on startup and is used when contact added.

In both cases it's not necessary to check if there are contacts.
The contacts are needed when asterisk sends mwi.

ASTERISK-26200 #close

Change-Id: I98e43bdc97f3c0829951cd9bf5f3c6348c6ac1fa
---
M res/res_pjsip_mwi.c
1 file changed, 1 insertion(+), 27 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c
index 9eba335..d86c96c 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -976,37 +976,11 @@
 {
 	RAII_VAR(struct mwi_subscription *, aggregate_sub, NULL, ao2_cleanup);
 	struct ast_sip_endpoint *endpoint = obj;
-	char *endpoint_aors, *aor_name, *mailboxes, *mailbox;
-	struct ao2_container *contacts = NULL;
+	char *mailboxes, *mailbox;
 
 	if (ast_strlen_zero(endpoint->subscription.mwi.mailboxes)) {
 		return 0;
 	}
-
-	endpoint_aors = ast_strdupa(endpoint->aors);
-
-	while ((aor_name = ast_strip(strsep(&endpoint_aors, ",")))) {
-		RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
-
-		if (!aor) {
-			continue;
-		}
-
-		contacts = ast_sip_location_retrieve_aor_contacts(aor);
-		if (!contacts || (ao2_container_count(contacts) == 0)) {
-			ao2_cleanup(contacts);
-			contacts = NULL;
-			continue;
-		}
-
-		break;
-	}
-
-	if (!contacts) {
-		return 0;
-	}
-
-	ao2_ref(contacts, -1);
 
 	if (endpoint->subscription.mwi.aggregate) {
 		aggregate_sub = mwi_subscription_alloc(endpoint, 0, NULL);

-- 
To view, visit https://gerrit.asterisk.org/3210
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I98e43bdc97f3c0829951cd9bf5f3c6348c6ac1fa
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list