Added gatekeeper support.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12878 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Robert Joly 2009-04-01 23:10:52 +00:00
parent c15866847c
commit a6065fb411
3 changed files with 53 additions and 28 deletions

View File

@ -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">

View File

@ -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 @@ bool FSManager::Initialise(switch_loadable_module_interface_t *iface)
}
}
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,7 +404,8 @@ switch_status_t FSManager::ReadConfig(int reload)
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) {
@ -418,11 +432,15 @@ switch_status_t FSManager::ReadConfig(int reload)
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) {

View File

@ -113,6 +113,10 @@ class FSManager : public OpalManager {
IAX2EndPoint *m_iaxep;
FSEndPoint *m_fsep;
PString m_gkAddress;
PString m_gkIdentifer;
PString m_gkInterface;
list < FSListener > m_listeners;
};