forked from Mirrors/freeswitch
FreeTDM - ISDN fix for BRI lines with Q.921 layer going idle
This commit is contained in:
parent
d730df77e4
commit
be4512be03
|
@ -682,16 +682,26 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
|||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALING: /* outgoing call request */
|
||||
{
|
||||
if (FTDM_SPAN_IS_BRI(ftdmchan->span) &&
|
||||
ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) &&
|
||||
ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) {
|
||||
if (FTDM_SPAN_IS_BRI(ftdmchan->span) && ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) {
|
||||
ftdm_signaling_status_t sigstatus;
|
||||
ftdm_span_get_sig_status(ftdmchan->span, &sigstatus);
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) {
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)ftdmchan->span->signal_data;
|
||||
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
|
||||
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Line activation\n");
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Physical Line activation\n");
|
||||
sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING);
|
||||
ftdm_sangoma_isdn_wakeup_phy(ftdmchan);
|
||||
ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL);
|
||||
} else if (sigstatus == FTDM_SIG_STATE_DOWN) {
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)ftdmchan->span->signal_data;
|
||||
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Q.921 Line activation\n");
|
||||
sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING);
|
||||
sngisdn_snd_info_req(ftdmchan);
|
||||
ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL);
|
||||
} else {
|
||||
sngisdn_snd_setup(ftdmchan);
|
||||
}
|
||||
} else {
|
||||
sngisdn_snd_setup(ftdmchan);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,16 @@ void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status
|
|||
sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sig.ev_data.sigstatus.status = status;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
|
||||
if (FTDM_SPAN_IS_BRI(ftdmchan->span)) {
|
||||
sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data;
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)ftdmchan->span->signal_data;
|
||||
if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) {
|
||||
ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING);
|
||||
|
||||
ftdm_sched_timer(signal_data->sched, "delayed_setup", 1000, sngisdn_delayed_setup, (void*) sngisdn_info, NULL);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -972,8 +972,19 @@ ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span)
|
|||
cfg.t.cfg.s.inLCe.sapId = signal_data->dchan_id;
|
||||
|
||||
cfg.t.cfg.s.inLCe.lnkUpDwnInd = TRUE;
|
||||
|
||||
if (FTDM_SPAN_IS_BRI(span)) {
|
||||
/* tCon Timer causes unwanted hangup on BRI links
|
||||
where the Q.921 link goes into disconnected
|
||||
state when idle. */
|
||||
|
||||
cfg.t.cfg.s.inLCe.tCon.enb = FALSE;
|
||||
cfg.t.cfg.s.inLCe.tCon.val = 0;
|
||||
} else {
|
||||
cfg.t.cfg.s.inLCe.tCon.enb = TRUE;
|
||||
cfg.t.cfg.s.inLCe.tCon.val = 35;
|
||||
}
|
||||
|
||||
cfg.t.cfg.s.inLCe.tDisc.enb = TRUE;
|
||||
cfg.t.cfg.s.inLCe.tDisc.val = 35;
|
||||
cfg.t.cfg.s.inLCe.t314.enb = FALSE; /* if segmentation enabled, set to TRUE */
|
||||
|
|
|
@ -1169,6 +1169,7 @@ static ftdm_status_t sngisdn_bring_down(ftdm_channel_t *ftdmchan)
|
|||
|
||||
void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event)
|
||||
{
|
||||
ftdm_signaling_status_t sigstatus;
|
||||
int16_t suId = sngisdn_event->suId;
|
||||
int16_t dChan = sngisdn_event->dChan;
|
||||
uint8_t ces = sngisdn_event->ces;
|
||||
|
@ -1214,6 +1215,8 @@ void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event)
|
|||
}
|
||||
}
|
||||
|
||||
ftdm_span_get_sig_status(signal_data->ftdm_span, &sigstatus);
|
||||
if (sigstatus == FTDM_SIG_STATE_DOWN) {
|
||||
if (chan_no) { /* For a single channel */
|
||||
if (chan_no > ftdm_span_get_chan_count(signal_data->ftdm_span)) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Received RESTART on invalid channel:%d\n", chan_no);
|
||||
|
@ -1231,6 +1234,7 @@ void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event)
|
|||
}
|
||||
ftdm_iterator_free(chaniter);
|
||||
}
|
||||
}
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Processing RESTART CFM (suId:%u dChan:%d ces:%d type:%d)\n", suId, dChan, ces, evntType);
|
||||
ISDN_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
|
|
|
@ -305,6 +305,7 @@ void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan)
|
|||
return;
|
||||
}
|
||||
|
||||
/* This is used to request Q.921 to initiate link establishment */
|
||||
void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
CnStEvnt cnStEvnt;
|
||||
|
|
|
@ -689,6 +689,17 @@ void sngisdn_rcv_q921_ind(BdMngmt *status)
|
|||
DECODE_LCM_CATEGORY(status->t.usta.alarm.category),
|
||||
DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event,
|
||||
DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause);
|
||||
|
||||
if (FTDM_SPAN_IS_BRI(ftdmspan) && (status->t.usta.alarm.event == PROT_ST_DN)) {
|
||||
/* Q.921 link is down - This is a line where the Q.921 stops transmitting
|
||||
after the line goes idle.
|
||||
|
||||
Do not drop current calls, but set sigstatus do down so that we
|
||||
can try to re-initialize link before trying new outbound calls */
|
||||
|
||||
sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_DOWN);
|
||||
sngisdn_set_span_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n",
|
||||
|
|
|
@ -112,7 +112,7 @@ uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi)
|
|||
|
||||
void sngisdn_trace_interpreted_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len)
|
||||
{
|
||||
char *data_str = ftdm_calloc(1,200); /* TODO Find a proper size */
|
||||
char *data_str = ftdm_calloc(1,500); /* TODO Find a proper size */
|
||||
sngisdn_decode_q921(data_str, data, data_len);
|
||||
ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q921] %s FRAME %s:\n%s\n", signal_data->ftdm_span->name, ftdm_trace_dir2str(dir), data_str);
|
||||
ftdm_safe_free(data_str);
|
||||
|
|
Loading…
Reference in New Issue