ftdm: fixing reset on in-use channel causing infinite state loop.

This commit is contained in:
yannick 2011-10-06 17:36:50 -04:00
parent c82f1ecabd
commit f1257ab8b5
2 changed files with 24 additions and 8 deletions

View File

@ -29,6 +29,10 @@
* LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
* James Zhang <jzhang@sangoma.com>
*
*/
#if 0
@ -1198,7 +1202,7 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span,
}
#ifdef SMG_RELAY_DBG
stream->write_function(stream, " blk_flag= %x ckt_flag = %d", ss7_info->blk_flags, ss7_info->ckt_flags );
stream->write_function(stream," blk_flag=%x | ckt_flag=%x | chan_flag=%x", ss7_info->blk_flags, ss7_info->ckt_flags, ftdmchan->flags);
#endif
stream->write_function(stream, "\n");
} /* if ( span and chan) */
@ -1314,7 +1318,7 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,
}
#ifdef SMG_RELAY_DBG
stream->write_function(stream," blk_flag= %x ckt_flag = %d", ss7_info->blk_flags, ss7_info->ckt_flags );
stream->write_function(stream," blk_flag=%x | ckt_flag=%x | chan_flag=%x", ss7_info->blk_flags, ss7_info->ckt_flags, ftdmchan->flags);
#endif
stream->write_function(stream, "\n");
} /* if ( hole, sig, voice) */

View File

@ -842,9 +842,18 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
if (sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) {
/* check if this hangup is from a tx RSC */
if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) {
/* go to RESTART State until RSCa is received */
state_flag = 0;
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
if (!sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT)) {
ft_to_sngss7_rsc (ftdmchan);
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT);
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
} else if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP)) {
state_flag = 0;
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
} else {
/* go to RESTART State until RSCa is received */
state_flag = 0;
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
}
} else {
/* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */
if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) &&
@ -1040,9 +1049,12 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) &&
!(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT))) {
/* send a reset request */
ft_to_sngss7_rsc (ftdmchan);
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT);
/* don't send out reset before finished hanging up if I'm in-use. */
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) {
/* send a reset request */
ft_to_sngss7_rsc (ftdmchan);
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT);
}
} /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) */