mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 16:21:01 +00:00
chan_sip: Add SIPURIPHONECONTEXT channel variable for Request TEL URIs
This patch is a continuation of https://reviewboard.asterisk.org/r/3349/, committed in r412303. It resolves a finding oej had that the phone-context be available in a channel variable separate from SIPDOMAIN. This patch adds that variable as SIPURIPHONECONTEXT. It also allows a local number (or global number specified in the TEL URI) to be used to look up as a peer. (issue ASTERISK-17179) Review: https://reviewboard.asterisk.org/r/3349/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412467 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -98,7 +98,7 @@ chan_sip
|
|||||||
-------------------------
|
-------------------------
|
||||||
* TEL URI support for inbound INVITE requests has been added. chan_sip will
|
* TEL URI support for inbound INVITE requests has been added. chan_sip will
|
||||||
now handle TEL schemes in the Request and From URIs. The phone-context in
|
now handle TEL schemes in the Request and From URIs. The phone-context in
|
||||||
the Request URI will be stored in the TELPHONECONTEXT channel variable on
|
the Request URI will be stored in the SIPURIPHONECONTEXT channel variable on
|
||||||
the inbound channel.
|
the inbound channel.
|
||||||
|
|
||||||
Debugging
|
Debugging
|
||||||
|
@@ -8249,6 +8249,9 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
|
|||||||
if (!ast_strlen_zero(i->domain)) {
|
if (!ast_strlen_zero(i->domain)) {
|
||||||
pbx_builtin_setvar_helper(tmp, "SIPDOMAIN", i->domain);
|
pbx_builtin_setvar_helper(tmp, "SIPDOMAIN", i->domain);
|
||||||
}
|
}
|
||||||
|
if (!ast_strlen_zero(i->tel_phone_context)) {
|
||||||
|
pbx_builtin_setvar_helper(tmp, "SIPURIPHONECONTEXT", i->tel_phone_context);
|
||||||
|
}
|
||||||
if (!ast_strlen_zero(i->callid)) {
|
if (!ast_strlen_zero(i->callid)) {
|
||||||
pbx_builtin_setvar_helper(tmp, "SIPCALLID", i->callid);
|
pbx_builtin_setvar_helper(tmp, "SIPCALLID", i->callid);
|
||||||
}
|
}
|
||||||
@@ -17694,6 +17697,12 @@ static enum sip_get_dest_result get_destination(struct sip_pvt *p, struct sip_re
|
|||||||
|
|
||||||
extract_host_from_hostport(&domain);
|
extract_host_from_hostport(&domain);
|
||||||
|
|
||||||
|
if (strncasecmp(get_in_brackets(tmp), "tel:", 4)) {
|
||||||
|
ast_string_field_set(p, domain, domain);
|
||||||
|
} else {
|
||||||
|
ast_string_field_set(p, tel_phone_context, domain);
|
||||||
|
}
|
||||||
|
|
||||||
if (ast_strlen_zero(uri)) {
|
if (ast_strlen_zero(uri)) {
|
||||||
/*
|
/*
|
||||||
* Either there really was no extension found or the request
|
* Either there really was no extension found or the request
|
||||||
@@ -17703,8 +17712,6 @@ static enum sip_get_dest_result get_destination(struct sip_pvt *p, struct sip_re
|
|||||||
uri = "s";
|
uri = "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_string_field_set(p, domain, domain);
|
|
||||||
|
|
||||||
/* Now find the From: caller ID and name */
|
/* Now find the From: caller ID and name */
|
||||||
/* XXX Why is this done in get_destination? Isn't it already done?
|
/* XXX Why is this done in get_destination? Isn't it already done?
|
||||||
Needs to be checked
|
Needs to be checked
|
||||||
@@ -18358,7 +18365,7 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of,
|
|||||||
if (!peer) {
|
if (!peer) {
|
||||||
char *uri_tmp, *callback = NULL, *dummy;
|
char *uri_tmp, *callback = NULL, *dummy;
|
||||||
uri_tmp = ast_strdupa(uri2);
|
uri_tmp = ast_strdupa(uri2);
|
||||||
parse_uri(uri_tmp, "sip:,sips:", &callback, &dummy, &dummy, &dummy);
|
parse_uri(uri_tmp, "sip:,sips:,tel:", &callback, &dummy, &dummy, &dummy);
|
||||||
if (!ast_strlen_zero(callback) && (peer = sip_find_peer_by_ip_and_exten(&p->recv, callback, p->socket.type))) {
|
if (!ast_strlen_zero(callback) && (peer = sip_find_peer_by_ip_and_exten(&p->recv, callback, p->socket.type))) {
|
||||||
; /* found, fall through */
|
; /* found, fall through */
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1038,6 +1038,7 @@ struct sip_pvt {
|
|||||||
AST_STRING_FIELD(last_presence_subtype); /*!< The last presence subtype sent for a subscription. */
|
AST_STRING_FIELD(last_presence_subtype); /*!< The last presence subtype sent for a subscription. */
|
||||||
AST_STRING_FIELD(last_presence_message); /*!< The last presence message for a subscription */
|
AST_STRING_FIELD(last_presence_message); /*!< The last presence message for a subscription */
|
||||||
AST_STRING_FIELD(msg_body); /*!< Text for a MESSAGE body */
|
AST_STRING_FIELD(msg_body); /*!< Text for a MESSAGE body */
|
||||||
|
AST_STRING_FIELD(tel_phone_context); /*!< The phone-context portion of a TEL URI */
|
||||||
);
|
);
|
||||||
char via[128]; /*!< Via: header */
|
char via[128]; /*!< Via: header */
|
||||||
int maxforwards; /*!< SIP Loop prevention */
|
int maxforwards; /*!< SIP Loop prevention */
|
||||||
|
Reference in New Issue
Block a user