From 3a162334febf6fc528075d1ed0f68b1ec7c4180e Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 3 Nov 2013 20:22:41 -0500 Subject: [PATCH] freetdm: E&M: Set the line offhook when suspended --- .../src/ftmod/ftmod_analog_em/ftmod_analog_em.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 0612ab0b23..0986f44136 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 @@ -291,13 +291,23 @@ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(analog_em_set_channel_sig_status) return FTDM_FAIL; case FTDM_SIG_STATE_SUSPENDED: if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { + int cas_bits = 0xFF; ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_CAS_BITS, &cas_bits); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { + ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); + } ftdm_analog_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); } break; case FTDM_SIG_STATE_UP: if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { + int cas_bits = 0x00; ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_CAS_BITS, &cas_bits); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { + ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL); + } if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { ftdm_analog_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); }