diff options
-rw-r--r-- | OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs | 128 | ||||
-rw-r--r-- | prebuild.xml | 6 |
2 files changed, 133 insertions, 1 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 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | |||
39 | namespace 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 | } | ||
diff --git a/prebuild.xml b/prebuild.xml index b614d65..07b9398 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -1745,7 +1745,11 @@ | |||
1745 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | 1745 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> |
1746 | <Reference name="OpenSim.Framework.Statistics"/> | 1746 | <Reference name="OpenSim.Framework.Statistics"/> |
1747 | <Reference name="OpenSim.Region.Physics.Manager"/> | 1747 | <Reference name="OpenSim.Region.Physics.Manager"/> |
1748 | <Reference name="OpenSim.Services.Interfaces"/> | 1748 | <Reference name="OpenSim.Server.Base" /> |
1749 | <Reference name="OpenSim.Server.Handlers" /> | ||
1750 | <Reference name="OpenSim.Services.Connectors" /> | ||
1751 | <Reference name="OpenSim.Services.Base" /> | ||
1752 | <Reference name="OpenSim.Services.Interfaces" /> | ||
1749 | <Reference name="Mono.Addins.dll" /> | 1753 | <Reference name="Mono.Addins.dll" /> |
1750 | 1754 | ||
1751 | <!-- For scripting in funny languages by default --> | 1755 | <!-- For scripting in funny languages by default --> |