Merge branch 'nsg-4.3' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3

This commit is contained in:
David Yat Sin 2012-06-18 12:30:33 -04:00
commit 3b8b2e256d
9 changed files with 183 additions and 180 deletions

View File

@ -316,7 +316,7 @@ if test "${HAVE_SNG_SS7}" = "yes"; then
case "${host}" in
x86_64-*)
# X86_64 machines need additional flags when compiling against libsng_isdn
CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT -DDEBUGP"
CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT"
;;
esac
fi

View File

@ -3061,7 +3061,6 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
return NULL;
}
/* If ISUP is operating mode then only include mtp3_links/isup links */
if(is_isup) {
/* add mtp3 links */
if (add_config_list_nodes(isup, rootnode, "mtp3_links", "mtp3_link", NULL, NULL)) {
@ -3097,10 +3096,9 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
ftdm_conf_node_destroy(rootnode);
return NULL;
}
}
else {
} else {
/* add sctp links */
if (add_config_list_nodes(isup, rootnode, "sng_sctp_interfaces", "sng_sctp_interface", NULL, NULL)) {
if (add_config_nodes(isup, rootnode, "sng_sctp_interfaces", "sng_sctp_interface", "sng_source_addresses")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_sctp_interface for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode);
return NULL;
@ -3124,13 +3122,11 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
return NULL;
}
if (add_config_nodes(isup, rootnode, "sng_m2ua_cluster_interfaces", "sng_m2ua_cluster_interface", "sng_m2ua_peers")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_cluster_interfaces for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode);
return NULL;
}
}
switch_core_hash_insert(globals.ss7_configs, confname, rootnode);

View File

@ -209,6 +209,13 @@ int ft_to_sngss7_cfg_all(void)
}
} /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) */
if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){
if(FTDM_SUCCESS != ftmod_ss7_m2ua_init()){
ftdm_log (FTDM_LOG_ERROR, "ftmod_ss7_m2ua_init FAILED \n");
return FTDM_FAIL;
}
}
g_ftdm_sngss7_data.gen_config = SNG_GEN_CFG_STATUS_DONE;
} /* if (!(g_ftdm_sngss7_data.gen_config)) */

View File

@ -3090,8 +3090,8 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_gen>\n");
len = len + sprintf(buf + len, "<mem_size> %ld </mem_size>\n", cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %ld </allocated_mem_size>\n", cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, "<mem_size> %d </mem_size>\n", cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %d </allocated_mem_size>\n", cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, " <num_of_cluster> %d </num_of_cluster>\n", cfm.t.ssta.s.genSta.nmbClusters);
len = len + sprintf(buf + len, " <num_of_peers> %d </num_of_peers>\n", cfm.t.ssta.s.genSta.nmbPeers);
len = len + sprintf(buf + len, " <num_of_interfaces> %d </num_of_interfaces>\n", cfm.t.ssta.s.genSta.nmbIntf);
@ -3102,7 +3102,9 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_ACTIVE))) {
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
len = len + sprintf(buf + len, "<m2ua_profile>\n");
len = len + sprintf(buf + len, "<name> %s </name>\n", g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].name);
@ -3120,6 +3122,7 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
len = len + sprintf(buf + len, "</m2ua_dlsap>\n");
}
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
if(ftmod_m2ua_ssta_req(STMWCLUSTER,g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].clusterId,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
@ -3137,34 +3140,47 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
len = len + sprintf(buf + len, "<num_active_peer> %d </num_active_peer>\n",cfm.t.ssta.s.clusterSta.nmbActPeer);
len = len + sprintf(buf + len, "</m2ua_cluster>\n");
}
memcpy((U8 *)&rsp, &cfm, sizeof(MwMgmt));
memset((U8 *)&rsp, 0, sizeof(MwMgmt));
memcpy(&rsp, &cfm, sizeof(MwMgmt));
/* loop through configured peers */
for(idx = 0; idx < rsp.t.ssta.s.clusterSta.nmbPeer; idx++)
{
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
if(ftmod_m2ua_ssta_req(STMWPEER, rsp.t.ssta.s.clusterSta.peerSt[idx].peerId, &cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len, "<name> %s </name>\n",g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[rsp.t.ssta.s.clusterSta.peerSt[idx].peerId].name);
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state));
len = len + sprintf(buf + len, " <retry_count> %d </retry_count>\n",cfm.t.ssta.s.peerSta.retryCount);
len = len + sprintf(buf + len, " <assoc_id> %ld </assoc_id>\n",cfm.t.ssta.s.peerSta.assocSta.spAssocId);
len = len + sprintf(buf + len, " <connected_status> %s </connected_status>\n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");
len = len + sprintf(buf + len, " <flow_cntrl_progress> %d </flow_cntrl_progress>\n",cfm.t.ssta.s.peerSta.assocSta.flcInProg);
len = len + sprintf(buf + len, " <flow_cntrl_level> %d </flow_cntrl_level>\n",cfm.t.ssta.s.peerSta.assocSta.flcLevel);
len = len + sprintf(buf + len, " <hearbeat_status> %d </hearbeat_status>\n",cfm.t.ssta.s.peerSta.assocSta.sctpHBeatEnb);
len = len + sprintf(buf + len, " <nmb_of_stream> %d </nmb_of_stream>\n",cfm.t.ssta.s.peerSta.assocSta.locOutStrms);
/* loop through configured peers */
for(idx = 0; idx < rsp.t.ssta.s.clusterSta.nmbPeer; idx++)
{
int peer_id = rsp.t.ssta.s.clusterSta.peerSt[idx].peerId;
memset(&cfm, 0, sizeof(MwMgmt));
len = len + sprintf(buf + len, "</m2ua_peer>\n");
if(LMW_PEER_DOWN != rsp.t.ssta.s.clusterSta.peerSt[idx].peerState){
if(ftmod_m2ua_ssta_req(STMWPEER, peer_id, &cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len, "<name> %s </name>\n",g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id].name);
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state));
len = len + sprintf(buf + len, " <retry_count> %d </retry_count>\n",cfm.t.ssta.s.peerSta.retryCount);
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n",cfm.t.ssta.s.peerSta.assocSta.spAssocId);
len = len + sprintf(buf + len, " <connected_status> %s </connected_status>\n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");
len = len + sprintf(buf + len, " <flow_cntrl_progress> %d </flow_cntrl_progress>\n",cfm.t.ssta.s.peerSta.assocSta.flcInProg);
len = len + sprintf(buf + len, " <flow_cntrl_level> %d </flow_cntrl_level>\n",cfm.t.ssta.s.peerSta.assocSta.flcLevel);
len = len + sprintf(buf + len, " <hearbeat_status> %d </hearbeat_status>\n",cfm.t.ssta.s.peerSta.assocSta.sctpHBeatEnb);
len = len + sprintf(buf + len, " <nmb_of_stream> %d </nmb_of_stream>\n",cfm.t.ssta.s.peerSta.assocSta.locOutStrms);
len = len + sprintf(buf + len, "</m2ua_peer>\n");
}
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len, "<name> %s </name>\n",g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id].name);
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(rsp.t.ssta.s.clusterSta.peerSt[idx].peerState));
len = len + sprintf(buf + len, "</m2ua_peer>\n");
}
}
}
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) {
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
@ -3172,7 +3188,7 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
len = len + sprintf(buf + len, "<m2ua_sctp_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.sctSapSta.state));
len = len + sprintf(buf + len," <end_point_open_state> %s </end_point_open_state>\n", (cfm.t.ssta.s.sctSapSta.endpOpen)?"END_POINT_OPENED_SUCCESSFULLY":"END_POINT_NOT_OPEN");
len = len + sprintf(buf + len," <end_point_id> %ld </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
len = len + sprintf(buf + len," <end_point_id> %d </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
len = len + sprintf(buf + len," <nmb_of_retry_attemp> %d </nmb_of_retry_attemp>\n", cfm.t.ssta.s.sctSapSta.nmbPrimRetry);
len = len + sprintf(buf + len, "</m2ua_sctp_sap>\n");
}
@ -3218,7 +3234,7 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_ACTIVE))) {
if(!strcasecmp(m2ua_profile_name, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].name)){
found = 0x01;
@ -3284,7 +3300,7 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
len = len + sprintf(buf + len, "<name> %s </name>\n",g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[rsp.t.ssta.s.clusterSta.peerSt[idx].peerId].name);
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state));
len = len + sprintf(buf + len, " <retry_count> %d </retry_count>\n",cfm.t.ssta.s.peerSta.retryCount);
len = len + sprintf(buf + len, " <assoc_id> %ld </assoc_id>\n",cfm.t.ssta.s.peerSta.assocSta.spAssocId);
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n",cfm.t.ssta.s.peerSta.assocSta.spAssocId);
len = len + sprintf(buf + len, " <connected_status> %s </connected_status>\n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");
len = len + sprintf(buf + len, " <flow_cntrl_progress> %d </flow_cntrl_progress>\n",cfm.t.ssta.s.peerSta.assocSta.flcInProg);
len = len + sprintf(buf + len, " <flow_cntrl_level> %d </flow_cntrl_level>\n",cfm.t.ssta.s.peerSta.assocSta.flcLevel);
@ -3302,7 +3318,7 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
len = len + sprintf(buf + len, "<m2ua_sctp_sap>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.sctSapSta.state));
len = len + sprintf(buf + len," <end_point_open_state> %s </end_point_open_state>\n", (cfm.t.ssta.s.sctSapSta.endpOpen)?"END_POINT_OPENED_SUCCESSFULLY":"END_POINT_NOT_OPEN");
len = len + sprintf(buf + len," <end_point_id> %ld </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
len = len + sprintf(buf + len," <end_point_id> %d </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
len = len + sprintf(buf + len," <nmb_of_retry_attemp> %d </nmb_of_retry_attemp>\n", cfm.t.ssta.s.sctSapSta.nmbPrimRetry);
len = len + sprintf(buf + len, "</m2ua_sctp_sap>\n");
}
@ -3341,8 +3357,8 @@ static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream)
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<sctp_gen>\n");
len = len + sprintf(buf + len, "<mem_size> %ld </mem_size>\n",cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %ld </allocated_mem_size>\n",cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, "<mem_size> %d </mem_size>\n",cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %d </allocated_mem_size>\n",cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, " <num_of_open_assoc> %d </num_of_open_assoc>\n",cfm.t.ssta.s.genSta.nmbAssoc);
len = len + sprintf(buf + len, " <num_of_open_end_points> %d </num_of_open_end_points>\n",cfm.t.ssta.s.genSta.nmbEndp);
len = len + sprintf(buf + len, " <num_of_lcl_addr_in_use> %d </num_of_lcl_addr_in_use>\n",cfm.t.ssta.s.genSta.nmbLocalAddr);
@ -3379,7 +3395,7 @@ static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream)
x = 1;
while(x<MAX_SCTP_LINK){
if((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED))) {
((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_ACTIVE))) {
len = len + sprintf(buf + len, "<sctp_profile>\n");
@ -3438,7 +3454,7 @@ int get_assoc_resp_buf(char* buf,SbMgmt* cfm)
char *asciiAddr;
CmInetIpAddr ip;
len = len + sprintf(buf + len, " <assoc_id> %ld </assoc_id>\n", cfm->t.ssta.s.assocSta.assocId);
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n", cfm->t.ssta.s.assocSta.assocId);
len = len + sprintf(buf + len, " <assoc_status> %s </assoc_status>\n", PRNT_SCTP_ASSOC_STATE(cfm->t.ssta.s.assocSta.assocState));
len = len + sprintf(buf + len, " <assoc_dst_port> %d </assoc_dst_port>\n", cfm->t.ssta.s.assocSta.dstPort);
len = len + sprintf(buf + len, " <assoc_src_port> %d </assoc_src_port>\n", cfm->t.ssta.s.assocSta.srcPort);
@ -3558,7 +3574,7 @@ static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char
x = 1;
while(x<MAX_SCTP_LINK){
if((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED))) {
((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_ACTIVE))) {
if(!strcasecmp(sctp_profile_name, g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].name)){
found = 0x01;
break;
@ -3644,8 +3660,8 @@ static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream)
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<nif_gen>\n");
len = len + sprintf(buf + len, "<mem_size> %ld </mem_size>\n",cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %ld </allocated_mem_size>\n",cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, "<mem_size> %d </mem_size>\n",cfm.t.ssta.s.genSta.memSize);
len = len + sprintf(buf + len, " <allocated_mem_size> %d </allocated_mem_size>\n",cfm.t.ssta.s.genSta.memAlloc);
len = len + sprintf(buf + len, "</nif_gen>\n");
}
@ -3653,7 +3669,7 @@ static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream)
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED))) {
((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_ACTIVE))) {
len = len + sprintf(buf + len, "<nif_profile>\n");
@ -3664,7 +3680,7 @@ static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream)
len = len + sprintf(buf + len, "<nif_dlsap>\n");
len = len + sprintf(buf + len," <m2ua_sap_state> %s </m2ua_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.m2uaState));
len = len + sprintf(buf + len," <mtp2_sap_state> %s </mtp2_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.mtp2State));
len = len + sprintf(buf + len," <nmb_of_retry> %ld </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
len = len + sprintf(buf + len," <nmb_of_retry> %d </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
len = len + sprintf(buf + len, "</nif_dlsap>\n");
}
@ -3704,7 +3720,7 @@ static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char*
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED))) {
((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_ACTIVE))) {
if(!strcasecmp(nif_profile_name, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].name)){
found = 0x01;
@ -3729,7 +3745,7 @@ static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char*
len = len + sprintf(buf + len, "<nif_dlsap>\n");
len = len + sprintf(buf + len," <m2ua_sap_state> %s </m2ua_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.m2uaState));
len = len + sprintf(buf + len," <mtp2_sap_state> %s </mtp2_sap_state>\n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.mtp2State));
len = len + sprintf(buf + len," <nmb_of_retry> %ld </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
len = len + sprintf(buf + len," <nmb_of_retry> %d </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
len = len + sprintf(buf + len, "</nif_dlsap>\n");
}
@ -3774,7 +3790,7 @@ static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream,
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_ACTIVE))) {
if(!strcasecmp(m2ua_profile_name, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].name)){
found = 0x01;

View File

@ -72,25 +72,94 @@ static int ftmod_ss7_sctp_shutdown(void);
static int ftmod_ss7_m2ua_shutdown(void);
static int ftmod_ss7_tucl_shutdown(void);
ftdm_status_t sng_m2ua_init(void);
ftdm_status_t sng_m2ua_cfg(void);
/******************************************************************************/
ftdm_status_t ftmod_ss7_m2ua_init(void)
{
/****************************************************************************************************/
if (sng_isup_init_nif()) {
ftdm_log (FTDM_LOG_ERROR , "Failed to start NIF\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started NIF!\n");
}
/****************************************************************************************************/
if (sng_isup_init_m2ua()) {
ftdm_log (FTDM_LOG_ERROR ,"Failed to start M2UA\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started M2UA!\n");
}
/****************************************************************************************************/
if (sng_isup_init_sctp()) {
ftdm_log (FTDM_LOG_ERROR ,"Failed to start SCTP\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started SCTP!\n");
}
/****************************************************************************************************/
if (sng_isup_init_tucl()) {
ftdm_log (FTDM_LOG_ERROR ,"Failed to start TUCL\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started TUCL!\n");
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_PRESENT);
}
/****************************************************************************************************/
if(ftmod_tucl_gen_config()){
ftdm_log (FTDM_LOG_ERROR ,"TUCL GEN configuration: NOT OK\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"TUCL GEN configuration: OK\n");
}
/****************************************************************************************************/
if(ftmod_sctp_gen_config()){
ftdm_log (FTDM_LOG_ERROR ,"SCTP GEN configuration: NOT OK\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"SCTP GEN configuration: OK\n");
}
/****************************************************************************************************/
if(ftmod_m2ua_gen_config()) {
ftdm_log (FTDM_LOG_ERROR ,"M2UA General configuration: NOT OK\n");
return FTDM_FAIL;
}else {
ftdm_log (FTDM_LOG_INFO ,"M2UA General configuration: OK\n");
}
/****************************************************************************************************/
if(ftmod_nif_gen_config()){
ftdm_log (FTDM_LOG_ERROR ,"NIF General configuration: NOT OK\n");
return FTDM_FAIL;
}else {
ftdm_log (FTDM_LOG_INFO ,"NIF General configuration: OK\n");
}
/****************************************************************************************************/
return FTDM_SUCCESS;
}
/******************************************************************************/
void ftmod_ss7_m2ua_free()
{
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_STARTED)) {
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_PRESENT)) {
ftmod_ss7_m2ua_shutdown();
sng_isup_free_m2ua();
}
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_STARTED)) {
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_PRESENT)) {
ftmod_ss7_sctp_shutdown();
sng_isup_free_sctp();
}
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_STARTED)) {
if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_PRESENT)) {
ftmod_ss7_tucl_shutdown();
sng_isup_free_tucl();
}
}
/******************************************************************************/
static int ftmod_ss7_tucl_shutdown()
{
@ -181,86 +250,12 @@ static int ftmod_ss7_sctp_shutdown()
/******************************************************************************/
ftdm_status_t ftmod_ss7_m2ua_cfg(void)
{
if(FTDM_SUCCESS != sng_m2ua_init()){
ftdm_log (FTDM_LOG_ERROR, " sng_m2ua_init FAILED \n");
return FTDM_FAIL;
}
if(FTDM_SUCCESS != sng_m2ua_cfg()){
ftdm_log (FTDM_LOG_ERROR, " sng_m2ua_cfg FAILED \n");
return FTDM_FAIL;
}
/* SET STARTED FLAGS */
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_NIF_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_STARTED);
return FTDM_SUCCESS;
}
/******************************************************************************/
ftdm_status_t sng_m2ua_init(void)
{
if (sng_isup_init_nif()) {
ftdm_log (FTDM_LOG_ERROR , "Failed to start NIF\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started NIF!\n");
}
if (sng_isup_init_m2ua()) {
ftdm_log (FTDM_LOG_ERROR ,"Failed to start M2UA\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started M2UA!\n");
}
if (sng_isup_init_sctp()) {
ftdm_log (FTDM_LOG_ERROR ,"Failed to start SCTP\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started SCTP!\n");
}
if (sng_isup_init_tucl()) {
ftdm_log (FTDM_LOG_ERROR ,"Failed to start TUCL\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"Started TUCL!\n");
}
return FTDM_SUCCESS;
}
/****************************************************************************************************/
ftdm_status_t sng_m2ua_cfg(void)
{
int x=0;
/****************************************************************************************************/
/* TUCL */
if(ftmod_tucl_gen_config()){
ftdm_log (FTDM_LOG_ERROR ,"TUCL GEN configuration: NOT OK\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"TUCL GEN configuration: OK\n");
}
/****************************************************************************************************/
/* SCTP */
if(ftmod_sctp_gen_config()){
ftdm_log (FTDM_LOG_ERROR ,"SCTP GEN configuration: NOT OK\n");
return FTDM_FAIL;
} else {
ftdm_log (FTDM_LOG_INFO ,"SCTP GEN configuration: OK\n");
}
/****************************************************************************************************/
/* SCTP configuration */
if(ftmod_cfg_sctp()){
ftdm_log (FTDM_LOG_ERROR ,"SCTP Configuration : NOT OK\n");
@ -268,15 +263,7 @@ ftdm_status_t sng_m2ua_cfg(void)
} else {
ftdm_log (FTDM_LOG_INFO ,"SCTP Configuration : OK\n");
}
/****************************************************************************************************/
/* M2UA configurations */
if(ftmod_m2ua_gen_config()) {
ftdm_log (FTDM_LOG_ERROR ,"M2UA General configuration: NOT OK\n");
return FTDM_FAIL;
}else {
ftdm_log (FTDM_LOG_INFO ,"M2UA General configuration: OK\n");
}
/****************************************************************************************************/
/* M2UA SCTP SAP configurations */
x = 1;
@ -314,17 +301,9 @@ ftdm_status_t sng_m2ua_cfg(void)
ftdm_log (FTDM_LOG_INFO ,"M2UA DLSAP[%d] configuration: OK\n", x);
}
} /* END - SNGSS7_CONFIGURED */
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags |= SNGSS7_CONFIGURED;
x++;
}/* END - M2UA Interfaces for loop*/
/****************************************************************************************************/
/* NIF */
if(ftmod_nif_gen_config()){
ftdm_log (FTDM_LOG_ERROR ,"NIF General configuration: NOT OK\n");
return FTDM_FAIL;
}else {
ftdm_log (FTDM_LOG_INFO ,"NIF General configuration: OK\n");
}
/****************************************************************************************************/
/* NIF DLSAP */
@ -339,10 +318,16 @@ ftdm_status_t sng_m2ua_cfg(void)
ftdm_log (FTDM_LOG_INFO ,"NIF DLSAP[%d] configuration: OK\n", x);
}
}
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags |= SNGSS7_CONFIGURED;
x++;
}
/****************************************************************************************************/
/* successfully started all the layers , not SET STARTED FLAGS */
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_NIF_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_STARTED);
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_STARTED);
return 0;
}
@ -524,16 +509,22 @@ static int ftmod_sctp_gen_config(void)
static int ftmod_cfg_sctp(void)
{
int x=0;
for (x=1; g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0; x++) {
if (!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED)) {
x = 1;
while(x<MAX_SCTP_LINK){
if((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED))) {
if ( ftmod_sctp_config(x) == FTDM_FAIL) {
SS7_CRITICAL("SCTP %d configuration FAILED!\n", x);
return FTDM_FAIL;
} else {
SS7_INFO("SCTP %d configuration DONE!\n", x);
}
g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags |= SNGSS7_CONFIGURED;
}
x++;
}
return FTDM_SUCCESS;
}
@ -1214,7 +1205,7 @@ int ftmod_ss7_m2ua_start(void){
x = 1;
while(x<MAX_SCTP_LINK){
if((g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_CONFIGURED))) {
(!(g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags & SNGSS7_ACTIVE))) {
/* Send a control request to bind the TSAP between SCTP and TUCL */
if(ftmod_sctp_tucl_tsap_bind(x)) {
@ -1223,6 +1214,7 @@ int ftmod_ss7_m2ua_start(void){
} else {
ftdm_log (FTDM_LOG_INFO ,"\nControl request to bind TSAP[%d] of SCTP and TUCL: OK\n", x);
}
g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[x].flags |= SNGSS7_ACTIVE;
}
x++;
}
@ -1232,13 +1224,14 @@ int ftmod_ss7_m2ua_start(void){
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_ACTIVE))) {
if(ftmod_m2ua_sctp_sctsap_bind(x)) {
ftdm_log (FTDM_LOG_ERROR ,"Control request to bind SCTSAP[%d] of M2UA and SCTP : NOT OK\n", x);
return 1;
} else {
ftdm_log (FTDM_LOG_INFO ,"Control request to bind SCTSAP[%d] of M2UA and SCTP: OK\n", x);
}
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags |= SNGSS7_ACTIVE;
}
x++;
}/* END - M2UA Interfaces while loop*/
@ -1247,7 +1240,7 @@ int ftmod_ss7_m2ua_start(void){
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if ((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_CONFIGURED))) {
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags & SNGSS7_ACTIVE))) {
/* Send a control request to bind the DLSAP between NIF, M2UA and MTP-2 */
if(ftmod_nif_m2ua_dlsap_bind(x)) {
ftdm_log (FTDM_LOG_ERROR ,"Control request to bind DLSAP[%d] between NIF and M2UA: NOT OK\n", x);
@ -1261,6 +1254,7 @@ int ftmod_ss7_m2ua_start(void){
}else {
ftdm_log (FTDM_LOG_INFO ,"Control request to bind DLSAP[%d] between NIF and MTP2 : OK\n", x);
}
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].flags |= SNGSS7_ACTIVE;
}
x++;
}/* END - NIF Interfaces for loop*/
@ -1270,7 +1264,7 @@ int ftmod_ss7_m2ua_start(void){
x = 1;
while(x<MW_MAX_NUM_OF_INTF){
if ((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].id !=0) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].flags & SNGSS7_CONFIGURED))) {
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].end_point_opened))) {
/* Send a control request to open endpoint */
if(ftmod_open_endpoint(x)) {
ftdm_log (FTDM_LOG_ERROR ,"ftmod_open_endpoint FAIL \n");
@ -1278,6 +1272,7 @@ int ftmod_ss7_m2ua_start(void){
}else {
ftdm_log (FTDM_LOG_INFO ,"ftmod_open_endpoint SUCCESS \n");
}
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].end_point_opened = 0x01;
}
x++;
}
@ -1288,7 +1283,7 @@ int ftmod_ss7_m2ua_start(void){
x = 1;
while (x < (MW_MAX_NUM_OF_PEER)) {
if ((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].id !=0) &&
((g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].flags & SNGSS7_CONFIGURED)) &&
(!(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].flags & SNGSS7_M2UA_INIT_ASSOC_DONE)) &&
(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].init_sctp_assoc)) {
if(ftmod_init_sctp_assoc(x)) {
ftdm_log (FTDM_LOG_ERROR ,"ftmod_init_sctp_assoc FAIL for peerId[%d] \n", x);
@ -1296,12 +1291,13 @@ int ftmod_ss7_m2ua_start(void){
}else {
ftdm_log (FTDM_LOG_INFO ,"ftmod_init_sctp_assoc SUCCESS for peerId[%d] \n", x);
}
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[x].flags |= SNGSS7_M2UA_INIT_ASSOC_DONE;
}
x++;
}
return 0;
}
@ -1676,7 +1672,6 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
Pst pst;
sng_m2ua_cfg_t* m2ua = NULL;
sng_m2ua_cluster_cfg_t* clust = NULL;
sng_m2ua_peer_cfg_t* peer = NULL;
memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&ssta, 0, sizeof(MwMgmt));
@ -1714,8 +1709,7 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
}
case STMWPEER:
{
peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[id];
ssta.t.ssta.id.peerId = peer->id ; /* peer Id */
ssta.t.ssta.id.peerId = id ; /* peer Id */
break;
}
case STMWCLUSTER:

View File

@ -60,6 +60,7 @@ typedef struct sng_m2ua_cfg{
uint32_t flags;
uint32_t id; /* ID */
uint8_t nodeType; /*Node Type SG/ASP */
uint8_t end_point_opened; /* flag to check is end-point already opened */
uint16_t clusterId; /* idx to m2ua_cluster profile */
}sng_m2ua_cfg_t;
@ -122,6 +123,7 @@ int ftmod_ss7_m2ua_start(void);
void ftmod_ss7_m2ua_free(void);
ftdm_status_t ftmod_ss7_m2ua_cfg(void);
ftdm_status_t ftmod_ss7_m2ua_init(void);
int ftmod_sctp_ssta_req(int elemt, int id, SbMgmt* cfm);
int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm);

View File

@ -146,9 +146,6 @@ static int ftmod_ss7_parse_nif_interface(ftdm_conf_node_t *nif_interface)
/**************************************************************************/
} /* for (i = 0; i < num_parms; i++) */
/* default the interface to paused state */
sngss7_set_flag(&sng_nif, SNGSS7_PAUSED);
/* fill in the nif interface */
ftmod_ss7_fill_in_nif_interface(&sng_nif);
@ -259,9 +256,6 @@ static int ftmod_ss7_parse_m2ua_interface(ftdm_conf_node_t *m2ua_interface)
sng_m2ua.nodeType = SNG_M2UA_NODE_TYPE_SGP;
/* default the interface to paused state */
sngss7_set_flag(&sng_m2ua, SNGSS7_PAUSED);
/* fill in the nif interface */
ftmod_ss7_fill_in_m2ua_interface(&sng_m2ua);
@ -421,9 +415,6 @@ static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_inter
/**************************************************************************/
} /* for (i = 0; i < num_parms; i++) */
/* default the interface to paused state */
sngss7_set_flag(&sng_m2ua_peer, SNGSS7_PAUSED);
/* fill in the sng_m2ua_peer interface */
ftmod_ss7_fill_in_m2ua_peer_interface(&sng_m2ua_peer);
@ -576,9 +567,6 @@ static int ftmod_ss7_parse_m2ua_clust_interface(ftdm_conf_node_t *m2ua_cluster_i
/**************************************************************************/
} /* for (i = 0; i < num_parms; i++) */
/* default the interface to paused state */
sngss7_set_flag(&sng_m2ua_cluster, SNGSS7_PAUSED);
/* fill in the sng_m2ua_peer interface */
ftmod_ss7_fill_in_m2ua_clust_interface(&sng_m2ua_cluster);
@ -663,7 +651,7 @@ static int ftmod_ss7_parse_sctp_link(ftdm_conf_node_t *node)
t_link.id = atoi(param->val);
SS7_DEBUG("SCTP - Parsing <sng_sctp_interface> with id = %s\n", param->val);
}
else if (!strcasecmp(param->var, "src-addr")) {
else if (!strcasecmp(param->var, "address")) {
if (t_link.numSrcAddr < SCT_MAX_NET_ADDRS) {
t_link.srcAddrList[t_link.numSrcAddr+1] = iptoul (param->val);
t_link.numSrcAddr++;
@ -671,7 +659,7 @@ 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")) {
} else if (!strcasecmp(param->var, "source-port")) {
t_link.port = atoi(param->val);
SS7_DEBUG("SCTP - Parsing <sng_sctp_interface> with port = %s\n", param->val);
}
@ -683,7 +671,6 @@ 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].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;
for (i=1; i<=t_link.numSrcAddr; i++) {
g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].srcAddrList[i] = t_link.srcAddrList[i];

View File

@ -768,9 +768,10 @@ typedef enum {
SNGSS7_M2UA_PRESENT = (1 << 18),
SNGSS7_M2UA_STARTED = (1 << 19),
SNGSS7_M2UA_EP_OPENED = (1 << 20),
SNGSS7_M2UA_INIT_ASSOC_DONE = (1 << 21),
SNGSS7_NIF_PRESENT = (1 << 21),
SNGSS7_NIF_STARTED = (1 << 22),
SNGSS7_NIF_PRESENT = (1 << 22),
SNGSS7_NIF_STARTED = (1 << 23),
} sng_task_flag_t;
/******************************************************************************/

View File

@ -12,9 +12,9 @@
struct megaco_globals megaco_globals;
static sng_mg_event_interface_t sng_event;
SWITCH_MODULE_LOAD_FUNCTION(mod_megaco_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_megaco_shutdown);
SWITCH_MODULE_DEFINITION(mod_megaco, mod_megaco_load, mod_megaco_shutdown, NULL);
SWITCH_MODULE_LOAD_FUNCTION(mod_media_gateway_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_media_gateway_shutdown);
SWITCH_MODULE_DEFINITION(mod_media_gateway, mod_media_gateway_load, mod_media_gateway_shutdown, NULL);
SWITCH_STANDARD_API(megaco_function)
{
@ -51,7 +51,7 @@ static switch_status_t list_profiles(const char *line, const char *cursor, switc
return status;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_megaco_load)
SWITCH_MODULE_LOAD_FUNCTION(mod_media_gateway_load)
{
switch_api_interface_t *api_interface;
@ -93,7 +93,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_megaco_load)
return sng_mgco_init(&sng_event);
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_megaco_shutdown)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_media_gateway_shutdown)
{
sng_mgco_stack_shutdown();