chlog: freetdm: ss7 - bug fix: a route now supports multiple linksets

This commit is contained in:
Konrad Hammel 2011-01-21 12:04:33 -05:00
parent becb94052a
commit a382990d9f
2 changed files with 42 additions and 11 deletions

View File

@ -2462,7 +2462,7 @@ static ftdm_conf_node_t *get_ss7_config_node(switch_xml_t cfg, const char *confn
}
/* add mtp routes */
if (add_config_list_nodes(isup, rootnode, "mtp_routes", "mtp_route", NULL, NULL)) {
if (add_config_list_nodes(isup, rootnode, "mtp_routes", "mtp_route", "linksets", "linkset")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_routes for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode);
return NULL;

View File

@ -1269,6 +1269,10 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)
int num_parms = mtp_route->n_parameters;
int i;
ftdm_conf_node_t *linkset;
int ls_id;
int numLinks;
/* initalize the mtpRoute structure */
memset(&mtpRoute, 0x0, sizeof(mtpRoute));
@ -1299,11 +1303,6 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)
mtpRoute.dpc = atoi(parm->val);
SS7_DEBUG("Found an mtpRoute dpc = %d\n", mtpRoute.dpc);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "linksetId")) {
/**********************************************************************/
mtpRoute.linkSetId = atoi(parm->val);
SS7_DEBUG("Found an mtpRoute linkset = %s\n", parm->val);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isSTP")) {
/**********************************************************************/
if (!strcasecmp(parm->val, "no")) {
@ -1383,15 +1382,47 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)
parm = parm + 1;
}
/* pull up the linktype, switchtype, and SSF from the linkset */
mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].linkType;
mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].switchType;
mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].ssf;
/* fill in the rest of the values in the mtpRoute struct */
mtpRoute.nwId = mtpRoute.id;
mtpRoute.cmbLinkSetId = mtpRoute.id;
/* parse in the list of linksets this route is reachable by */
linkset = mtp_route->child->child;
while (linkset != NULL) {
/**************************************************************************/
/* extract the linkset Id */
ls_id = atoi(linkset->parameters->val);
if (g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].id != 0) {
SS7_DEBUG("Found mtpRoute linkset id = %d that is valid\n",ls_id);
} else {
SS7_ERROR("Found mtpRoute linkset id = %d that is invalid\n",ls_id);
goto move_along;
}
/* pull up the linktype, switchtype, and SSF from the linkset */
mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].linkType;
mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].switchType;
mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].ssf;
/* extract the number of cmbLinkSetId aleady on this linkset */
numLinks = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].numLinks;
/* add this routes cmbLinkSetId to the list */
g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].links[numLinks] = mtpRoute.cmbLinkSetId;
/* increment the number of cmbLinkSets on this linkset */
g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].numLinks++;
move_along:
/* move to the next linkset element */
linkset = linkset->next;
/**************************************************************************/
} /* while (linkset != null) */
ftmod_ss7_fill_in_mtp3_route(&mtpRoute);
ftmod_ss7_fill_in_nsap(&mtpRoute);