fix analog fxs state machine issue

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@569 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2008-09-26 17:29:48 +00:00
parent e403a7952f
commit 36abcdd03d
2 changed files with 12 additions and 6 deletions

View File

@ -779,19 +779,24 @@ static switch_status_t channel_receive_message_fxs(switch_core_session_t *sessio
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_PROGRESS:
case SWITCH_MESSAGE_INDICATE_ANSWER:
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_ANSWERED);
zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS);
zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_MEDIA);
} else {
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_UP);
switch_channel_mark_answered(channel);
}
break;
case SWITCH_MESSAGE_INDICATE_RINGING:
if (!(switch_channel_test_flag(channel, CF_OUTBOUND) ||
switch_channel_test_flag(channel, CF_ANSWERED) ||
switch_channel_test_flag(channel, CF_EARLY_MEDIA))) {
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_RING);
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
if (!switch_channel_test_flag(channel, CF_ANSWERED) &&
!switch_channel_test_flag(channel, CF_EARLY_MEDIA) &&
!switch_channel_test_flag(channel, CF_RING_READY)
) {
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_RING);
switch_channel_mark_ring_ready(channel);
}
}
break;
default:

View File

@ -733,6 +733,7 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
switch(state) {
case ZAP_CHANNEL_STATE_PROGRESS:
case ZAP_CHANNEL_STATE_PROGRESS_MEDIA:
case ZAP_CHANNEL_STATE_RING:
ok = 0;
break;
default: