From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 72 ++++++++++++++++------ 1 file changed, 52 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs') diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index b04b076..23ae307 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -38,6 +38,7 @@ using System.Collections.Generic; using System.Reflection; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; @@ -53,7 +54,8 @@ using System.Text.RegularExpressions; namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { - public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -108,9 +110,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice private IConfig m_config; - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; m_config = config.Configs["FreeSwitchVoice"]; if (null == m_config) @@ -224,17 +225,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice return; } } + } - if (m_pluginEnabled) + public void AddRegion(Scene scene) + { + m_scene = scene; + 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); - }; - - + { + OnRegisterCaps(scene, agentID, caps); + }; + + try { @@ -254,33 +259,60 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 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() - { if (m_pluginEnabled) { m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); - + // register the voice interface for this module, so the script engine can call us m_scene.RegisterModuleInterface(this); } } - public void Close() + public void RegionLoaded(Scene scene) { } - public string Name + public void RemoveRegion(Scene scene) + { + if (UseProxy) + { + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/", m_freeSwitchAPIPrefix)); + } + else + { + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix)); + + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix)); + + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix)); + + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix)); + } + scene.EventManager.OnRegisterCaps -= delegate(UUID agentID, Caps caps) + { + OnRegisterCaps(scene, agentID, caps); + }; + scene.UnregisterModuleInterface(this); + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void PostInitialise() { - get { return "FreeSwitchVoiceModule"; } } - public bool IsSharedModule + public void Close() { - get { return true; } + } + + public string Name + { + get { return "FreeSwitchVoiceModule"; } } // -- cgit v1.1