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

Freeswitch SVN anthm at freeswitch.org
Wed May 7 10:22:37 EDT 2008


Author: anthm
Date: Wed May  7 10:22:36 2008
New Revision: 8290

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

Log:
update

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	Wed May  7 10:22:36 2008
@@ -1114,7 +1114,7 @@
 		msg_nh = nua_handle(tech_pvt->profile->nua, NULL,
 							SIPTAG_FROM_STR(tech_pvt->chat_from),
 							NUTAG_URL(tech_pvt->chat_to), SIPTAG_TO_STR(tech_pvt->chat_to), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
-
+		nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private);
 		nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR("text/html"), SIPTAG_PAYLOAD_STR(body), TAG_END());
 	}
 

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	Wed May  7 10:22:36 2008
@@ -71,7 +71,7 @@
 {
 	if (status >= 300 && sip && sip->sip_call_id) {
 		char *sql;
-		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "delete subscriptions for failed notify\n");
 		sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", sip->sip_call_id->i_id);
 		switch_assert(sql != NULL);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -159,21 +159,6 @@
 
 void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip)
 {
-	if (status == 503) {
-		const char *user = NULL, *host = NULL;
-		char *sql;
-
-		if (sip->sip_to && sip->sip_to->a_url) {
-			user = sip->sip_to->a_url->url_user;
-			host = sip->sip_to->a_url->url_host;
-
-			sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", user, host);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Deleting registration for %s@%s\n", user, host);
-			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-		}
-	}
-
-	nua_handle_destroy(nh);
 }
 
 void sofia_event_callback(nua_event_t event,
@@ -354,7 +339,7 @@
 
   done:
 
-	if (sofia_private && sofia_private->destroy_nh) {
+	if ((sofia_private && sofia_private->destroy_nh) || !nua_handle_magic(nh)) {
 		//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy handle requested.\n");
 		nua_handle_destroy(nh);
 	}
@@ -1554,7 +1539,6 @@
 								   );
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 	}
-	nua_handle_destroy(nh);
 }
 
 
@@ -3139,7 +3123,6 @@
 	nua_respond(nh, SIP_200_OK,
 				NUTAG_WITH_THIS(nua),
 				TAG_END());
-	nua_handle_destroy(nh);
 }
 
 static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)

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	Wed May  7 10:22:36 2008
@@ -107,7 +107,7 @@
 						SIPTAG_CONTACT_STR(profile->url), TAG_END());
 
 	switch_safe_free(contact);
-
+	nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private);
 	nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR("text/html"), SIPTAG_PAYLOAD_STR(body), TAG_END());
 
 	switch_safe_free(ffrom);

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	Wed May  7 10:22:36 2008
@@ -87,7 +87,7 @@
 			pvt = malloc(sizeof(*pvt));
 			switch_assert(pvt);
 			memset(pvt, 0, sizeof(*pvt));
-			
+			pvt->destroy_nh = 1;
 			switch_copy_string(pvt->gateway_name, gateway_ptr->name, sizeof(pvt->gateway_name));
 			nua_handle_bind(nh, pvt);
 
@@ -196,7 +196,7 @@
 	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_handle_bind(nh, &mod_sofia_globals.destroy_private);
 	nua_options(nh, TAG_END());
 
 	switch_safe_free(contact);



More information about the Freeswitch-svn mailing list