提交 52021c80 authored 作者: Anthony Minessale's avatar Anthony Minessale

skip all the hangup code in ringing state

上级 40f29b38
......@@ -1053,6 +1053,7 @@ static int control_handler(modem_t *modem, const char *num, int op)
case AT_MODEM_CONTROL_ONHOOK:
case AT_MODEM_CONTROL_HANGUP:
{
if (modem_get_state(modem) != MODEM_STATE_RINGING) {
int set_state = 1;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
......@@ -1060,16 +1061,17 @@ static int control_handler(modem_t *modem, const char *num, int op)
switch_clear_flag(modem, MODEM_FLAG_XOFF);
wake_modem_thread(modem);
modem_set_state(modem, MODEM_STATE_HANGUP);
if (!zstr(modem->uuid_str)) {
switch_core_session_t *session;
if ((session = switch_core_session_force_locate(modem->uuid_str))) {
switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_channel_up(channel) &&
(switch_channel_test_flag(channel, CF_ANSWERED) || switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND)) {
if (switch_channel_up(channel)) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
set_state = 0;
}
......@@ -1077,10 +1079,12 @@ static int control_handler(modem_t *modem, const char *num, int op)
}
}
if (set_state) {
modem_set_state(modem, MODEM_STATE_ONHOOK);
}
}
}
break;
case AT_MODEM_CONTROL_DTR:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论