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 18abfac317
commit 2dd27f2738
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) { switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_PROGRESS: case SWITCH_MESSAGE_INDICATE_PROGRESS:
case SWITCH_MESSAGE_INDICATE_ANSWER: 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_ANSWERED);
zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS); zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS);
zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_MEDIA); zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_MEDIA);
} else {
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_UP); zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_UP);
switch_channel_mark_answered(channel);
} }
break; break;
case SWITCH_MESSAGE_INDICATE_RINGING: case SWITCH_MESSAGE_INDICATE_RINGING:
if (!(switch_channel_test_flag(channel, CF_OUTBOUND) || if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
switch_channel_test_flag(channel, CF_ANSWERED) ||
switch_channel_test_flag(channel, CF_EARLY_MEDIA))) { if (!switch_channel_test_flag(channel, CF_ANSWERED) &&
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_RING); !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; break;
default: 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) { switch(state) {
case ZAP_CHANNEL_STATE_PROGRESS: case ZAP_CHANNEL_STATE_PROGRESS:
case ZAP_CHANNEL_STATE_PROGRESS_MEDIA: case ZAP_CHANNEL_STATE_PROGRESS_MEDIA:
case ZAP_CHANNEL_STATE_RING:
ok = 0; ok = 0;
break; break;
default: default: