From e40ab4966b79686f40aef0ec7861a94b9a80d8e5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Jul 2008 17:54:42 +0000 Subject: [PATCH] fix jira issue FSCORE-164 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9204 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 4 ++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index fc2e19e940..1edccedf50 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -111,6 +111,7 @@ struct sofia_private { 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);} diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 093fd5f49b..b3a55c607c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -205,6 +205,8 @@ void sofia_event_callback(nua_event_t event, 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 @@ void sofia_event_callback(nua_event_t event, nua_handle_bind(nh, NULL); } sofia_private->destroy_me = 12; + free(sofia_private); sofia_private = NULL; } @@ -3559,6 +3562,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } memset(sofia_private, 0, sizeof(*sofia_private)); + sofia_private->is_call++; tech_pvt->sofia_private = sofia_private; if ((profile->pflags & PFLAG_PRESENCE)) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index e0bf13c7d1..217ad4b8f3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1206,7 +1206,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) 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);