[Asterisk-code-review] pjsip options: dynamic contact's fields not updated on reload (asterisk[certified/13.18])

George Joseph asteriskteam at digium.com
Wed Dec 13 13:07:39 CST 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/7483 )

Change subject: pjsip_options: dynamic contact's fields not updated on reload
......................................................................

pjsip_options: dynamic contact's fields not updated on reload

Dynamic contacts were not being properly updated on reload. As a matter of
fact any changes to the AOR that a dynamic contact was associated with were
not being applied.

On reload, this patch makes it so for each dynamic contact, the associated
AOR is now retrieved and the AOR's fields are applied to the contact.

ASTERISK-27467

Change-Id: I8e3165dc6a745218c1c9db837f77fafa0516985d
---
M res/res_pjsip/pjsip_options.c
1 file changed, 18 insertions(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index d4ea911..da95341 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -1157,7 +1157,24 @@
 
 static int qualify_and_schedule_cb_without_aor(void *obj, void *arg, int flags)
 {
-	qualify_and_schedule_contact((struct ast_sip_contact *) obj);
+	/*
+	 * These are really dynamic contacts. We need to retrieve the aor associated
+	 * with the contact since it's possible some of the aor's fields were updated
+	 * since last load.
+	 */
+	struct ast_sip_contact *contact = obj;
+	struct ast_sip_aor *aor = ast_sip_location_retrieve_aor(contact->aor);
+
+	if (aor) {
+		qualify_and_schedule_cb_with_aor(obj, aor, flags);
+		ao2_ref(aor, -1);
+	} else {
+		ast_log(LOG_WARNING, "Unable to locate AOR for contact '%s'. Keeping old "
+			"associated settings: frequency=%d, timeout=%f, authenticate=%s\n",
+			contact->uri, contact->qualify_frequency, contact->qualify_timeout,
+			contact->authenticate_qualify ? "yes" : "no");
+		qualify_and_schedule_contact(contact);
+	}
 
 	return 0;
 }

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

Gerrit-Project: asterisk
Gerrit-Branch: certified/13.18
Gerrit-MessageType: merged
Gerrit-Change-Id: I8e3165dc6a745218c1c9db837f77fafa0516985d
Gerrit-Change-Number: 7483
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171213/15a170a0/attachment-0001.html>


More information about the asterisk-code-review mailing list