diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 0d52dfada7..a4fee0f862 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -953,6 +953,42 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->flags); + /**********************************************************************/ + if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) { + + /* clear the RESUME flag */ + sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); + + /* if there are any resets present */ + if ((sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) || + (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) || + (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) || + (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX))) { + + /* go back to the reset state */ + goto suspend_goto_restart; + } else { + + /* bring the sig status back up */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } + + /* go back to the last state */ + goto suspend_goto_last; + } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */ + + if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { + + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + + /* go back to the last state */ + goto suspend_goto_last; + } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { */ /**********************************************************************/ if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 5086d11a71..694e9a4ed8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -561,24 +561,19 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; + /* if we have the PAUSED flag and the sig status is still UP */ if ((sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) && (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { - /* bring the sig status down */ - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; - ftdm_span_send_signal(ftdmchan->span, &sigev); + /* throw the channel into SUSPENDED to process the flag */ + /* after doing this once the sig status will be down */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } - if ((sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) && - !(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { - - /* bring the sig status back up */ - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); + /* if the RESUME flag is up go to SUSPENDED to process the flag */ + /* after doing this the flag will be cleared */ + if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) { + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } /* unlock the channel */