Merge branch 'nsg-4.3' of git.sangoma.com:smg_freeswitch into nsg-4.3
This commit is contained in:
commit
1720e4f072
|
@ -5,7 +5,7 @@ applications/mod_dptools
|
|||
applications/mod_commands
|
||||
applications/mod_hash
|
||||
applications/mod_spandsp
|
||||
applications/mod_rad_auth
|
||||
#applications/mod_rad_auth
|
||||
dialplans/mod_dialplan_xml
|
||||
endpoints/mod_sofia
|
||||
endpoints/mod_media_gateway
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#define _GNU_SOURCE
|
||||
#include "private/ftdm_core.h"
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
@ -66,7 +67,8 @@ static ftdm_status_t ftdm_call_set_call_id(ftdm_channel_t *fchan, ftdm_caller_da
|
|||
static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data);
|
||||
static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan);
|
||||
static ftdm_status_t ftdm_channel_sig_indicate(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_usrmsg_t *usrmsg);
|
||||
|
||||
static const char *channel_val2str(unsigned long long flag);
|
||||
static unsigned long long channel_str2val(const char *flag_name);
|
||||
|
||||
static int time_is_init = 0;
|
||||
|
||||
|
@ -4339,7 +4341,7 @@ static struct {
|
|||
ftdm_io_interface_t *pika_interface;
|
||||
} interfaces;
|
||||
|
||||
static void print_channels_by_flag(ftdm_stream_handle_t *stream, int32_t flagval, int not, int *count)
|
||||
static void print_channels_by_flag(ftdm_stream_handle_t *stream, ftdm_span_t *inspan, uint32_t inchan_id, int32_t flagval, int not, int *count)
|
||||
{
|
||||
ftdm_hash_iterator_t *i = NULL;
|
||||
ftdm_span_t *span;
|
||||
|
@ -4349,40 +4351,85 @@ static void print_channels_by_flag(ftdm_stream_handle_t *stream, int32_t flagval
|
|||
const void *key = NULL;
|
||||
void *val = NULL;
|
||||
uint32_t flag = (1 << flagval);
|
||||
int mycount = 0;
|
||||
|
||||
*count = 0;
|
||||
|
||||
ftdm_mutex_lock(globals.mutex);
|
||||
|
||||
for (i = hashtable_first(globals.span_hash); i; i = hashtable_next(i)) {
|
||||
hashtable_this(i, &key, NULL, &val);
|
||||
if (!key || !val) {
|
||||
break;
|
||||
}
|
||||
span = val;
|
||||
citer = ftdm_span_get_chan_iterator(span, NULL);
|
||||
if (inspan) {
|
||||
citer = ftdm_span_get_chan_iterator(inspan, NULL);
|
||||
if (!citer) {
|
||||
continue;
|
||||
goto end;
|
||||
}
|
||||
for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) {
|
||||
fchan = ftdm_iterator_current(curr);
|
||||
if (not && !ftdm_test_flag(fchan, flag)) {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] has not flag %d\n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval);
|
||||
(*count)++;
|
||||
} else if (!not && ftdm_test_flag(fchan, flag)) {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] has flag %d\n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval);
|
||||
(*count)++;
|
||||
if (!inchan_id || inchan_id == fchan->chan_id) {
|
||||
if (not) {
|
||||
if (!ftdm_test_flag(fchan, flag)) {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] flag !%d(!%s) ON \n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval, channel_val2str(flagval));
|
||||
|
||||
mycount++;
|
||||
} else {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] flag !%d(!%s) OFF \n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval, channel_val2str(flagval));
|
||||
}
|
||||
} else if (!not) {
|
||||
if (ftdm_test_flag(fchan, flag)) {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] flag %d(%s) ON\n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval, channel_val2str(flagval));
|
||||
|
||||
mycount++;
|
||||
} else {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] flag %d(%s) OFF \n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval, channel_val2str(flagval));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ftdm_iterator_free(citer);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (i = hashtable_first(globals.span_hash); i; i = hashtable_next(i)) {
|
||||
hashtable_this(i, &key, NULL, &val);
|
||||
if (!key || !val) {
|
||||
break;
|
||||
}
|
||||
span = val;
|
||||
citer = ftdm_span_get_chan_iterator(span, NULL);
|
||||
if (!citer) {
|
||||
continue;
|
||||
}
|
||||
for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) {
|
||||
fchan = ftdm_iterator_current(curr);
|
||||
if (not && !ftdm_test_flag(fchan, flag)) {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] has not flag %d\n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval);
|
||||
mycount++;
|
||||
} else if (!not && ftdm_test_flag(fchan, flag)) {
|
||||
stream->write_function(stream, "[s%dc%d][%d:%d] has flag %d\n",
|
||||
fchan->span_id, fchan->chan_id,
|
||||
fchan->physical_span_id, fchan->physical_chan_id,
|
||||
flagval);
|
||||
mycount++;
|
||||
}
|
||||
}
|
||||
ftdm_iterator_free(citer);
|
||||
}
|
||||
}
|
||||
*count = mycount;
|
||||
end:
|
||||
ftdm_mutex_unlock(globals.mutex);
|
||||
}
|
||||
|
||||
|
@ -4434,12 +4481,88 @@ static void print_core_usage(ftdm_stream_handle_t *stream)
|
|||
{
|
||||
stream->write_function(stream,
|
||||
"--------------------------------------------------------------------------------\n"
|
||||
"ftdm core state [!]<state_name> - List all channels in or not in the given state\n"
|
||||
"ftdm core flag <flag-int-value> - List all channels with the given flag value set\n"
|
||||
"ftdm core state [!]<state-name> - List all channels in or not in the given state\n"
|
||||
"ftdm core flag [!]<flag-int-value|flag-name> [<span_id|span_name>] [<chan_id>] - List all channels with the given flag value set\n"
|
||||
"ftdm core calls - List all known calls to the FreeTDM core\n"
|
||||
"--------------------------------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
typedef struct channel_flags_str {
|
||||
const char *name;
|
||||
unsigned long long channel_flag;
|
||||
} channel_flag_str_t;
|
||||
|
||||
static channel_flag_str_t channel_flag_strs[] = {
|
||||
{ "configured" , FTDM_CHANNEL_CONFIGURED},
|
||||
{ "ready", FTDM_CHANNEL_READY},
|
||||
{ "open", FTDM_CHANNEL_OPEN},
|
||||
{ "dtmf-detect", FTDM_CHANNEL_DTMF_DETECT},
|
||||
{ "suppress-dtmf", FTDM_CHANNEL_SUPRESS_DTMF},
|
||||
{ "transcode", FTDM_CHANNEL_TRANSCODE},
|
||||
{ "buffer", FTDM_CHANNEL_BUFFER},
|
||||
{ "in-thread", FTDM_CHANNEL_INTHREAD},
|
||||
{ "wink", FTDM_CHANNEL_WINK},
|
||||
{ "flash", FTDM_CHANNEL_FLASH},
|
||||
{ "state-change", FTDM_CHANNEL_STATE_CHANGE},
|
||||
{ "hold", FTDM_CHANNEL_HOLD},
|
||||
{ "in-use", FTDM_CHANNEL_INUSE},
|
||||
{ "off-hook", FTDM_CHANNEL_OFFHOOK},
|
||||
{ "ringing", FTDM_CHANNEL_RINGING},
|
||||
{ "progress-detect", FTDM_CHANNEL_PROGRESS_DETECT},
|
||||
{ "callerid-detect", FTDM_CHANNEL_CALLERID_DETECT},
|
||||
{ "outbound", FTDM_CHANNEL_OUTBOUND},
|
||||
{ "suspended", FTDM_CHANNEL_SUSPENDED},
|
||||
{ "3-way", FTDM_CHANNEL_3WAY},
|
||||
{ "progress", FTDM_CHANNEL_PROGRESS},
|
||||
{ "media", FTDM_CHANNEL_MEDIA},
|
||||
{ "answered", FTDM_CHANNEL_ANSWERED},
|
||||
{ "mute", FTDM_CHANNEL_MUTE},
|
||||
{ "use-rx-gain", FTDM_CHANNEL_USE_RX_GAIN},
|
||||
{ "use-tx-gain", FTDM_CHANNEL_USE_TX_GAIN},
|
||||
{ "in-alarm", FTDM_CHANNEL_IN_ALARM},
|
||||
{ "sig-up", FTDM_CHANNEL_SIG_UP},
|
||||
{ "user-hangup", FTDM_CHANNEL_USER_HANGUP},
|
||||
{ "rx-disabled", FTDM_CHANNEL_RX_DISABLED},
|
||||
{ "tx-disabled", FTDM_CHANNEL_TX_DISABLED},
|
||||
{ "call-started", FTDM_CHANNEL_CALL_STARTED},
|
||||
{ "non-block", FTDM_CHANNEL_NONBLOCK},
|
||||
{ "ind-ack-pending", FTDM_CHANNEL_IND_ACK_PENDING},
|
||||
{ "blocking", FTDM_CHANNEL_BLOCKING},
|
||||
{ "media", FTDM_CHANNEL_DIGITAL_MEDIA},
|
||||
{ "native-sigbridge", FTDM_CHANNEL_NATIVE_SIGBRIDGE},
|
||||
{ "invalid", FTDM_CHANNEL_MAX_FLAG},
|
||||
};
|
||||
|
||||
static unsigned long long channel_str2val(const char *flag_name)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ftdm_array_len(channel_flag_strs); i++) {
|
||||
if (!strcasecmp(channel_flag_strs[i].name, flag_name)) {
|
||||
return channel_flag_strs[i].channel_flag;
|
||||
}
|
||||
}
|
||||
return FTDM_CHANNEL_MAX_FLAG;
|
||||
}
|
||||
|
||||
static const char *channel_val2str(unsigned long long flag)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ftdm_array_len(channel_flag_strs); i++) {
|
||||
if (channel_flag_strs[i].channel_flag == flag) {
|
||||
return channel_flag_strs[i].name;
|
||||
}
|
||||
}
|
||||
return "invalid";
|
||||
}
|
||||
|
||||
static void print_channel_flag_values(ftdm_stream_handle_t *stream)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ftdm_array_len(channel_flag_strs); i++) {
|
||||
stream->write_function(stream, "%s\n", channel_flag_strs[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
static char *handle_core_command(const char *cmd)
|
||||
{
|
||||
char *mycmd = NULL;
|
||||
|
@ -4449,11 +4572,12 @@ static char *handle_core_command(const char *cmd)
|
|||
char *argv[10] = { 0 };
|
||||
char *state = NULL;
|
||||
char *flag = NULL;
|
||||
uint32_t flagval = 0;
|
||||
unsigned long long flagval = 0;
|
||||
uint32_t current_call_id = 0;
|
||||
ftdm_caller_data_t *calldata = NULL;
|
||||
ftdm_channel_t *fchan = NULL;
|
||||
ftdm_channel_state_t i = FTDM_CHANNEL_STATE_INVALID;
|
||||
ftdm_span_t *fspan = NULL;
|
||||
ftdm_stream_handle_t stream = { 0 };
|
||||
|
||||
FTDM_STANDARD_STREAM(stream);
|
||||
|
@ -4494,6 +4618,7 @@ static char *handle_core_command(const char *cmd)
|
|||
print_channels_by_state(&stream, i, not, &count);
|
||||
stream.write_function(&stream, "\nTotal channels %s %s: %d\n", not ? "not in state" : "in state", ftdm_channel_state2str(i), count);
|
||||
} else if (!strcasecmp(argv[0], "flag")) {
|
||||
uint32_t chan_id = 0;
|
||||
if (argc < 2) {
|
||||
stream.write_function(&stream, "core flag command requires an argument\n");
|
||||
print_core_usage(&stream);
|
||||
|
@ -4504,8 +4629,37 @@ static char *handle_core_command(const char *cmd)
|
|||
not = 1;
|
||||
flag++;
|
||||
}
|
||||
flagval = atoi(flag);
|
||||
print_channels_by_flag(&stream, flagval, not, &count);
|
||||
|
||||
if (isalpha(flag[0])) {
|
||||
flagval = channel_str2val(flag);
|
||||
if (flagval == FTDM_CHANNEL_MAX_FLAG) {
|
||||
stream.write_function(&stream, "\nInvalid channel flag value. Possible channel flags\n");
|
||||
print_channel_flag_values(&stream);
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
flagval = atoi(flag);
|
||||
}
|
||||
|
||||
/* Specific span specified */
|
||||
if (argv[2]) {
|
||||
ftdm_span_find_by_name(argv[2], &fspan);
|
||||
if (!fspan) {
|
||||
stream.write_function(&stream, "-ERR span:%s not found\n", argv[2]);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Specific channel specified */
|
||||
if (argv[3]) {
|
||||
chan_id = atoi(argv[3]);
|
||||
if (chan_id >= ftdm_span_get_chan_count(fspan)) {
|
||||
stream.write_function(&stream, "-ERR invalid channel %d\n", chan_id);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
print_channels_by_flag(&stream, fspan, chan_id, flagval, not, &count);
|
||||
stream.write_function(&stream, "\nTotal channels %s %d: %d\n", not ? "without flag" : "with flag", flagval, count);
|
||||
} else if (!strcasecmp(argv[0], "calls")) {
|
||||
ftdm_mutex_lock(globals.call_id_mutex);
|
||||
|
|
|
@ -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)) */
|
||||
|
|
|
@ -124,6 +124,7 @@ static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char
|
|||
static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream);
|
||||
static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char* m2ua_profile_name);
|
||||
static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name);
|
||||
static ftdm_status_t handle_show_m2ua_cluster_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name);
|
||||
static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream);
|
||||
static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char* profile_name);
|
||||
int get_assoc_resp_buf(char* buf,SbMgmt* cfm);
|
||||
|
@ -427,10 +428,17 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha
|
|||
{
|
||||
char* profile_name = argv[++c];
|
||||
c++;
|
||||
/***************************************************************/
|
||||
if(!strcasecmp(argv[c],"peerstatus")){
|
||||
/***************************************************************/
|
||||
handle_show_m2ua_peer_status(stream, profile_name);
|
||||
}
|
||||
else{
|
||||
/***************************************************************/
|
||||
}else if(!strcasecmp(argv[c],"clusterstatus")){
|
||||
/***************************************************************/
|
||||
handle_show_m2ua_cluster_status(stream, profile_name);
|
||||
/***************************************************************/
|
||||
} else{
|
||||
/***************************************************************/
|
||||
stream->write_function(stream, "Unknown \"show m2ua \" command..\n");
|
||||
goto handle_cli_error_argc;
|
||||
}
|
||||
|
@ -933,6 +941,7 @@ static ftdm_status_t handle_print_usage(ftdm_stream_handle_t *stream)
|
|||
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 m2ua <m2ua_interface_name> clusterstatus\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");
|
||||
|
@ -3086,12 +3095,17 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
|
|||
len = len + sprintf(buf + len, "<m2ua_profiles>\n");
|
||||
|
||||
if(ftmod_m2ua_ssta_req(STMWGEN, 0x00, &cfm)) {
|
||||
stream->write_function(stream," Request to Trillium M2UA layer failed \n");
|
||||
stream->write_function(stream," Request to layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<m2ua_gen>\n");
|
||||
#ifdef BIT_64
|
||||
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);
|
||||
#else
|
||||
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);
|
||||
#endif
|
||||
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,13 +3116,15 @@ 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);
|
||||
|
||||
if(ftmod_m2ua_ssta_req(STMWDLSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<m2ua_dlsap>\n");
|
||||
|
@ -3120,8 +3136,9 @@ 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");
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<m2ua_cluster>\n");
|
||||
|
@ -3137,42 +3154,55 @@ 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 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",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", (int)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");
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
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", (int) 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");
|
||||
}
|
||||
|
@ -3185,7 +3215,7 @@ static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream)
|
|||
len = len + sprintf(buf + len, "</m2ua_profiles>\n");
|
||||
stream->write_function(stream,"\n%s\n",buf);
|
||||
|
||||
return FTDM_FAIL;
|
||||
return FTDM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
@ -3218,7 +3248,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;
|
||||
|
@ -3238,7 +3268,7 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
|
|||
len = len + sprintf(buf + len, "<name> %s </name>\n", m2ua_profile_name);
|
||||
|
||||
if(ftmod_m2ua_ssta_req(STMWDLSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<m2ua_dlsap>\n");
|
||||
|
@ -3251,7 +3281,7 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
|
|||
}
|
||||
|
||||
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");
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<m2ua_cluster>\n");
|
||||
|
@ -3277,14 +3307,18 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
|
|||
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");
|
||||
stream->write_function(stream," Request to 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",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);
|
||||
#ifdef BIT_64
|
||||
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n", cfm.t.ssta.s.peerSta.assocSta.spAssocId);
|
||||
#else
|
||||
len = len + sprintf(buf + len, " <assoc_id> %ld </assoc_id>\n", cfm.t.ssta.s.peerSta.assocSta.spAssocId);
|
||||
#endif
|
||||
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);
|
||||
|
@ -3296,13 +3330,17 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
|
|||
}
|
||||
|
||||
if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
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");
|
||||
#ifdef BIT_64
|
||||
len = len + sprintf(buf + len," <end_point_id> %d </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
|
||||
#else
|
||||
len = len + sprintf(buf + len," <end_point_id> %ld </end_point_id>\n", cfm.t.ssta.s.sctSapSta.spEndpId);
|
||||
#endif
|
||||
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");
|
||||
}
|
||||
|
@ -3311,7 +3349,7 @@ static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char
|
|||
|
||||
stream->write_function(stream,"\n%s\n",buf);
|
||||
|
||||
return FTDM_FAIL;
|
||||
return FTDM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
@ -3337,12 +3375,17 @@ static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream)
|
|||
len = len + sprintf(buf + len, "<sctp_profiles>\n");
|
||||
|
||||
if(ftmod_sctp_ssta_req(STSBGEN, 0x00, &cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<sctp_gen>\n");
|
||||
#ifdef BIT_64
|
||||
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);
|
||||
#else
|
||||
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);
|
||||
#endif
|
||||
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);
|
||||
|
@ -3352,7 +3395,7 @@ static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream)
|
|||
|
||||
#ifdef LSB12
|
||||
if(ftmod_sctp_ssta_req(STSBTMR, 0x00, &cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<sctp_timers>\n");
|
||||
|
@ -3379,12 +3422,12 @@ 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");
|
||||
|
||||
if(ftmod_sctp_ssta_req(STSBSCTSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<sctp_sap>\n");
|
||||
|
@ -3394,7 +3437,7 @@ static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream)
|
|||
}
|
||||
|
||||
if(ftmod_sctp_ssta_req(STSBTSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<sctp_transport_sap>\n");
|
||||
|
@ -3409,7 +3452,7 @@ static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream)
|
|||
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");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
} else {
|
||||
|
@ -3438,7 +3481,11 @@ int get_assoc_resp_buf(char* buf,SbMgmt* cfm)
|
|||
char *asciiAddr;
|
||||
CmInetIpAddr ip;
|
||||
|
||||
#ifdef BIT_64
|
||||
len = len + sprintf(buf + len, " <assoc_id> %d </assoc_id>\n", cfm->t.ssta.s.assocSta.assocId);
|
||||
#else
|
||||
len = len + sprintf(buf + len, " <assoc_id> %ld </assoc_id>\n", cfm->t.ssta.s.assocSta.assocId);
|
||||
#endif
|
||||
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 +3605,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;
|
||||
|
@ -3574,7 +3621,7 @@ static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char
|
|||
len = len + sprintf(buf + len, "<sctp_profile>\n");
|
||||
|
||||
if(ftmod_sctp_ssta_req(STSBSCTSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<sctp_sap>\n");
|
||||
|
@ -3584,7 +3631,7 @@ static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char
|
|||
}
|
||||
|
||||
if(ftmod_sctp_ssta_req(STSBTSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<sctp_transport_sap>\n");
|
||||
|
@ -3600,7 +3647,7 @@ static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char
|
|||
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");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
} else {
|
||||
|
@ -3640,12 +3687,17 @@ static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream)
|
|||
len = len + sprintf(buf + len, "<nif_profiles>\n");
|
||||
|
||||
if(ftmod_nif_ssta_req(STNWGEN, 0x00, &cfm)) {
|
||||
stream->write_function(stream," Request to Trillium NIF layer failed \n");
|
||||
stream->write_function(stream," Request to NIF layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<nif_gen>\n");
|
||||
#ifdef BIT_64
|
||||
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);
|
||||
#else
|
||||
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);
|
||||
#endif
|
||||
len = len + sprintf(buf + len, "</nif_gen>\n");
|
||||
}
|
||||
|
||||
|
@ -3653,18 +3705,22 @@ 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");
|
||||
|
||||
if(ftmod_nif_ssta_req(STNWDLSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to NIF layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
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));
|
||||
#ifdef BIT_64
|
||||
len = len + sprintf(buf + len," <nmb_of_retry> %d </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
|
||||
#else
|
||||
len = len + sprintf(buf + len," <nmb_of_retry> %ld </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
|
||||
#endif
|
||||
len = len + sprintf(buf + len, "</nif_dlsap>\n");
|
||||
}
|
||||
|
||||
|
@ -3676,7 +3732,7 @@ static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream)
|
|||
len = len + sprintf(buf + len, "</nif_profiles>\n");
|
||||
stream->write_function(stream,"\n%s\n",buf);
|
||||
|
||||
return FTDM_FAIL;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -3704,7 +3760,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;
|
||||
|
@ -3723,13 +3779,17 @@ static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char*
|
|||
len = len + sprintf(buf + len, "<nif_profile>\n");
|
||||
|
||||
if(ftmod_nif_ssta_req(STNWDLSAP,x,&cfm)) {
|
||||
stream->write_function(stream," Request to Trillium SCTP layer failed \n");
|
||||
stream->write_function(stream," Request to NIF layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
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));
|
||||
#ifdef BIT_64
|
||||
len = len + sprintf(buf + len," <nmb_of_retry> %d </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
|
||||
#else
|
||||
len = len + sprintf(buf + len," <nmb_of_retry> %ld </nmb_of_retry>\n", cfm.t.ssta.s.dlSapSta.nmbRetry);
|
||||
#endif
|
||||
len = len + sprintf(buf + len, "</nif_dlsap>\n");
|
||||
}
|
||||
|
||||
|
@ -3737,7 +3797,7 @@ static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char*
|
|||
|
||||
stream->write_function(stream,"\n%s\n",buf);
|
||||
|
||||
return FTDM_FAIL;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -3774,7 +3834,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;
|
||||
|
@ -3797,7 +3857,7 @@ static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream,
|
|||
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");
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<m2ua_peer>\n");
|
||||
|
@ -3816,7 +3876,7 @@ static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream,
|
|||
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");
|
||||
stream->write_function(stream," Request to SCTP layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
} else {
|
||||
|
@ -3828,7 +3888,82 @@ static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream,
|
|||
|
||||
stream->write_function(stream,"\n%s\n",buf);
|
||||
|
||||
return FTDM_FAIL;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Fun: handle_show_m2ua_cluster_status()
|
||||
* Desc: display requested m2ua profile cluster information
|
||||
* Ret: FTDM_SUCCESS | FTDM_FAIL
|
||||
* Note:
|
||||
* author: Kapil Gupta
|
||||
*******************************************************************************/
|
||||
|
||||
static ftdm_status_t handle_show_m2ua_cluster_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name)
|
||||
{
|
||||
char* xmlhdr = (char*)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
|
||||
char buf[4096];
|
||||
int x = 0x00;
|
||||
int found = 0x00;
|
||||
int len = 0x00;
|
||||
int idx = 0x00;
|
||||
MwMgmt cfm;
|
||||
SbMgmt sctp_cfm;
|
||||
sng_m2ua_cluster_cfg_t* clust = NULL;
|
||||
sng_m2ua_cfg_t* m2ua = NULL;
|
||||
|
||||
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);
|
||||
|
||||
/*iterate through all the m2ua links and get required profile */
|
||||
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_ACTIVE))) {
|
||||
|
||||
if(!strcasecmp(m2ua_profile_name, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].name)){
|
||||
found = 0x01;
|
||||
break;
|
||||
}
|
||||
}
|
||||
x++;
|
||||
}
|
||||
|
||||
if(!found){
|
||||
stream->write_function(stream,"Requested M2UA profile[%s] not configured\n", m2ua_profile_name);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x];
|
||||
clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId];
|
||||
|
||||
if(ftmod_m2ua_ssta_req(STMWCLUSTER,g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].clusterId,&cfm)) {
|
||||
stream->write_function(stream," Request to M2UA layer failed \n");
|
||||
return FTDM_FAIL;
|
||||
} else {
|
||||
len = len + sprintf(buf + len, "<m2ua_cluster>\n");
|
||||
len = len + sprintf(buf + len, "<name> %s </name>\n",clust->name);
|
||||
len = len + sprintf(buf + len," <state> %s </state>\n", PRNT_M2UA_CLUSTER_STATE(cfm.t.ssta.s.clusterSta.state));
|
||||
len = len + sprintf(buf + len, "<num_of_peers> %d </num_of_peers>\n",cfm.t.ssta.s.clusterSta.nmbPeer);
|
||||
for(idx = 0; idx < cfm.t.ssta.s.clusterSta.nmbPeer; idx++)
|
||||
{
|
||||
len = len + sprintf(buf + len, "<m2ua_cluster_peer>\n");
|
||||
len = len + sprintf(buf + len, " <peer_name> %s </peer_name>\n", g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[cfm.t.ssta.s.clusterSta.peerSt[idx].peerId].name);
|
||||
len = len + sprintf(buf + len, " <peer_id> %d </peer_id>\n", cfm.t.ssta.s.clusterSta.peerSt[idx].peerId);
|
||||
len = len + sprintf(buf + len, " <peer_state> %s </peer_state>\n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.clusterSta.peerSt[idx].peerState));
|
||||
len = len + sprintf(buf + len, "</m2ua_cluster_peer>\n");
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
stream->write_function(stream,"\n%s\n",buf);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -802,10 +793,10 @@ static int ftmod_m2ua_peer_config(int 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);
|
||||
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer[%d] configuration for M2UA Intf Id[%d] config FAILED \n", peer_id, id);
|
||||
return 0x01;
|
||||
}else{
|
||||
ftdm_log (FTDM_LOG_INFO, " 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[%d] configuration for M2UA Intf Id[%d] config SUCCESS \n", peer_id, id);
|
||||
}
|
||||
|
||||
clust->sct_sap_id = id;
|
||||
|
@ -822,13 +813,28 @@ static int ftmod_m2ua_peer_config(int id)
|
|||
static int ftmod_m2ua_sctsap_config(int sct_sap_id, int sctp_id)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
Pst pst;
|
||||
MwMgmt cfg;
|
||||
MwMgmt cfm;
|
||||
sng_sctp_link_t *sctp = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[sctp_id];
|
||||
|
||||
|
||||
|
||||
memset((U8 *)&cfg, 0, sizeof(MwMgmt));
|
||||
memset((U8 *)&cfm, 0, sizeof(MwMgmt));
|
||||
memset((U8 *)&pst, 0, sizeof(Pst));
|
||||
|
||||
/* check is sct_sap is already configured */
|
||||
if(!ftmod_m2ua_ssta_req(STMWSCTSAP, sct_sap_id, &cfm )){
|
||||
ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_sctsap_config: SCT SAP [%s] is already configured \n", sctp->name);
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
if(LCM_REASON_INVALID_SAP == cfm.cfm.reason){
|
||||
ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_sctsap_config: SCT SAP [%s] is not configured..configuring now \n", sctp->name);
|
||||
}
|
||||
|
||||
smPstInit(&pst);
|
||||
|
||||
pst.dstEnt = ENTMW;
|
||||
|
@ -889,8 +895,11 @@ static int ftmod_m2ua_sctsap_config(int sct_sap_id, int sctp_id)
|
|||
cfg.t.cfg.s.sctSapCfg.reConfig.mem.region = S_REG;
|
||||
cfg.t.cfg.s.sctSapCfg.reConfig.mem.pool = S_POOL;
|
||||
|
||||
return (sng_cfg_m2ua (&pst, &cfg));
|
||||
if (0 == (ret = sng_cfg_m2ua (&pst, &cfg))){
|
||||
sctp->flags |= SNGSS7_CONFIGURED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************************************/
|
||||
|
@ -1214,7 +1223,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 +1232,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 +1242,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 +1258,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 +1272,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 +1282,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 +1290,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 +1301,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 +1309,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 +1690,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 +1727,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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -268,6 +268,10 @@ typedef enum {
|
|||
/*!< Native signaling bridge is enabled */
|
||||
#define FTDM_CHANNEL_NATIVE_SIGBRIDGE (1ULL << 37)
|
||||
|
||||
/*!< This no more flags after this flag */
|
||||
#define FTDM_CHANNEL_MAX_FLAG (1ULL << 38)
|
||||
/*!<When adding a new flag, need to update ftdm_io.c:channel_flag_strs */
|
||||
|
||||
#include "ftdm_state.h"
|
||||
|
||||
typedef enum ftdm_channel_hw_link_status {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<configuration name="media_gateway.conf" description="Media Gateway Configuration">
|
||||
<mg_profiles>
|
||||
<mg_profile name="profile-1">
|
||||
<param name="protocol" value="MEGACO"/>
|
||||
<param name="local-ip" value="192.168.1.50"/>
|
||||
<param name="port" value="2944" />
|
||||
<param name="domain-name" value="lab.sangoma.com" />
|
||||
<param name="message-identifier" value="<mg.sangoma.com>" />
|
||||
<param name="version" value="3"/>
|
||||
<param name="default-codec" value="PCMA"/>
|
||||
<param name="rtp-port-range" value="5000-6000"/>
|
||||
<param name="rtp-termination-id-prefix" value="TermRtp"/>
|
||||
<param name="rtp-termination-id-len" value="4"/> <!-- /* Allowed values = any digit from 0 to 9 */ -->
|
||||
<physical_terminations>
|
||||
<map termination-id-prefix="Term1/" termination-id-base="1" tech="freetdm" channel-prefix="wp2" channel-map="1-15,17-31"/>
|
||||
<map termination-id-prefix="Term2/" termination-id-base="1" tech="freetdm" channel-prefix="wp3" channel-map="1-31"/>
|
||||
</physical_terminations>
|
||||
<peers>
|
||||
<param name="peer" value = "peer-1" />
|
||||
<param name="peer" value = "peer-2" />
|
||||
<param name="peer" value = "peer-3" />
|
||||
</peers>
|
||||
|
||||
</mg_profile>
|
||||
</mg_profiles>
|
||||
|
||||
<mg_peers>
|
||||
<mg_peer name="peer-1">
|
||||
<param name="ip" value="192.168.1.49"/>
|
||||
<param name="port" value="2944"/>
|
||||
<param name="encoding-scheme" value="TEXT"/>
|
||||
<param name="transport-type" value="UDP"/>
|
||||
<param name="message-identifier" value="<remote1.mgc.com>" />
|
||||
</mg_peer>
|
||||
<mg_peer name="peer-2">
|
||||
<param name="ip" value="192.168.1.55"/>
|
||||
<param name="port" value="2944"/>
|
||||
<param name="encoding-scheme" value="BINARY"/>
|
||||
<param name="transport-type" value="UDP"/>
|
||||
<param name="message-identifier" value="<remote2.mgc.com>" />
|
||||
</mg_peer>
|
||||
<mg_peer name="peer-3">
|
||||
<param name="ip" value="192.168.1.44"/>
|
||||
<param name="port" value="2944"/>
|
||||
<param name="transport-type" value="UDP"/>
|
||||
<param name="encoding-scheme" value="TEXT"/>
|
||||
<param name="message-identifier" value="<remote3.mgc.com>" />
|
||||
</mg_peer>
|
||||
</mg_peers>
|
||||
</configuration>
|
|
@ -99,12 +99,35 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
|
|||
/**********************************************************************************/
|
||||
goto usage;
|
||||
}
|
||||
/**********************************************************************************/
|
||||
}else if (!strcmp(argv[0], "logging")) {
|
||||
/**********************************************************************************/
|
||||
if (zstr(argv[1])) {
|
||||
goto usage;
|
||||
}
|
||||
/******************************************************************/
|
||||
if(!strcasecmp(argv[1], "enable")){
|
||||
mg_enable_logging();
|
||||
/******************************************************************/
|
||||
}else if(!strcasecmp(argv[1], "disable")){
|
||||
/******************************************************************/
|
||||
mg_disable_logging();
|
||||
/******************************************************************/
|
||||
} else {
|
||||
/******************************************************************/
|
||||
goto usage;
|
||||
}
|
||||
/**********************************************************************************/
|
||||
}else {
|
||||
/**********************************************************************************/
|
||||
goto usage;
|
||||
}
|
||||
/**********************************************************************************/
|
||||
|
||||
goto done;
|
||||
|
||||
usage:
|
||||
stream->write_function(stream, "-ERR Usage: "MEGACO_FUNCTION_SYNTAX"\n");
|
||||
stream->write_function(stream, "-ERR Usage: \n""\t"MEGACO_CLI_SYNTAX" \n \t"MEGACO_FUNCTION_SYNTAX"\n \t" MEGACO_LOGGING_CLI_SYNTAX "\n");
|
||||
|
||||
done:
|
||||
switch_safe_free(dup);
|
||||
|
|
|
@ -19,7 +19,6 @@ int mgco_mu_gen_config(void);
|
|||
int mgco_tucl_gen_config(void);
|
||||
int mgco_mu_ssap_config(int idx);
|
||||
int mgco_mg_tsap_config(megaco_profile_t* profile);
|
||||
int mgco_mg_enble_debug(void);
|
||||
int mgco_mg_ssap_config(megaco_profile_t* profile);
|
||||
int mgco_mg_peer_config(megaco_profile_t* profile);
|
||||
int mgco_mg_tpt_server_config(megaco_profile_t* profile);
|
||||
|
@ -97,6 +96,9 @@ switch_status_t sng_mgco_init(sng_mg_event_interface_t* event)
|
|||
/*****************************************************************************************************************/
|
||||
switch_status_t sng_mgco_stack_shutdown()
|
||||
{
|
||||
/* disable MG logging */
|
||||
mg_disable_logging();
|
||||
|
||||
/* shutdown MG */
|
||||
sng_mgco_mg_shutdown();
|
||||
|
||||
|
@ -255,6 +257,8 @@ switch_status_t sng_mgco_start(megaco_profile_t* profile )
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " mgco_mg_tsap_enable_cntrl SUCCESS \n");
|
||||
}
|
||||
|
||||
mgco_mg_enble_debug();
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -571,7 +575,7 @@ int mgco_mg_ssap_cntrl(int idx)
|
|||
}
|
||||
/******************************************************************************/
|
||||
|
||||
int mgco_mg_enble_debug()
|
||||
int mg_enable_logging()
|
||||
{
|
||||
MgMngmt mgMngmt;
|
||||
Pst pst; /* Post for layer manager */
|
||||
|
@ -597,6 +601,33 @@ int mgco_mg_enble_debug()
|
|||
return(sng_cntrl_mg(&pst, &mgMngmt));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int mg_disable_logging()
|
||||
{
|
||||
MgMngmt mgMngmt;
|
||||
Pst pst; /* Post for layer manager */
|
||||
MgCntrl* cntrl;
|
||||
|
||||
memset(&mgMngmt, 0, sizeof(mgMngmt));
|
||||
cntrl = &mgMngmt.t.cntrl;
|
||||
|
||||
/* initalize the post structure */
|
||||
smPstInit(&pst);
|
||||
|
||||
/* insert the destination Entity */
|
||||
pst.dstEnt = ENTMG;
|
||||
mgMngmt.hdr.msgType = TCFG;
|
||||
mgMngmt.hdr.entId.ent = ENTHI;
|
||||
mgMngmt.hdr.entId.inst = S_INST;
|
||||
mgMngmt.hdr.elmId.elmnt = STGEN;
|
||||
|
||||
cntrl->action = ADISIMM;
|
||||
cntrl->subAction = SADBG;
|
||||
cntrl->s.dbg.genDbgMask = 0xfffffdff;
|
||||
|
||||
return(sng_cntrl_mg(&pst, &mgMngmt));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int mgco_tucl_gen_config(void)
|
||||
{
|
||||
|
@ -1230,7 +1261,7 @@ int sng_mgco_mg_get_status(int elemId, MgMngmt* cfm, megaco_profile_t* mg_cfg,
|
|||
case STSERVER:
|
||||
{
|
||||
cntrl.t.ssta.s.mgTptSrvSta.tptAddr.type = CM_INET_IPV4ADDR_TYPE;
|
||||
cntrl.t.ssta.s.mgTptSrvSta.tptAddr.u.ipv4TptAddr.port = ntohl(ipAddr);
|
||||
cntrl.t.ssta.s.mgTptSrvSta.tptAddr.u.ipv4TptAddr.port = atoi(mg_cfg->port);
|
||||
if(ROK == cmInetAddr((S8*)mg_cfg->my_ipaddr, &ipAddr))
|
||||
{
|
||||
cntrl.t.ssta.s.mgTptSrvSta.tptAddr.u.ipv4TptAddr.address = ntohl(ipAddr);
|
||||
|
|
|
@ -53,6 +53,8 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg);
|
|||
void handle_mgco_audit_cfm(Pst *pst, SuId suId, MgMgtAudit* audit, Reason reason);
|
||||
void handle_mg_alarm(Pst *pst, MgMngmt *sta);
|
||||
void handle_tucl_alarm(Pst *pst, HiMngmt *sta);
|
||||
int mg_enable_logging(void);
|
||||
int mg_disable_logging(void);
|
||||
|
||||
|
||||
switch_status_t sng_mgco_cfg(megaco_profile_t* profile);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) ;
|
||||
static switch_xml_config_item_t *get_peer_instructions(mg_peer_profile_t *profile) ;
|
||||
static int mg_sap_id;
|
||||
static switch_status_t modify_mid(char* mid);
|
||||
|
||||
/****************************************************************************************************************************/
|
||||
switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
||||
|
@ -19,7 +20,7 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
|||
switch_xml_t cfg, xml, param, mg_interfaces, mg_interface, mg_peers, mg_peer, peer_interfaces ;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
switch_event_t *event = NULL;
|
||||
const char *file = "megaco.conf";
|
||||
const char *file = "media_gateway.conf";
|
||||
switch_xml_config_item_t *instructions = (profile ? get_instructions(profile) : NULL);
|
||||
int count;
|
||||
int idx;
|
||||
|
@ -57,12 +58,21 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
|||
profile->total_peers++;
|
||||
}
|
||||
|
||||
if(SWITCH_STATUS_FALSE == (status = modify_mid(profile->mid))){
|
||||
goto done;
|
||||
}
|
||||
|
||||
profile->idx = ++mg_sap_id;
|
||||
|
||||
/* we should break from here , profile name should be unique */
|
||||
break;
|
||||
}
|
||||
|
||||
if (!mg_interface) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error profile %s not found\n", profile->name);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
/* go through the peer configuration and get the mg profile associated peers only */
|
||||
if (!(mg_peers = switch_xml_child(cfg, "mg_peers"))) {
|
||||
goto done;
|
||||
|
@ -87,6 +97,10 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if(SWITCH_STATUS_FALSE == (status = modify_mid(peer_profile->mid))){
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,"peer_profile name[%s], ipaddr[%s] port[%s], mid[%s] transport_type[%s], encoding_type[%s] \n",
|
||||
peer_profile->name, peer_profile->ipaddr, peer_profile->port,peer_profile->mid, peer_profile->transport_type, peer_profile->encoding_type);
|
||||
|
||||
|
@ -144,10 +158,25 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
|
|||
static switch_xml_config_int_options_t opt_version = {
|
||||
SWITCH_TRUE, /* enforce min */
|
||||
1,
|
||||
SWITCH_TRUE, /* Enforce Max */
|
||||
SWITCH_TRUE, /* enforce Max */
|
||||
3
|
||||
};
|
||||
|
||||
static switch_xml_config_int_options_t opt_termination_id_len = {
|
||||
SWITCH_TRUE, /* enforce min */
|
||||
1,
|
||||
SWITCH_TRUE, /* enforce Max */
|
||||
9
|
||||
};
|
||||
|
||||
static switch_xml_config_enum_item_t opt_default_codec_enum[] = {
|
||||
{ "PCMA", MEGACO_CODEC_PCMA},
|
||||
{ "PCMU", MEGACO_CODEC_PCMU},
|
||||
{ "G.729", MEGACO_CODEC_G729},
|
||||
{ "G.723.1", MEGACO_CODEC_G723_1},
|
||||
{ "ILBC", MEGACO_CODEC_ILBC },
|
||||
};
|
||||
|
||||
switch_xml_config_item_t instructions[] = {
|
||||
/* parameter name type reloadable pointer default value options structure */
|
||||
SWITCH_CONFIG_ITEM("protocol", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->protocol_type, "MEGACO", &switch_config_string_strdup, "", "MG Protocol type"),
|
||||
|
@ -156,6 +185,11 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
|
|||
SWITCH_CONFIG_ITEM("port", SWITCH_CONFIG_STRING, 0, &profile->port, "2944", &switch_config_string_strdup, "", "port"),
|
||||
SWITCH_CONFIG_ITEM("domain-name", SWITCH_CONFIG_STRING, 0, &profile->my_domain, "", &switch_config_string_strdup, "", "domain name"),
|
||||
SWITCH_CONFIG_ITEM("message-identifier", SWITCH_CONFIG_STRING, 0, &profile->mid, "", &switch_config_string_strdup, "", "message identifier "),
|
||||
|
||||
SWITCH_CONFIG_ITEM("default-codec", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &profile->default_codec, "PCMU", &opt_default_codec_enum, "", "default codec"),
|
||||
SWITCH_CONFIG_ITEM("rtp-port-range", SWITCH_CONFIG_STRING, CONFIG_REQUIRED, &profile->rtp_port_range, "1-65535", &switch_config_string_strdup, "", "rtp port range"),
|
||||
SWITCH_CONFIG_ITEM("rtp-termination-id-prefix", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rtp_termination_id_prefix, "", &switch_config_string_strdup, "", "rtp termination prefix"),
|
||||
SWITCH_CONFIG_ITEM("rtp-termination-id-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &profile->rtp_termination_id_len, "", &opt_termination_id_len, "", "rtp termination id"),
|
||||
SWITCH_CONFIG_ITEM_END()
|
||||
};
|
||||
|
||||
|
@ -165,3 +199,54 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
|
|||
}
|
||||
|
||||
/****************************************************************************************************************************/
|
||||
|
||||
static switch_status_t modify_mid(char* mid)
|
||||
{
|
||||
char* dup = NULL;
|
||||
char* val[10];
|
||||
int count;
|
||||
|
||||
switch_assert(mid);
|
||||
|
||||
/* If MID type is IP then add mid into [] brackets ,
|
||||
* If MID type is domain then add mid into <> brackets *
|
||||
*/
|
||||
|
||||
dup = strdup(mid);
|
||||
count = switch_split(dup, '.', val);
|
||||
|
||||
if(!count) {
|
||||
/* Input string is not separated by '.', check if its separated by '-' as format could be xxx-xx-xxx/xxx-xx-xx-xxx */
|
||||
free(dup);
|
||||
dup = strdup(mid);
|
||||
if(0 == (count = switch_split(dup, '-', val))){
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid input MID string[%s]\n",mid);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if(('<' == val[0][0]) || ('[' == val[0][0])){
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "MID[%s] is already prefixed with proper brackets \n",mid);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*first check could be if count is 3 means domain name as generally we have xxx-xx-xxx/xxx.xx.xxx domain */
|
||||
if(3 == count){
|
||||
/* domain-type, add value into <> */
|
||||
free(dup);
|
||||
dup = strdup(mid);
|
||||
sprintf(mid,"<%s>",dup);
|
||||
}else if(4 == count){
|
||||
/* IP address in xxx.xxx.xxx.xxx format */
|
||||
free(dup);
|
||||
dup = strdup(mid);
|
||||
sprintf(mid,"[%s]",dup);
|
||||
}else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid input MID string[%s]\n",mid);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
free(dup);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -66,14 +66,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_media_gateway_load)
|
|||
switch_core_hash_init(&megaco_globals.peer_profile_hash, pool);
|
||||
switch_thread_rwlock_create(&megaco_globals.peer_profile_rwlock, pool);
|
||||
|
||||
SWITCH_ADD_API(api_interface, "megaco", "megaco", megaco_function, MEGACO_FUNCTION_SYNTAX);
|
||||
SWITCH_ADD_API(api_interface, "mg", "media_gateway", megaco_function, MEGACO_FUNCTION_SYNTAX);
|
||||
|
||||
switch_console_set_complete("add megaco profile ::megaco::list_profiles start");
|
||||
switch_console_set_complete("add megaco profile ::megaco::list_profiles stop");
|
||||
switch_console_set_complete("add megaco profile ::megaco::list_profiles status");
|
||||
switch_console_set_complete("add megaco profile ::megaco::list_profiles xmlstatus");
|
||||
switch_console_set_complete("add megaco profile ::megaco::list_profiles peerxmlstatus");
|
||||
switch_console_add_complete_func("::megaco::list_profiles", list_profiles);
|
||||
switch_console_set_complete("add mg profile ::mg::list_profiles start");
|
||||
switch_console_set_complete("add mg profile ::mg::list_profiles stop");
|
||||
switch_console_set_complete("add mg profile ::mg::list_profiles status");
|
||||
switch_console_set_complete("add mg profile ::mg::list_profiles xmlstatus");
|
||||
switch_console_set_complete("add mg profile ::mg::list_profiles peerxmlstatus");
|
||||
switch_console_set_complete("add mg logging ::mg::list_profiles enable");
|
||||
switch_console_set_complete("add mg logging ::mg::list_profiles disable");
|
||||
switch_console_add_complete_func("::mg::list_profiles", list_profiles);
|
||||
|
||||
|
||||
/* Initialize MEGACO Stack */
|
||||
|
@ -116,14 +118,14 @@ void handle_sng_log(uint8_t level, char *fmt, ...)
|
|||
case SNG_LOGLEVEL_DEBUG: log_level = SWITCH_LOG_DEBUG; break;
|
||||
case SNG_LOGLEVEL_INFO: log_level = SWITCH_LOG_INFO; break;
|
||||
case SNG_LOGLEVEL_WARN: log_level = SWITCH_LOG_WARNING; break;
|
||||
case SNG_LOGLEVEL_ERROR: log_level = SWITCH_LOG_ERROR; break;
|
||||
case SNG_LOGLEVEL_ERROR: log_level = SWITCH_LOG_DEBUG; break;
|
||||
case SNG_LOGLEVEL_CRIT: log_level = SWITCH_LOG_CRIT; break;
|
||||
default: log_level = SWITCH_LOG_DEBUG; break;
|
||||
};
|
||||
|
||||
vsprintf(&print_buf[0], fmt, ptr);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, log_level, " MOD_MEGACO: %s \n", &print_buf[0]);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, log_level, " MOD_MEGACO: %s \n", &print_buf[0]);
|
||||
|
||||
va_end(ptr);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#define MG_MAX_PEERS 5
|
||||
|
||||
#define MEGACO_CLI_SYNTAX "profile|logging"
|
||||
#define MEGACO_LOGGING_CLI_SYNTAX "logging [enable|disable]"
|
||||
#define MEGACO_FUNCTION_SYNTAX "profile [name] [start | stop] [status] [xmlstatus] [peerxmlstatus]"
|
||||
|
||||
struct megaco_globals {
|
||||
|
@ -30,6 +32,14 @@ typedef enum {
|
|||
PF_RUNNING = (1 << 0)
|
||||
} megaco_profile_flags_t;
|
||||
|
||||
typedef enum {
|
||||
MEGACO_CODEC_PCMA,
|
||||
MEGACO_CODEC_PCMU,
|
||||
MEGACO_CODEC_G729,
|
||||
MEGACO_CODEC_G723_1,
|
||||
MEGACO_CODEC_ILBC,
|
||||
} megaco_codec_t;
|
||||
|
||||
typedef struct mg_peer_profile_s{
|
||||
char *name;
|
||||
switch_memory_pool_t *pool;
|
||||
|
@ -45,18 +55,22 @@ typedef struct mg_peer_profile_s{
|
|||
|
||||
typedef struct megaco_profile_s {
|
||||
char *name;
|
||||
switch_memory_pool_t *pool;
|
||||
switch_thread_rwlock_t *rwlock; /* < Reference counting rwlock */
|
||||
megaco_profile_flags_t flags;
|
||||
int idx; /* Trillium MEGACO SAP identification*/
|
||||
char* mid; /* MG H.248 MID */
|
||||
char* my_domain; /* local domain name */
|
||||
char* my_ipaddr; /* local domain name */
|
||||
char* port; /* port */
|
||||
char* protocol_type; /* MEGACO/MGCP */
|
||||
int protocol_version; /* Protocol supported version */
|
||||
int total_peers;
|
||||
char* peer_list[MG_MAX_PEERS]; /* MGC Peer ID LIST */
|
||||
switch_memory_pool_t *pool;
|
||||
switch_thread_rwlock_t *rwlock; /* < Reference counting rwlock */
|
||||
megaco_profile_flags_t flags;
|
||||
int idx; /* Trillium MEGACO SAP identification*/
|
||||
char* mid; /* MG H.248 MID */
|
||||
char* my_domain; /* local domain name */
|
||||
char* my_ipaddr; /* local domain name */
|
||||
char* port; /* port */
|
||||
char* protocol_type; /* MEGACO/MGCP */
|
||||
int protocol_version; /* Protocol supported version */
|
||||
int total_peers;
|
||||
megaco_codec_t default_codec;
|
||||
char* rtp_port_range;
|
||||
char* rtp_termination_id_prefix;
|
||||
int rtp_termination_id_len;
|
||||
char* peer_list[MG_MAX_PEERS]; /* MGC Peer ID LIST */
|
||||
} megaco_profile_t;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue