be more strict about changing callstate based on clearing hold flag

This commit is contained in:
Anthony Minessale 2010-06-24 10:09:39 -05:00
parent 09e386deda
commit 10b8cfa18e
1 changed files with 6 additions and 9 deletions

View File

@ -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);
}
}