adding code to make "version" as configurable parameter

This commit is contained in:
kapil 2012-05-31 18:36:10 +05:30
parent a7ac272595
commit 529e7fd24a
4 changed files with 30 additions and 3 deletions

View File

@ -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 */-->

View File

@ -917,7 +917,21 @@ int mgco_mg_ssap_config(int idx)
pCfg->mwdTimer = (U16)10;
pCfg->minMgcoVersion = LMG_VER_PROF_MGCO_H248_1_0;
pCfg->maxMgcoVersion = LMG_VER_PROF_MGCO_H248_3_0;
switch(mgCfg->protocol_version)
{
case 1:
pCfg->maxMgcoVersion = LMG_VER_PROF_MGCO_H248_1_0;
break;
case 2:
pCfg->maxMgcoVersion = LMG_VER_PROF_MGCO_H248_2_0;
break;
case 3:
pCfg->maxMgcoVersion = LMG_VER_PROF_MGCO_H248_3_0;
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Protocol version[%d] \n",mgCfg->protocol_version);
return SWITCH_STATUS_FALSE;
}
pCfg->userInfo.pres.pres = PRSNT_NODEF;
pCfg->userInfo.id.pres = NOTPRSNT;

View File

@ -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 */

View File

@ -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);