aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorMelanie2009-08-04 04:25:17 +0100
committerMelanie2009-08-04 04:25:17 +0100
commitafc318f30bb9b520825cc0f6a783ad376f325026 (patch)
tree9a0ea6569c0c9374c04e9da33ae294b478e32d6e /OpenSim/Region/OptionalModules
parentAdding the plumbing for a ROBUST freeswitch service (diff)
downloadopensim-SC_OLD-afc318f30bb9b520825cc0f6a783ad376f325026.zip
opensim-SC_OLD-afc318f30bb9b520825cc0f6a783ad376f325026.tar.gz
opensim-SC_OLD-afc318f30bb9b520825cc0f6a783ad376f325026.tar.bz2
opensim-SC_OLD-afc318f30bb9b520825cc0f6a783ad376f325026.tar.xz
Add the region module shell for the new freeswitch service
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs128
1 files changed, 128 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs
new file mode 100644
index 0000000..7ec34aa
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs
@@ -0,0 +1,128 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using Nini.Config;
30using System;
31using System.Collections.Generic;
32using System.Reflection;
33using OpenSim.Framework;
34using OpenSim.Server.Base;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
38
39namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
40{
41 public class FreeswitchServicesConnector :
42 ISharedRegionModule
43 {
44 private static readonly ILog m_log =
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47
48 private IFreeswitchService m_FreeswitchService;
49
50 private bool m_Enabled = false;
51
52 public Type ReplacableInterface
53 {
54 get { return null; }
55 }
56
57 public string Name
58 {
59 get { return "FreeswitchServicesConnector"; }
60 }
61
62 public void Initialise(IConfigSource source)
63 {
64 IConfig moduleConfig = source.Configs["Modules"];
65 if (moduleConfig != null)
66 {
67 string name = moduleConfig.GetString("FreeswitchServices", "");
68 if (name == Name)
69 {
70 IConfig freeswitchConfig = source.Configs["FreeswitchService"];
71 if (freeswitchConfig == null)
72 {
73 m_log.Error("[FREESWITCH CONNECTOR]: FreeswitchService missing from OpenSim.ini");
74 return;
75 }
76
77 string serviceDll = freeswitchConfig.GetString("LocalServiceModule",
78 String.Empty);
79
80 if (serviceDll == String.Empty)
81 {
82 m_log.Error("[FREESWITCH CONNECTOR]: No LocalServiceModule named in section FreeswitchService");
83 return;
84 }
85
86 Object[] args = new Object[] { source };
87 m_FreeswitchService =
88 ServerUtils.LoadPlugin<IFreeswitchService>(serviceDll,
89 args);
90
91 if (m_FreeswitchService == null)
92 {
93 m_log.Error("[FREESWITCH CONNECTOR]: Can't load freeswitch service");
94 return;
95 }
96 m_Enabled = true;
97 m_log.Info("[FREESWITCH CONNECTOR]: Freeswitch connector enabled");
98 }
99 }
100 }
101
102 public void PostInitialise()
103 {
104 }
105
106 public void Close()
107 {
108 }
109
110 public void AddRegion(Scene scene)
111 {
112 if (!m_Enabled)
113 return;
114
115 m_log.InfoFormat("[FREESWITCH CONNECTOR]: Enabled freeswitch for region {0}", scene.RegionInfo.RegionName);
116
117 scene.RegisterModuleInterface<IFreeswitchService>(m_FreeswitchService);
118 }
119
120 public void RemoveRegion(Scene scene)
121 {
122 }
123
124 public void RegionLoaded(Scene scene)
125 {
126 }
127 }
128}