<p>Kevin Harwell <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14613">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, approved; Approved for Submit
George Joseph: Looks good to me, but someone else must approve
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Apply AOR outbound proxy to static contacts.<br><br>The outbound proxy for an AOR was not being applied to<br>any statically configured Contacts. This resulted in the<br>OPTIONS requests being sent to the wrong target.<br><br>This change sets the outbound proxy on statically configured<br>contacts once the AOR configuration is done being<br>applied.<br><br>ASTERISK-28965<br><br>Change-Id: Ia60f3e93ea63f819c5a46bc8b54be2e588dfa9e0<br>---<br>M res/res_pjsip/location.c<br>1 file changed, 24 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c</span><br><span>index a41128e..cef5ad7 100644</span><br><span>--- a/res/res_pjsip/location.c</span><br><span>+++ b/res/res_pjsip/location.c</span><br><span>@@ -1339,6 +1339,29 @@</span><br><span> return status ? 0 : -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int aor_apply_outbound_proxy(void *obj, void *arg, int flags)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_sip_contact *contact = obj;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_sip_aor *aor = arg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_string_field_set(contact, outbound_proxy, aor->outbound_proxy);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int aor_apply_handler(const struct ast_sorcery *sorcery, void *object)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_sip_aor *aor = object;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!aor->permanent_contacts || ast_strlen_zero(aor->outbound_proxy)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_callback(aor->permanent_contacts, OBJ_NODATA | OBJ_MULTIPLE, aor_apply_outbound_proxy, aor);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \brief Initialize sorcery with location support */</span><br><span> int ast_sip_initialize_sorcery_location(void)</span><br><span> {</span><br><span>@@ -1355,7 +1378,7 @@</span><br><span> ast_sorcery_apply_default(sorcery, "aor", "config", "pjsip.conf,criteria=type=aor");</span><br><span> </span><br><span> if (ast_sorcery_object_register(sorcery, "contact", contact_alloc, NULL, contact_apply_handler) ||</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sorcery_object_register(sorcery, "aor", aor_alloc, NULL, NULL)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_register(sorcery, "aor", aor_alloc, NULL, aor_apply_handler)) {</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14613">change 14613</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/14613"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: certified/16.8 </div>
<div style="display:none"> Gerrit-Change-Id: Ia60f3e93ea63f819c5a46bc8b54be2e588dfa9e0 </div>
<div style="display:none"> Gerrit-Change-Number: 14613 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>