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,
}
} /* 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;
}
/* 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 */
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){
/**************************************************************************/
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,
/* 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;
}