diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index bd5b13bfec..9fe28190e1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -84,6 +84,8 @@ static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span signal_data->switchtype = SNGISDN_SWITCH_4ESS; } else if (!strcasecmp(switch_name, "dms100")) { signal_data->switchtype = SNGISDN_SWITCH_DMS100; + } else if (!strcasecmp(switch_name, "qsig")) { + signal_data->switchtype = SNGISDN_SWITCH_QSIG; } else { ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported switchtype %s for trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type)); return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index a52a624dd0..1bd2753e81 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -667,25 +667,33 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.maxBSrvCnt = 2; cfg.t.cfg.s.inDLSAP.maxDSrvCnt = 2; #endif /* ISDN_SRV */ - - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; - cfg.t.cfg.s.inDLSAP.intType = NETWORK; - cfg.t.cfg.s.inDLSAP.clrGlr = FALSE; /* in case of glare, do not clear local call */ - cfg.t.cfg.s.inDLSAP.statEnqOpt = TRUE; - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || - signal_data->switchtype == SNGISDN_SWITCH_INSNET) { - cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; - } else { - cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; - } - } else { - cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; - cfg.t.cfg.s.inDLSAP.intType = USER; + if (signal_data->switchtype == SNGISDN_SWITCH_QSIG) { + cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; + cfg.t.cfg.s.inDLSAP.intType = SYM_USER; cfg.t.cfg.s.inDLSAP.clrGlr = TRUE; /* in case of glare, clear local call */ cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } else { + if (signal_data->signalling == SNGISDN_SIGNALING_NET) { + cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; + cfg.t.cfg.s.inDLSAP.intType = NETWORK; + cfg.t.cfg.s.inDLSAP.clrGlr = FALSE; /* in case of glare, do not clear local call */ + cfg.t.cfg.s.inDLSAP.statEnqOpt = TRUE; + + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || + signal_data->switchtype == SNGISDN_SWITCH_INSNET) { + cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } else { + cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; + } + } else { + cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; + cfg.t.cfg.s.inDLSAP.intType = USER; + cfg.t.cfg.s.inDLSAP.clrGlr = TRUE; /* in case of glare, clear local call */ + cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; + cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } } /* Override the restart options if user selected that option */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 578677a39f..bcc7d938b7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -801,6 +801,23 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + /* If Facility decoding is disabled, we do not care about current call state, just pass event up to user */ + ftdm_sigmsg_t sigev; + if (facEvnt->facElmt.facStr.pres) { + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); + } + memset(&sigev, 0, sizeof(sigev)); + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + sigev.event_id = FTDM_SIGEVENT_FACILITY; + ftdm_span_send_signal(ftdmchan->span, &sigev); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index 20bcc3a043..df0414a7f5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -352,22 +352,6 @@ int ft_to_sngss7_cfg_all(void) x++; } /* while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) */ - if (g_ftdm_sngss7_data.cfg.mtpRoute[1].id != 0) { - if (!(g_ftdm_sngss7_data.cfg.mtpRoute[0].flags & SNGSS7_CONFIGURED)) { - - if (ftmod_ss7_mtp3_route_config(0)) { - SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n"); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.mtpRoute[0].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - } - - x = 1; while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) { /* check if this link has been configured already */ @@ -1161,10 +1145,10 @@ int ftmod_ss7_mtp3_route_config(int id) cfg.t.cfg.s.snRout.swtchType = k->linkType; /* switch type */ cfg.t.cfg.s.snRout.upSwtch = k->switchType; /* user part switch type */ cfg.t.cfg.s.snRout.cmbLnkSetId = k->cmbLinkSetId; /* combined link set ID */ - if (k->id == 0) { - cfg.t.cfg.s.snRout.dir = LSN_RTE_UP; /* direction */ + if (k->dir == SNG_RTE_UP) { + cfg.t.cfg.s.snRout.dir = LSN_RTE_UP; /* direction */ } else { - cfg.t.cfg.s.snRout.dir = LSN_RTE_DN; /* direction */ + cfg.t.cfg.s.snRout.dir = LSN_RTE_DN; /* direction */ } cfg.t.cfg.s.snRout.rteToAdjSp = 0; /* flag indicating this route to adjacent SP */ cfg.t.cfg.s.snRout.ssf = k->ssf; /* sub service field */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index fe291fb305..05c63518ec 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -82,6 +82,11 @@ typedef enum { HOLE } sng_ckt_type_t; +typedef enum { + SNG_RTE_UP = 0, + SNG_RTE_DN +} sng_route_direction_t; + typedef enum { SNGSS7_LPA_FOR_COT = (1 << 0), /* send LPA when COT arrives */ SNGSS7_ACM_OBCI_BITA = (1 << 10) /* in-band indication */ @@ -236,6 +241,7 @@ typedef struct sng_route { uint32_t ssf; uint32_t nwId; uint32_t isSTP; + uint32_t dir; uint32_t t6; uint32_t t8; uint32_t t10; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 46df9908e9..1b24e344d4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -2383,6 +2383,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) g_ftdm_sngss7_data.cfg.mtpRoute[i].nwId = mtp3_route->nwId; g_ftdm_sngss7_data.cfg.mtpRoute[i].lnkSets = mtp3_route->lnkSets; g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = mtp3_route->ssf; + g_ftdm_sngss7_data.cfg.mtpRoute[i].dir = SNG_RTE_DN; if (mtp3_route->t6 != 0) { g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = mtp3_route->t6; } else { @@ -2442,6 +2443,52 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) return 0; } +/******************************************************************************/ +static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf) +{ + int i = 1; + + while (g_ftdm_sngss7_data.cfg.mtpRoute[i].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc == spc) { + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + i++; + } + + if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].id = i; + SS7_DEBUG("found new mtp3 self route\n"); + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].id = i; + SS7_DEBUG("found existing mtp3 self route\n"); + } + + strncpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, "self-route", MAX_NAME_LEN-1); + + g_ftdm_sngss7_data.cfg.mtpRoute[i].id = i; + g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = spc; + g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType = linkType; + g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = switchType; + g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = i; + g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = 0; + g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = ssf; + g_ftdm_sngss7_data.cfg.mtpRoute[i].dir = SNG_RTE_UP; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = 8; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t8 = 12; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t10 = 300; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t11 = 300; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t15 = 30; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t16 = 20; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t18 = 200; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t19 = 690; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t21 = 650; + g_ftdm_sngss7_data.cfg.mtpRoute[i].t25 = 100; + + return 0; +} + /******************************************************************************/ static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route) { @@ -2754,45 +2801,6 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap) return 0; } -/******************************************************************************/ -static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf) -{ - - if (g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc == 0){ - SS7_DEBUG("found new mtp3 self route\n"); - } else if (g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc == spc) { - SS7_DEBUG("found existing mtp3 self route\n"); - return FTDM_SUCCESS; - } else { - SS7_ERROR("found new mtp3 self route but it does not match the route already configured (dpc=%d:spc=%d)\n", - g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc, - spc); - return FTDM_FAIL; - } - - strncpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[0].name, "self-route", MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.mtpRoute[0].id = 0; - g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc = spc; - g_ftdm_sngss7_data.cfg.mtpRoute[0].linkType = linkType; - g_ftdm_sngss7_data.cfg.mtpRoute[0].switchType = switchType; - g_ftdm_sngss7_data.cfg.mtpRoute[0].cmbLinkSetId = 0; - g_ftdm_sngss7_data.cfg.mtpRoute[0].isSTP = 0; - g_ftdm_sngss7_data.cfg.mtpRoute[0].ssf = ssf; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t6 = 8; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t8 = 12; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t10 = 300; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t11 = 300; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t15 = 30; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t16 = 20; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t18 = 200; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t19 = 690; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t21 = 650; - g_ftdm_sngss7_data.cfg.mtpRoute[0].t25 = 100; - - return 0; -} - /******************************************************************************/ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) {