Merge branch 'master' of /var/git/opensim/

viewer-2-initial-appearance
opensim mirror account 2010-11-21 15:40:03 -08:00
commit dd67175edf
1 changed files with 107 additions and 102 deletions

View File

@ -41,6 +41,7 @@ using log4net;
using Nini.Config; using Nini.Config;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework; using OpenSim.Framework;
using Mono.Addins;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
@ -52,7 +53,8 @@ using System.Text.RegularExpressions;
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{ {
public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FreeSwitchVoiceModule")]
public class FreeSwitchVoiceModule : INonSharedRegionModule, IVoiceModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -64,8 +66,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private static readonly string m_chatSessionRequestPath = "0009/"; private static readonly string m_chatSessionRequestPath = "0009/";
// Control info // Control info
private static bool m_WOF = true; private static bool m_Enabled = false;
private static bool m_pluginEnabled = false;
// FreeSwitch server is going to contact us and ask us all // FreeSwitch server is going to contact us and ask us all
// sorts of things. // sorts of things.
@ -104,9 +105,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private IConfig m_config; private IConfig m_config;
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
m_scene = scene;
m_config = config.Configs["FreeSwitchVoice"]; m_config = config.Configs["FreeSwitchVoice"];
if (null == m_config) if (null == m_config)
@ -121,11 +121,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return; return;
} }
// This is only done the FIRST time this method is invoked. m_Enabled = true;
if (m_WOF)
{
m_pluginEnabled = true;
m_WOF = false;
try try
{ {
@ -187,8 +183,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm); m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
m_pluginEnabled = true; m_Enabled = true;
m_WOF = false;
m_log.Info("[FreeSwitchVoice] plugin enabled"); m_log.Info("[FreeSwitchVoice] plugin enabled");
} }
@ -198,17 +193,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_log.DebugFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.ToString()); m_log.DebugFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.ToString());
return; return;
} }
}
if (m_pluginEnabled)
{
// we need to capture scene in an anonymous method
// here as we need it later in the callbacks
scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps)
{
OnRegisterCaps(scene, agentID, caps);
};
// This here is a region module trying to make a global setting.
// Not really a good idea but it's Windows only, so I can't test.
try try
{ {
ServicePointManager.ServerCertificateValidationCallback += CustomCertificateValidation; ServicePointManager.ServerCertificateValidationCallback += CustomCertificateValidation;
@ -224,20 +211,38 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
} }
catch (Exception) catch (Exception)
{ {
m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); //m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
}
} }
} }
} }
public void PostInitialise() public void AddRegion(Scene scene)
{ {
if (m_pluginEnabled) m_scene = scene;
if (m_Enabled)
{
// we need to capture scene in an anonymous method
// here as we need it later in the callbacks
scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps)
{
OnRegisterCaps(scene, agentID, caps);
};
}
}
public void RemoveRegion(Scene scene)
{
}
public void RegionLoaded(Scene scene)
{
if (m_Enabled)
{ {
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
// register the voice interface for this module, so the script engine can call us // register the voice interface for this module, so the script engine can call us
m_scene.RegisterModuleInterface<IVoiceModule>(this); scene.RegisterModuleInterface<IVoiceModule>(this);
} }
} }
@ -250,9 +255,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
get { return "FreeSwitchVoiceModule"; } get { return "FreeSwitchVoiceModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return true; } get { return null; }
} }
// <summary> // <summary>