From 56846c02c693b55c904483b9cdd733f10527c20f Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 20 Dec 2012 12:11:11 -0500 Subject: [PATCH] freetdm: ftmod_analog_em: If the destination number DTMF was already generated, do not generate it again This bug was cause when answer-supervision is used because now we do not move from DIALING to UP as soon as the line is ringing, but instead we wait for the CAS bit change --- libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c index c073c5364e..108eda923e 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c @@ -239,6 +239,7 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) int cas_bits = 0; uint32_t cas_answer = 0; int cas_answer_ms = 500; + ftdm_bool_t digits_sent = FTDM_FALSE; ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM CHANNEL thread starting.\n"); @@ -291,7 +292,8 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) case FTDM_CHANNEL_STATE_DIALING: { if (! ftdmchan->needed_tones[FTDM_TONEMAP_RING] - && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { + && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK) + && !digits_sent) { if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) { ftdm_log(FTDM_LOG_ERROR, "No Digits to send!\n"); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); @@ -301,6 +303,7 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else { state_counter = 0; + digits_sent = FTDM_TRUE; ftdmchan->needed_tones[FTDM_TONEMAP_RING] = 1; ftdmchan->needed_tones[FTDM_TONEMAP_BUSY] = 1; ftdmchan->needed_tones[FTDM_TONEMAP_FAIL1] = 1;