From 10b8cfa18eb5fb2fce31b529e85347fc4337748f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Jun 2010 10:09:39 -0500 Subject: [PATCH] be more strict about changing callstate based on clearing hold flag --- src/switch_channel.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index df7601199e..7eb8bd0c74 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1229,6 +1229,9 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw switch_assert(channel->flag_mutex); switch_mutex_lock(channel->flag_mutex); + if (flag == CF_LEG_HOLDING && !channel->flags[flag] && channel->flags[CF_ANSWERED]) { + switch_channel_set_callstate(channel, CCS_HELD); + } channel->flags[flag] = value; switch_mutex_unlock(channel->flag_mutex); @@ -1236,11 +1239,6 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw switch_channel_set_variable(channel, "is_outbound", "true"); } - if (flag == CF_LEG_HOLDING) { - switch_channel_set_callstate(channel, CCS_HELD); - } - - } SWITCH_DECLARE(void) switch_channel_set_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag) @@ -1322,16 +1320,15 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch switch_assert(channel->flag_mutex); switch_mutex_lock(channel->flag_mutex); + if (flag == CF_LEG_HOLDING && channel->flags[flag] && channel->flags[CF_ANSWERED]) { + switch_channel_set_callstate(channel, CCS_ACTIVE); + } channel->flags[flag] = 0; switch_mutex_unlock(channel->flag_mutex); if (flag == CF_OUTBOUND) { switch_channel_set_variable(channel, "is_outbound", NULL); } - - if (flag == CF_LEG_HOLDING) { - switch_channel_set_callstate(channel, CCS_ACTIVE); - } }