Fixed 5 relay conditions

M UP  -> S UP
M Down -> S UP -> M UP
M UP -> S UP -> relay down -> relay up
M UP -> S UP -> Kill M -> M UP
M Up -> S UP -> relay down -> M link down -> relay up -> M link up
This commit is contained in:
James Zhang 2011-11-25 21:05:39 -05:00
parent 69c62f7b38
commit 5b8af78a89
3 changed files with 29 additions and 14 deletions

View File

@ -1171,16 +1171,19 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
sngss7_info->circuit->flags );
if (!(sngss7_info->circuit->flags & SNGSS7_CONFIGURED)) {
if ( !sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)
||(sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME))) {
/* Configure the circuit if RESUME and PAUSED are not set.
And also in a case when RESUME is set */
if (!sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED) ||
sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) {
if (ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id)) {
SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", sngss7_info->circuit->id);
*(int*)0=0;
return 1;
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
} else {
SS7_INFO("ISUP CKT %d configuration DONE!\n", sngss7_info->circuit->id);
}
sngss7_info->circuit->flags |= SNGSS7_CONFIGURED;
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
}
}
}

View File

@ -64,12 +64,10 @@ ftdm_status_t handle_relay_connect(RyMngmt *sta)
SS7_INFO("Relay Channel %d connection UP\n", sng_relay->id);
if (sng_relay->type == LRY_CT_TCP_CLIENT) {
if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) {
if (reconfig_all_ckts_for_relay()) {
SS7_ERROR("Failed to reconfigure ISUP Ckts!\n");
/* we're done....this is very bad! */
}
}
return FTDM_SUCCESS;
} else if (sng_relay->type == LRY_CT_TCP_SERVER) {
ftmod_ss7_enable_grp_mtp3Link(sta->t.usta.s.ryUpUsta.id);

View File

@ -2110,6 +2110,7 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
uint8_t bits_ef = 0;
int x;
int ret;
ret=0;
for (x = 1; x < (ftdmspan->chan_count + 1); x++) {
/**************************************************************************/
@ -2147,6 +2148,10 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
/* query for the status of the ckt */
if (ftmod_ss7_isup_ckt_sta(sngss7_info->circuit->id, &state)) {
/* NC: Circuit statistic failed: does not exist. Must re-configure circuit
Reset the circuit CONFIGURED flag so that RESUME will reconfigure
this circuit. */
sngss7_info->circuit->flags &= ~SNGSS7_CONFIGURED;
SS7_ERROR("Failed to read isup ckt = %d status\n", sngss7_info->circuit->id);
continue;
}
@ -2159,6 +2164,14 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
if (bits_cd == 0x0) {
/* check if circuit is UCIC or transient */
if (bits_ab == 0x3) {
SS7_INFO("ISUP CKT %d re-configuration pending!\n", x);
sngss7_info->circuit->flags &= ~SNGSS7_CONFIGURED;
SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
/* NC: The code below should be deleted. Its here for hitorical
reason. The RESUME code will reconfigure the channel since
the CONFIGURED flag has been reset */
#if 0
/* bit a and bit b are set, unequipped */
ret = ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id);
if (ret) {
@ -2181,6 +2194,7 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
/* unlock the channel */
ftdm_mutex_unlock(ftdmchan->mutex);
#endif
} /* if (bits_ab == 0x3) */
} else {
@ -2192,8 +2206,8 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
break;
/**************************************************************************/
case (1):
/* locally blocked */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
/* locally blocked: Therefore we need to state machine to send an unblock */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX);
/* set the channel to suspended state */
SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
@ -2209,7 +2223,7 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
/**************************************************************************/
case (3):
/* both locally and remotely blocked */
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX);
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
/* set the channel to suspended state */