[asterisk-commits] dvossel: trunk r201570 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 18 10:16:19 CDT 2009


Author: dvossel
Date: Thu Jun 18 10:16:05 2009
New Revision: 201570

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201570
Log:
parsing extension correctly from sip register lines

If a transport type was specified, but no extension, parsing of the extension would return whatever was after the transport rather than defaulting to 's'.

(closes issue #15111)
Reported by: ffs
Patches:
      chan_sip.c_register-parser.patch uploaded by ffs (license 730)
Tested by: ffs, dvossel


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=201570&r1=201569&r2=201570
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jun 18 10:16:05 2009
@@ -7294,19 +7294,20 @@
 	enum sip_transport transport = SIP_TRANSPORT_UDP;
 	char buf[256] = "";
 	char *username = NULL;
-	char *hostname=NULL, *secret=NULL, *authuser=NULL, *expire=NULL;
+	char *hostname=NULL, *secret=NULL, *authuser=NULL, *expire=NULL, *buf2=NULL;
 	char *callback=NULL;
 
 	if (!value)
 		return -1;
 
 	ast_copy_string(buf, value, sizeof(buf));
-
-	/* split [/contact][~expiry] */
-	expire = strchr(buf, '~');
+	buf2 = strrchr(buf, '@');
+
+	/* split [/extension][~expiry] */
+	expire = strchr(buf2, '~');
 	if (expire)
 		*expire++ = '\0';
-	callback = strrchr(buf, '/');
+	callback = strrchr(buf2, '/');
 	if (callback)
 		*callback++ = '\0';
 	if (ast_strlen_zero(callback))




More information about the asterisk-commits mailing list