[asterisk-commits] oej: trunk r99521 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 10:40:03 CST 2008


Author: oej
Date: Tue Jan 22 09:25:43 2008
New Revision: 99521

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99521
Log:
Add authentication options to the SIP dialstring.
Documentation follows separately

(issue #11587)
Reported by: sobomax
Patches: 
      chan_sip.c-trunk.diff uploaded by sobomax (license 359)


Modified:
    trunk/channels/chan_sip.c

Change Statistics:
 trunk/channels/chan_sip.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=99521&r1=99520&r2=99521
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jan 22 09:25:43 2008
@@ -18716,6 +18716,9 @@
 	char tmp[256];
 	char *dest = data;
 	char *dnid;
+ 	char *secret = NULL;
+ 	char *md5secret = NULL;
+ 	char *authname = NULL;
 	int oldformat = format;
 
 	/* mask request with some set of allowed formats.
@@ -18764,6 +18767,17 @@
 	if (host) {
 		*host++ = '\0';
 		ext = tmp;
+		secret = strchr(ext, ':');
+		if (secret) {
+			*secret++ = '\0';
+			md5secret = strchr(secret, ':');
+			if (md5secret) {
+				*md5secret++ = '\0';
+				authname = strchr(md5secret, ':');
+				if (authname)
+					*authname++ = '\0';
+			}
+		}
 	} else {
 		ext = strchr(tmp, '/');
 		if (ext) 
@@ -18798,6 +18812,14 @@
 		ast_string_field_set(p, username, ext);
 		ast_string_field_set(p, fullcontact, NULL);
 	}
+	if (secret && !ast_strlen_zero(secret))
+		ast_string_field_set(p, peersecret, secret);
+
+	if (md5secret && !ast_strlen_zero(md5secret))
+		ast_string_field_set(p, peermd5secret, md5secret);
+
+	if (authname && !ast_strlen_zero(authname))
+		ast_string_field_set(p, authname, authname);
 #if 0
 	printf("Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host);
 #endif




More information about the asterisk-commits mailing list