[Freeswitch-svn] [commit] r12878 - in freeswitch/trunk: conf/autoload_configs src/mod/endpoints/mod_opal

FreeSWITCH SVN robertj at freeswitch.org
Wed Apr 1 16:10:53 PDT 2009


Author: robertj
Date: Wed Apr  1 18:10:52 2009
New Revision: 12878

Log:
Added gatekeeper support.

Modified:
   freeswitch/trunk/conf/autoload_configs/opal.conf.xml
   freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
   freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h

Modified: freeswitch/trunk/conf/autoload_configs/opal.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/opal.conf.xml	(original)
+++ freeswitch/trunk/conf/autoload_configs/opal.conf.xml	Wed Apr  1 18:10:52 2009
@@ -4,6 +4,9 @@
     <param name="context" value="default"/>
     <param name="dialplan" value="XML"/>
     <param name="codec-prefs" value="PCMU"/>
+    <param name="gk-address" value=""/>    <!-- empty to disable, "*" to search LAN -->
+    <param name="gk-identifer" value=""/>  <!-- optional name of gk -->
+    <param name="gk-interface" value=""/>  <!-- optional listener interface name -->
   </settings>
   <listeners>
     <listener name="default">

Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp	Wed Apr  1 18:10:52 2009
@@ -25,6 +25,7 @@
 #include "mod_opal.h"
 #include <opal/patch.h>
 #include <h323/h323pdu.h>
+#include <h323/gkclient.h>
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, mod_opal_globals.codec_string);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, mod_opal_globals.context);
@@ -364,6 +365,18 @@
       }
     }
 
+    if (!m_gkAddress.IsEmpty()) {
+      if (m_h323ep->UseGatekeeper(m_gkAddress, m_gkIdentifer, m_gkInterface))
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper: %s\n",
+                          (const char *)m_h323ep->GetGatekeeper()->GetName());
+      else
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+                          "Could not start gatekeeper: addr=\"%s\", id=\"%s\", if=\"%s\"\n",
+                          (const char *)m_gkAddress,
+                          (const char *)m_gkIdentifer,
+                          (const char *)m_gkInterface);
+    }
+
     return TRUE;
 }
 
@@ -391,39 +404,44 @@
     if (xml == NULL) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
         return SWITCH_STATUS_FALSE;
-    } else {
-        switch_xml_t xmlSettings = switch_xml_child(cfg, "settings");
-        if (xmlSettings) {
-            for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
-                const char *var = switch_xml_attr_soft(xmlParam, "name");
-                const char *val = switch_xml_attr_soft(xmlParam, "value");
+    }
 
-                if (!strcasecmp(var, "trace-level")) {
-                    int level = atoi(val);
-                    if (level > 0) {
-                        mod_opal_globals.trace_level = level;
-                    }
-                } else if (!strcasecmp(var, "context")) {
-                    set_global_context(val);
-                } else if (!strcasecmp(var, "dialplan")) {
-                    set_global_dialplan(val);
-                } else if (!strcasecmp(var, "codec-prefs")) {
-                    set_global_codec_string(val);
-                } else if (!strcasecmp(var, "jitter-size")) {
-                    char * next;
-                    unsigned minJitter = strtoul(val, &next, 10);
-                    if (minJitter >= 10) {
-                        unsigned maxJitter = minJitter;
-                        if (*next == ',')
-                          maxJitter = atoi(next+1);
-                        SetAudioJitterDelay(minJitter, maxJitter); // In milliseconds
-                    }
+    switch_xml_t xmlSettings = switch_xml_child(cfg, "settings");
+    if (xmlSettings) {
+        for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
+            const char *var = switch_xml_attr_soft(xmlParam, "name");
+            const char *val = switch_xml_attr_soft(xmlParam, "value");
+
+            if (!strcasecmp(var, "trace-level")) {
+                int level = atoi(val);
+                if (level > 0) {
+                    mod_opal_globals.trace_level = level;
                 }
+            } else if (!strcasecmp(var, "context")) {
+                set_global_context(val);
+            } else if (!strcasecmp(var, "dialplan")) {
+                set_global_dialplan(val);
+            } else if (!strcasecmp(var, "codec-prefs")) {
+                set_global_codec_string(val);
+            } else if (!strcasecmp(var, "jitter-size")) {
+                char * next;
+                unsigned minJitter = strtoul(val, &next, 10);
+                if (minJitter >= 10) {
+                    unsigned maxJitter = minJitter;
+                    if (*next == ',')
+                      maxJitter = atoi(next+1);
+                    SetAudioJitterDelay(minJitter, maxJitter); // In milliseconds
+                }
+            } else if (!strcasecmp(var, "gk-address")) {
+                m_gkAddress = val;
+            } else if (!strcasecmp(var, "gk-identifer")) {
+                m_gkIdentifer = val;
+            } else if (!strcasecmp(var, "gk-interface")) {
+                m_gkInterface = val;
             }
         }
     }
 
-
     switch_xml_t xmlListeners = switch_xml_child(cfg, "listeners");
     if (xmlListeners != NULL) {
         for (switch_xml_t xmlListener = switch_xml_child(xmlListeners, "listener"); xmlListener != NULL; xmlListener = xmlListener->next) {

Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h	Wed Apr  1 18:10:52 2009
@@ -111,7 +111,11 @@
 
     H323EndPoint *m_h323ep;
     IAX2EndPoint *m_iaxep;
-    FSEndPoint *m_fsep;
+    FSEndPoint   *m_fsep;
+
+    PString m_gkAddress;
+    PString m_gkIdentifer;
+    PString m_gkInterface;
 
     list < FSListener > m_listeners;
 };



More information about the Freeswitch-svn mailing list