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

Freeswitch SVN anthm at freeswitch.org
Fri Nov 17 17:13:26 EST 2006


Author: anthm
Date: Fri Nov 17 17:13:26 2006
New Revision: 3398

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Log:
reg realm stuff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Nov 17 17:13:26 2006
@@ -4115,7 +4115,8 @@
 	outbound_reg_t *oreg = NULL;
 	sip_www_authenticate_t const *authenticate = NULL;
 	switch_core_session_t *session = sofia_private ? sofia_private->session : NULL;
-	char const *realm = NULL;
+	char const *realm = NULL; 
+	char *p = NULL, *qrealm = NULL;
 	char const *scheme = NULL;
 	int index;
 	char *cur;
@@ -4149,28 +4150,41 @@
 
 		if (!(scheme && realm)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No scheme and realm!\n");
-			return;
 		}
 	}
 
+	if (!(scheme && realm)) {
+		return;
+	}
 
+	qrealm = strdup(realm);
+
+	while(*qrealm && *qrealm == '"') {
+		*qrealm++;
+	}
+	if ((p = strchr(qrealm, '"'))) {
+		*p = '\0';
+	}
+
 	if (sofia_private) {
 		if (sofia_private->oreg) {
 			oreg = sofia_private->oreg;
 		} else if (profile) {
 			outbound_reg_t *oregp;
 			for (oregp = profile->registrations; oregp; oregp = oregp->next) {
-				if (scheme && realm && !strcasecmp(oregp->register_scheme, scheme) && !strcasecmp(oregp->register_realm, realm)) {
+				if (scheme && qrealm && !strcasecmp(oregp->register_scheme, scheme) && !strcasecmp(oregp->register_realm, qrealm)) {
 					oreg = oregp;
 					break;
 				}
 			}
 			if (!oreg) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, realm);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, qrealm);
 			}
 
 		}
 	}
+
+	switch_safe_free(qrealm);
 
 	if (!oreg) {
 		return;



More information about the Freeswitch-svn mailing list