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 44764295d4..93bd3154b3 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 @@ -213,7 +213,7 @@ int ft_to_sngss7_cfg_all(void) SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x); SS7_ASSERT } else { - SS7_INFO("MTP3 ROUTE %d configuration DONE!\n"); + SS7_INFO("MTP3 ROUTE %d configuration DONE!\n",x); } /* set the CONFIGURED flag */ @@ -229,7 +229,7 @@ int ft_to_sngss7_cfg_all(void) SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n"); SS7_ASSERT } else { - SS7_INFO("MTP3 ROUTE %d configuration DONE!\n"); + SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n"); } /* set the CONFIGURED flag */ @@ -925,7 +925,6 @@ int ftmod_ss7_mtp3_linkset_config(int id) { Pst pst; SnMngmt cfg; - U16 c; sng_link_set_t *k = &g_ftdm_sngss7_data.cfg.mtpLinkSet[id]; /* initalize the post structure */ @@ -953,10 +952,9 @@ int ftmod_ss7_mtp3_linkset_config(int id) cfg.t.cfg.s.snLnkSet.adjDpc = k->apc; /* adjacent DPC */ cfg.t.cfg.s.snLnkSet.nmbActLnkReqd = k->minActive; /* minimum number of active links */ cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet = 1; /* number of combined link sets */ - for (c = 0; c < LSN_MAXCMBLNK; c++) { - cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].cmbLnkSetId = c+1; - cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].lnkSetPrior = 0; - } + cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].cmbLnkSetId = k->cmbLinkSetId; + cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].lnkSetPrior = 0; + return(sng_cfg_mtp3(&pst, &cfg)); } 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 bab1c8be6a..f76a56099f 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 @@ -162,6 +162,7 @@ typedef struct sng_link_set { uint32_t flags; uint32_t apc; uint32_t linkType; + uint32_t cmbLinkSetId; uint32_t minActive; uint32_t numLinks; uint32_t links[16]; @@ -176,6 +177,7 @@ typedef struct sng_route { uint32_t linkType; uint32_t switchType; uint32_t ssf; + uint32_t nwId; uint32_t isSTP; uint32_t t6; uint32_t t8; 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 f6d04ed2e8..66907e78ba 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 @@ -343,11 +343,11 @@ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) /**********************************************************************/ } else if (!strcasecmp(parm->var, "apc")) { mtpLinkSet.apc = atoi(parm->val); - SS7_DEBUG("\tFoundmtpLinkSet->apc = %d\n", mtpLinkSet.apc); + SS7_DEBUG("\tFound mtpLinkSet->apc = %d\n", mtpLinkSet.apc); /**********************************************************************/ } else if (!strcasecmp(parm->var, "minActive")) { mtpLinkSet.minActive = atoi(parm->val); - SS7_DEBUG("\tFoundmtpLinkSet->minActive = %d\n", mtpLinkSet.minActive); + SS7_DEBUG("\tFound mtpLinkSet->minActive = %d\n", mtpLinkSet.minActive); /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); @@ -497,27 +497,27 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * if (!strcasecmp(parm->val, "itu92")) { mtpLink->mtp2.linkType = LSD_SW_ITU92; mtpLink->mtp3.linkType = LSN_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ITU92\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ITU92\"\n"); } else if (!strcasecmp(parm->val, "itu88")) { mtpLink->mtp2.linkType = LSD_SW_ITU88; mtpLink->mtp3.linkType = LSN_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ITU88\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ITU88\"\n"); } else if (!strcasecmp(parm->val, "ansi96")) { mtpLink->mtp2.linkType = LSD_SW_ANSI92; mtpLink->mtp3.linkType = LSN_SW_ANS96; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI96\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI96\"\n"); } else if (!strcasecmp(parm->val, "ansi92")) { mtpLink->mtp2.linkType = LSD_SW_ANSI92; mtpLink->mtp3.linkType = LSN_SW_ANS; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI92\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI92\"\n"); } else if (!strcasecmp(parm->val, "ansi88")) { mtpLink->mtp2.linkType = LSD_SW_ANSI88; mtpLink->mtp3.linkType = LSN_SW_ANS; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI88\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI88\"\n"); } else if (!strcasecmp(parm->val, "etsi")) { mtpLink->mtp2.linkType = LSD_SW_ITU92; mtpLink->mtp3.linkType = LSN_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ETSI\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ETSI\"\n"); } else { SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -526,40 +526,40 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * } else if (!strcasecmp(parm->var, "switchType")) { if (!strcasecmp(parm->val, "itu97")) { mtpLink->mtp3.switchType = LSI_SW_ITU97; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU97\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU97\"\n"); } else if (!strcasecmp(parm->val, "itu88")) { mtpLink->mtp3.switchType = LSI_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU88\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU88\"\n"); } else if (!strcasecmp(parm->val, "itu92")) { mtpLink->mtp3.switchType = LSI_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU92\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU92\"\n"); } else if (!strcasecmp(parm->val, "itu00")) { mtpLink->mtp3.switchType = LSI_SW_ITU2000; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU00\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU00\"\n"); } else if (!strcasecmp(parm->val, "ETSIV2")) { mtpLink->mtp3.switchType = LSI_SW_ETSI; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ETSIV2\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ETSIV2\"\n"); } else if (!strcasecmp(parm->val, "ETSIV3")) { mtpLink->mtp3.switchType = LSI_SW_ETSIV3; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ETSIV3\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ETSIV3\"\n"); } else if (!strcasecmp(parm->val, "UK")) { mtpLink->mtp3.switchType = LSI_SW_UK; - SS7_DEBUG("\tFoundmtpLink->switchType = \"UK\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"UK\"\n"); } else if (!strcasecmp(parm->val, "RUSSIA")) { mtpLink->mtp3.switchType = LSI_SW_RUSSIA; - SS7_DEBUG("\tFoundmtpLink->switchType = \"RUSSIA\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"RUSSIA\"\n"); } else if (!strcasecmp(parm->val, "INDIA")) { mtpLink->mtp3.switchType = LSI_SW_INDIA; - SS7_DEBUG("\tFoundmtpLink->switchType = \"INDIA\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"INDIA\"\n"); } else if (!strcasecmp(parm->val, "ansi88")) { mtpLink->mtp3.switchType = LSI_SW_ANS88; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI88\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI88\"\n"); } else if (!strcasecmp(parm->val, "ansi92")) { mtpLink->mtp3.switchType = LSI_SW_ANS92; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI92\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI92\"\n"); } else if (!strcasecmp(parm->val, "ansi95")) { mtpLink->mtp3.switchType = LSI_SW_ANS95; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI95\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI95\"\n"); } else { SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -577,7 +577,7 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * /**********************************************************************/ } else if (!strcasecmp(parm->var, "slc")) { mtpLink->mtp3.slc = atoi(parm->val); - SS7_DEBUG("\tFoundmtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc); + SS7_DEBUG("\tFound mtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc); /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); @@ -665,7 +665,7 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.linkType; mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.switchType; mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.ssf; - mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id; + mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].cmbLinkSetId; break; } x++; @@ -781,36 +781,25 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) /* check if the name matches */ if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpRoute[x].name, parm->val)) { - /* now, harvest the required information from the global structure */ sng_isup.mtpRouteId = g_ftdm_sngss7_data.cfg.mtpRoute[x].id; sng_isup.dpc = g_ftdm_sngss7_data.cfg.mtpRoute[x].dpc; sng_isup.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType; sng_isap.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType; - /* find the nwID from the nsap */ - int y = 1; - while (g_ftdm_sngss7_data.cfg.nsap[y].id != 0) { - - if ((g_ftdm_sngss7_data.cfg.nsap[y].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) && - (g_ftdm_sngss7_data.cfg.nsap[y].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) && - (g_ftdm_sngss7_data.cfg.nsap[y].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) { - + /* find the NSAP corresponding to this switchType and SSF */ + int z = 1; + while (g_ftdm_sngss7_data.cfg.nsap[z].id != 0) { + if ((g_ftdm_sngss7_data.cfg.nsap[z].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) && + (g_ftdm_sngss7_data.cfg.nsap[z].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) && + (g_ftdm_sngss7_data.cfg.nsap[z].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) { + sng_isup.nwId = g_ftdm_sngss7_data.cfg.nsap[z].nwId; /* we have a match so break out of this loop */ break; } /* move on to the next one */ - y++; - } /* while (g_ftdm_sngss7_data.cfg.mtp3_isup[y].id != 0) */ - - /* check how we exited the last while loop */ - if (g_ftdm_sngss7_data.cfg.nsap[y].id == 0) { - SS7_ERROR("\tFailed to find the nwID for = \"%s\"!\n", parm->val); - return FTDM_FAIL; - } else { - sng_isup.nwId = g_ftdm_sngss7_data.cfg.nsap[y].nwId; + z++; } - break; } x++; @@ -867,8 +856,6 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) ftmod_ss7_fill_in_isup_interface(&sng_isup); - g_ftdm_sngss7_data.cfg.isap[sng_isap.id].spId = sng_isup.id; - return FTDM_SUCCESS; } @@ -1074,6 +1061,7 @@ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet) g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id = mtpLinkSet->id; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc = mtpLinkSet->apc; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].linkType = g_ftdm_sngss7_data.cfg.mtpLink[1].mtp3.linkType; /* KONRAD FIX ME */ + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].cmbLinkSetId = mtpLinkSet->id; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive = mtpLinkSet->minActive; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].numLinks = mtpLinkSet->numLinks; @@ -1092,8 +1080,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) /* go through all the existing routes and see if we find a match */ i = 1; while (g_ftdm_sngss7_data.cfg.mtpRoute[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc == mtp3_route->dpc) { - + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpRoute[i].name, mtp3_route->name)) { /* we have a match so break out of this loop */ break; } @@ -1115,7 +1102,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = mtp3_route->dpc; g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType = mtp3_route->linkType; g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = mtp3_route->switchType; - g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = 1; /* mtp3_route->cmbLinkSetId;*/ + g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = mtp3_route->cmbLinkSetId; g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = mtp3_route->isSTP; g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = mtp3_route->ssf; if (mtp3_route->t6 != 0) { @@ -1222,7 +1209,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) /* go through all the existing interfaces and see if we find a match */ i = 1; while (g_ftdm_sngss7_data.cfg.isupIntf[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupIntf[i].nwId == sng_isup->nwId) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.isupIntf[i].name, sng_isup->name)) { /* we have a match so break out of this loop */ break; @@ -1395,7 +1382,8 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap) } g_ftdm_sngss7_data.cfg.isap[i].id = sng_isap->id; - g_ftdm_sngss7_data.cfg.isap[i].suId = 1; /*KONRAD FIX ME */ + g_ftdm_sngss7_data.cfg.isap[i].suId = sng_isap->id; + g_ftdm_sngss7_data.cfg.isap[i].spId = sng_isap->id; g_ftdm_sngss7_data.cfg.isap[i].switchType = sng_isap->switchType; g_ftdm_sngss7_data.cfg.isap[i].ssf = sng_isap->ssf; @@ -1513,7 +1501,9 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i SS7_DEBUG("found existing mtp3 self route\n"); return FTDM_SUCCESS; } else { - SS7_ERROR("found new mtp3 self route but it does not much the route already configured\n"); + 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; }