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

Freeswitch SVN mikej at freeswitch.org
Thu Dec 6 22:57:49 EST 2007


Author: mikej
Date: Thu Dec  6 22:57:48 2007
New Revision: 6561

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

Log:
don't use < > on request uri's.

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	Thu Dec  6 22:57:48 2007
@@ -468,7 +468,7 @@
 void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip);
 void sofia_glue_sql_close(sofia_profile_t *profile);
 int sofia_glue_init_sql(sofia_profile_t *profile);
-char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const char *transport);
+char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const char *transport, switch_bool_t uri_only);
 switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
 											  switch_bool_t master,
 											  switch_mutex_t *mutex,

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Thu Dec  6 22:57:48 2007
@@ -447,7 +447,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const char *transport)
+char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const char *transport, switch_bool_t uri_only)
 {
 	char *stripped = switch_core_session_strdup(session, uri);
 	char *new_uri = NULL;
@@ -455,12 +455,12 @@
 	stripped = sofia_glue_get_url_from_contact(stripped, 0);
 	if (transport && strcasecmp(transport, "udp")) {
 		if (switch_stristr("port=", stripped)) {
-			new_uri = switch_core_session_sprintf(session, "<%s>", stripped);
+			new_uri = switch_core_session_sprintf(session, "%s%s%s", uri_only ? "" : "<", stripped, uri_only ? "" : ">");
 		} else {
 			if (strchr(stripped, ';')) {
-				new_uri = switch_core_session_sprintf(session, "<%s&transport=%s>", stripped, transport);
+				new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s%s", uri_only ? "" : "<", stripped, transport, uri_only ? "" : ">");
 			} else {
-				new_uri = switch_core_session_sprintf(session, "<%s;transport=%s>", stripped, transport);
+				new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s", uri_only ? "" : "<", stripped, transport, uri_only ? "" : ">");
 			}
 		}
 	} else {
@@ -593,10 +593,10 @@
 			}
 		}
 
-		url_str = sofia_overcome_sip_uri_weakness(session, url, transport);
-		invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, transport);
-		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, NULL);
-		to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, NULL);
+		url_str = sofia_overcome_sip_uri_weakness(session, url, transport, SWITCH_TRUE);
+		invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, transport, SWITCH_FALSE);
+		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, NULL, SWITCH_FALSE);
+		to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, NULL, SWITCH_FALSE);
 		
 		/* 
 		   Does the "genius" who wanted SIP to be "text-based" so it was "easier to read" even use it now,



More information about the Freeswitch-trunk mailing list