[Asterisk-code-review] res_pjsip: Apply AOR outbound proxy to static contacts. (asterisk[13])
Friendly Automation
asteriskteam at digium.com
Mon Jun 29 17:47:18 CDT 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14576 )
Change subject: res_pjsip: Apply AOR outbound proxy to static contacts.
......................................................................
res_pjsip: Apply AOR outbound proxy to static contacts.
The outbound proxy for an AOR was not being applied to
any statically configured Contacts. This resulted in the
OPTIONS requests being sent to the wrong target.
This change sets the outbound proxy on statically configured
contacts once the AOR configuration is done being
applied.
ASTERISK-28965
Change-Id: Ia60f3e93ea63f819c5a46bc8b54be2e588dfa9e0
---
M res/res_pjsip/location.c
1 file changed, 24 insertions(+), 1 deletion(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 2a173da..68ea83b 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -1289,6 +1289,29 @@
return status ? 0 : -1;
}
+static int aor_apply_outbound_proxy(void *obj, void *arg, int flags)
+{
+ struct ast_sip_contact *contact = obj;
+ struct ast_sip_aor *aor = arg;
+
+ ast_string_field_set(contact, outbound_proxy, aor->outbound_proxy);
+
+ return 0;
+}
+
+static int aor_apply_handler(const struct ast_sorcery *sorcery, void *object)
+{
+ struct ast_sip_aor *aor = object;
+
+ if (!aor->permanent_contacts || ast_strlen_zero(aor->outbound_proxy)) {
+ return 0;
+ }
+
+ ao2_callback(aor->permanent_contacts, OBJ_NODATA | OBJ_MULTIPLE, aor_apply_outbound_proxy, aor);
+
+ return 0;
+}
+
/*! \brief Initialize sorcery with location support */
int ast_sip_initialize_sorcery_location(void)
{
@@ -1305,7 +1328,7 @@
ast_sorcery_apply_default(sorcery, "aor", "config", "pjsip.conf,criteria=type=aor");
if (ast_sorcery_object_register(sorcery, "contact", contact_alloc, NULL, contact_apply_handler) ||
- ast_sorcery_object_register(sorcery, "aor", aor_alloc, NULL, NULL)) {
+ ast_sorcery_object_register(sorcery, "aor", aor_alloc, NULL, aor_apply_handler)) {
return -1;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14576
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: Ia60f3e93ea63f819c5a46bc8b54be2e588dfa9e0
Gerrit-Change-Number: 14576
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200629/f951e3c7/attachment.html>
More information about the asterisk-code-review
mailing list