Revision
15350
Author
anthm
Date
2009-11-04 10:46:17 -0600 (Wed, 04 Nov 2009)

Log Message

fix dest parser to not hit false positive

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (15349 => 15350)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-11-04 15:27:46 UTC (rev 15349)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-11-04 16:46:17 UTC (rev 15350)
@@ -3069,12 +3069,18 @@
 	switch_channel_set_variable(nchannel, "sip_destination_url", tech_pvt->dest);
 
 	dest_num = switch_core_session_strdup(nsession, dest);
-	if ((p = strchr(dest_num, ':'))) {
-		dest_num = p + 1;
-		if ((p = strchr(dest_num, '@'))) {
-			*p = '\0';
+	if ((p = strchr(dest_num, '@'))) {
+		*p = '\0';
+		
+		if ((p = strrchr(dest_num, '/'))) {
+			dest_num = p + 1;
+		} else if ((p = (char *)switch_stristr("sip:", dest_num))) {
+			dest_num = p + 4;
+		} else if ((p = (char *)switch_stristr("sips:", dest_num))) {
+			dest_num = p + 5;
 		}
 	}
+	
 
 	caller_profile = switch_caller_profile_clone(nsession, outbound_profile);
 	caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest_num);