[Asterisk-code-review] res pjsip session: Access SIPDOMAIN via Dialplan. (asterisk[13])

Anonymous Coward asteriskteam at digium.com
Thu Jan 5 07:43:51 CST 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4653 )

Change subject: res_pjsip_session: Access SIPDOMAIN via Dialplan.
......................................................................


res_pjsip_session: Access SIPDOMAIN via Dialplan.

This feature was available in the SIP channel driver chan_sip. For example,
Asterisk is the outbound proxy and has to handle all SIP-URIs, even domains not
local to Asterisk. In that case, SIPDOMAIN is used in the Dialplan, to detect
and dial remote SIP-URIs. This change here sets the SIP destination domain of
an inbound call (SIPDOMAIN) in the SIP channel driver res_pjsip as well.

ASTERISK-26670 #close

Change-Id: I27c880dc404a3c1c6792e1ba3545475339577243
---
M res/res_pjsip_session.c
1 file changed, 6 insertions(+), 0 deletions(-)

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



diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 60850f0..3c4f102 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1998,6 +1998,12 @@
 
 	if (!strcmp(session->exten, pickupexten) ||
 		ast_exists_extension(NULL, session->endpoint->context, session->exten, 1, NULL)) {
+		size_t size = pj_strlen(&sip_ruri->host) + 1;
+		char *domain = ast_alloca(size);
+
+		ast_copy_pj_str(domain, &sip_ruri->host, size);
+		pbx_builtin_setvar_helper(session->channel, "SIPDOMAIN", domain);
+
 		return SIP_GET_DEST_EXTEN_FOUND;
 	}
 	/* XXX In reality, we'll likely have further options so that partial matches

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I27c880dc404a3c1c6792e1ba3545475339577243
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>



More information about the asterisk-code-review mailing list