freetdm: Added sng_cc_resource_check()

On SIG Down we must not fail a call instead try hunting for another.
         The only time we can fail the call and not bother hunting is
         if sng_cc_resource_check fails.
         Took out configuration retry as the config code is now
         fixed in sng_ss7 library. Transaction id fix.

Unit Tested:

NSG UP -- start full load
kill NSG
NSG UP again on full load
make sure it comes up fine.
This commit is contained in:
Nenad Corbic 2011-12-19 02:27:38 -05:00
parent 7e2ef3a55c
commit b6ca6c5b1d
3 changed files with 24 additions and 16 deletions

View File

@ -77,9 +77,9 @@ int ft_to_sngss7_cfg_all(void)
int ret = 0;
/* check if we have done gen_config already */
if (!(g_ftdm_sngss7_data.gen_config)) {
if (g_ftdm_sngss7_data.gen_config == SNG_GEN_CFG_STATUS_INIT) {
/* update the global gen_config so we don't do it again */
g_ftdm_sngss7_data.gen_config = 1;
g_ftdm_sngss7_data.gen_config = SNG_GEN_CFG_STATUS_PENDING;
/* start of by checking if the license and sig file are valid */
if (sng_validate_license(g_ftdm_sngss7_data.cfg.license,
@ -209,13 +209,12 @@ int ft_to_sngss7_cfg_all(void)
}
} /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) */
g_ftdm_sngss7_data.gen_config = 2;
g_ftdm_sngss7_data.gen_config = SNG_GEN_CFG_STATUS_DONE;
} /* if (!(g_ftdm_sngss7_data.gen_config)) */
/* FIXME: Please change number 2 to an ENUM that is more explanatory */
if (g_ftdm_sngss7_data.gen_config != 2) {
if (g_ftdm_sngss7_data.gen_config != SNG_GEN_CFG_STATUS_DONE) {
SS7_CRITICAL("General configuration FAILED!\n");
return 1;
}

View File

@ -1653,8 +1653,10 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
/* check if the channel sig state is UP */
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) {
SS7_ERROR_CHAN(ftdmchan, "Requested channel sig state is down, cancelling call!%s\n", " ");
goto outgoing_fail;
SS7_ERROR_CHAN(ftdmchan, "Requested channel sig state is down, skipping channell!%s\n", " ");
/* Sig state will be down due to a block.
Right action is to hunt for another call */
goto outgoing_break;
}
/* check if there is a remote block */
@ -1679,6 +1681,14 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
goto outgoing_break;
}
/* This is a gracefull stack resource check.
Removing this function will cause unpredictable
ungracefule errors. */
if (sng_cc_resource_check()) {
goto outgoing_fail;
}
/* check the state of the channel */
switch (ftdmchan->state){
/**************************************************************************/
@ -1873,7 +1883,6 @@ static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span)
static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config)
{
sngss7_span_data_t *ss7_span_info;
int sngss7_retry_cnt=5;
ftdm_log (FTDM_LOG_INFO, "Configuring ftmod_sangoma_ss7 span = %s(%d)...\n",
span->name,
@ -1923,20 +1932,14 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config)
/* parse the configuration and apply to the global config structure */
if (ftmod_ss7_parse_xml(ftdm_parameters, span)) {
ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n");
ftdm_sleep (1000);
ftdm_sleep (100);
return FTDM_FAIL;
}
/* configure libsngss7 */
try_cfg_again:
if (ft_to_sngss7_cfg_all()) {
if (sngss7_retry_cnt--) {
ftdm_sleep (500);
ftdm_log (FTDM_LOG_DEBUG, "Failed to configure LibSngSS7 - retrying!\n");
goto try_cfg_again;
}
ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n");
ftdm_sleep (1000);
ftdm_sleep (100);
return FTDM_FAIL;
}

View File

@ -116,6 +116,12 @@ typedef enum {
SNG_CALLING = 2
} sng_addr_type_t;
typedef enum {
SNG_GEN_CFG_STATUS_INIT = 0,
SNG_GEN_CFG_STATUS_PENDING = 1,
SNG_GEN_CFG_STATUS_DONE = 2
} nsg_gen_cfg_type_t;
typedef struct sng_mtp2_error_type {
int init;
char sng_type[MAX_NAME_LEN];