[asterisk-commits] branch 1.2 r15366 - /branches/1.2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 27 15:50:42 MST 2006


Author: oej
Date: Mon Mar 27 16:50:41 2006
New Revision: 15366

URL: http://svn.digium.com/view/asterisk?rev=15366&view=rev
Log:
Issue #6409 - Use "s" extension when there's no username in the URI

Modified:
    branches/1.2/channels/chan_sip.c

Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?rev=15366&r1=15365&r2=15366&view=diff
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Mon Mar 27 16:50:41 2006
@@ -6519,6 +6519,7 @@
 	char tmp[256] = "", *uri, *a;
 	char tmpf[256], *from;
 	struct sip_request *req;
+	char *colon;
 	
 	req = oreq;
 	if (!req)
@@ -6550,20 +6551,24 @@
 		ast_uri_decode(from);
 	}
 
-	/* Get the target domain */
-	if ((a = strchr(uri, '@'))) {
-		char *colon;
-		*a = '\0';
-		a++;
-		colon = strchr(a, ':'); /* Remove :port */
-		if (colon)
-			*colon = '\0';
-		ast_copy_string(p->domain, a, sizeof(p->domain));
-	}
 	/* Skip any options */
 	if ((a = strchr(uri, ';'))) {
 		*a = '\0';
 	}
+
+	/* Get the target domain */
+	if ((a = strchr(uri, '@'))) {
+		*a = '\0';
+		a++;
+	} else {	/* No username part */
+		a = uri;
+		uri = "s";	/* Set extension to "s" */
+	}
+	colon = strchr(a, ':'); /* Remove :port */
+	if (colon)
+		*colon = '\0';
+
+	ast_copy_string(p->domain, a, sizeof(p->domain));
 
 	if (!AST_LIST_EMPTY(&domain_list)) {
 		char domain_context[AST_MAX_EXTENSION];



More information about the asterisk-commits mailing list