From fff6e50a9bd76676ea23a49e0102cda77bdabeca Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 19 Sep 2012 20:02:30 -0400 Subject: [PATCH] freetdm: Fix E&M answer procedure for DAHDI --- libs/freetdm/mod_freetdm/mod_freetdm.c | 1 + libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 271f532a70..06dc587a4b 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2285,6 +2285,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) } break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: + case FTDM_SIGEVENT_COLLECTED_DIGIT: /* Analog E&M */ break; default: { diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 2569ea49fd..363dcee7c5 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -737,6 +737,7 @@ static FIO_COMMAND_FUNCTION(zt_command) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "OFFHOOK Failed"); return FTDM_FAIL; } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel is now offhook\n"); ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); } break; @@ -747,6 +748,7 @@ static FIO_COMMAND_FUNCTION(zt_command) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "ONHOOK Failed"); return FTDM_FAIL; } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel is now onhook\n"); ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); } break; @@ -1084,7 +1086,10 @@ static __inline__ ftdm_status_t zt_channel_process_event(ftdm_channel_t *fchan, case ZT_EVENT_RINGOFFHOOK: { if (fchan->type == FTDM_CHAN_TYPE_FXS || (fchan->type == FTDM_CHAN_TYPE_EM && fchan->state != FTDM_CHANNEL_STATE_UP)) { - ftdm_set_flag_locked(fchan, FTDM_CHANNEL_OFFHOOK); + if (fchan->type != FTDM_CHAN_TYPE_EM) { + /* In E&M we're supposed to set this flag when the tx side goes offhook, not the rx */ + ftdm_set_flag_locked(fchan, FTDM_CHANNEL_OFFHOOK); + } *event_id = FTDM_OOB_OFFHOOK; } else if (fchan->type == FTDM_CHAN_TYPE_FXO) { *event_id = FTDM_OOB_RING_START;