diff --git a/src/mod/endpoints/mod_megaco/conf/megaco.conf.xml b/src/mod/endpoints/mod_megaco/conf/megaco.conf.xml index d386e055a9..e21ab3a074 100644 --- a/src/mod/endpoints/mod_megaco/conf/megaco.conf.xml +++ b/src/mod/endpoints/mod_megaco/conf/megaco.conf.xml @@ -5,8 +5,9 @@ + - + @@ -35,7 +36,7 @@ - + diff --git a/src/mod/endpoints/mod_megaco/megaco_stack.c b/src/mod/endpoints/mod_megaco/megaco_stack.c index 86d1f80268..d650aaa48a 100644 --- a/src/mod/endpoints/mod_megaco/megaco_stack.c +++ b/src/mod/endpoints/mod_megaco/megaco_stack.c @@ -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; diff --git a/src/mod/endpoints/mod_megaco/megaco_stack.h b/src/mod/endpoints/mod_megaco/megaco_stack.h index e7ef56db49..64ef1f1ff2 100644 --- a/src/mod/endpoints/mod_megaco/megaco_stack.h +++ b/src/mod/endpoints/mod_megaco/megaco_stack.h @@ -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 */ diff --git a/src/mod/endpoints/mod_megaco/megaco_xml.c b/src/mod/endpoints/mod_megaco/megaco_xml.c index e7addf5875..a886546b9b 100644 --- a/src/mod/endpoints/mod_megaco/megaco_xml.c +++ b/src/mod/endpoints/mod_megaco/megaco_xml.c @@ -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);