diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 72 |
1 files changed, 52 insertions, 20 deletions
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; | |||
38 | using System.Reflection; | 38 | using System.Reflection; |
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using log4net; | 40 | using log4net; |
41 | using Mono.Addins; | ||
41 | using Nini.Config; | 42 | using Nini.Config; |
42 | using Nwc.XmlRpc; | 43 | using Nwc.XmlRpc; |
43 | using OpenSim.Framework; | 44 | using OpenSim.Framework; |
@@ -53,7 +54,8 @@ using System.Text.RegularExpressions; | |||
53 | 54 | ||
54 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | 55 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice |
55 | { | 56 | { |
56 | public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule | 57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
58 | public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule | ||
57 | { | 59 | { |
58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 60 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | 61 | ||
@@ -108,9 +110,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
108 | 110 | ||
109 | private IConfig m_config; | 111 | private IConfig m_config; |
110 | 112 | ||
111 | public void Initialise(Scene scene, IConfigSource config) | 113 | public void Initialise(IConfigSource config) |
112 | { | 114 | { |
113 | m_scene = scene; | ||
114 | m_config = config.Configs["FreeSwitchVoice"]; | 115 | m_config = config.Configs["FreeSwitchVoice"]; |
115 | 116 | ||
116 | if (null == m_config) | 117 | if (null == m_config) |
@@ -224,17 +225,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
224 | return; | 225 | return; |
225 | } | 226 | } |
226 | } | 227 | } |
228 | } | ||
227 | 229 | ||
228 | if (m_pluginEnabled) | 230 | public void AddRegion(Scene scene) |
231 | { | ||
232 | m_scene = scene; | ||
233 | if (m_pluginEnabled) | ||
229 | { | 234 | { |
230 | // we need to capture scene in an anonymous method | 235 | // we need to capture scene in an anonymous method |
231 | // here as we need it later in the callbacks | 236 | // here as we need it later in the callbacks |
232 | scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps) | 237 | scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps) |
233 | { | 238 | { |
234 | OnRegisterCaps(scene, agentID, caps); | 239 | OnRegisterCaps(scene, agentID, caps); |
235 | }; | 240 | }; |
236 | 241 | ||
237 | 242 | ||
238 | 243 | ||
239 | try | 244 | try |
240 | { | 245 | { |
@@ -254,33 +259,60 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
254 | 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."); | 259 | 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."); |
255 | } | 260 | } |
256 | } | 261 | } |
257 | 262 | ||
258 | } | 263 | } |
259 | } | ||
260 | |||
261 | public void PostInitialise() | ||
262 | { | ||
263 | if (m_pluginEnabled) | 264 | if (m_pluginEnabled) |
264 | { | 265 | { |
265 | m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); | 266 | m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); |
266 | 267 | ||
267 | // register the voice interface for this module, so the script engine can call us | 268 | // register the voice interface for this module, so the script engine can call us |
268 | m_scene.RegisterModuleInterface<IVoiceModule>(this); | 269 | m_scene.RegisterModuleInterface<IVoiceModule>(this); |
269 | } | 270 | } |
270 | } | 271 | } |
271 | 272 | ||
272 | public void Close() | 273 | public void RegionLoaded(Scene scene) |
273 | { | 274 | { |
274 | } | 275 | } |
275 | 276 | ||
276 | public string Name | 277 | public void RemoveRegion(Scene scene) |
278 | { | ||
279 | if (UseProxy) | ||
280 | { | ||
281 | MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/", m_freeSwitchAPIPrefix)); | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix)); | ||
286 | |||
287 | MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix)); | ||
288 | |||
289 | MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix)); | ||
290 | |||
291 | MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix)); | ||
292 | } | ||
293 | scene.EventManager.OnRegisterCaps -= delegate(UUID agentID, Caps caps) | ||
294 | { | ||
295 | OnRegisterCaps(scene, agentID, caps); | ||
296 | }; | ||
297 | scene.UnregisterModuleInterface<IVoiceModule>(this); | ||
298 | } | ||
299 | |||
300 | public Type ReplaceableInterface | ||
301 | { | ||
302 | get { return null; } | ||
303 | } | ||
304 | |||
305 | public void PostInitialise() | ||
277 | { | 306 | { |
278 | get { return "FreeSwitchVoiceModule"; } | ||
279 | } | 307 | } |
280 | 308 | ||
281 | public bool IsSharedModule | 309 | public void Close() |
282 | { | 310 | { |
283 | get { return true; } | 311 | } |
312 | |||
313 | public string Name | ||
314 | { | ||
315 | get { return "FreeSwitchVoiceModule"; } | ||
284 | } | 316 | } |
285 | 317 | ||
286 | // <summary> | 318 | // <summary> |