Change the freeswitch out connector (which is pointless) to an in connector

arthursv
Melanie 2009-08-04 04:32:44 +01:00
parent afc318f30b
commit 2b8c3f8519
1 changed files with 44 additions and 59 deletions

View File

@ -25,77 +25,42 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using System.Collections.Generic;
using log4net;
using Nini.Config;
using System;
using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Server.Base;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch
{
public class FreeswitchServicesConnector :
ISharedRegionModule
public class FreeswitchServiceInConnectorModule : ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static bool m_Enabled = false;
private IFreeswitchService m_FreeswitchService;
private IConfigSource m_Config;
bool m_Registered = false;
private bool m_Enabled = false;
#region IRegionModule interface
public Type ReplacableInterface
public void Initialise(IConfigSource config)
{
get { return null; }
}
public string Name
{
get { return "FreeswitchServicesConnector"; }
}
public void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("FreeswitchServices", "");
if (name == Name)
m_Enabled = moduleConfig.GetBoolean("FreeswitchServiceInConnector", false);
if (m_Enabled)
{
IConfig freeswitchConfig = source.Configs["FreeswitchService"];
if (freeswitchConfig == null)
{
m_log.Error("[FREESWITCH CONNECTOR]: FreeswitchService missing from OpenSim.ini");
return;
m_log.Info("[FREESWITCH IN CONNECTOR]: FreeswitchServiceInConnector enabled");
}
string serviceDll = freeswitchConfig.GetString("LocalServiceModule",
String.Empty);
if (serviceDll == String.Empty)
{
m_log.Error("[FREESWITCH CONNECTOR]: No LocalServiceModule named in section FreeswitchService");
return;
}
Object[] args = new Object[] { source };
m_FreeswitchService =
ServerUtils.LoadPlugin<IFreeswitchService>(serviceDll,
args);
if (m_FreeswitchService == null)
{
m_log.Error("[FREESWITCH CONNECTOR]: Can't load freeswitch service");
return;
}
m_Enabled = true;
m_log.Info("[FREESWITCH CONNECTOR]: Freeswitch connector enabled");
}
}
}
@ -107,14 +72,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
}
public Type ReplacableInterface
{
get { return null; }
}
public string Name
{
get { return "RegionFreeswitchService"; }
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
m_log.InfoFormat("[FREESWITCH CONNECTOR]: Enabled freeswitch for region {0}", scene.RegionInfo.RegionName);
if (!m_Registered)
{
m_Registered = true;
scene.RegisterModuleInterface<IFreeswitchService>(m_FreeswitchService);
m_log.Info("[RegionFreeswitchService]: Starting...");
Object[] args = new Object[] { m_Config, MainServer.Instance };
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:FreeswitchServiceConnector", args);
}
}
public void RemoveRegion(Scene scene)
@ -124,5 +106,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public void RegionLoaded(Scene scene)
{
}
#endregion
}
}