Merge branch 'nsg-4.3' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3
This commit is contained in:
commit
d147dcd504
|
@ -5,8 +5,9 @@
|
|||
<sng_mg_interface name="default">
|
||||
<param name="id" value="1"/> <!-- /* equivalent to SSAP ID of MEGACO layer */-->
|
||||
<param name="protocol" value="MEGACO"/> <!-- /* Protocol Type , Supported values are MEGACO/MGCP */ -->
|
||||
<param name="version" value="3"/> <!-- /* Protocol Version , Supported values for MEGACO are 1/2/3 */ -->
|
||||
<param name="transportProfileId" value="1"/> <!-- /* Link to transport layer configuration -->
|
||||
<param name="localIp" value="192.168.1.100"/> <!-- /* Local node IP */ -->
|
||||
<param name="localIp" value="192.168.1.101"/> <!-- /* Local node IP */ -->
|
||||
<param name="port" value="2944" /> <!-- /* Port */ -->
|
||||
<param name="myDomainName" value="mg.sangoma.com" /> <!--/* Local domain name */ -->
|
||||
<param name="mid" value="<lab.sangoma.com>"/> <!-- /* Message Identifier (MID) of MEGACO message */ -->
|
||||
|
@ -35,7 +36,7 @@
|
|||
|
||||
<sng_mg_peer_interface name="MG_PEER1">
|
||||
<param name="id" value="1"/> <!-- /* Peer profile ID */-->
|
||||
<param name="ip" value="192.168.1.101"/> <!-- /* Peer node IP */ -->
|
||||
<param name="ip" value="192.168.1.100"/> <!-- /* Peer node IP */ -->
|
||||
<param name="port" value="2944"/> <!--/* peer port */ -->
|
||||
<param name="encodingScheme" value="TEXT"/> <!--/* H.248 Encoding scheme TEXT/BINARY */ -->
|
||||
<param name="mid" value="<remote.mgc.com>" /> <!-- /* Message Identifier (MID) of remote MGC MEGACO message */-->
|
||||
|
|
|
@ -45,7 +45,7 @@ static switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t r
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* iterate through MG Interface list to build all MG profiles */
|
||||
/* iterate through MG Interface list to build requested MG profile */
|
||||
for (mg_interface = switch_xml_child(mg_interfaces, "sng_mg_interface"); mg_interface; mg_interface = mg_interface->next) {
|
||||
|
||||
const char *name = switch_xml_attr_soft(mg_interface, "name");
|
||||
|
@ -161,9 +161,11 @@ switch_status_t megaco_profile_destroy(megaco_profile_t **profile)
|
|||
switch_thread_rwlock_wrlock((*profile)->rwlock);
|
||||
|
||||
|
||||
/* TODO: Kapil: Insert stack per-interface shutdown code here */
|
||||
/* stop MEGACP stack */
|
||||
if(SWITCH_STATUS_FALSE == sng_mgco_stop((*profile)->name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error stopping MEGACO Stack for profile %s\n", (*profile)->name);
|
||||
}
|
||||
|
||||
|
||||
switch_thread_rwlock_unlock((*profile)->rwlock);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stopped profile: %s\n", (*profile)->name);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -76,6 +76,7 @@ typedef struct sng_mg_cfg{
|
|||
uint8_t my_domain[MAX_DOMAIN_LEN]; /* local domain name */
|
||||
uint8_t my_ipaddr[MAX_DOMAIN_LEN]; /* local domain name */
|
||||
uint32_t port; /* port */
|
||||
uint16_t protocol_version; /* Protocol supported version */
|
||||
uint16_t peer_id; /* MGC Peer ID */
|
||||
uint16_t transport_prof_id; /* Transport profile id ..this also will be the spId for MG SAP*/
|
||||
uint16_t protocol_type; /* MEGACO/MGCP */
|
||||
|
@ -83,6 +84,7 @@ typedef struct sng_mg_cfg{
|
|||
|
||||
|
||||
typedef struct sng_mg_gbl_cfg{
|
||||
int num_of_mg_profiles;
|
||||
sng_mg_cfg_t mgCfg[MAX_MG_PROFILES + 1];
|
||||
sng_mg_transport_profile_t mgTptProf[MG_MAX_PEERS+1]; /* transport profile */
|
||||
sng_mg_peers_t mgPeer;
|
||||
|
@ -108,7 +110,11 @@ void handle_tucl_alarm(Pst *pst, HiMngmt *sta);
|
|||
switch_status_t sng_mgco_init(sng_isup_event_interface_t* event);
|
||||
switch_status_t sng_mgco_cfg(const char* profilename);
|
||||
switch_status_t sng_mgco_start(const char* profilename);
|
||||
switch_status_t sng_mgco_stop(const char* profilename);
|
||||
switch_status_t sng_mgco_stack_shutdown(void);
|
||||
int sng_mgco_mg_get_status(int elemId, MgMngmt* cfm, int mg_cfg_idx);
|
||||
switch_status_t megaco_profile_status(switch_stream_handle_t *stream, const char* profilename);
|
||||
switch_status_t megaco_profile_xmlstatus(switch_stream_handle_t *stream, const char* profilename);
|
||||
|
||||
/*****************************************************************************************************/
|
||||
|
||||
|
|
|
@ -46,6 +46,17 @@ switch_status_t sng_parse_mg_profile(switch_xml_t mg_interface)
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " mg_interface protocol[%d] \n",
|
||||
megaco_globals.g_mg_cfg.mgCfg[i].protocol_type);
|
||||
/********************************************************************************************/
|
||||
}else if(!strcasecmp(var, "version")){
|
||||
/********************************************************************************************/
|
||||
megaco_globals.g_mg_cfg.mgCfg[i].protocol_version = atoi(val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " mg_interface protocol version[%s] \n",val);
|
||||
if((megaco_globals.g_mg_cfg.mgCfg[i].protocol_version < 1)
|
||||
|| (megaco_globals.g_mg_cfg.mgCfg[i].protocol_version > 3))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Protocol version[%s] , Supported values are [1/2/3] \n",val);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
/********************************************************************************************/
|
||||
}else if(!strcasecmp(var, "transportProfileId")){
|
||||
/********************************************************************************************/
|
||||
megaco_globals.g_mg_cfg.mgCfg[i].transport_prof_id = atoi(val);
|
||||
|
@ -214,6 +225,8 @@ switch_status_t sng_parse_mg_peer_profile(switch_xml_t mg_peer_profile)
|
|||
}
|
||||
}
|
||||
|
||||
strcpy((char*)&megaco_globals.g_mg_cfg.mgPeer.peers[i].name[0], prof_name);
|
||||
|
||||
megaco_globals.g_mg_cfg.mgPeer.total_peer++;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_megaco_shutdown);
|
|||
SWITCH_MODULE_DEFINITION(mod_megaco, mod_megaco_load, mod_megaco_shutdown, NULL);
|
||||
|
||||
|
||||
#define MEGACO_FUNCTION_SYNTAX "profile [name] [start | stop]"
|
||||
#define MEGACO_FUNCTION_SYNTAX "profile [name] [start | stop] [status] [xmlstatus]"
|
||||
SWITCH_STANDARD_API(megaco_function)
|
||||
{
|
||||
int argc;
|
||||
|
@ -56,7 +56,22 @@ SWITCH_STANDARD_API(megaco_function)
|
|||
} else {
|
||||
stream->write_function(stream, "-ERR No such profile\n");
|
||||
}
|
||||
}else if(!strcmp(argv[2], "status")) {
|
||||
megaco_profile_t *profile = megaco_profile_locate(argv[1]);
|
||||
if (profile) {
|
||||
megaco_profile_status(stream, profile->name);
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR No such profile\n");
|
||||
}
|
||||
}else if(!strcmp(argv[2], "xmlstatus")) {
|
||||
megaco_profile_t *profile = megaco_profile_locate(argv[1]);
|
||||
if (profile) {
|
||||
megaco_profile_xmlstatus(stream, profile->name);
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR No such profile\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
goto done;
|
||||
|
@ -115,6 +130,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_megaco_load)
|
|||
|
||||
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_add_complete_func("::megaco::list_profiles", list_profiles);
|
||||
|
||||
|
||||
|
@ -209,16 +226,6 @@ void handle_mgco_audit_cfm(Pst *pst, SuId suId, MgMgtAudit* audit, Reason reason
|
|||
}
|
||||
|
||||
/*****************************************************************************************************************************/
|
||||
void handle_mg_alarm(Pst *pst, MgMngmt *sta)
|
||||
{
|
||||
/*TODO*/
|
||||
}
|
||||
|
||||
/*****************************************************************************************************************************/
|
||||
void handle_tucl_alarm(Pst *pst, HiMngmt *sta)
|
||||
{
|
||||
/*TODO*/
|
||||
}
|
||||
|
||||
/*****************************************************************************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in New Issue