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>remotes/origin/0.6.7-post-fixes
parent
56edbe9b60
commit
4f3975f04e
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
using System.IO;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IVoiceModule
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Set the SIP url to be used by a parcel, this will allow manual setting of a SIP address
|
||||
/// for a particular piece of land, allowing region owners to use preconfigured SIP conference channels.
|
||||
/// This is used by osSetParcelSIPAddress
|
||||
/// </summary>
|
||||
void setLandSIPAddress(string SIPAddress,UUID GlobalID);
|
||||
|
||||
}
|
||||
}
|
|
@ -53,7 +53,7 @@ using System.Text.RegularExpressions;
|
|||
|
||||
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
{
|
||||
public class FreeSwitchVoiceModule : IRegionModule
|
||||
public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
@ -101,13 +101,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
private FreeSwitchDialplan m_FreeSwitchDialplan;
|
||||
|
||||
private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
|
||||
private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
|
||||
private IConfig m_config;
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
||||
m_scene = scene;
|
||||
m_config = config.Configs["FreeSwitchVoice"];
|
||||
|
||||
if (null == m_config)
|
||||
|
@ -231,6 +234,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
OnRegisterCaps(scene, agentID, caps);
|
||||
};
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback += CustomCertificateValidation;
|
||||
|
@ -255,6 +260,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if(m_pluginEnabled)
|
||||
{
|
||||
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
|
||||
|
||||
// register the voice interface for this module, so the script engine can call us
|
||||
m_scene.RegisterModuleInterface<IVoiceModule>(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -271,6 +283,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// implementation of IVoiceModule, called by osSetParcelSIPAddress script function
|
||||
// </summary>
|
||||
public void setLandSIPAddress(string SIPAddress,UUID GlobalID)
|
||||
{
|
||||
m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
|
||||
GlobalID, SIPAddress);
|
||||
|
||||
lock (m_ParcelAddress)
|
||||
{
|
||||
if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
|
||||
{
|
||||
m_ParcelAddress[GlobalID.ToString()] = SIPAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ParcelAddress.Add(GlobalID.ToString(), SIPAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// OnRegisterCaps is invoked via the scene.EventManager
|
||||
|
@ -777,6 +809,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
// Create parcel voice channel. If no parcel exists, then the voice channel ID is the same
|
||||
// as the directory ID. Otherwise, it reflects the parcel's ID.
|
||||
|
||||
lock (m_ParcelAddress)
|
||||
{
|
||||
if (m_ParcelAddress.ContainsKey( land.GlobalID.ToString() ))
|
||||
{
|
||||
m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
|
||||
land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]);
|
||||
return m_ParcelAddress[land.GlobalID.ToString()];
|
||||
}
|
||||
}
|
||||
|
||||
if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0)
|
||||
{
|
||||
landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name);
|
||||
|
@ -797,6 +839,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
// 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.
|
||||
channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm);
|
||||
|
||||
lock (m_ParcelAddress)
|
||||
{
|
||||
if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
|
||||
{
|
||||
m_ParcelAddress.Add(land.GlobalID.ToString(),channelUri);
|
||||
}
|
||||
}
|
||||
|
||||
return channelUri;
|
||||
}
|
||||
|
|
|
@ -1165,6 +1165,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
land.SetMediaUrl(url);
|
||||
}
|
||||
|
||||
public void osSetParcelSIPAddress(string SIPAddress)
|
||||
{
|
||||
// What actually is the difference to the LL function?
|
||||
//
|
||||
CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL");
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
|
||||
ILandObject land
|
||||
= World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
||||
|
||||
if (land.landData.OwnerID != m_host.ObjectOwner)
|
||||
{
|
||||
OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function");
|
||||
return;
|
||||
}
|
||||
|
||||
// get the voice module
|
||||
IVoiceModule voiceModule = World.RequestModuleInterface<IVoiceModule>();
|
||||
|
||||
if (voiceModule != null)
|
||||
voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID);
|
||||
else
|
||||
OSSLError("osSetParcelSIPAddress: No voice module enabled for this land");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string osGetScriptEngineName()
|
||||
{
|
||||
// This gets a "high" because knowing the engine may be used
|
||||
|
|
|
@ -75,6 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
bool osConsoleCommand(string Command);
|
||||
void osSetParcelMediaURL(string url);
|
||||
void osSetPrimFloatOnWater(int floatYN);
|
||||
void osSetParcelSIPAddress(string SIPAddress);
|
||||
|
||||
// Avatar Info Commands
|
||||
string osGetAgentIP(string agent);
|
||||
|
|
|
@ -184,6 +184,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_OSSL_Functions.osSetParcelMediaURL(url);
|
||||
}
|
||||
|
||||
public void osSetParcelSIPAddress(string SIPAddress)
|
||||
{
|
||||
m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress);
|
||||
}
|
||||
|
||||
public void osSetPrimFloatOnWater(int floatYN)
|
||||
{
|
||||
m_OSSL_Functions.osSetPrimFloatOnWater(floatYN);
|
||||
|
|
Loading…
Reference in New Issue