From 118f53ec459b4e025025fc810dfa2d8e6739ed5f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 7 Feb 2011 17:29:26 -0500 Subject: [PATCH 1/3] freetdm: allow reception of FACILITY msg in any channel state when transparent facility is enabled --- .../ftmod_sangoma_isdn_stack_hndl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 0b52011d42..fff34fcae6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -797,6 +797,23 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + /* If Facility decoding is disabled, we do not care about current call state, just pass event up to user */ + ftdm_sigmsg_t sigev; + if (facEvnt->facElmt.facStr.pres) { + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); + } + memset(&sigev, 0, sizeof(sigev)); + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + sigev.event_id = FTDM_SIGEVENT_FACILITY; + ftdm_span_send_signal(ftdmchan->span, &sigev); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ From c5dd481fbd7713e996f1d25d04f03758887d7bfd Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 2 Mar 2011 10:59:43 -0500 Subject: [PATCH 2/3] freetdm: ISDN - ftdm_complete_state is not called in state_advance if a new state is set --- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 1437b45883..d119ff4fd2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -603,6 +603,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm ftdm_sigmsg_t sigev; ftdm_channel_state_t initial_state; sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; + uint8_t state_change = 0; memset(&sigev, 0, sizeof(sigev)); @@ -673,6 +674,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROCEED); if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } } else { @@ -693,6 +695,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_RINGING); if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } } else { @@ -752,6 +755,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm /* Send a release complete */ sngisdn_snd_release(ftdmchan, 0); /*now go to the HANGUP complete state*/ + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } break; @@ -811,6 +815,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm } } /* now go to the HANGUP complete state */ + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } break; @@ -819,6 +824,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) || sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) { /* If the remote side aborted, we will not get anymore message for this call */ + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } else { /* waiting on remote confirmation before moving to down */ @@ -873,8 +879,10 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm break; } - /* Acknowledge the state change */ - ftdm_channel_complete_state(ftdmchan); + if (!state_change) { + /* Acknowledge the state change */ + ftdm_channel_complete_state(ftdmchan); + } /* If sngisdn_info->variables is not NULL, it means did not send any * sigevent to the user, therefore we have to free that hashtable */ From 00dc8577e826ab06cc41d79d4485a219fa7075e0 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 1 Mar 2011 09:54:52 -0500 Subject: [PATCH 3/3] freetdm: Typo in function define --- libs/freetdm/src/ftdm_io.c | 2 +- libs/freetdm/src/include/private/ftdm_core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6b225fe8f0..4c75b6bd8a 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4051,7 +4051,7 @@ done: return status; } -FT_DECLARE(ftdm_iterator_t) *ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter) +FT_DECLARE(ftdm_iterator_t *) ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter) { int allocated = 0; if (iter) { diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 464b1c0209..3c21be392f 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -590,7 +590,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_status_t status); -FT_DECLARE(ftdm_iterator_t) *ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); +FT_DECLARE(ftdm_iterator_t *) ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); /*!