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

Freeswitch SVN mikej at freeswitch.org
Sun Oct 28 12:07:23 EDT 2007


Author: mikej
Date: Sun Oct 28 12:07:23 2007
New Revision: 6075

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

Log:
improve sofia_glue_get_url_from_contact and its usage.  Should fix MODENDP-33.

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	Sun Oct 28 12:07:23 2007
@@ -1572,6 +1572,12 @@
 		}
 
 		*e = '\0';
+	} else {
+		if (to_dup) {
+			url = strdup(buf);
+		} else {
+			url = buf;
+		}
 	}
 
 	return url;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Sun Oct 28 12:07:23 2007
@@ -530,16 +530,10 @@
 	char *sub_to_user = argv[3];
 	char *sub_to_host = argv[4];
 	char *event = argv[5];
-	char *contact = argv[6];
 	char *call_id = argv[7];
-	//char *full_from = argv[8];
-	//char *full_via = argv[9];
-	//char *expires = argv[10];
-
 	nua_handle_t *nh;
 	char *to;
 	char *open;
-	char *tmp;
 	char *prpid;
 	int done = 0;
 
@@ -605,10 +599,6 @@
 						id, profile->url, open, status, prpid,
 						open, rpid, note);
 
-
-	tmp = contact;
-	contact = sofia_glue_get_url_from_contact(tmp, 0);
-
 	nua_notify(nh,
 			   SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=3600"),
 			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
@@ -635,7 +625,7 @@
 	char *sub_to_user = argv[3];
 	char *sub_to_host = argv[4];
 	char *event = argv[5];
-	char *contact = argv[6];
+	//char *contact = argv[6];
 	char *call_id = argv[7];
 	//char *full_from = argv[8];
 	//char *full_via = argv[9];
@@ -643,7 +633,7 @@
 	char *body = argv[11];
 	char *exp;
 	sofia_profile_t *profile = NULL;
-	char *tmp, *id = NULL;
+	char *id = NULL;
 	nua_handle_t *nh;
 	int expire_sec = atoi(expires);
 
@@ -664,9 +654,6 @@
 	}
 	exp = switch_mprintf("active;expires=%ld", expire_sec);
 
-	tmp = contact;
-	contact = sofia_glue_get_url_from_contact(tmp, 0);
-
 	nua_notify(nh,
 			   SIPTAG_SUBSCRIPTION_STATE_STR(exp),
 			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());

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	Sun Oct 28 12:07:23 2007
@@ -156,18 +156,17 @@
 {
 	sofia_profile_t *profile = (sofia_profile_t *) pArg;
 	nua_handle_t *nh;
-	char *contact;
+	char *contact = NULL;
 	char to[128] = "";
 
 	snprintf(to, sizeof(to), "%s@%s", argv[1], argv[2]);
 	contact = sofia_glue_get_url_from_contact(argv[3], 1);
 
 	nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
-	
-	//nua_message(nh, SIPTAG_CONTENT_TYPE_STR("text/plain"),
-	//SIPTAG_PAYLOAD_STR("You suffer from Connectile Dysfunction.\nYou should use stun....\n"), TAG_END());
 
 	nua_options(nh, TAG_END());
+
+	switch_safe_free(contact);
 	
 	return 0;
 }



More information about the Freeswitch-svn mailing list