Merge branch 'releases.3.4' of ssh://git.sangoma.com/smg_freeswitch into releases.3.4

This commit is contained in:
wadam 2011-12-01 11:43:08 -05:00
commit 16c2da1369
7 changed files with 162 additions and 50 deletions

View File

@ -87,6 +87,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c
ftdm_assert(!fchan->history[hindex].end_time, "End time should be zero!\n"); ftdm_assert(!fchan->history[hindex].end_time, "End time should be zero!\n");
fchan->history[hindex].end_time = ftdm_current_time_in_ms(); fchan->history[hindex].end_time = ftdm_current_time_in_ms();
fchan->last_state_change_time = ftdm_current_time_in_ms();
fchan->state_status = FTDM_STATE_STATUS_COMPLETED; fchan->state_status = FTDM_STATE_STATUS_COMPLETED;

View File

@ -1632,7 +1632,9 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c
ftdm_mutex_lock(ftdmchan->mutex); ftdm_mutex_lock(ftdmchan->mutex);
/* throw the reset flag */ /* throw the reset flag */
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL);
sngss7_clear_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
sngss7_tx_reset_restart(sngss7_info);
switch (ftdmchan->state) { switch (ftdmchan->state) {
/**************************************************************************/ /**************************************************************************/

View File

@ -122,8 +122,11 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */ /* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX_DN);
/* KONRAD FIX ME : check in case there is a ckt and grp block */ /* KONRAD FIX ME : check in case there is a ckt and grp block */
} }
@ -324,9 +327,8 @@ handle_glare:
/* throw the TX reset flag */ /* throw the TX reset flag */
if (!sngss7_tx_reset_status_pending(sngss7_info)) { if (!sngss7_tx_reset_status_pending(sngss7_info)) {
sngss7_info->ckt_flags=0; sngss7_tx_reset_restart(sngss7_info);
sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
/* go to RESTART */ /* go to RESTART */
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
@ -398,9 +400,8 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* throw the TX reset flag */ /* throw the TX reset flag */
if (!sngss7_tx_reset_status_pending(sngss7_info)) { if (!sngss7_tx_reset_status_pending(sngss7_info)) {
sngss7_info->ckt_flags=0; sngss7_tx_reset_restart(sngss7_info);
sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
/* go to RESTART */ /* go to RESTART */
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
@ -665,9 +666,8 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* throw the TX reset flag */ /* throw the TX reset flag */
if (!sngss7_tx_reset_status_pending(sngss7_info)) { if (!sngss7_tx_reset_status_pending(sngss7_info)) {
sngss7_info->ckt_flags=0; sngss7_tx_reset_restart(sngss7_info);
sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
/* go to RESTART */ /* go to RESTART */
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
@ -769,6 +769,10 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* send out the release complete */ /* send out the release complete */
ft_to_sngss7_rlc (ftdmchan); ft_to_sngss7_rlc (ftdmchan);
} else {
SS7_DEBUG_CHAN(ftdmchan, "Collision of REL messages - resetting state.\n", " ");
ft_to_sngss7_rlc (ftdmchan);
goto rel_ind_reset;
} }
break; break;
/**************************************************************************/ /**************************************************************************/
@ -791,11 +795,11 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/**************************************************************************/ /**************************************************************************/
default: default:
rel_ind_reset:
/* throw the TX reset flag */ /* throw the TX reset flag */
if (!sngss7_tx_reset_status_pending(sngss7_info)) { if (!sngss7_tx_reset_status_pending(sngss7_info)) {
sngss7_info->ckt_flags=0; sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); sngss7_tx_reset_restart(sngss7_info);
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
/* go to RESTART */ /* go to RESTART */
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
@ -1650,6 +1654,7 @@ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* throw the ckt block flag */ /* throw the ckt block flag */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
/* set the channel to suspended state */ /* set the channel to suspended state */
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
@ -1981,7 +1986,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP); sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);
/* go to DOWN */ /* go to DOWN */
/*ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
break; break;
/**********************************************************************/ /**********************************************************************/

View File

@ -453,7 +453,7 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj)
/* check each channel on the span to see if it needs to be reconfigured */ /* check each channel on the span to see if it needs to be reconfigured */
check_for_reconfig_flag(ftdmspan); check_for_reconfig_flag(ftdmspan);
/* Poll for events, e.g HW DTMF */ /* Poll for events, e.g HW DTMF */
switch (ftdm_span_poll_event(ftdmspan, 0, NULL)) { switch (ftdm_span_poll_event(ftdmspan, 0, NULL)) {
/**********************************************************************/ /**********************************************************************/
@ -825,6 +825,14 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/*this state is set when the line is hanging up */ /*this state is set when the line is hanging up */
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_STOP); sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_STOP);
/* If the RESET flag is set, do not say in TERMINATING state.
Go back to RESTART state and wait for RESET Confirmation */
if (sngss7_tx_reset_status_pending(sngss7_info)) {
SS7_DEBUG_CHAN(ftdmchan,"Reset pending in Terminating state!%s\n", "");
state_flag = 0;
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
}
break; break;
/**************************************************************************/ /**************************************************************************/
@ -880,9 +888,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
state_flag = 0; state_flag = 0;
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
} else { } else {
/* go to RESTART State until RSCa is received */ /* Stay in hangup complete until RSC is received */
state_flag = 0; /* Channel is in use if we go to RESTART we will
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); restart will just come back to HANGUP_COMPLETE */
} }
} else { } else {
/* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */ /* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */
@ -901,6 +909,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
SS7_DEBUG_CHAN(ftdmchan,"Completing remotely requested hangup!%s\n", ""); SS7_DEBUG_CHAN(ftdmchan,"Completing remotely requested hangup!%s\n", "");
} else if (sngss7_test_ckt_flag (sngss7_info, FLAG_LOCAL_REL)) { } else if (sngss7_test_ckt_flag (sngss7_info, FLAG_LOCAL_REL)) {
/* if this hang up is do to a rx RESET we need to sit here till the RSP arrives */ /* if this hang up is do to a rx RESET we need to sit here till the RSP arrives */
if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP)) { if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP)) {
@ -923,10 +932,12 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/**************************************************************************/ /**************************************************************************/
case FTDM_CHANNEL_STATE_DOWN: /*the call is finished and removed */ case FTDM_CHANNEL_STATE_DOWN: /*the call is finished and removed */
if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) {
SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) {
break; SS7_DEBUG_CHAN(ftdmchan,"Down came from SUSPEND - break %s\n", "");
break;
}
} }
/* check if there is a reset response that needs to be sent */ /* check if there is a reset response that needs to be sent */
@ -997,7 +1008,10 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
} /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */ } /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */
} else { } else {
state_flag = 0; state_flag = 0;
SS7_DEBUG_CHAN(ftdmchan,"Down detected blocked flags go to SUSPEND %s\n", " ");
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
break;
} /* if !blocked */ } /* if !blocked */
} else { } else {
SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->ckt_flags); SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->ckt_flags);
@ -1029,6 +1043,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) { if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) {
ftdm_channel_t *close_chan = ftdmchan; ftdm_channel_t *close_chan = ftdmchan;
/* close the channel */ /* close the channel */
SS7_DEBUG_CHAN(ftdmchan,"FTDM Channel Close %s\n", "");
ftdm_channel_close (&close_chan); ftdm_channel_close (&close_chan);
} }
@ -1205,6 +1220,14 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/* clear the PAUSE flag */ /* clear the PAUSE flag */
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
if (sngss7_test_ckt_flag (sngss7_info, FLAG_LOCAL_REL)) {
SS7_DEBUG_CHAN(ftdmchan, "Channel local release on RESUME, restart Reset procedure%s\n", "");
/* By setting RESET_TX flag the check below sngss7_tx_reset_status_pending() will
be true, and will restart the RESET TX procedure */
sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
sngss7_set_ckt_flag (sngss7_info, FLAG_RESET_TX);
}
/* We have transmitted Reset/GRS but have not gotten a /* We have transmitted Reset/GRS but have not gotten a
* Response. In mean time we got a RESUME. We cannot be sure * Response. In mean time we got a RESUME. We cannot be sure
* that our reset has been trasmitted, thus restart reset procedure. */ * that our reset has been trasmitted, thus restart reset procedure. */
@ -1250,7 +1273,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
} }
/* Wait for RESUME */ /* Wait for RESUME */
/* FIXME: Check if this is a correct action to wait for RESUME */
goto suspend_goto_last; goto suspend_goto_last;
} /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */ } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */
@ -1269,8 +1291,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/* throw the done flag */ /* throw the done flag */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
/* check the last state and return to it to allow the call to finish */
goto suspend_goto_last;
} }
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){ if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){
@ -1283,7 +1303,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/* clear the unblock flag */ /* clear the unblock flag */
sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX); sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);
SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X\n", SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X\n",
sngss7_info->ckt_flags, sngss7_info->ckt_flags,
sngss7_info->blk_flags); sngss7_info->blk_flags);
/* not bring the cic up if there is a hardware block */ /* not bring the cic up if there is a hardware block */
@ -1295,8 +1315,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/* send a uba */ /* send a uba */
ft_to_sngss7_uba (ftdmchan); ft_to_sngss7_uba (ftdmchan);
/* check the last state and return to it to allow the call to finish */
goto suspend_goto_last;
} }
@ -1316,7 +1334,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
} }
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN);
goto suspend_goto_last;
} }
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_TX)) { if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_TX)) {
@ -1341,10 +1358,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
} }
if (sngss7_tx_block_status_clear(sngss7_info) && !skip_unblock) { if (sngss7_tx_block_status_clear(sngss7_info) && !skip_unblock) {
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
ft_to_sngss7_ubl(ftdmchan); ft_to_sngss7_ubl(ftdmchan);
} }
goto suspend_goto_last;
} }
/**********************************************************************/ /**********************************************************************/
@ -1398,8 +1416,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/* throw the done flag */ /* throw the done flag */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN);
/* check the last state and return to it to allow the call to finish */
goto suspend_goto_last;
} }
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)) { if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)) {
@ -1420,11 +1436,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
if (sngss7_tx_block_status_clear(sngss7_info)) { if (sngss7_tx_block_status_clear(sngss7_info)) {
/* send a ubl */ /* send a ubl */
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
ft_to_sngss7_ubl(ftdmchan); ft_to_sngss7_ubl(ftdmchan);
} }
/* check the last state and return to it to allow the call to finish */
goto suspend_goto_last;
} }
/**********************************************************************/ /**********************************************************************/
@ -1434,16 +1450,20 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", ""); SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", "");
/* send a BLA */ /* send a BLA */
/*ft_to_sngss7_bla(ftdmchan);*/ ft_to_sngss7_bla(ftdmchan);
/* throw the done flag */ /* throw the done flag */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN);
if (sngss7_tx_block_status_clear(sngss7_info)) {
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
ft_to_sngss7_ubl(ftdmchan);
} else {
/* bring the sig status down */
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
}
/* bring the sig status down */
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
/* check the last state and return to it to allow the call to finish */
goto suspend_goto_last;
} }
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {
@ -1458,15 +1478,13 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX);
/* send a uba */ /* send a uba */
/*ft_to_sngss7_uba(ftdmchan);*/ ft_to_sngss7_uba(ftdmchan);
if (sngss7_channel_status_clear(sngss7_info)) { if (sngss7_channel_status_clear(sngss7_info)) {
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
} }
/* check the last state and return to it to allow the call to finish */
goto suspend_goto_last;
} }
/**********************************************************************/ /**********************************************************************/
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK) && if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK) &&
@ -1488,8 +1506,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
/* throw the done flag */ /* throw the done flag */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK_DN); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK_DN);
/* bring the channel down */
goto suspend_goto_last;
} }
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) { if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) {
@ -1521,6 +1537,23 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
SS7_DEBUG_CHAN(ftdmchan,"No block flag processed!%s\n", ""); SS7_DEBUG_CHAN(ftdmchan,"No block flag processed!%s\n", "");
suspend_goto_last: suspend_goto_last:
if (ftdmchan->last_state == FTDM_CHANNEL_STATE_UP) {
/* proceed to UP */
} else if (!sngss7_channel_status_clear(sngss7_info)) {
SS7_DEBUG_CHAN(ftdmchan,"Channel opted to stay in RESTART due to reset/blocks!%s\n", "");
SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X, circuit->flag=0x%X\n",
sngss7_info->ckt_flags, sngss7_info->blk_flags,
sngss7_info->circuit->flags );
goto suspend_goto_restart;
} else {
SS7_DEBUG_CHAN(ftdmchan,"Channel signaling is up proceed to DOWN! [Last State=%s]\n", ftdm_channel_state2str(ftdmchan->last_state));
SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X, circuit->flag=0x%X\n",
sngss7_info->ckt_flags, sngss7_info->blk_flags,
sngss7_info->circuit->flags );
ftdmchan->last_state = FTDM_CHANNEL_STATE_DOWN;
}
state_flag = 0; state_flag = 0;
ftdm_set_state(ftdmchan, ftdmchan->last_state); ftdm_set_state(ftdmchan, ftdmchan->last_state);
break; break;

View File

@ -1049,11 +1049,13 @@ if (ftdmchan->state == new_state) { \
#define sngss7_set_options(obj, option) ((obj)->options |= (option)) #define sngss7_set_options(obj, option) ((obj)->options |= (option))
#define sngss7_tx_block_status_clear(obj) (!sngss7_test_ckt_blk_flag(obj, (FLAG_CKT_MN_BLOCK_TX | \ #define sngss7_tx_block_status_clear(obj) (!sngss7_test_ckt_blk_flag(obj, (FLAG_CKT_MN_BLOCK_TX | \
FLAG_CKT_MN_BLOCK_TX_DN | \ FLAG_CKT_MN_BLOCK_TX_DN | \
FLAG_GRP_MN_BLOCK_TX | \ FLAG_GRP_MN_BLOCK_TX | \
FLAG_GRP_MN_BLOCK_TX_DN | \ FLAG_GRP_MN_BLOCK_TX_DN | \
FLAG_GRP_HW_BLOCK_TX | \ FLAG_GRP_HW_BLOCK_TX | \
FLAG_GRP_HW_BLOCK_TX_DN ))) FLAG_GRP_HW_BLOCK_TX_DN | \
FLAG_GRP_HW_UNBLK_TX | \
FLAG_CKT_MN_UNBLK_TX )))
#define sngss7_block_status_clear(obj) (obj->blk_flags == 0) #define sngss7_block_status_clear(obj) (obj->blk_flags == 0)
@ -1062,12 +1064,23 @@ if (ftdmchan->state == new_state) { \
FLAG_GRP_RESET_TX | \ FLAG_GRP_RESET_TX | \
FLAG_GRP_RESET_RX ))) FLAG_GRP_RESET_RX )))
#define sngss7_tx_reset_status_pending(obj) ((sngss7_test_ckt_flag(obj, (FLAG_RESET_TX)) && \ #define sngss7_tx_reset_sent(obj) ((sngss7_test_ckt_flag(obj, (FLAG_RESET_TX)) && \
sngss7_test_ckt_flag(obj, (FLAG_RESET_SENT))) || \ sngss7_test_ckt_flag(obj, (FLAG_RESET_SENT))) || \
(sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_TX)) && \ (sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_TX)) && \
sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_SENT)))) sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_SENT))))
#define sngss7_tx_reset_status_pending(obj) (sngss7_test_ckt_flag(obj, (FLAG_RESET_TX)) || sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_TX)))
#define sngss7_channel_status_clear(obj) ((sngss7_block_status_clear(obj)) && (sngss7_reset_status_clear(obj))) #define sngss7_channel_status_clear(obj) ((sngss7_block_status_clear(obj)) && \
(sngss7_reset_status_clear(obj)) && \
(!sngss7_test_ckt_flag((obj),FLAG_INFID_PAUSED)))
#define sngss7_tx_reset_restart(obj) do { clear_tx_grs_flags((obj)); \
clear_tx_grs_data((obj)); \
clear_tx_rsc_flags((obj)); \
sngss7_set_ckt_flag((obj), (FLAG_RESET_TX)); \
} while (0);
#ifdef SMG_RELAY_DBG #ifdef SMG_RELAY_DBG

View File

@ -2098,6 +2098,55 @@ void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_statu
return; return;
} }
#if 0
ftdm_status_t check_for_invalid_states(ftdm_channel_t *ftmchan)
{
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
if (!sngss7_info) {
SS7_WARN_CHAN(ftdmchan, "Found ftdmchan with no sig module data!%s\n", " ");
return FTDM_FAIL;
}
if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) {
return FTDM_SUCCESS;
}
switch (ftdmchan->state) {
case UP:
case DOWN:
return FTDM_SUCCESS;
default:
if ((ftdm_current_time_in_ms() - ftdmchan->last_state_change_time) > 30000) {
SS7_WARN_CHAN(ftdmchan, "Circuite in state=%s too long - resetting!%s\n",
ftdm_channel_state2str(ftdmchan->state));
ftdm_channel_lock(ftdmchan);
if (sngss7_channel_status_clear(sngss7_info)) {
sngss7_tx_reset_restart(sngss7_info);
if (ftdmchan->state == FTDM_CHANNEL_STATE_RESTART) {
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
} else {
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
}
} else {
}
ftdm_channel_unlock(ftdmchan);
}
}
return FTDM_SUCCESS;
}
#endif
/******************************************************************************/ /******************************************************************************/
ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
{ {
@ -2232,11 +2281,16 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
} }
/* Only locally blocked, thus remove a remote block */
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
break; break;
/**************************************************************************/ /**************************************************************************/
case (2): case (2):
/* remotely blocked */ /* remotely blocked */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
/* set the channel to suspended state */ /* set the channel to suspended state */
SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
@ -2244,8 +2298,11 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
/**************************************************************************/ /**************************************************************************/
case (3): case (3):
/* both locally and remotely blocked */ /* both locally and remotely blocked */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX); if (!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) {
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX);
}
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
/* set the channel to suspended state */ /* set the channel to suspended state */
SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);

View File

@ -469,6 +469,7 @@ struct ftdm_channel {
int32_t txdrops; int32_t txdrops;
int32_t rxdrops; int32_t rxdrops;
ftdm_usrmsg_t *usrmsg; ftdm_usrmsg_t *usrmsg;
ftdm_time_t last_state_change_time;
}; };
struct ftdm_span { struct ftdm_span {