[Freeswitch-svn] [commit] r9305 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Fri Aug 15 15:30:35 EDT 2008


Author: anthm
Date: Fri Aug 15 15:30:34 2008
New Revision: 9305

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c

Log:
fix MODENDP-121

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Fri Aug 15 15:30:34 2008
@@ -269,6 +269,7 @@
 	char *register_scheme;
 	char *register_realm;
 	char *register_username;
+	char *auth_username;
 	char *register_password;
 	char *register_from;
 	char *register_contact;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Fri Aug 15 15:30:34 2008
@@ -775,6 +775,7 @@
 			char *register_str = "true", *scheme = "Digest",
 				*realm = NULL,
 				*username = NULL,
+				*auth_username = NULL,
 				*password = NULL,
 				*caller_id_in_from = "false",
 				*extension = NULL,
@@ -807,6 +808,8 @@
 					realm = val;
 				} else if (!strcmp(var, "username")) {
 					username = val;
+				} else if (!strcmp(var, "auth-username")) {
+					auth_username = val;
 				} else if (!strcmp(var, "password")) {
 					password = val;
 				} else if (!strcmp(var, "caller-id-in-from")) {
@@ -886,6 +889,10 @@
 				from_domain = realm;
 			}
 
+			if (switch_strlen_zero(auth_username)) {
+				auth_username = username;
+			}
+			
 			if (!switch_strlen_zero(register_proxy)) {
 				gateway->register_sticky_proxy = switch_core_strdup(gateway->pool, register_proxy);
 			}
@@ -899,6 +906,7 @@
 			gateway->register_context = switch_core_strdup(gateway->pool, context);
 			gateway->register_realm = switch_core_strdup(gateway->pool, realm);
 			gateway->register_username = switch_core_strdup(gateway->pool, username);
+			gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
 			gateway->register_password = switch_core_strdup(gateway->pool, password);
 			if (switch_true(caller_id_in_from)) {
 				switch_set_flag(gateway, REG_FLAG_CALLERID);

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Fri Aug 15 15:30:34 2008
@@ -1094,7 +1094,7 @@
 		goto cancel;
 	}
 
-	switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->register_username, gateway->register_password);
+	switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n", profile->username, authentication);
 



More information about the Freeswitch-svn mailing list