adding code based on modified xml and cli code changes (rename the m2ua cli command to

"xmlshow" and adding cli code to show sctp state also in m2ua peerstatus command)
This commit is contained in:
kapil 2012-06-12 18:43:01 +05:30
parent 91f9374a9f
commit 58dc659fbb
7 changed files with 273 additions and 149 deletions

View File

@ -2867,6 +2867,77 @@ static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode
return 0;
}
/* create ftdm_conf_node_t tree based on a fixed pattern XML configuration list
* last arg is to specify if we have any sublist for e.g.
* <list_name>
* <list_element_name>
* <param name="xxx" value="xxx"/>
* <sub-list>
* <param name="xxx" value="xxx"/>
* </sub-list>
* </list_element_name>
* </list_name>
* */
static int add_config_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode,
const char *list_name, const char *list_element_name, const char *sub_list_name)
{
char *var, *val;
switch_xml_t list;
switch_xml_t sub_list;
switch_xml_t element;
switch_xml_t param;
ftdm_conf_node_t *n_list;
ftdm_conf_node_t *n_element;
list = switch_xml_child(swnode, list_name);
if (!list) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no list %s found\n", list_name);
return -1;
}
if ((FTDM_SUCCESS != ftdm_conf_node_create(list_name, &n_list, rootnode))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node\n", list_name);
return -1;
}
for (element = switch_xml_child(list, list_element_name); element; element = element->next) {
char *element_name = (char *) switch_xml_attr(element, "name");
if (!element_name) {
continue;
}
if ((FTDM_SUCCESS != ftdm_conf_node_create(list_element_name, &n_element, n_list))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node for %s\n", list_element_name, element_name);
return -1;
}
ftdm_conf_node_add_param(n_element, "name", element_name);
for (param = switch_xml_child(element, "param"); param; param = param->next) {
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
ftdm_conf_node_add_param(n_element, var, val);
}
/*If we have single node list */
if (sub_list_name ) {
sub_list = switch_xml_child(element, sub_list_name);
if (!sub_list) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no sub_list %s found\n", sub_list_name);
return -1;
}
for (param = switch_xml_child(sub_list, "param"); param; param = param->next) {
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
ftdm_conf_node_add_param(n_element, var, val);
}
}
}
return 0;
}
static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *confname, const char *operatingMode)
{
switch_xml_t signode, ss7configs, isup, gen, param;
@ -2998,23 +3069,21 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
ftdm_conf_node_destroy(rootnode);
return NULL;
}
}
/* add mtp linksets */
if (add_config_list_nodes(isup, rootnode, "mtp_linksets", "mtp_linkset", NULL, NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_linksets for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode);
return NULL;
}
/* add mtp linksets */
if (add_config_list_nodes(isup, rootnode, "mtp_linksets", "mtp_linkset", NULL, NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_linksets for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode);
return NULL;
}
/* add mtp routes */
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;
}
/* add mtp routes */
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;
}
if(is_isup) {
/* add isup interfaces */
if (add_config_list_nodes(isup, rootnode, "isup_interfaces", "isup_interface", NULL, NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process isup_interfaces for sng_isup config %s\n", confname);
@ -3049,13 +3118,14 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
return NULL;
}
if (add_config_list_nodes(isup, rootnode, "sng_m2ua_peer_interfaces", "sng_m2ua_peer_interface", NULL, NULL)) {
if (add_config_nodes(isup, rootnode, "sng_m2ua_peer_interfaces", "sng_m2ua_peer_interface", "sng_destination_addresses")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_peer_interfaces for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode);
return NULL;
}
if (add_config_list_nodes(isup, rootnode, "sng_m2ua_cluster_interfaces", "sng_m2ua_cluster_interface", NULL, 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;

View File

@ -393,64 +393,78 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha
handle_show_procId(stream);
/**********************************************************************/
} else if (!strcasecmp(argv[c], "m2ua")) {
/**********************************************************************/
} else{
/**********************************************************************/
stream->write_function(stream, "Unknown \"show\" command\n");
goto handle_cli_error;
}
/**************************************************************************/
} else if (!strcasecmp(argv[c], "xmlshow")) {
/**************************************************************************/
if (check_arg_count(argc, 2)) {
cli_ss7_show_general(stream);
return FTDM_SUCCESS;
}
c++;
/**************************************************************************/
if (!strcasecmp(argv[c], "m2ua")) {
/**************************************************************************/
switch(argc)
{
case 2: /* show m2ua */
{
handle_show_m2ua_profiles(stream);
break;
}
{
handle_show_m2ua_profiles(stream);
break;
}
case 3: /* show m2ua <profile-name> */
{
c++;
handle_show_m2ua_profile(stream, argv[c]);
break;
}
{
c++;
handle_show_m2ua_profile(stream, argv[c]);
break;
}
case 4:
{
char* profile_name = argv[++c];
c++;
if(!strcasecmp(argv[c],"peerstatus")){
handle_show_m2ua_peer_status(stream, profile_name);
{
char* profile_name = argv[++c];
c++;
if(!strcasecmp(argv[c],"peerstatus")){
handle_show_m2ua_peer_status(stream, profile_name);
}
else{
stream->write_function(stream, "Unknown \"show m2ua \" command..\n");
goto handle_cli_error_argc;
}
break;
}
else{
stream->write_function(stream, "Unknown \"show m2ua \" command..\n");
goto handle_cli_error_argc;
}
break;
}
default:
goto handle_cli_error_argc;
goto handle_cli_error_argc;
}
/**********************************************************************/
/**********************************************************************/
} else if (!strcasecmp(argv[c], "nif")) {
/**********************************************************************/
/**********************************************************************/
if (check_arg_count(argc, 3)){
handle_show_nif_profiles(stream);
}else{
c++;
handle_show_nif_profile(stream, argv[c]);
}
/**********************************************************************/
/**********************************************************************/
} else if (!strcasecmp(argv[c], "sctp")) {
/**********************************************************************/
/**********************************************************************/
if (check_arg_count(argc, 3)){
handle_show_sctp_profiles(stream);
}else{
c++;
handle_show_sctp_profile(stream, argv[c]);
}
/**********************************************************************/
/**********************************************************************/
} else {
/**********************************************************************/
stream->write_function(stream, "Unknown \"show\" command\n");
/**********************************************************************/
stream->write_function(stream, "Unknown \"xmlshow\" command\n");
goto handle_cli_error;
/**********************************************************************/
}
/**************************************************************************/
/**********************************************************************/
} else if (!strcasecmp(argv[c], "set")) {
/**************************************************************************/
if (check_arg_count(argc, 4)) goto handle_cli_error_argc;
@ -914,13 +928,13 @@ static ftdm_status_t handle_print_usage(ftdm_stream_handle_t *stream)
stream->write_function(stream, "\n");
stream->write_function(stream, "ftmod_sangoma_ss7 M2UA :\n");
stream->write_function(stream, "ftdm ss7 show sctp \n");
stream->write_function(stream, "ftdm ss7 show sctp <sctp_interface_name>\n");
stream->write_function(stream, "ftdm ss7 show m2ua \n");
stream->write_function(stream, "ftdm ss7 show m2ua <m2ua_interface_name>\n");
stream->write_function(stream, "ftdm ss7 show m2ua <m2ua_interface_name> peerstatus\n");
stream->write_function(stream, "ftdm ss7 show nif \n");
stream->write_function(stream, "ftdm ss7 show nif <nif_interface_name>\n");
stream->write_function(stream, "ftdm ss7 xmlshow sctp \n");
stream->write_function(stream, "ftdm ss7 xmlshow sctp <sctp_interface_name>\n");
stream->write_function(stream, "ftdm ss7 xmlshow m2ua \n");
stream->write_function(stream, "ftdm ss7 xmlshow m2ua <m2ua_interface_name>\n");
stream->write_function(stream, "ftdm ss7 xmlshow m2ua <m2ua_interface_name> peerstatus\n");
stream->write_function(stream, "ftdm ss7 xmlshow nif \n");
stream->write_function(stream, "ftdm ss7 xmlshow nif <nif_interface_name>\n");
stream->write_function(stream, "\n");
@ -3062,8 +3076,10 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
int idx = 0x00;
int len = 0x00;
MwMgmt cfm;
MwMgmt rsp;
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
memset((U8 *)&rsp, 0, sizeof(MwMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
@ -3103,7 +3119,7 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
len = len + sprintf(buf + len, "</m2ua_dlsap>\n");
}
if(ftmod_m2ua_ssta_req(STMWCLUSTER,x,&cfm)) {
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;
} else {
@ -3122,21 +3138,30 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
len = len + sprintf(buf + len, "</m2ua_cluster>\n");
}
if(ftmod_m2ua_ssta_req(STMWPEER,x,&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," <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);
memcpy((U8 *)&rsp, &cfm, sizeof(MwMgmt));
len = len + sprintf(buf + len, "</m2ua_peer>\n");
/* 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> %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");
}
}
if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) {
@ -3180,8 +3205,10 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
int found = 0x00;
int len = 0x00;
MwMgmt cfm;
MwMgmt rsp;
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
memset((U8 *)&rsp, 0, sizeof(MwMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
@ -3240,21 +3267,30 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
len = len + sprintf(buf + len, "</m2ua_cluster>\n");
}
if(ftmod_m2ua_ssta_req(STMWPEER,x,&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," <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);
memcpy((U8 *)&rsp, &cfm, sizeof(MwMgmt));
len = len + sprintf(buf + len, "</m2ua_peer>\n");
/* 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> %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");
}
}
if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) {
@ -3706,8 +3742,15 @@ static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream,
int found = 0x00;
int len = 0x00;
MwMgmt cfm;
SbMgmt sctp_cfm;
sng_m2ua_cluster_cfg_t* clust = NULL;
sng_m2ua_cfg_t* m2ua = NULL;
sng_m2ua_peer_cfg_t* peer = NULL;
int peer_id = 0;
int sctp_id = 0;
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
memset((U8 *)&sctp_cfm, 0, sizeof(SbMgmt));
memset(&buf[0], 0, sizeof(buf));
len = len + sprintf(buf + len, "%s\n", xmlhdr);
@ -3731,14 +3774,41 @@ static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream,
return FTDM_FAIL;
}
if(ftmod_m2ua_ssta_req(STMWPEER,x,&cfm)) {
stream->write_function(stream," Request to Trillium M2UA layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state));
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, "</m2ua_peer>\n");
m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x];
clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId];
for(x = 0; x < clust->numOfPeers;x++){
peer_id = clust->peerIdLst[x];
peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id];
if(ftmod_m2ua_ssta_req(STMWPEER, peer_id, &cfm)) {
stream->write_function(stream," Request to Trillium M2UA layer failed \n");
return FTDM_FAIL;
} else {
len = len + sprintf(buf + len, "<m2ua_peer>\n");
len = len + sprintf(buf + len, "<name> %s </name>\n",peer->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, " <connected_status> %s </connected_status>\n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");*/
len = len + sprintf(buf + len, "</m2ua_peer>\n");
}
sctp_id = peer->sctpId;
if(ftmod_sctp_ssta_req(STSBASSOC, sctp_id, &sctp_cfm)) {
if(LMW_PEER_DOWN == cfm.t.ssta.s.peerSta.state){
/* If there is no association established so far, it will return fail..*/
len = len + sprintf(buf + len, "<sctp_association>\n");
len = len + sprintf(buf + len, " <status> SCT_ASSOC_STATE_CLOSED </status>\n");
len = len + sprintf(buf + len, "</sctp_association>\n");
}else{
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
return FTDM_FAIL;
}
} else {
len = len + sprintf(buf + len, "<sctp_association>\n");
len = len + sprintf(buf + len, " <status> %s </status>\n", PRNT_SCTP_ASSOC_STATE(sctp_cfm.t.ssta.s.assocSta.assocState));
len = len + sprintf(buf + len, "</sctp_association>\n");
}
}
stream->write_function(stream,"\n%s\n",buf);

View File

@ -870,6 +870,11 @@ void handle_sng_m2ua_alarm(Pst *pst, MwMgmt *sta)
/* To print the event specific information */
switch(sta->t.usta.alarm.event)
{
case LMW_EVENT_TERM_OK:
{
ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_TERM_OK: Association Terminated with PeerId[%d] \n",sta->t.usta.s.peerId);
break;
}
case LMW_EVENT_ENDPOPEN_OK:
{
ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ENDPOPEN_OK: \n");

View File

@ -791,13 +791,13 @@ static int ftmod_m2ua_peer_config(int id)
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config FAILED \n", id);
return 0x01;
}else{
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config SUCCESS \n", id);
ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config SUCCESS \n", id);
}
if(ftmod_m2ua_peer_config1(id, peer_id)){
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config FAILED \n", id);
return 0x01;
}else{
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config SUCCESS \n", id);
ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config SUCCESS \n", id);
}
@ -1639,10 +1639,9 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
{
MwMgmt ssta;
Pst pst;
int peerId = 0x01;
sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id];
sng_m2ua_cluster_cfg_t* clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId];
sng_m2ua_peer_cfg_t* peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peerId]; /*TODO - KAPIL - need to add proper peerId*/
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));
@ -1668,6 +1667,7 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
{
case STMWSCTSAP:
{
m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id];
ssta.t.ssta.id.suId = m2ua->id ; /* lower sap Id */
break;
}
@ -1678,11 +1678,13 @@ 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 */
break;
}
case STMWCLUSTER:
{
clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[id];
ssta.t.ssta.id.clusterId = clust->id ; /* cluster Id */
break;
}

View File

@ -71,8 +71,8 @@ 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 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 */
}sng_m2ua_peer_cfg_t;

View File

@ -38,6 +38,7 @@
/* INCLUDE ********************************************************************/
#include "ftmod_sangoma_ss7_main.h"
#include "switch_utils.h"
/******************************************************************************/
/* DEFINES ********************************************************************/
@ -123,16 +124,16 @@ static int ftmod_ss7_parse_nif_interface(ftdm_conf_node_t *nif_interface)
sng_nif.id = atoi(parm->val);
SS7_DEBUG("Found an nif id = %d\n", sng_nif.id);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "m2ua_link_nmb")) {
} else if (!strcasecmp(parm->var, "m2ua-interface-id")) {
/**********************************************************************/
sng_nif.m2uaLnkNmb = atoi(parm->val);
SS7_DEBUG("Found an nif m2ua_link_nmb = %d\n", sng_nif.m2uaLnkNmb);
SS7_DEBUG("Found an nif m2ua-interface-id = %d\n", sng_nif.m2uaLnkNmb);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2_link_nmb")) {
} else if (!strcasecmp(parm->var, "mtp2-interface-id")) {
/**********************************************************************/
sng_nif.mtp2LnkNmb=atoi(parm->val);
SS7_DEBUG("Found an nif mtp2_link_nmb = %d\n", sng_nif.mtp2LnkNmb);
SS7_DEBUG("Found an nif mtp2-interface-id = %d\n", sng_nif.mtp2LnkNmb);
/**********************************************************************/
} else {
/**********************************************************************/
@ -239,21 +240,7 @@ static int ftmod_ss7_parse_m2ua_interface(ftdm_conf_node_t *m2ua_interface)
sng_m2ua.id = atoi(parm->val);
SS7_DEBUG("Found an m2ua id = %d\n", sng_m2ua.id);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "node_type")) {
/**********************************************************************/
if(!strcasecmp(parm->val, "SGP")){
sng_m2ua.nodeType = SNG_M2UA_NODE_TYPE_SGP;
} else if(!strcasecmp(parm->val, "ASP")){
SS7_ERROR(" NodeType = ASP Not Supported Yet \n");
return FTDM_FAIL;
} else {
SS7_ERROR("Found an invalid NodeType Parameter Value[%s]\n", parm->val);
return FTDM_FAIL;
}
SS7_DEBUG("Found an nif node_type = %d\n", sng_m2ua.nodeType);
/**********************************************************************/
/**********************************************************************/
} else if (!strcasecmp(parm->var, "cluster_id")) {
} else if (!strcasecmp(parm->var, "m2ua-cluster-interface-id")) {
/**********************************************************************/
sng_m2ua.clusterId=atoi(parm->val);
@ -271,6 +258,8 @@ static int ftmod_ss7_parse_m2ua_interface(ftdm_conf_node_t *m2ua_interface)
/**************************************************************************/
} /* for (i = 0; i < num_parms; i++) */
sng_m2ua.nodeType = SNG_M2UA_NODE_TYPE_SGP;
/* default the interface to paused state */
sngss7_set_flag(&sng_m2ua, SNGSS7_PAUSED);
@ -348,7 +337,6 @@ static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_inter
SS7_DEBUG("Parsing \"m2ua_peer_interface\"...\n");
}
for (i = 0; i < num_parms; i++) {
/**************************************************************************/
@ -363,7 +351,7 @@ static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_inter
sng_m2ua_peer.id = atoi(parm->val);
SS7_DEBUG("Found an sng_m2ua_peer id = %d\n", sng_m2ua_peer.id);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "asp_id_flag")) {
} else if (!strcasecmp(parm->var, "include-asp-identifier")) {
/**********************************************************************/
if(!strcasecmp(parm->val, "TRUE")){
sng_m2ua_peer.aspIdFlag = 0x01;
@ -375,41 +363,41 @@ static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_inter
}
SS7_DEBUG("Found an sng_m2ua_peer aspIdFlag = %d\n", sng_m2ua_peer.aspIdFlag);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "self_asp_id")) {
} else if (!strcasecmp(parm->var, "asp-identifier")) {
/**********************************************************************/
sng_m2ua_peer.selfAspId=atoi(parm->val);
SS7_DEBUG("Found an sng_m2ua_peer self_asp_id = %d\n", sng_m2ua_peer.selfAspId);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "sctp_id")) {
} else if (!strcasecmp(parm->var, "sctp-interface-id")) {
/**********************************************************************/
sng_m2ua_peer.sctpId = atoi(parm->val);
SS7_DEBUG("Found an sng_m2ua_peer sctp_id = %d\n", sng_m2ua_peer.sctpId);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "dest_port")) {
} else if (!strcasecmp(parm->var, "destination-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")) {
} else if (!strcasecmp(parm->var, "address")) {
/**********************************************************************/
if (sng_m2ua_peer.numDestAddr < SCT_MAX_NET_ADDRS) {
sng_m2ua_peer.destAddrList[sng_m2ua_peer.numDestAddr] = iptoul (parm->val);
sng_m2ua_peer.numDestAddr++;
SS7_DEBUG("sng_m2ua_peer - Parsing with dest IP Address = %s\n", parm->val);
SS7_DEBUG("sng_m2ua_peer - Parsing with dest IP Address = %s \n", parm->val);
} else {
SS7_ERROR("sng_m2ua_peer - too many dest address configured. dropping %s \n", parm->val);
}
/**********************************************************************/
} else if (!strcasecmp(parm->var, "loc_out_strms")) {
} else if (!strcasecmp(parm->var, "number-of-outgoing-streams")) {
/**********************************************************************/
sng_m2ua_peer.locOutStrms=atoi(parm->val);
SS7_DEBUG("Found an sng_m2ua_peer loc_out_strms = %d\n", sng_m2ua_peer.locOutStrms);
SS7_DEBUG("Found an sng_m2ua_peer number-of-outgoing-streams = %d\n", sng_m2ua_peer.locOutStrms);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "init_sctp_assoc")) {
} else if (!strcasecmp(parm->var, "init-sctp-association")) {
/**********************************************************************/
if(!strcasecmp(parm->val, "TRUE")){
sng_m2ua_peer.init_sctp_assoc = 0x01;
@ -535,7 +523,7 @@ static int ftmod_ss7_parse_m2ua_clust_interface(ftdm_conf_node_t *m2ua_cluster_i
sng_m2ua_cluster.id = atoi(parm->val);
SS7_DEBUG("Found an sng_m2ua_cluster id = %d\n", sng_m2ua_cluster.id);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "trf_mode")) {
} else if (!strcasecmp(parm->var, "traffic-mode")) {
/**********************************************************************/
if(!strcasecmp(parm->val, "loadshare")){
sng_m2ua_cluster.trfMode = SNG_M2UA_TRF_MODE_LOADSHARE;
@ -549,7 +537,7 @@ static int ftmod_ss7_parse_m2ua_clust_interface(ftdm_conf_node_t *m2ua_cluster_i
}
SS7_DEBUG("Found an sng_m2ua_cluster.trfMode = %d\n", sng_m2ua_cluster.trfMode);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "load_share_algo")) {
} else if (!strcasecmp(parm->var, "load-share-algorithm")) {
/**********************************************************************/
if(!strcasecmp(parm->val, "roundrobin")){
sng_m2ua_cluster.loadShareAlgo = SNG_M2UA_LOAD_SHARE_ALGO_RR;
@ -564,14 +552,14 @@ static int ftmod_ss7_parse_m2ua_clust_interface(ftdm_conf_node_t *m2ua_cluster_i
SS7_DEBUG("Found an sng_m2ua_cluster.loadShareAlgo = %d\n", sng_m2ua_cluster.loadShareAlgo);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "peer_id")) {
} else if (!strcasecmp(parm->var, "m2ua-peer-interface-id")) {
/**********************************************************************/
if(sng_m2ua_cluster.numOfPeers < MW_MAX_NUM_OF_PEER) {
sng_m2ua_cluster.peerIdLst[sng_m2ua_cluster.numOfPeers] = atoi(parm->val);
sng_m2ua_cluster.numOfPeers++;
SS7_DEBUG("Found an sng_m2ua_cluster peerId[%d], Total numOfPeers[%d] \n",
sng_m2ua_cluster.peerIdLst[sng_m2ua_cluster.numOfPeers],
sng_m2ua_cluster.numOfPeers);
sng_m2ua_cluster.numOfPeers+1);
sng_m2ua_cluster.numOfPeers++;
}else{
SS7_ERROR("Peer List excedding max[%d] limit \n", MW_MAX_NUM_OF_PEER);
return FTDM_FAIL;
@ -603,7 +591,7 @@ static int ftmod_ss7_fill_in_m2ua_clust_interface(sng_m2ua_cluster_cfg_t *m2ua_c
int k = 0x00;
int i = m2ua_cluster_iface->id;
strncpy((char *)g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].name, (char *)m2ua_cluster_iface->name, MAX_NAME_LEN-1);
strncpy((char *)g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].name, (char *)m2ua_cluster_iface->name, MAX_NAME_LEN-1);
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].id = m2ua_cluster_iface->id;
g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].trfMode = m2ua_cluster_iface->trfMode;
@ -676,7 +664,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, "src-addr")) {
if (t_link.numSrcAddr < SCT_MAX_NET_ADDRS) {
t_link.srcAddrList[t_link.numSrcAddr+1] = iptoul (param->val);
t_link.numSrcAddr++;
@ -684,7 +672,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, "src-port")) {
t_link.port = atoi(param->val);
SS7_DEBUG("SCTP - Parsing <sng_sctp_interface> with port = %s\n", param->val);
}

View File

@ -223,7 +223,6 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
var = ftdm_parameters[i].var;
val = ftdm_parameters[i].val;
printf("var[%s], val[%s]\n",var,val);
/* confirm that the first parameter is the "operatingMode" */
if(!strcasecmp(var, "operatingMode")){
/**********************************************************************/
@ -275,7 +274,7 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
/**********************************************************************/
/* don't care for now */
/**********************************************************************/
} else if (!strcasecmp(var, "ccSpanId")) {
} else if (!strcasecmp(var, "span-id")) {
/**********************************************************************/
sngSpan.ccSpanId = atoi(val);
SS7_DEBUG("Found an ccSpanId = %d\n",sngSpan.ccSpanId);
@ -543,16 +542,6 @@ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup)
}
case SNG_SS7_OPR_MODE_M2UA_SG:
{
if (ftmod_ss7_parse_mtp_linksets(mtp_linksets)) {
SS7_ERROR("Failed to parse \"mtp_linksets\"!\n");
return FTDM_FAIL;
}
if (ftmod_ss7_parse_mtp_routes(mtp_routes)) {
SS7_ERROR("Failed to parse \"mtp_routes\"!\n");
return FTDM_FAIL;
}
if (ftmod_ss7_parse_sctp_links(sctp_ifaces) != FTDM_SUCCESS) {
SS7_ERROR("Failed to parse <sctp_links>!\n");
return FTDM_FAIL;