freetdm: logging fixes, ss7 events sanity checks

This commit is contained in:
Nenad Corbic 2011-10-24 19:40:45 -04:00
parent 563460ce15
commit fc997aaea4
5 changed files with 29 additions and 13 deletions

View File

@ -791,7 +791,7 @@ void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta)
break; break;
/**************************************************************************/ /**************************************************************************/
case (LRY_USTA_UP): /* channel up */ case (LRY_USTA_UP): /* channel up */
ftdm_log(FTDM_LOG_ERROR,"[RELAY] Channel UP: tx procId %d: channel %d\n", ftdm_log(FTDM_LOG_INFO,"[RELAY] Channel UP: tx procId %d: channel %d\n",
sta->t.usta.s.ryUpUsta.sendPid, sta->t.usta.s.ryUpUsta.sendPid,
sta->t.usta.s.ryUpUsta.id); sta->t.usta.s.ryUpUsta.id);

View File

@ -1651,6 +1651,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)
static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span) static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span)
{ {
/*this function is called by the FT-Core to stop this span */ /*this function is called by the FT-Core to stop this span */
int timeout=0;
ftdm_log (FTDM_LOG_INFO, "Stopping span %s:%u.\n", span->name,span->span_id); ftdm_log (FTDM_LOG_INFO, "Stopping span %s:%u.\n", span->name,span->span_id);
@ -1659,10 +1660,17 @@ static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span)
/* wait for the thread to stop */ /* wait for the thread to stop */
while (ftdm_test_flag (span, FTDM_SPAN_IN_THREAD)) { while (ftdm_test_flag (span, FTDM_SPAN_IN_THREAD)) {
ftdm_log (FTDM_LOG_DEBUG,"Waiting for monitor thread to end for %s:%u.\n", ftdm_set_flag (span, FTDM_SPAN_STOP_THREAD);
ftdm_log (FTDM_LOG_DEBUG,"Waiting for monitor thread to end for %s:%u. [flags=0x%08X]\n",
span->name, span->name,
span->span_id); span->span_id,
ftdm_sleep (1); span->flags);
/* Wait 50ms */
ftdm_sleep (50);
timeout++;
/* timeout after 5 sec, better to crash than hang */
ftdm_assert_return(timeout < 100, FTDM_FALSE, "SS7 Span stop timeout!\n");
} }
/* KONRAD FIX ME - deconfigure any circuits, links, attached to this span */ /* KONRAD FIX ME - deconfigure any circuits, links, attached to this span */
@ -1725,12 +1733,14 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config)
/* parse the configuration and apply to the global config structure */ /* parse the configuration and apply to the global config structure */
if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { if (ftmod_ss7_parse_xml(ftdm_parameters, span)) {
ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n"); ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n");
ftdm_sleep (1000);
return FTDM_FAIL; return FTDM_FAIL;
} }
/* configure libsngss7 */ /* configure libsngss7 */
if (ft_to_sngss7_cfg_all()) { if (ft_to_sngss7_cfg_all()) {
ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n");
ftdm_sleep (1000);
return FTDM_FAIL; return FTDM_FAIL;
} }

View File

@ -915,7 +915,7 @@ if (ftdmchan->state == new_state) { \
#define SS7_ERROR_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_ERROR, msg , ##args) #define SS7_ERROR_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_ERROR, msg , ##args)
#define SS7_CTRIT_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_CRIT, msg , ##args) #define SS7_CTRIT_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_CRIT, msg , ##args)
#ifdef KONRAD_DEVEL #ifdef SS7_CODE_DEVEL
#define SS7_DEVEL_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a,##__VA_ARGS__ ); #define SS7_DEVEL_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a,##__VA_ARGS__ );
#else #else
#define SS7_DEVEL_DEBUG(a,...) #define SS7_DEVEL_DEBUG(a,...)

View File

@ -922,11 +922,6 @@ int check_for_state_change(ftdm_channel_t *ftdmchan)
/******************************************************************************/ /******************************************************************************/
ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan) ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan)
{ {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj == NULL) {
SS7_ERROR("sngss7_info is Null for circuit #%d\n", circuit);
return FTDM_FAIL;
}
if (!g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj) { if (!g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj) {
SS7_ERROR("No ss7 info for circuit #%d\n", circuit); SS7_ERROR("No ss7 info for circuit #%d\n", circuit);
return FTDM_FAIL; return FTDM_FAIL;
@ -935,10 +930,21 @@ ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_in
*sngss7_info = g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj; *sngss7_info = g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj;
if (!(*sngss7_info)->ftdmchan) { if (!(*sngss7_info)->ftdmchan) {
SS7_ERROR("No channel for circuit #%d\n", circuit); SS7_ERROR("No ftdmchan for circuit #%d\n", circuit);
return FTDM_FAIL; return FTDM_FAIL;
} }
if (!(*sngss7_info)->ftdmchan->span) {
SS7_CRITICAL("ftdmchan->span = NULL for circuit #%d\n",circuit);
return FTDM_FAIL;
}
if (!(*sngss7_info)->ftdmchan->span->signal_data) {
SS7_CRITICAL("ftdmchan->span->signal_data = NULL for circuit #%d\n",circuit);
return FTDM_FAIL;
}
*ftdmchan = (*sngss7_info)->ftdmchan; *ftdmchan = (*sngss7_info)->ftdmchan;
return FTDM_SUCCESS; return FTDM_SUCCESS;
} }

View File

@ -2877,7 +2877,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)
(g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count)) { (g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count)) {
/* we are processing a circuit that already exists */ /* we are processing a circuit that already exists */
SS7_DEBUG("Found an existing circuit %d, ccSpanId=%d, chan%d\n", SS7_DEVEL_DEBUG("Found an existing circuit %d, ccSpanId=%d, chan%d\n",
x, x,
ccSpan->id, ccSpan->id,
count); count);
@ -2886,7 +2886,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)
flag = 1; flag = 1;
/* not supporting reconfig at this time */ /* not supporting reconfig at this time */
SS7_DEBUG("Not supporting ckt reconfig at this time!\n"); SS7_DEVEL_DEBUG("Not supporting ckt reconfig at this time!\n");
goto move_along; goto move_along;
} else { } else {
/* this is not the droid you are looking for */ /* this is not the droid you are looking for */