[asterisk-commits] mjordan: trunk r412467 - in /trunk: ./ channels/ channels/sip/include/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 17 14:50:15 CDT 2014


Author: mjordan
Date: Thu Apr 17 14:50:05 2014
New Revision: 412467

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=412467
Log:
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/

Modified:
    trunk/CHANGES
    trunk/channels/chan_sip.c
    trunk/channels/sip/include/sip.h

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=412467&r1=412466&r2=412467
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Apr 17 14:50:05 2014
@@ -98,7 +98,7 @@
 -------------------------
  * 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
-   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.
 
 Debugging

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=412467&r1=412466&r2=412467
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Apr 17 14:50:05 2014
@@ -8249,6 +8249,9 @@
 	if (!ast_strlen_zero(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)) {
 		pbx_builtin_setvar_helper(tmp, "SIPCALLID", i->callid);
 	}
@@ -17694,6 +17697,12 @@
 
 	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)) {
 		/*
 		 * Either there really was no extension found or the request
@@ -17702,8 +17711,6 @@
 		 */
 		uri = "s";
 	}
-
-	ast_string_field_set(p, domain, domain);
 
 	/* Now find the From: caller ID and name */
 	/* XXX Why is this done in get_destination? Isn't it already done?
@@ -18358,7 +18365,7 @@
 		if (!peer) {
 			char *uri_tmp, *callback = NULL, *dummy;
 			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))) {
 				; /* found, fall through */
 			} else {

Modified: trunk/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/include/sip.h?view=diff&rev=412467&r1=412466&r2=412467
==============================================================================
--- trunk/channels/sip/include/sip.h (original)
+++ trunk/channels/sip/include/sip.h Thu Apr 17 14:50:05 2014
@@ -1038,6 +1038,7 @@
 		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(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 */
 	int maxforwards;                        /*!< SIP Loop prevention */




More information about the asterisk-commits mailing list