Author: anthm Date: Tue Jul 29 13:54:42 2008 New Revision: 9204 Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Log: fix jira issue FSCORE-164 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 Tue Jul 29 13:54:42 2008 @@ -111,6 +111,7 @@ char gateway_name[512]; int destroy_nh; int destroy_me; + int is_call; }; #define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);} 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 Tue Jul 29 13:54:42 2008 @@ -205,6 +205,8 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already hungup.\n"); goto done; } + } else if (sofia_private && sofia_private->is_call) { + sofia_private->destroy_me = 22; } if ((profile->pflags & PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) { @@ -353,6 +355,7 @@ nua_handle_bind(nh, NULL); } sofia_private->destroy_me = 12; + free(sofia_private); sofia_private = NULL; } @@ -3559,6 +3562,7 @@ } memset(sofia_private, 0, sizeof(*sofia_private)); + sofia_private->is_call++; tech_pvt->sofia_private = sofia_private; if ((profile->pflags & PFLAG_PRESENCE)) { 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 Tue Jul 29 13:54:42 2008 @@ -1206,7 +1206,10 @@ if (!(sofia_private = malloc(sizeof(*sofia_private)))) { abort(); } + memset(sofia_private, 0, sizeof(*sofia_private)); + sofia_private->is_call++; + tech_pvt->sofia_private = sofia_private; switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid)); nua_handle_bind(tech_pvt->nh, tech_pvt->sofia_private);