avoidance a different way
This commit is contained in:
parent
72be253d2b
commit
67c07ee1d1
|
@ -1226,18 +1226,22 @@ SWITCH_DECLARE(char *) switch_channel_get_cap_string(switch_channel_t *channel)
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, switch_channel_flag_t flag, uint32_t value)
|
SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, switch_channel_flag_t flag, uint32_t value)
|
||||||
{
|
{
|
||||||
|
int HELD = 0;
|
||||||
|
|
||||||
switch_assert(channel);
|
switch_assert(channel);
|
||||||
switch_assert(channel->flag_mutex);
|
switch_assert(channel->flag_mutex);
|
||||||
|
|
||||||
switch_mutex_lock(channel->flag_mutex);
|
switch_mutex_lock(channel->flag_mutex);
|
||||||
if (flag == CF_LEG_HOLDING && !channel->flags[flag] && channel->flags[CF_ANSWERED]) {
|
if (flag == CF_LEG_HOLDING && !channel->flags[flag] && channel->flags[CF_ANSWERED]) {
|
||||||
switch_mutex_unlock(channel->flag_mutex);
|
HELD = 1;
|
||||||
switch_channel_set_callstate(channel, CCS_HELD);
|
|
||||||
switch_mutex_lock(channel->flag_mutex);
|
|
||||||
}
|
}
|
||||||
channel->flags[flag] = value;
|
channel->flags[flag] = value;
|
||||||
switch_mutex_unlock(channel->flag_mutex);
|
switch_mutex_unlock(channel->flag_mutex);
|
||||||
|
|
||||||
|
if (HELD) {
|
||||||
|
switch_channel_set_callstate(channel, CCS_HELD);
|
||||||
|
}
|
||||||
|
|
||||||
if (flag == CF_OUTBOUND) {
|
if (flag == CF_OUTBOUND) {
|
||||||
switch_channel_set_variable(channel, "is_outbound", "true");
|
switch_channel_set_variable(channel, "is_outbound", "true");
|
||||||
}
|
}
|
||||||
|
@ -1319,16 +1323,22 @@ SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, sw
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
|
SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
|
||||||
{
|
{
|
||||||
|
int ACTIVE = 0;
|
||||||
|
|
||||||
switch_assert(channel != NULL);
|
switch_assert(channel != NULL);
|
||||||
switch_assert(channel->flag_mutex);
|
switch_assert(channel->flag_mutex);
|
||||||
|
|
||||||
switch_mutex_lock(channel->flag_mutex);
|
switch_mutex_lock(channel->flag_mutex);
|
||||||
if (flag == CF_LEG_HOLDING && channel->flags[flag] && channel->flags[CF_ANSWERED]) {
|
if (flag == CF_LEG_HOLDING && channel->flags[flag] && channel->flags[CF_ANSWERED]) {
|
||||||
switch_channel_set_callstate(channel, CCS_ACTIVE);
|
ACTIVE = 1;
|
||||||
}
|
}
|
||||||
channel->flags[flag] = 0;
|
channel->flags[flag] = 0;
|
||||||
switch_mutex_unlock(channel->flag_mutex);
|
switch_mutex_unlock(channel->flag_mutex);
|
||||||
|
|
||||||
|
if (ACTIVE) {
|
||||||
|
switch_channel_set_callstate(channel, CCS_ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
if (flag == CF_OUTBOUND) {
|
if (flag == CF_OUTBOUND) {
|
||||||
switch_channel_set_variable(channel, "is_outbound", NULL);
|
switch_channel_set_variable(channel, "is_outbound", NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue