diff options
author | Melanie | 2009-08-04 04:32:44 +0100 |
---|---|---|
committer | Melanie | 2009-08-04 04:32:44 +0100 |
commit | 2b8c3f8519687f524da061dab0ec4a27a9d22f4c (patch) | |
tree | 4e668879881e93c433c03afb09e2d6f6132cad70 /OpenSim/Region | |
parent | Add the region module shell for the new freeswitch service (diff) | |
download | opensim-SC_OLD-2b8c3f8519687f524da061dab0ec4a27a9d22f4c.zip opensim-SC_OLD-2b8c3f8519687f524da061dab0ec4a27a9d22f4c.tar.gz opensim-SC_OLD-2b8c3f8519687f524da061dab0ec4a27a9d22f4c.tar.bz2 opensim-SC_OLD-2b8c3f8519687f524da061dab0ec4a27a9d22f4c.tar.xz |
Change the freeswitch out connector (which is pointless) to an in connector
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs (renamed from OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs) | 103 |
1 files changed, 44 insertions, 59 deletions
diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs index 7ec34aa..a0e8d0c 100644 --- a/OpenSim/Region/OptionalModules/ServiceConnectorsOut/Freeswitch/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs | |||
@@ -25,77 +25,42 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | 28 | using System; |
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Server.Base; | 34 | using OpenSim.Framework.Servers.HttpServer; |
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | ||
38 | using OpenSim.Server.Handlers.Base; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | 40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch |
40 | { | 41 | { |
41 | public class FreeswitchServicesConnector : | 42 | public class FreeswitchServiceInConnectorModule : ISharedRegionModule |
42 | ISharedRegionModule | ||
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | LogManager.GetLogger( | 45 | private static bool m_Enabled = false; |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | |
47 | 47 | private IConfigSource m_Config; | |
48 | private IFreeswitchService m_FreeswitchService; | 48 | bool m_Registered = false; |
49 | |||
50 | private bool m_Enabled = false; | ||
51 | 49 | ||
52 | public Type ReplacableInterface | 50 | #region IRegionModule interface |
53 | { | ||
54 | get { return null; } | ||
55 | } | ||
56 | |||
57 | public string Name | ||
58 | { | ||
59 | get { return "FreeswitchServicesConnector"; } | ||
60 | } | ||
61 | 51 | ||
62 | public void Initialise(IConfigSource source) | 52 | public void Initialise(IConfigSource config) |
63 | { | 53 | { |
64 | IConfig moduleConfig = source.Configs["Modules"]; | 54 | m_Config = config; |
55 | IConfig moduleConfig = config.Configs["Modules"]; | ||
65 | if (moduleConfig != null) | 56 | if (moduleConfig != null) |
66 | { | 57 | { |
67 | string name = moduleConfig.GetString("FreeswitchServices", ""); | 58 | m_Enabled = moduleConfig.GetBoolean("FreeswitchServiceInConnector", false); |
68 | if (name == Name) | 59 | if (m_Enabled) |
69 | { | 60 | { |
70 | IConfig freeswitchConfig = source.Configs["FreeswitchService"]; | 61 | m_log.Info("[FREESWITCH IN CONNECTOR]: FreeswitchServiceInConnector enabled"); |
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 | } | 62 | } |
63 | |||
99 | } | 64 | } |
100 | } | 65 | } |
101 | 66 | ||
@@ -107,14 +72,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
107 | { | 72 | { |
108 | } | 73 | } |
109 | 74 | ||
75 | public Type ReplacableInterface | ||
76 | { | ||
77 | get { return null; } | ||
78 | } | ||
79 | |||
80 | public string Name | ||
81 | { | ||
82 | get { return "RegionFreeswitchService"; } | ||
83 | } | ||
84 | |||
110 | public void AddRegion(Scene scene) | 85 | public void AddRegion(Scene scene) |
111 | { | 86 | { |
112 | if (!m_Enabled) | 87 | if (!m_Enabled) |
113 | return; | 88 | return; |
114 | 89 | ||
115 | m_log.InfoFormat("[FREESWITCH CONNECTOR]: Enabled freeswitch for region {0}", scene.RegionInfo.RegionName); | 90 | if (!m_Registered) |
91 | { | ||
92 | m_Registered = true; | ||
93 | |||
94 | m_log.Info("[RegionFreeswitchService]: Starting..."); | ||
116 | 95 | ||
117 | scene.RegisterModuleInterface<IFreeswitchService>(m_FreeswitchService); | 96 | Object[] args = new Object[] { m_Config, MainServer.Instance }; |
97 | |||
98 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:FreeswitchServiceConnector", args); | ||
99 | } | ||
118 | } | 100 | } |
119 | 101 | ||
120 | public void RemoveRegion(Scene scene) | 102 | public void RemoveRegion(Scene scene) |
@@ -124,5 +106,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
124 | public void RegionLoaded(Scene scene) | 106 | public void RegionLoaded(Scene scene) |
125 | { | 107 | { |
126 | } | 108 | } |
109 | |||
110 | #endregion | ||
111 | |||
127 | } | 112 | } |
128 | } | 113 | } |