diff options
author | Rob Smart | 2009-09-18 14:11:38 +0100 |
---|---|---|
committer | dr scofield (aka dirk husemann) | 2009-09-18 15:47:15 +0200 |
commit | 4f3975f04e7bbaf7b7b8e286831714240ced5e6d (patch) | |
tree | af8d71400d65040b2f0c19beeaaad29ca7b340dd /OpenSim | |
parent | Alternate algorithm for fixing avatar capsule tilt (Mantis #2905) (diff) | |
download | opensim-SC-4f3975f04e7bbaf7b7b8e286831714240ced5e6d.zip opensim-SC-4f3975f04e7bbaf7b7b8e286831714240ced5e6d.tar.gz opensim-SC-4f3975f04e7bbaf7b7b8e286831714240ced5e6d.tar.bz2 opensim-SC-4f3975f04e7bbaf7b7b8e286831714240ced5e6d.tar.xz |
addition of a new script function osSetParcelSIPAddress(string SIPAddress), now including iVoiceModule
This patch allows the land owner to dynamically set the SIP address of a particular land parcel from script. This allows predetermined SIP addresses to be used, making it easier to allow non OpenSim users to join a regions voice channel.
Signed-off-by: dr scofield (aka dirk husemann) <drscofield@xyzzyxyzzy.net>
Diffstat (limited to 'OpenSim')
5 files changed, 132 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs b/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs new file mode 100644 index 0000000..2e555fa --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs | |||
@@ -0,0 +1,45 @@ | |||
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 | |||
29 | using System.IO; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | public interface IVoiceModule | ||
35 | { | ||
36 | |||
37 | /// <summary> | ||
38 | /// Set the SIP url to be used by a parcel, this will allow manual setting of a SIP address | ||
39 | /// for a particular piece of land, allowing region owners to use preconfigured SIP conference channels. | ||
40 | /// This is used by osSetParcelSIPAddress | ||
41 | /// </summary> | ||
42 | void setLandSIPAddress(string SIPAddress,UUID GlobalID); | ||
43 | |||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 65c5274..6b30959 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -53,7 +53,7 @@ using System.Text.RegularExpressions; | |||
53 | 53 | ||
54 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | 54 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice |
55 | { | 55 | { |
56 | public class FreeSwitchVoiceModule : IRegionModule | 56 | public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule |
57 | { | 57 | { |
58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | 59 | ||
@@ -101,13 +101,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
101 | private FreeSwitchDialplan m_FreeSwitchDialplan; | 101 | private FreeSwitchDialplan m_FreeSwitchDialplan; |
102 | 102 | ||
103 | private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); | 103 | private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); |
104 | private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); | ||
105 | |||
106 | private Scene m_scene; | ||
104 | 107 | ||
105 | 108 | ||
106 | private IConfig m_config; | 109 | private IConfig m_config; |
107 | 110 | ||
108 | public void Initialise(Scene scene, IConfigSource config) | 111 | public void Initialise(Scene scene, IConfigSource config) |
109 | { | 112 | { |
110 | 113 | m_scene = scene; | |
111 | m_config = config.Configs["FreeSwitchVoice"]; | 114 | m_config = config.Configs["FreeSwitchVoice"]; |
112 | 115 | ||
113 | if (null == m_config) | 116 | if (null == m_config) |
@@ -230,6 +233,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
230 | { | 233 | { |
231 | OnRegisterCaps(scene, agentID, caps); | 234 | OnRegisterCaps(scene, agentID, caps); |
232 | }; | 235 | }; |
236 | |||
237 | |||
233 | 238 | ||
234 | try | 239 | try |
235 | { | 240 | { |
@@ -255,6 +260,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
255 | 260 | ||
256 | public void PostInitialise() | 261 | public void PostInitialise() |
257 | { | 262 | { |
263 | if(m_pluginEnabled) | ||
264 | { | ||
265 | m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); | ||
266 | |||
267 | // register the voice interface for this module, so the script engine can call us | ||
268 | m_scene.RegisterModuleInterface<IVoiceModule>(this); | ||
269 | } | ||
258 | } | 270 | } |
259 | 271 | ||
260 | public void Close() | 272 | public void Close() |
@@ -270,7 +282,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
270 | { | 282 | { |
271 | get { return true; } | 283 | get { return true; } |
272 | } | 284 | } |
273 | 285 | ||
286 | // <summary> | ||
287 | // implementation of IVoiceModule, called by osSetParcelSIPAddress script function | ||
288 | // </summary> | ||
289 | public void setLandSIPAddress(string SIPAddress,UUID GlobalID) | ||
290 | { | ||
291 | m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}", | ||
292 | GlobalID, SIPAddress); | ||
293 | |||
294 | lock (m_ParcelAddress) | ||
295 | { | ||
296 | if (m_ParcelAddress.ContainsKey(GlobalID.ToString())) | ||
297 | { | ||
298 | m_ParcelAddress[GlobalID.ToString()] = SIPAddress; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | m_ParcelAddress.Add(GlobalID.ToString(), SIPAddress); | ||
303 | } | ||
304 | } | ||
305 | } | ||
274 | 306 | ||
275 | // <summary> | 307 | // <summary> |
276 | // OnRegisterCaps is invoked via the scene.EventManager | 308 | // OnRegisterCaps is invoked via the scene.EventManager |
@@ -776,6 +808,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
776 | 808 | ||
777 | // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same | 809 | // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same |
778 | // as the directory ID. Otherwise, it reflects the parcel's ID. | 810 | // as the directory ID. Otherwise, it reflects the parcel's ID. |
811 | |||
812 | lock (m_ParcelAddress) | ||
813 | { | ||
814 | if (m_ParcelAddress.ContainsKey( land.GlobalID.ToString() )) | ||
815 | { | ||
816 | m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}", | ||
817 | land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]); | ||
818 | return m_ParcelAddress[land.GlobalID.ToString()]; | ||
819 | } | ||
820 | } | ||
779 | 821 | ||
780 | if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) | 822 | if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) |
781 | { | 823 | { |
@@ -797,6 +839,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
797 | // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. | 839 | // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. |
798 | channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); | 840 | channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); |
799 | 841 | ||
842 | lock (m_ParcelAddress) | ||
843 | { | ||
844 | if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString())) | ||
845 | { | ||
846 | m_ParcelAddress.Add(land.GlobalID.ToString(),channelUri); | ||
847 | } | ||
848 | } | ||
800 | 849 | ||
801 | return channelUri; | 850 | return channelUri; |
802 | } | 851 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 726b37a..ccdd4c5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1164,6 +1164,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1164 | 1164 | ||
1165 | land.SetMediaUrl(url); | 1165 | land.SetMediaUrl(url); |
1166 | } | 1166 | } |
1167 | |||
1168 | public void osSetParcelSIPAddress(string SIPAddress) | ||
1169 | { | ||
1170 | // What actually is the difference to the LL function? | ||
1171 | // | ||
1172 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); | ||
1173 | |||
1174 | m_host.AddScriptLPS(1); | ||
1175 | |||
1176 | |||
1177 | ILandObject land | ||
1178 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1179 | |||
1180 | if (land.landData.OwnerID != m_host.ObjectOwner) | ||
1181 | { | ||
1182 | OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); | ||
1183 | return; | ||
1184 | } | ||
1185 | |||
1186 | // get the voice module | ||
1187 | IVoiceModule voiceModule = World.RequestModuleInterface<IVoiceModule>(); | ||
1188 | |||
1189 | if (voiceModule != null) | ||
1190 | voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID); | ||
1191 | else | ||
1192 | OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); | ||
1193 | |||
1194 | |||
1195 | } | ||
1167 | 1196 | ||
1168 | public string osGetScriptEngineName() | 1197 | public string osGetScriptEngineName() |
1169 | { | 1198 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 49aa45a..d8d3c31 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
75 | bool osConsoleCommand(string Command); | 75 | bool osConsoleCommand(string Command); |
76 | void osSetParcelMediaURL(string url); | 76 | void osSetParcelMediaURL(string url); |
77 | void osSetPrimFloatOnWater(int floatYN); | 77 | void osSetPrimFloatOnWater(int floatYN); |
78 | void osSetParcelSIPAddress(string SIPAddress); | ||
78 | 79 | ||
79 | // Avatar Info Commands | 80 | // Avatar Info Commands |
80 | string osGetAgentIP(string agent); | 81 | string osGetAgentIP(string agent); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 8f52d99..d0df390 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -183,6 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
183 | { | 183 | { |
184 | m_OSSL_Functions.osSetParcelMediaURL(url); | 184 | m_OSSL_Functions.osSetParcelMediaURL(url); |
185 | } | 185 | } |
186 | |||
187 | public void osSetParcelSIPAddress(string SIPAddress) | ||
188 | { | ||
189 | m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress); | ||
190 | } | ||
186 | 191 | ||
187 | public void osSetPrimFloatOnWater(int floatYN) | 192 | public void osSetPrimFloatOnWater(int floatYN) |
188 | { | 193 | { |