Start implementing Freeswitch in ROBUST

This commit is contained in:
Melanie
2010-11-21 20:59:01 +00:00
parent 164007dd00
commit 1cf8eb8a90
6 changed files with 106 additions and 77 deletions

View File

@@ -31,11 +31,28 @@ using Nini.Config;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Base;
using log4net;
namespace OpenSim.Services.FreeswitchService
{
public class FreeswitchServiceBase : ServiceBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected string m_freeSwitchRealm;
protected string m_freeSwitchSIPProxy;
protected bool m_freeSwitchAttemptUseSTUN = false;
protected string m_freeSwitchEchoServer;
protected int m_freeSwitchEchoPort = 50505;
protected string m_freeSwitchDefaultWellKnownIP;
protected int m_freeSwitchDefaultTimeout = 5000;
protected string m_freeSwitchContext = "default";
protected string m_freeSwitchServerUser = "freeswitch";
protected string m_freeSwitchServerPass = "password";
protected readonly string m_freeSwitchAPIPrefix = "/fsapi";
protected bool m_Enabled = false;
public FreeswitchServiceBase(IConfigSource config) : base(config)
{
//
@@ -44,7 +61,24 @@ namespace OpenSim.Services.FreeswitchService
IConfig freeswitchConfig = config.Configs["FreeswitchService"];
if (freeswitchConfig != null)
{
// Read config here !!
m_freeSwitchDefaultWellKnownIP = freeswitchConfig.GetString("ServerAddress", String.Empty);
if (m_freeSwitchDefaultWellKnownIP == String.Empty)
{
m_log.Error("[FREESWITCH]: No FreeswitchServerAddress given, can't continue");
return;
}
m_freeSwitchRealm = freeswitchConfig.GetString("Realm", m_freeSwitchDefaultWellKnownIP);
m_freeSwitchSIPProxy = freeswitchConfig.GetString("SIPProxy", m_freeSwitchDefaultWellKnownIP + ":5060");
m_freeSwitchEchoServer = freeswitchConfig.GetString("EchoServer", m_freeSwitchDefaultWellKnownIP);
m_freeSwitchEchoPort = freeswitchConfig.GetInt("EchoPort", m_freeSwitchEchoPort);
m_freeSwitchAttemptUseSTUN = freeswitchConfig.GetBoolean("AttemptSTUN", false); // This may not work
m_freeSwitchDefaultTimeout = freeswitchConfig.GetInt("DefaultTimeout", m_freeSwitchDefaultTimeout);
m_freeSwitchContext = freeswitchConfig.GetString("Context", m_freeSwitchContext);
m_freeSwitchServerUser = freeswitchConfig.GetString("UserName", m_freeSwitchServerUser);
m_freeSwitchServerPass = freeswitchConfig.GetString("Password", m_freeSwitchServerPass);
m_Enabled = true;
}
}
}