diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index a410e4eac6..165fce0a84 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1690,6 +1690,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) } } break; + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; default: { @@ -1744,6 +1745,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) } } break; + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; case FTDM_SIGEVENT_STOP: { private_t *tech_pvt = NULL; @@ -1966,6 +1968,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) status = ftdm_channel_from_event(sigmsg, &session); } break; + + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; /* on DNIS received from the R2 forward side, return status == FTDM_BREAK to stop requesting DNIS */ case FTDM_SIGEVENT_COLLECTED_DIGIT: @@ -2063,6 +2067,9 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) return ftdm_channel_from_event(sigmsg, &session); } break; + + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_STOP: case FTDM_SIGEVENT_RESTART: { diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 939933af73..24e54574ae 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2349,6 +2349,8 @@ static void close_dtmf_debug(ftdm_channel_t *ftdmchan) static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) { + ftdm_sigmsg_t sigmsg; + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); ftdm_mutex_lock(ftdmchan->mutex); @@ -2387,6 +2389,13 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_log(FTDM_LOG_DEBUG, "channel done %u:%u\n", ftdmchan->span_id, ftdmchan->chan_id); + memset(&sigmsg, 0, sizeof(sigmsg)); + sigmsg.span_id = ftdmchan->span_id; + sigmsg.chan_id = ftdmchan->chan_id; + sigmsg.channel = ftdmchan; + sigmsg.event_id = FTDM_SIGEVENT_RELEASED; + ftdm_span_send_signal(ftdmchan->span, &sigmsg); + ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 55e433d9c7..dc181e15c7 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -287,6 +287,7 @@ typedef enum { typedef enum { FTDM_SIGEVENT_START, /*!< Incoming call (ie: incoming SETUP msg or Ring) */ FTDM_SIGEVENT_STOP, /*!< Hangup */ + FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ FTDM_SIGEVENT_FLASH, /*< Flash event (typically on-hook/off-hook for analog devices) */ FTDM_SIGEVENT_PROGRESS, /*!< Outgoing call is making progress */