From 91d405a2c1a01091cf8c42f9c65f2f4a0624cfd7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 16 Jul 2014 21:40:18 +0500 Subject: [PATCH] call recovery_track on recovering channels once the recovery has completed and fix race condition with repeated recovery --- src/mod/endpoints/mod_sofia/sofia.c | 1 - src/switch_channel.c | 4 ++++ src/switch_core_state_machine.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c5e2dfaa21..390c8886a9 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6134,7 +6134,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status extract_header_vars(profile, sip, session, nh); extract_vars(profile, sip, session); - switch_core_recovery_track(session); switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING); } diff --git a/src/switch_channel.c b/src/switch_channel.c index c27f1c5ff9..f6d3a96ddc 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1990,6 +1990,10 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch switch_core_session_wake_video_thread(channel->session); } + if (flag == CF_RECOVERING && !channel->hangup_cause) { + switch_core_recovery_track(channel->session); + } + } diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 91fe8f7a3d..eb54bc9ca1 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -48,6 +48,8 @@ static void switch_core_standard_on_init(switch_core_session_t *session) switch_channel_set_state(session->channel, CS_ROUTING); } } + + switch_channel_clear_flag(session->channel, CF_RECOVERING); } static void switch_core_standard_on_hangup(switch_core_session_t *session)