]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
chlog: freetdm: ss7 - bug fix: a route now supports multiple linksets
authorKonrad Hammel <konrad@sangoma.com>
Fri, 21 Jan 2011 17:04:33 +0000 (12:04 -0500)
committerKonrad Hammel <konrad@sangoma.com>
Sun, 30 Jan 2011 00:49:34 +0000 (19:49 -0500)
libs/freetdm/mod_freetdm/mod_freetdm.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c

index d972cd74065494f00e89d4780bf6f40538e3fbd6..92cf9e54b9c8dadc34a52bb59204245973702842 100755 (executable)
@@ -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;
index 277951c5d1834a5e53c754bc74f4a41b20472491..93f2678d085c6012ffb82eb62f465b6f3ce199ce 100644 (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);