summaryrefslogtreecommitdiff
path: root/res/res_pjsip_session.c
diff options
context:
space:
mode:
authorAlexander Traud <pabstraud@compuserve.com>2016-12-22 16:13:46 +0100
committerAlexander Traud <pabstraud@compuserve.com>2017-01-04 07:13:12 -0600
commitf0eb3214e6cde4035c39891fe6bc65041c701803 (patch)
treece4083b2d2e62957db3599fdf99bb2a2d98bcc15 /res/res_pjsip_session.c
parent4ecc3de00e4105d1f2a2cd1344023988a61268ae (diff)
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
Diffstat (limited to 'res/res_pjsip_session.c')
-rw-r--r--res/res_pjsip_session.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index d41d2d959..4c68cc9f6 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1998,6 +1998,12 @@ static enum sip_get_destination_result get_destination(struct ast_sip_session *s
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