From 8102c1603cd6455361d68809b9ee61647d52363b Mon Sep 17 00:00:00 2001 From: kapil Date: Mon, 11 Jun 2012 18:45:56 +0530 Subject: [PATCH] adding src/peer port into xml config --- .../ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c | 4 ++-- .../ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h | 1 + .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c | 12 +++++++++++- .../ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c index 57ab67c0ca..c1566d7758 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c @@ -840,7 +840,7 @@ static int ftmod_m2ua_sctsap_config(int m2ua_inf_id, int sctp_id) /* service provider ID */ cfg.t.cfg.s.sctSapCfg.spId = sctp_id; /* source port number */ - cfg.t.cfg.s.sctSapCfg.srcPort = 2904; + cfg.t.cfg.s.sctSapCfg.srcPort = sctp->port; /* interface address */ /*For multiple IP address support */ #ifdef SCT_ENDP_MULTI_IPADDR @@ -925,7 +925,7 @@ static int ftmod_m2ua_peer_config1(int m2ua_inf_id, int peer_id) cfg.t.cfg.s.peerCfg.assocCfg.dstAddrLst.nAddr[i].u.ipv4NetAddr = peer->destAddrList[i]; } #ifdef MW_CFG_DSTPORT - cfg.t.cfg.s.peerCfg.assocCfg.dstPort = /* TODO */ 2904; /* Port on which M2UA runs */ + cfg.t.cfg.s.peerCfg.assocCfg.dstPort = peer->port; /* Port on which M2UA runs */ #endif cfg.t.cfg.s.peerCfg.assocCfg.srcAddrLst.nmb = sctp->numSrcAddr; /* source address list */ for (i=0; i <= (sctp->numSrcAddr-1); i++) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h index 8c2a12e1c8..d87b9d6c04 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h @@ -71,6 +71,7 @@ typedef struct sng_m2ua_peer_cfg{ uint16_t selfAspId; /* Self ASP ID. ASP identifier for this ASP node if the aspIdFlag is TRUE. */ uint32_t numDestAddr; /* Number of destination address defined */ uint16_t sctpId; /* idx to sctp profile */ + uint16_t port; /* port */ uint32_t destAddrList[SCT_MAX_NET_ADDRS+1]; /* Destination adddress list */ uint16_t locOutStrms; /*Number of outgoing streams supported by this association*/ int init_sctp_assoc; /* flag to tell if we need to initiate SCTP association */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c index a0ed2b3d7f..be8cbe4a85 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c @@ -387,6 +387,12 @@ static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_inter SS7_DEBUG("Found an sng_m2ua_peer sctp_id = %d\n", sng_m2ua_peer.sctpId); /**********************************************************************/ + } else if (!strcasecmp(parm->var, "dest_port")) { + /**********************************************************************/ + sng_m2ua_peer.port = atoi(parm->val); + + SS7_DEBUG("Found an sng_m2ua_peer port = %d\n", sng_m2ua_peer.port); + /**********************************************************************/ } else if (!strcasecmp(parm->var, "dest_addr")) { /**********************************************************************/ if (sng_m2ua_peer.numDestAddr < SCT_MAX_NET_ADDRS) { @@ -450,6 +456,7 @@ static int ftmod_ss7_fill_in_m2ua_peer_interface(sng_m2ua_peer_cfg_t *m2ua_peer_ g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].locOutStrms = m2ua_peer_iface->locOutStrms; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].numDestAddr = m2ua_peer_iface->numDestAddr; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].sctpId = m2ua_peer_iface->sctpId; + g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].port = m2ua_peer_iface->port; g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].init_sctp_assoc = m2ua_peer_iface->init_sctp_assoc; for (k=0; knumDestAddr; k++) { g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].destAddrList[k] = m2ua_peer_iface->destAddrList[k]; @@ -677,6 +684,9 @@ static int ftmod_ss7_parse_sctp_link(ftdm_conf_node_t *node) } else { SS7_ERROR("SCTP - too many source address configured. dropping %s \n", param->val); } + } else if (!strcasecmp(param->var, "src_port")) { + t_link.port = atoi(param->val); + SS7_DEBUG("SCTP - Parsing with port = %s\n", param->val); } else { SS7_ERROR("SCTP - Found an unknown parameter <%s>. Skipping it.\n", param->var); @@ -684,7 +694,7 @@ static int ftmod_ss7_parse_sctp_link(ftdm_conf_node_t *node) } g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].id = t_link.id; - g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].tuclId = t_link.id; + g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].port = t_link.port; strncpy((char*)g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].name, t_link.name, strlen(t_link.name) ); g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].flags = 0; g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].numSrcAddr = t_link.numSrcAddr; 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 90fb3e5b7f..63e146c029 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 @@ -462,7 +462,7 @@ typedef struct sng_sctp_link { char name[MAX_NAME_LEN]; uint32_t flags; uint32_t id; - uint32_t tuclId; + uint32_t port; uint32_t numSrcAddr; uint32_t srcAddrList[SCT_MAX_NET_ADDRS+1]; } sng_sctp_link_t;