]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding code to make "version" as configurable parameter
authorkapil <kgupta@sangoma.com>
Thu, 31 May 2012 13:06:10 +0000 (18:36 +0530)
committerkapil <kgupta@sangoma.com>
Thu, 31 May 2012 13:06:10 +0000 (18:36 +0530)
src/mod/endpoints/mod_megaco/conf/megaco.conf.xml
src/mod/endpoints/mod_megaco/megaco_stack.c
src/mod/endpoints/mod_megaco/megaco_stack.h
src/mod/endpoints/mod_megaco/megaco_xml.c

index d386e055a9a2cd803d10be2418f94c53420ce469..e21ab3a07467098e823be6708b52d0e2e3bb619d 100644 (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  */-->
index 86d1f802688db47d4a00a9cb0ff7a388a71ef6c1..d650aaa48a299be41db53e4e2e8654d30e8379b5 100644 (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;
index e7ef56db49f6fdc3e66ec9a468d3bd7a165f0fc1..64ef1f1ff23042ebc84dd42b588808b7a9268e55 100644 (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 */
index e7addf5875efc2840817eeb93798dadb6ca91d0f..a886546b9b9d31ecea47858d86fe3ae68db9049a 100644 (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);