From 179f6b57a600de6102a13120499badb40a8476a6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 Nov 2011 15:26:17 -0600 Subject: [PATCH] FS-3688 please test under same monitoring conditions and report results --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 22 ++++++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 796813aa35..68aa5096f0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1414,7 +1414,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (switch_core_session_in_thread(session)) { de->session = session; } - sofia_process_dispatch_event(&de); + sofia_process_dispatch_event(&de, SWITCH_TRUE); switch_mutex_unlock(tech_pvt->sofia_mutex); goto end; } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index df207fea32..8d479e942b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1137,5 +1137,5 @@ void sofia_glue_check_dtmf_type(private_object_t *tech_pvt); void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str); char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_dispatch_event_t *de, sofia_nat_parse_t *np); void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on); -void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); +void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t do_callback); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 1aa4b174ca..a93205f6a8 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -810,7 +810,7 @@ static void our_sofia_event_callback(nua_event_t event, if (sofia_private && sofia_private->is_call && sofia_private->de) { sofia_dispatch_event_t *qde = sofia_private->de; sofia_private->de = NULL; - sofia_process_dispatch_event(&qde); + sofia_process_dispatch_event(&qde, SWITCH_TRUE); } profile->last_sip_event = switch_time_now(); @@ -1132,7 +1132,7 @@ static void our_sofia_event_callback(nua_event_t event, } } -void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) +void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t do_callback) { sofia_dispatch_event_t *de = *dep; nua_handle_t *nh = de->nh; @@ -1141,8 +1141,10 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) *dep = NULL; - our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile, - de->nh, nua_handle_magic(de->nh), de->sip, de, (tagi_t *) de->data->e_tags); + if (do_callback) { + our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile, + de->nh, nua_handle_magic(de->nh), de->sip, de, (tagi_t *) de->data->e_tags); + } nua_destroy_event(de->event); su_free(nh->nh_home, de); @@ -1166,7 +1168,7 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj while(switch_queue_pop(q, &pop) == SWITCH_STATUS_SUCCESS && pop) { sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop; - sofia_process_dispatch_event(&de); + sofia_process_dispatch_event(&de, SWITCH_TRUE); switch_cond_next(); } @@ -1217,7 +1219,7 @@ static void sofia_queue_message(sofia_dispatch_event_t *de) int idx = 0; if (mod_sofia_globals.running == 0) { - sofia_process_dispatch_event(&de); + sofia_process_dispatch_event(&de, SWITCH_TRUE); return; } @@ -1280,9 +1282,13 @@ void sofia_event_callback(nua_event_t event, switch_core_session_t *session; if (!zstr(sofia_private->uuid)) { - if ((session = switch_core_session_locate(sofia_private->uuid))) { + if ((session = switch_core_session_force_locate(sofia_private->uuid))) { if (switch_core_session_running(session)) { - switch_core_session_queue_signal_data(session, de); + if (switch_channel_down_nosig(switch_core_session_get_channel(session))) { + sofia_process_dispatch_event(&de, SWITCH_FALSE); + } else { + switch_core_session_queue_signal_data(session, de); + } } else { switch_core_session_message_t msg = { 0 }; msg.message_id = SWITCH_MESSAGE_INDICATE_SIGNAL_DATA;