[asterisk-commits] trunk r15375 - in /trunk: ./ channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 27 16:13:32 MST 2006


Author: oej
Date: Mon Mar 27 17:13:31 2006
New Revision: 15375

URL: http://svn.digium.com/view/asterisk?rev=15375&view=rev
Log:
Issue #6409 - Make calls to URI without username go to "s" extension (imported from 1.2)

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=15375&r1=15374&r2=15375&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Mar 27 17:13:31 2006
@@ -6704,6 +6704,7 @@
 	char tmp[256] = "", *uri, *a;
 	char tmpf[256], *from;
 	struct sip_request *req;
+	char *colon;
 	
 	req = oreq;
 	if (!req)
@@ -6735,20 +6736,27 @@
 		ast_uri_decode(from);
 	}
 
+	/* Skip any options */
+	if ((a = strchr(uri, ';'))) {
+		*a = '\0';
+	}
+
 	/* Get the target domain */
 	if ((a = strchr(uri, '@'))) {
-		char *colon;
 		*a = '\0';
 		a++;
 		colon = strchr(a, ':'); /* Remove :port */
 		if (colon)
 			*colon = '\0';
-		ast_string_field_set(p, domain, a);
-	}
-	/* Skip any options */
-	if ((a = strchr(uri, ';'))) {
-		*a = '\0';
-	}
+	} else {	/* No username part */
+		a = uri;
+		uri = "s";	/* Set extension to "s" */
+	}
+	colon = strchr(a, ':'); /* Remove :port */
+	if (colon)
+		*colon = '\0';
+
+	ast_string_field_set(p, domain, a);
 
 	if (!AST_LIST_EMPTY(&domain_list)) {
 		char domain_context[AST_MAX_EXTENSION];



More information about the asterisk-commits mailing list