<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9103">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip_options: handle modification of qualify options in realtime<br><br>Currentrly pjsip_options code does not handle the situation when the<br>qualify options were changed in realtime database.<br>Only 'module reload res_pjsip' helps.<br><br>This patch add a check on contact add/update observers if the contact<br>qualify options are different than local aor qualify options.<br>If the qualify options were modified then synchronize<br>the pjsip_options AOR local state.<br><br>ASTERISK-27872<br><br>Change-Id: Id55210a18e62ed5d35a88e408d5fe84a3c513c62<br>---<br>M res/res_pjsip/pjsip_options.c<br>1 file changed, 45 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c<br>index 904e70c..918dda3 100644<br>--- a/res/res_pjsip/pjsip_options.c<br>+++ b/res/res_pjsip/pjsip_options.c<br>@@ -2059,6 +2059,29 @@<br> struct ast_sip_contact *contact;<br> };<br> <br>+<br>+/*!<br>+ * \brief Check if the contact qualify options are different than local aor qualify options<br>+ */<br>+static int has_qualify_changed (struct ast_sip_contact *contact, struct sip_options_aor *aor_options)<br>+{<br>+ if (!contact) {<br>+ return 0;<br>+ }<br>+<br>+ if (!aor_options) {<br>+ if (contact->qualify_frequency) {<br>+ return 1;<br>+ }<br>+ } else if (contact->qualify_frequency != aor_options->qualify_frequency<br>+ || contact->authenticate_qualify != aor_options->authenticate_qualify<br>+ || ((int)(contact->qualify_timeout * 1000)) != ((int)(aor_options->qualify_timeout * 1000))) {<br>+ return 1;<br>+ }<br>+<br>+ return 0;<br>+}<br>+<br> /*!<br> * \brief Task which adds a dynamic contact to an AOR<br> * \note Run by aor_options->serializer<br>@@ -2129,23 +2152,21 @@<br> task_data.contact = obj;<br> task_data.aor_options = ao2_find(sip_options_aors, task_data.contact->aor,<br> OBJ_SEARCH_KEY);<br>- if (!task_data.aor_options) {<br>+<br>+ if (has_qualify_changed(task_data.contact, task_data.aor_options)) {<br> struct ast_sip_aor *aor;<br> <br>- /*<br>- * The only reason this would occur is if the AOR was sourced<br>- * after the last reload happened. To handle this we fetch the<br>- * AOR and treat it as if we received notification that it had<br>- * been created. This will create the needed AOR feeder<br>- * compositor and will cause any associated contact statuses and<br>- * endpoint state compositors to also get created if needed.<br>- */<br> aor = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "aor",<br> task_data.contact->aor);<br> if (aor) {<br>+ ast_debug(3, "AOR '%s' qualify options have been modified. Synchronize an AOR local state\n",<br>+ task_data.contact->aor);<br> sip_options_aor_observer_modified_task(aor);<br> ao2_ref(aor, -1);<br> }<br>+ }<br>+<br>+ if (!task_data.aor_options) {<br> return 0;<br> }<br> <br>@@ -2207,6 +2228,21 @@<br> task_data->contact = (struct ast_sip_contact *) obj;<br> task_data->aor_options = ao2_find(sip_options_aors, task_data->contact->aor,<br> OBJ_SEARCH_KEY);<br>+<br>+ if (has_qualify_changed(task_data->contact, task_data->aor_options)) {<br>+ struct ast_sip_aor *aor;<br>+<br>+ aor = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "aor",<br>+ task_data->contact->aor);<br>+ if (aor) {<br>+ ast_debug(3, "AOR '%s' qualify options have been modified. Synchronize an AOR local state\n",<br>+ task_data->contact->aor);<br>+ ast_sip_push_task_wait_serializer(management_serializer,<br>+ sip_options_aor_observer_modified_task, aor);<br>+ ao2_ref(aor, -1);<br>+ }<br>+ }<br>+<br> if (!task_data->aor_options) {<br> ast_free(task_data);<br> return;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9103">change 9103</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9103"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Id55210a18e62ed5d35a88e408d5fe84a3c513c62 </div>
<div style="display:none"> Gerrit-Change-Number: 9103 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>