From 180be7de07014aa33bc6066f12a0819b731c1c9d Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Tue, 10 Feb 2009 13:10:57 +0000
Subject: this is step 2 of 2 of the OpenSim.Region.Environment refactor.
NOTHING has been deleted or moved off to forge at this point. what has
happened is that OpenSim.Region.Environment.Modules has been split in two:
- OpenSim.Region.CoreModules: all those modules that are either
directly or indirectly referenced from other OpenSim packages, or
that provide functionality that the OpenSim developer community
considers core functionality:
CoreModules/Agent/AssetTransaction
CoreModules/Agent/Capabilities
CoreModules/Agent/TextureDownload
CoreModules/Agent/TextureSender
CoreModules/Agent/TextureSender/Tests
CoreModules/Agent/Xfer
CoreModules/Avatar/AvatarFactory
CoreModules/Avatar/Chat/ChatModule
CoreModules/Avatar/Combat
CoreModules/Avatar/Currency/SampleMoney
CoreModules/Avatar/Dialog
CoreModules/Avatar/Friends
CoreModules/Avatar/Gestures
CoreModules/Avatar/Groups
CoreModules/Avatar/InstantMessage
CoreModules/Avatar/Inventory
CoreModules/Avatar/Inventory/Archiver
CoreModules/Avatar/Inventory/Transfer
CoreModules/Avatar/Lure
CoreModules/Avatar/ObjectCaps
CoreModules/Avatar/Profiles
CoreModules/Communications/Local
CoreModules/Communications/REST
CoreModules/Framework/EventQueue
CoreModules/Framework/InterfaceCommander
CoreModules/Hypergrid
CoreModules/InterGrid
CoreModules/Scripting/DynamicTexture
CoreModules/Scripting/EMailModules
CoreModules/Scripting/HttpRequest
CoreModules/Scripting/LoadImageURL
CoreModules/Scripting/VectorRender
CoreModules/Scripting/WorldComm
CoreModules/Scripting/XMLRPC
CoreModules/World/Archiver
CoreModules/World/Archiver/Tests
CoreModules/World/Estate
CoreModules/World/Land
CoreModules/World/Permissions
CoreModules/World/Serialiser
CoreModules/World/Sound
CoreModules/World/Sun
CoreModules/World/Terrain
CoreModules/World/Terrain/DefaultEffects
CoreModules/World/Terrain/DefaultEffects/bin
CoreModules/World/Terrain/DefaultEffects/bin/Debug
CoreModules/World/Terrain/Effects
CoreModules/World/Terrain/FileLoaders
CoreModules/World/Terrain/FloodBrushes
CoreModules/World/Terrain/PaintBrushes
CoreModules/World/Terrain/Tests
CoreModules/World/Vegetation
CoreModules/World/Wind
CoreModules/World/WorldMap
- OpenSim.Region.OptionalModules: all those modules that are not core
modules:
OptionalModules/Avatar/Chat/IRC-stuff
OptionalModules/Avatar/Concierge
OptionalModules/Avatar/Voice/AsterixVoice
OptionalModules/Avatar/Voice/SIPVoice
OptionalModules/ContentManagementSystem
OptionalModules/Grid/Interregion
OptionalModules/Python
OptionalModules/SvnSerialiser
OptionalModules/World/NPC
OptionalModules/World/TreePopulator
---
.../Voice/AsterixVoice/AsteriskVoiceModule.cs | 292 +++++++++++++++++++++
.../Avatar/Voice/SIPVoice/SIPVoiceModule.cs | 202 ++++++++++++++
2 files changed, 494 insertions(+)
create mode 100644 OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
create mode 100644 OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
new file mode 100644
index 0000000..c827214
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
@@ -0,0 +1,292 @@
+/*
+ * 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 OpenSim 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;
+using System.Collections;
+using System.Reflection;
+using OpenMetaverse;
+using log4net;
+using Nini.Config;
+using Nwc.XmlRpc;
+using OpenSim.Framework;
+using OpenSim.Framework.Communications.Cache;
+using OpenSim.Framework.Communications.Capabilities;
+using OpenSim.Framework.Servers;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
+
+namespace OpenSim.Region.OptionalModules.Avatar.Voice.AsterixVoice
+{
+ public class AsteriskVoiceModule : IRegionModule
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
+ private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
+
+ private string m_asterisk;
+ private string m_asterisk_password;
+ private string m_asterisk_salt;
+ private int m_asterisk_timeout;
+ private string m_confDomain;
+ private IConfig m_config;
+ private Scene m_scene;
+ private string m_sipDomain;
+
+ #region IRegionModule Members
+
+ public void Initialise(Scene scene, IConfigSource config)
+ {
+ m_scene = scene;
+ m_config = config.Configs["AsteriskVoice"];
+
+ if (null == m_config)
+ {
+ m_log.Info("[ASTERISKVOICE] no config found, plugin disabled");
+ return;
+ }
+
+ if (!m_config.GetBoolean("enabled", false))
+ {
+ m_log.Info("[ASTERISKVOICE] plugin disabled by configuration");
+ return;
+ }
+ m_log.Info("[ASTERISKVOICE] plugin enabled");
+
+ try
+ {
+ m_sipDomain = m_config.GetString("sip_domain", String.Empty);
+ m_log.InfoFormat("[ASTERISKVOICE] using SIP domain {0}", m_sipDomain);
+
+ m_confDomain = m_config.GetString("conf_domain", String.Empty);
+ m_log.InfoFormat("[ASTERISKVOICE] using conf domain {0}", m_confDomain);
+
+ m_asterisk = m_config.GetString("asterisk_frontend", String.Empty);
+ m_asterisk_password = m_config.GetString("asterisk_password", String.Empty);
+ m_asterisk_timeout = m_config.GetInt("asterisk_timeout", 3000);
+ m_asterisk_salt = m_config.GetString("asterisk_salt", "Wuffwuff");
+ if (String.IsNullOrEmpty(m_asterisk)) throw new Exception("missing asterisk_frontend config parameter");
+ if (String.IsNullOrEmpty(m_asterisk_password)) throw new Exception("missing asterisk_password config parameter");
+ m_log.InfoFormat("[ASTERISKVOICE] using asterisk front end {0}", m_asterisk);
+
+ scene.EventManager.OnRegisterCaps += OnRegisterCaps;
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.Message);
+ m_log.DebugFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.ToString());
+ return;
+ }
+ }
+
+ public void PostInitialise()
+ {
+ }
+
+ public void Close()
+ {
+ }
+
+ public string Name
+ {
+ get { return "AsteriskVoiceModule"; }
+ }
+
+ public bool IsSharedModule
+ {
+ get { return false; }
+ }
+
+ #endregion
+
+ public void OnRegisterCaps(UUID agentID, Caps caps)
+ {
+ m_log.DebugFormat("[ASTERISKVOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
+ string capsBase = "/CAPS/" + caps.CapsObjectPath;
+ caps.RegisterHandler("ParcelVoiceInfoRequest",
+ new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ParcelVoiceInfoRequest(request, path, param,
+ agentID, caps);
+ }));
+ caps.RegisterHandler("ProvisionVoiceAccountRequest",
+ new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ProvisionVoiceAccountRequest(request, path, param,
+ agentID, caps);
+ }));
+ }
+
+ ///
+ /// Callback for a client request for ParcelVoiceInfo
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ParcelVoiceInfoRequest(string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ // we need to do:
+ // - send channel_uri: as "sip:regionID@m_sipDomain"
+ try
+ {
+ m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: request: {0}, path: {1}, param: {2}",
+ request, path, param);
+
+
+ // setup response to client
+ Hashtable creds = new Hashtable();
+ creds["channel_uri"] = String.Format("sip:{0}@{1}",
+ m_scene.RegionInfo.RegionID, m_sipDomain);
+
+ string regionName = m_scene.RegionInfo.RegionName;
+ ScenePresence avatar = m_scene.GetScenePresence(agentID);
+ if (null == m_scene.LandChannel) throw new Exception("land data not yet available");
+ LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
+
+ LLSDParcelVoiceInfoResponse parcelVoiceInfo =
+ new LLSDParcelVoiceInfoResponse(regionName, land.LocalID, creds);
+
+ string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
+
+
+ // update region on asterisk-opensim frontend
+ Hashtable requestData = new Hashtable();
+ requestData["admin_password"] = m_asterisk_password;
+ requestData["region"] = m_scene.RegionInfo.RegionID.ToString();
+ if (!String.IsNullOrEmpty(m_confDomain))
+ {
+ requestData["region"] += String.Format("@{0}", m_confDomain);
+ }
+
+ ArrayList SendParams = new ArrayList();
+ SendParams.Add(requestData);
+ XmlRpcRequest updateAccountRequest = new XmlRpcRequest("region_update", SendParams);
+ XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout);
+ Hashtable responseData = (Hashtable) updateAccountResponse.Value;
+
+ if (!responseData.ContainsKey("success")) throw new Exception("region_update call failed");
+
+ bool success = Convert.ToBoolean((string) responseData["success"]);
+ if (!success) throw new Exception("region_update failed");
+
+
+ m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: {0}", r);
+ return r;
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0}, retry later", e.Message);
+ m_log.DebugFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0} failed", e.ToString());
+
+ return "undef";
+ }
+ }
+
+ ///
+ /// Callback for a client request for Voice Account Details
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ProvisionVoiceAccountRequest(string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ // we need to
+ // - get user data from UserProfileCacheService
+ // - generate nonce for user voice account password
+ // - issue XmlRpc request to asterisk opensim front end:
+ // + user: base 64 encoded user name (otherwise SL
+ // client is unhappy)
+ // + password: nonce
+ // - the XmlRpc call to asteris-opensim was successful:
+ // send account details back to client
+ try
+ {
+ m_log.DebugFormat("[ASTERISKVOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
+ request, path, param);
+
+ // get user data & prepare voice account response
+ string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes());
+ voiceUser = voiceUser.Replace('+', '-').Replace('/', '_');
+
+ CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
+ if (null == userInfo) throw new Exception("cannot get user details");
+
+ // we generate a nonce everytime
+ string voicePassword = "$1$" + Util.Md5Hash(DateTime.UtcNow.ToLongTimeString() + m_asterisk_salt);
+ LLSDVoiceAccountResponse voiceAccountResponse =
+ new LLSDVoiceAccountResponse(voiceUser, voicePassword);
+ string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
+ m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);
+
+
+ // update user account on asterisk frontend
+ Hashtable requestData = new Hashtable();
+ requestData["admin_password"] = m_asterisk_password;
+ requestData["username"] = voiceUser;
+ if (!String.IsNullOrEmpty(m_sipDomain))
+ {
+ requestData["username"] += String.Format("@{0}", m_sipDomain);
+ }
+ requestData["password"] = voicePassword;
+
+ ArrayList SendParams = new ArrayList();
+ SendParams.Add(requestData);
+ XmlRpcRequest updateAccountRequest = new XmlRpcRequest("account_update", SendParams);
+ XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout);
+ Hashtable responseData = (Hashtable) updateAccountResponse.Value;
+
+ if (!responseData.ContainsKey("success")) throw new Exception("account_update call failed");
+
+ bool success = Convert.ToBoolean((string) responseData["success"]);
+ if (!success) throw new Exception("account_update failed");
+
+ return r;
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0}, retry later", e.Message);
+ m_log.DebugFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0} failed", e.ToString());
+
+ return "undef";
+ }
+ }
+ }
+}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
new file mode 100644
index 0000000..3e8a433
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
@@ -0,0 +1,202 @@
+/*
+ * 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 OpenSim 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;
+using System.Collections;
+using System.Reflection;
+using OpenMetaverse;
+using log4net;
+using Nini.Config;
+using OpenSim.Framework;
+using OpenSim.Framework.Communications.Cache;
+using OpenSim.Framework.Communications.Capabilities;
+using OpenSim.Framework.Servers;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
+
+namespace OpenSim.Region.OptionalModules.Avatar.Voice.SIPVoice
+{
+ public class SIPVoiceModule : IRegionModule
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
+ private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
+ private IConfig m_config;
+ private Scene m_scene;
+ private string m_sipDomain;
+
+ #region IRegionModule Members
+
+ public void Initialise(Scene scene, IConfigSource config)
+ {
+ m_scene = scene;
+ m_config = config.Configs["Voice"];
+
+ if (null == m_config || !m_config.GetBoolean("enabled", false))
+ {
+ m_log.Info("[VOICE] plugin disabled");
+ return;
+ }
+ m_log.Info("[VOICE] plugin enabled");
+
+ m_sipDomain = m_config.GetString("sip_domain", String.Empty);
+ if (String.IsNullOrEmpty(m_sipDomain))
+ {
+ m_log.Error("[VOICE] plugin mis-configured: missing sip_domain configuration");
+ m_log.Info("[VOICE] plugin disabled");
+ return;
+ }
+ m_log.InfoFormat("[VOICE] using SIP domain {0}", m_sipDomain);
+
+ scene.EventManager.OnRegisterCaps += OnRegisterCaps;
+ }
+
+ public void PostInitialise()
+ {
+ }
+
+ public void Close()
+ {
+ }
+
+ public string Name
+ {
+ get { return "VoiceModule"; }
+ }
+
+ public bool IsSharedModule
+ {
+ get { return false; }
+ }
+
+ #endregion
+
+ public void OnRegisterCaps(UUID agentID, Caps caps)
+ {
+ m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
+ string capsBase = "/CAPS/" + caps.CapsObjectPath;
+ caps.RegisterHandler("ParcelVoiceInfoRequest",
+ new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ParcelVoiceInfoRequest(request, path, param,
+ agentID, caps);
+ }));
+ caps.RegisterHandler("ProvisionVoiceAccountRequest",
+ new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ProvisionVoiceAccountRequest(request, path, param,
+ agentID, caps);
+ }));
+ }
+
+ ///
+ /// Callback for a client request for ParcelVoiceInfo
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ParcelVoiceInfoRequest(string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ try
+ {
+ m_log.DebugFormat("[VOICE][PARCELVOICE]: request: {0}, path: {1}, param: {2}", request, path, param);
+
+ // FIXME: get the creds from region file or from config
+ Hashtable creds = new Hashtable();
+
+ creds["channel_uri"] = String.Format("sip:{0}@{1}", agentID, m_sipDomain);
+
+ string regionName = m_scene.RegionInfo.RegionName;
+ ScenePresence avatar = m_scene.GetScenePresence(agentID);
+ if (null == m_scene.LandChannel) throw new Exception("land data not yet available");
+ LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
+
+ LLSDParcelVoiceInfoResponse parcelVoiceInfo =
+ new LLSDParcelVoiceInfoResponse(regionName, land.LocalID, creds);
+
+ string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
+ m_log.DebugFormat("[VOICE][PARCELVOICE]: {0}", r);
+
+ return r;
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[CAPS]: {0}, try again later", e.ToString());
+ }
+
+ return null;
+ }
+
+ ///
+ /// Callback for a client request for Voice Account Details
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ProvisionVoiceAccountRequest(string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ try
+ {
+ m_log.DebugFormat("[VOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
+ request, path, param);
+
+ string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes());
+ voiceUser = voiceUser.Replace('+', '-').Replace('/', '_');
+
+ CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
+ if (null == userInfo) throw new Exception("cannot get user details");
+
+ LLSDVoiceAccountResponse voiceAccountResponse =
+ new LLSDVoiceAccountResponse(voiceUser, "$1$" + userInfo.UserProfile.PasswordHash);
+ string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
+ m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);
+ return r;
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[CAPS][PROVISIONVOICE]: {0}, retry later", e.Message);
+ }
+
+ return null;
+ }
+ }
+}
--
cgit v1.1
From 1caf1c5d96dfa6863f524f57247befc9359e7259 Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Thu, 19 Mar 2009 08:42:59 +0000
Subject: adding missing ChatSessionRequest voice capability for direct AV-AV
calls.
---
.../Avatar/Voice/SIPVoice/SIPVoiceModule.cs | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
index 3e8a433..d00a256 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.SIPVoice
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
+ private static readonly string m_chatSessionRequestPath = "0009/";
private IConfig m_config;
private Scene m_scene;
private string m_sipDomain;
@@ -118,6 +119,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.SIPVoice
return ProvisionVoiceAccountRequest(request, path, param,
agentID, caps);
}));
+ caps.RegisterHandler("ChatSessionRequest",
+ new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ChatSessionRequest(request, path, param,
+ agentID, caps);
+ }));
+
}
///
@@ -198,5 +208,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.SIPVoice
return null;
}
+
+ ///
+ /// Callback for a client request for ParcelVoiceInfo
+ ///
+ /// current scene object of the client
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ChatSessionRequest(string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ ScenePresence avatar = m_scene.GetScenePresence(agentID);
+ string avatarName = avatar.Name;
+
+ m_log.DebugFormat("[CAPS][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}",
+ avatarName, request, path, param);
+ return "true";
+ }
+
}
}
--
cgit v1.1
From 7f30be17d0ee841961262ee9e9b8fab27ccf6d83 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Fri, 17 Apr 2009 20:00:30 +0000
Subject: experimental freeswitch code, imported from Rob Smart's tree
---
.../Voice/FreeSwitchVoice/FreeSwitchDialplan.cs | 88 ++++
.../Voice/FreeSwitchVoice/FreeSwitchDirectory.cs | 335 ++++++++++++
.../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 571 +++++++++++++++++++++
3 files changed, 994 insertions(+)
create mode 100644 OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
create mode 100644 OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
create mode 100644 OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
new file mode 100644
index 0000000..2a2b4a3
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
@@ -0,0 +1,88 @@
+/*
+ * 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 OpenSim 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 log4net;
+using System.Reflection;
+using System.Collections;
+
+namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
+{
+ public class FreeSwitchDialplan
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+
+ public Hashtable HandleDialplanRequest(Hashtable request)
+ {
+ m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString());
+
+ Hashtable response = new Hashtable();
+
+ foreach(DictionaryEntry item in request)
+ {
+ m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
+ }
+
+ response["content_type"] = "text/xml";
+ response["keepalive"] = false;
+ response["int_response_code"]=200;
+ response["str_response_string"] = @"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+
+ return response;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
new file mode 100644
index 0000000..9959d11
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -0,0 +1,335 @@
+/*
+ * 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 OpenSim 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 log4net;
+using System;
+using System.Reflection;
+using System.Text;
+using System.Collections;
+
+namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
+{
+ public class FreeSwitchDirectory
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ public Hashtable HandleDirectoryRequest(Hashtable request)
+ {
+ m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString());
+
+ Hashtable response = new Hashtable();
+
+ // information in the request we might be interested in
+
+ // Request 1 sip_auth for users account
+
+ //Event-Calling-Function=sofia_reg_parse_auth
+ //Event-Calling-Line-Number=1494
+ //action=sip_auth
+ //sip_user_agent=Vivox-SDK-2.1.3010.6151-Mac%20(Feb-11-2009/16%3A42%3A41)
+ //sip_auth_username=xhZuXKmRpECyr2AARJYyGgg%3D%3D (==)
+ //sip_auth_realm=9.20.151.43
+ //sip_contact_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D (==)
+ //sip_contact_host=192.168.0.3 // this shouldnt really be a local IP, investigate STUN servers
+ //sip_to_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D
+ //sip_to_host=9.20.151.43
+ //sip_auth_method=REGISTER
+ //user=xhZuXKmRpECyr2AARJYyGgg%3D%3D
+ //domain=9.20.151.43
+ //ip=9.167.220.137 // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup
+
+ foreach(DictionaryEntry item in request)
+ {
+ m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
+ }
+
+ string eventCallingFunction = (string) request["Event-Calling-Function"];
+
+
+ if(eventCallingFunction=="sofia_reg_parse_auth")
+ {
+ string sipAuthMethod = (string)request["sip_auth_method"];
+
+ if(sipAuthMethod=="REGISTER")
+ {
+ response = HandleRegister(request);
+ }
+ else if(sipAuthMethod=="INVITE")
+ {
+ response = HandleInvite(request);
+ }
+ else
+ {
+ m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
+ response["int_response_code"]=404;
+ }
+ }
+ else if(eventCallingFunction=="switch_xml_locate_user")
+ {
+ response = HandleLocateUser(request);
+ }
+ else if(eventCallingFunction=="user_data_function") // gets called when an avatar to avatar call is made
+ {
+ response = HandleLocateUser(request);
+ }
+ else if(eventCallingFunction=="user_outgoing_channel")
+ {
+ response = HandleRegister(request);
+ }
+ else if(eventCallingFunction=="config_sofia") // happens once on freeswitch startup
+ {
+ response = HandleConfigSofia(request);
+ }
+ else if(eventCallingFunction=="switch_load_network_lists")
+ {
+ //response = HandleLoadNetworkLists(request);
+ response["int_response_code"]=404;
+ response["keepalive"] = false;
+ }
+ else
+ {
+ m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction);
+ response["int_response_code"]=404;
+ response["keepalive"] = false;
+ }
+
+
+
+ return response;
+ }
+
+ private Hashtable HandleRegister(Hashtable request)
+ {
+ m_log.Info("[FreeSwitchDirectory] HandleRegister called");
+
+ // TODO the password we return needs to match that sent in the request, this is hard coded for now
+ string password = "1234";
+ string domain = (string) request["domain"];
+ string user = (string) request["user"];
+
+ Hashtable response = new Hashtable();
+ response["content_type"] = "text/xml";
+ response["keepalive"] = false;
+ response["int_response_code"]=200;
+ response["str_response_string"] = String.Format(
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ ""+
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n"
+ , domain , user, password);
+
+ return response;
+
+ }
+
+ private Hashtable HandleInvite(Hashtable request)
+ {
+ m_log.Info("[FreeSwitchDirectory] HandleInvite called");
+
+ // TODO the password we return needs to match that sent in the request, this is hard coded for now
+ string password = "1234";
+ string domain = (string) request["domain"];
+ string user = (string) request["user"];
+ string sipRequestUser = (string) request["sip_request_user"];
+
+ Hashtable response = new Hashtable();
+ response["content_type"] = "text/xml";
+ response["keepalive"] = false;
+ response["int_response_code"]=200;
+ response["str_response_string"] = String.Format(
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ ""+
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ ""+
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n"
+ , domain , user, password,sipRequestUser);
+
+ return response;
+ }
+
+
+ private Hashtable HandleLocateUser(Hashtable request)
+ {
+ m_log.Info("[FreeSwitchDirectory] HandleLocateUser called");
+
+ // TODO the password we return needs to match that sent in the request, this is hard coded for now
+ string domain = (string) request["domain"];
+ string user = (string) request["user"];
+
+ Hashtable response = new Hashtable();
+ response["content_type"] = "text/xml";
+ response["keepalive"] = false;
+ response["int_response_code"]=200;
+ response["str_response_string"] = String.Format(
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n"+
+ "\r\n"+
+ ""+
+ "\r\n"+
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n"
+ , domain , user);
+
+
+
+ return response;
+ }
+
+ private Hashtable HandleConfigSofia(Hashtable request)
+ {
+ m_log.Info("[FreeSwitchDirectory] HandleConfigSofia called");
+
+ // TODO the password we return needs to match that sent in the request, this is hard coded for now
+ string domain = (string) request["domain"];
+
+ Hashtable response = new Hashtable();
+ response["content_type"] = "text/xml";
+ response["keepalive"] = false;
+ response["int_response_code"]=200;
+ response["str_response_string"] = String.Format(
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ ""+
+ "\r\n" +
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n" +
+ "\r\n" +
+ "\r\n"
+ , domain);
+
+
+ return response;
+ }
+
+ private Hashtable HandleLoadNetworkLists(Hashtable request)
+ {
+ m_log.Info("[FreeSwitchDirectory] HandleLoadNetworkLists called");
+
+ // TODO the password we return needs to match that sent in the request, this is hard coded for now
+ string domain = (string) request["domain"];
+
+ Hashtable response = new Hashtable();
+ response["content_type"] = "text/xml";
+ response["keepalive"] = false;
+ response["int_response_code"]=200;
+ response["str_response_string"] = String.Format(
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n" +
+ "\r\n" +
+ "\r\n"
+ , domain);
+
+
+ return response;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
new file mode 100644
index 0000000..a8f9de6
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -0,0 +1,571 @@
+/*
+ * 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 OpenSim 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;
+using System.IO;
+using System.Net;
+using System.Web;
+using System.Text;
+using System.Xml;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using OpenMetaverse;
+using log4net;
+using Nini.Config;
+using Nwc.XmlRpc;
+using OpenSim.Framework;
+using OpenSim.Framework.Communications.Cache;
+using OpenSim.Framework.Communications.Capabilities;
+using OpenSim.Framework.Servers;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
+
+namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
+{
+ public class FreeSwitchVoiceModule : IRegionModule
+ {
+
+ // Infrastructure
+ private static readonly ILog m_log =
+ LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private static readonly bool DUMP = true;
+
+ // Capability string prefixes
+ private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
+ private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
+ private static readonly string m_chatSessionRequestPath = "0009/";
+
+ // Control info
+ private static bool m_WOF = true;
+ private static bool m_pluginEnabled = false;
+
+ // FreeSwitch server is going to contact us and ask us all
+ // sorts of things.
+ private static string m_freeSwitchServerUser;
+ private static string m_freeSwitchServerPass;
+
+ // SLVoice client will do a GET on this prefix
+ private static string m_freeSwitchAPIPrefix;
+
+ // We need to return some information to SLVoice
+ // figured those out via curl
+ // http://vd1.vivox.com/api2/viv_get_prelogin.php
+ //
+ // need to figure out whether we do need to return ALL of
+ // these...
+ private static string m_freeSwitchRealm;
+ private static string m_freeSwitchSIPProxy;
+ private static bool m_freeSwitchAttemptUseSTUN;
+ private static string m_freeSwitchSTUNServer;
+ private static string m_freeSwitchEchoServer;
+ private static int m_freeSwitchEchoPort;
+ private static string m_freeSwitchDefaultWellKnownIP;
+ private static int m_freeSwitchDefaultTimeout;
+ private static int m_freeSwitchSubscribeRetry;
+ private static string m_freeSwitchUrlResetPassword;
+ private static IPEndPoint m_FreeSwitchServiceIP;
+
+ private FreeSwitchDirectory m_FreeSwitchDirectory;
+ private FreeSwitchDialplan m_FreeSwitchDialplan;
+
+ private IConfig m_config;
+
+ public void Initialise(Scene scene, IConfigSource config)
+ {
+
+ m_config = config.Configs["FreeSwitchVoice"];
+
+ if (null == m_config)
+ {
+ m_log.Info("[FreeSwitchVoice] no config found, plugin disabled");
+ return;
+ }
+
+ if (!m_config.GetBoolean("enabled", false))
+ {
+ m_log.Info("[FreeSwitchVoice] plugin disabled by configuration");
+ return;
+ }
+
+ // This is only done the FIRST time this method is invoked.
+ if (m_WOF)
+ {
+ m_pluginEnabled = true;
+ m_WOF = false;
+
+ try
+ {
+ m_freeSwitchServerUser = m_config.GetString("freeswitch_server_user", String.Empty);
+ m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty);
+ m_freeSwitchAPIPrefix = m_config.GetString("freeswitch_api_prefix", String.Empty);
+
+ // XXX: get IP address of HTTP server. (This can be this OpenSim server or another, or could be a dedicated grid service or may live on the freeswitch server)
+
+ string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty);
+ int servicePort = m_config.GetInt("freeswitch_service_port", 80);
+ IPAddress serviceIPAddress = IPAddress.Parse(serviceIP);
+ m_FreeSwitchServiceIP = new IPEndPoint(serviceIPAddress, servicePort);
+
+ m_freeSwitchRealm = m_config.GetString("freeswitch_realm", String.Empty);
+ m_freeSwitchSIPProxy = m_config.GetString("freeswitch_sip_proxy", m_freeSwitchRealm);
+ m_freeSwitchAttemptUseSTUN = m_config.GetBoolean("freeswitch_attempt_stun", true);
+ m_freeSwitchSTUNServer = m_config.GetString("freeswitch_stun_server", m_freeSwitchRealm);
+ m_freeSwitchEchoServer = m_config.GetString("freeswitch_echo_server", m_freeSwitchRealm);
+ m_freeSwitchEchoPort = m_config.GetInt("freeswitch_echo_port", 50505);
+ m_freeSwitchDefaultWellKnownIP = m_config.GetString("freeswitch_well_known_ip", m_freeSwitchRealm);
+ m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000);
+ m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
+ m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
+
+
+
+
+ if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
+ String.IsNullOrEmpty(m_freeSwitchServerPass) ||
+ String.IsNullOrEmpty(m_freeSwitchRealm) ||
+ String.IsNullOrEmpty(m_freeSwitchAPIPrefix))
+ {
+ m_log.Error("[FreeSwitchVoice] plugin mis-configured");
+ m_log.Info("[FreeSwitchVoice] plugin disabled: incomplete configuration");
+ return;
+ }
+
+ // set up http request handlers for
+ // - prelogin: viv_get_prelogin.php
+ // - signin: viv_signin.php
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
+ FreeSwitchSLVoiceGetPreloginHTTPHandler);
+
+ // RestStreamHandler h = new RestStreamHandler("GET", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
+ // scene.CommsManager.HttpServer.AddStreamHandler(h);
+
+
+
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
+ FreeSwitchSLVoiceSigninHTTPHandler);
+
+ // set up http request handlers to provide
+ // on-demand FreeSwitch configuration to
+ // FreeSwitch's mod_curl_xml
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix),
+ FreeSwitchConfigHTTPHandler);
+
+ m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
+
+ m_FreeSwitchDirectory = new FreeSwitchDirectory();
+ m_FreeSwitchDialplan = new FreeSwitchDialplan();
+
+ m_pluginEnabled = true;
+ m_WOF = false;
+
+ m_log.Info("[FreeSwitchVoice] plugin enabled");
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.Message);
+ m_log.DebugFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.ToString());
+ return;
+ }
+ }
+
+ if (m_pluginEnabled)
+ {
+ // we need to capture scene in an anonymous method
+ // here as we need it later in the callbacks
+ scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps)
+ {
+ OnRegisterCaps(scene, agentID, caps);
+ };
+
+
+
+ }
+ }
+
+ public void PostInitialise()
+ {
+ }
+
+ public void Close()
+ {
+ }
+
+ public string Name
+ {
+ get { return "FreeSwitchVoiceModule"; }
+ }
+
+ public bool IsSharedModule
+ {
+ get { return true; }
+ }
+
+
+ //
+ // OnRegisterCaps is invoked via the scene.EventManager
+ // everytime OpenSim hands out capabilities to a client
+ // (login, region crossing). We contribute two capabilities to
+ // the set of capabilities handed back to the client:
+ // ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
+ //
+ // ProvisionVoiceAccountRequest allows the client to obtain
+ // the voice account credentials for the avatar it is
+ // controlling (e.g., user name, password, etc).
+ //
+ // ParcelVoiceInfoRequest is invoked whenever the client
+ // changes from one region or parcel to another.
+ //
+ // Note that OnRegisterCaps is called here via a closure
+ // delegate containing the scene of the respective region (see
+ // Initialise()).
+ //
+ public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps)
+ {
+ m_log.DebugFormat("[FreeSwitchVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
+
+ string capsBase = "/CAPS/" + caps.CapsObjectPath;
+ caps.RegisterHandler("ProvisionVoiceAccountRequest",
+ new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ProvisionVoiceAccountRequest(scene, request, path, param,
+ agentID, caps);
+ }));
+ caps.RegisterHandler("ParcelVoiceInfoRequest",
+ new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ParcelVoiceInfoRequest(scene, request, path, param,
+ agentID, caps);
+ }));
+ caps.RegisterHandler("ChatSessionRequest",
+ new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ChatSessionRequest(scene, request, path, param,
+ agentID, caps);
+ }));
+ }
+
+ ///
+ /// Callback for a client request for Voice Account Details
+ ///
+ /// current scene object of the client
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ ScenePresence avatar = scene.GetScenePresence(agentID);
+ string avatarName = avatar.Name;
+
+ try
+ {
+ m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
+ request, path, param);
+
+ //XmlElement resp;
+ string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
+ string password = "1234";//temp hack//new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16);
+
+ // XXX: we need to cache the voice credentials, as
+ // FreeSwitch is later going to come and ask us for
+ // those
+
+ agentname = agentname.Replace('+', '-').Replace('/', '_');
+
+ // LLSDVoiceAccountResponse voiceAccountResponse =
+ // new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
+ LLSDVoiceAccountResponse voiceAccountResponse =
+ new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
+ String.Format("http://{0}/{1}/", m_FreeSwitchServiceIP,
+ m_freeSwitchAPIPrefix));
+
+ string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
+
+ m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1}", avatarName, r);
+
+ return r;
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1}, retry later", avatarName, e.Message);
+ m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1} failed", avatarName, e.ToString());
+
+ return "undef";
+ }
+ }
+
+ ///
+ /// Callback for a client request for ParcelVoiceInfo
+ ///
+ /// current scene object of the client
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ ScenePresence avatar = scene.GetScenePresence(agentID);
+ string avatarName = avatar.Name;
+
+ // - check whether we have a region channel in our cache
+ // - if not:
+ // create it and cache it
+ // - send it to the client
+ // - send channel_uri: as "sip:regionID@m_sipDomain"
+ try
+ {
+ LLSDParcelVoiceInfoResponse parcelVoiceInfo;
+ string channelUri;
+
+ if (null == scene.LandChannel)
+ throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
+ scene.RegionInfo.RegionName, avatarName));
+
+
+
+ // get channel_uri: check first whether estate
+ // settings allow voice, then whether parcel allows
+ // voice, if all do retrieve or obtain the parcel
+ // voice channel
+ LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
+
+ m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
+ scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);
+
+ // TODO: EstateSettings don't seem to get propagated...
+ // if (!scene.RegionInfo.EstateSettings.AllowVoice)
+ // {
+ // m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings",
+ // scene.RegionInfo.RegionName);
+ // channel_uri = String.Empty;
+ // }
+ // else
+
+ if ((land.Flags & (uint)Parcel.ParcelFlags.AllowVoiceChat) == 0)
+ {
+ m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
+ scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
+ channelUri = String.Empty;
+ }
+ else
+ {
+ channelUri = ChannelUri(scene, land);
+ }
+
+ // fill in our response to the client
+ Hashtable creds = new Hashtable();
+ creds["channel_uri"] = channelUri;
+
+ parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
+ string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
+
+ m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
+ scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
+ return r;
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
+ scene.RegionInfo.RegionName, avatarName, e.Message);
+ m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
+ scene.RegionInfo.RegionName, avatarName, e.ToString());
+
+ return "undef";
+ }
+ }
+
+
+ ///
+ /// Callback for a client request for ChatSessionRequest
+ ///
+ /// current scene object of the client
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ChatSessionRequest(Scene scene, string request, string path, string param,
+ UUID agentID, Caps caps)
+ {
+ ScenePresence avatar = scene.GetScenePresence(agentID);
+ string avatarName = avatar.Name;
+
+ m_log.DebugFormat("[FreeSwitchVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}",
+ avatarName, request, path, param);
+ return "true";
+ }
+
+
+ public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
+ {
+ m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
+
+ Hashtable response = new Hashtable();
+ response["content_type"] = "text/xml";
+ response["keepalive"] = false;
+
+ response["str_response_string"] = String.Format(
+ "\r\n" +
+ "\r\n"+
+ "{0}\r\n" +
+ "{1}\r\n"+
+ "{2}\r\n"+
+ "{3}\r\n"+
+ "{4}\r\n"+
+ "{5}\r\n"+
+ "{6}\r\n"+
+ "{7}\r\n"+
+ "{8}\r\n"+
+ "\r\n"+
+ "false\r\n"+
+ ""
+ ,
+ m_freeSwitchRealm,m_freeSwitchSIPProxy,m_freeSwitchAttemptUseSTUN,
+ m_freeSwitchSTUNServer,m_freeSwitchEchoServer,m_freeSwitchEchoPort,
+ m_freeSwitchDefaultWellKnownIP,m_freeSwitchDefaultTimeout,m_freeSwitchUrlResetPassword,"");
+
+ response["int_response_code"] = 200;
+
+ m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
+ return response;
+ }
+
+ public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request)
+ {
+ m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called");
+
+ Hashtable response = new Hashtable();
+ response["str_response_string"] = @"
+
+ OK
+
+ 200
+ auth successful
+
+
+ ";
+ response["int_response_code"] = 200;
+ return response;
+ }
+
+
+ public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
+ {
+ m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}",request.ToString());
+
+ Hashtable response = new Hashtable();
+
+ // all the params come as NVPs in the request body
+ Hashtable requestBody = parseRequestBody((string) request["body"]);
+
+ // is this a dialplan or directory request
+ string section = (string) requestBody["section"];
+
+ if(section=="directory")
+ response = m_FreeSwitchDirectory.HandleDirectoryRequest(requestBody);
+ else if (section=="dialplan")
+ response = m_FreeSwitchDialplan.HandleDialplanRequest(requestBody);
+
+ // XXX: re-generate dialplan:
+ // - conf == region UUID
+ // - conf number = region port
+ // -> TODO Initialise(): keep track of regions via events
+ // re-generate accounts for all avatars
+ // -> TODO Initialise(): keep track of avatars via events
+ m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler return {0}",response["str_response_string"]);
+ return response;
+ }
+
+ public Hashtable parseRequestBody(string body)
+ {
+ Hashtable bodyParams = new Hashtable();
+ // split string
+ string [] nvps = body.Split(new Char [] {'&'});
+
+ foreach (string s in nvps) {
+
+ if (s.Trim() != "")
+ {
+ string [] nvp = s.Split(new Char [] {'='});
+ bodyParams.Add(HttpUtility.UrlDecode(nvp[0]),HttpUtility.UrlDecode(nvp[1]));
+ }
+ }
+
+ return bodyParams;
+
+ }
+
+ private string ChannelUri(Scene scene, LandData land)
+ {
+
+ string channelUri = null;
+
+ string landUUID;
+ string landName;
+
+ // 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.
+
+ if (land.LocalID != 1 && (land.Flags & (uint)Parcel.ParcelFlags.UseEstateVoiceChan) == 0)
+ {
+ landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name);
+ landUUID = land.GlobalID.ToString();
+ m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
+ landName, land.LocalID, landUUID);
+ }
+ else
+ {
+ landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionName);
+ landUUID = scene.RegionInfo.RegionID.ToString();
+ m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
+ landName, land.LocalID, landUUID);
+ }
+ System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
+ channelUri = String.Format("sip:confctl-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm);
+
+ //channelUri="sip:confctl-3001@9.20.151.43";
+ //channelUri="sip:opensimconf-3001@9.20.151.43";
+
+ return channelUri;
+ }
+ }
+}
--
cgit v1.1
From 4a8313f14c0aeffc87d37bd1f6c633a61c0a0fca Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Tue, 21 Apr 2009 16:06:16 +0000
Subject: culling AsteriskVoiceModule and SIPVoiceModule, now that we have
working FreeSwitchVoiceModule and soon will have a fully working
VivoxVoiceModule.
---
.../Voice/AsterixVoice/AsteriskVoiceModule.cs | 292 ---------------------
.../Avatar/Voice/SIPVoice/SIPVoiceModule.cs | 234 -----------------
2 files changed, 526 deletions(-)
delete mode 100644 OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
delete mode 100644 OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
deleted file mode 100644
index c827214..0000000
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * 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 OpenSim 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;
-using System.Collections;
-using System.Reflection;
-using OpenMetaverse;
-using log4net;
-using Nini.Config;
-using Nwc.XmlRpc;
-using OpenSim.Framework;
-using OpenSim.Framework.Communications.Cache;
-using OpenSim.Framework.Communications.Capabilities;
-using OpenSim.Framework.Servers;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
-
-namespace OpenSim.Region.OptionalModules.Avatar.Voice.AsterixVoice
-{
- public class AsteriskVoiceModule : IRegionModule
- {
- private static readonly ILog m_log =
- LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
- private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
-
- private string m_asterisk;
- private string m_asterisk_password;
- private string m_asterisk_salt;
- private int m_asterisk_timeout;
- private string m_confDomain;
- private IConfig m_config;
- private Scene m_scene;
- private string m_sipDomain;
-
- #region IRegionModule Members
-
- public void Initialise(Scene scene, IConfigSource config)
- {
- m_scene = scene;
- m_config = config.Configs["AsteriskVoice"];
-
- if (null == m_config)
- {
- m_log.Info("[ASTERISKVOICE] no config found, plugin disabled");
- return;
- }
-
- if (!m_config.GetBoolean("enabled", false))
- {
- m_log.Info("[ASTERISKVOICE] plugin disabled by configuration");
- return;
- }
- m_log.Info("[ASTERISKVOICE] plugin enabled");
-
- try
- {
- m_sipDomain = m_config.GetString("sip_domain", String.Empty);
- m_log.InfoFormat("[ASTERISKVOICE] using SIP domain {0}", m_sipDomain);
-
- m_confDomain = m_config.GetString("conf_domain", String.Empty);
- m_log.InfoFormat("[ASTERISKVOICE] using conf domain {0}", m_confDomain);
-
- m_asterisk = m_config.GetString("asterisk_frontend", String.Empty);
- m_asterisk_password = m_config.GetString("asterisk_password", String.Empty);
- m_asterisk_timeout = m_config.GetInt("asterisk_timeout", 3000);
- m_asterisk_salt = m_config.GetString("asterisk_salt", "Wuffwuff");
- if (String.IsNullOrEmpty(m_asterisk)) throw new Exception("missing asterisk_frontend config parameter");
- if (String.IsNullOrEmpty(m_asterisk_password)) throw new Exception("missing asterisk_password config parameter");
- m_log.InfoFormat("[ASTERISKVOICE] using asterisk front end {0}", m_asterisk);
-
- scene.EventManager.OnRegisterCaps += OnRegisterCaps;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.Message);
- m_log.DebugFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.ToString());
- return;
- }
- }
-
- public void PostInitialise()
- {
- }
-
- public void Close()
- {
- }
-
- public string Name
- {
- get { return "AsteriskVoiceModule"; }
- }
-
- public bool IsSharedModule
- {
- get { return false; }
- }
-
- #endregion
-
- public void OnRegisterCaps(UUID agentID, Caps caps)
- {
- m_log.DebugFormat("[ASTERISKVOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
- string capsBase = "/CAPS/" + caps.CapsObjectPath;
- caps.RegisterHandler("ParcelVoiceInfoRequest",
- new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
- delegate(string request, string path, string param,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
- return ParcelVoiceInfoRequest(request, path, param,
- agentID, caps);
- }));
- caps.RegisterHandler("ProvisionVoiceAccountRequest",
- new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
- delegate(string request, string path, string param,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
- return ProvisionVoiceAccountRequest(request, path, param,
- agentID, caps);
- }));
- }
-
- ///
- /// Callback for a client request for ParcelVoiceInfo
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public string ParcelVoiceInfoRequest(string request, string path, string param,
- UUID agentID, Caps caps)
- {
- // we need to do:
- // - send channel_uri: as "sip:regionID@m_sipDomain"
- try
- {
- m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: request: {0}, path: {1}, param: {2}",
- request, path, param);
-
-
- // setup response to client
- Hashtable creds = new Hashtable();
- creds["channel_uri"] = String.Format("sip:{0}@{1}",
- m_scene.RegionInfo.RegionID, m_sipDomain);
-
- string regionName = m_scene.RegionInfo.RegionName;
- ScenePresence avatar = m_scene.GetScenePresence(agentID);
- if (null == m_scene.LandChannel) throw new Exception("land data not yet available");
- LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
-
- LLSDParcelVoiceInfoResponse parcelVoiceInfo =
- new LLSDParcelVoiceInfoResponse(regionName, land.LocalID, creds);
-
- string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
-
-
- // update region on asterisk-opensim frontend
- Hashtable requestData = new Hashtable();
- requestData["admin_password"] = m_asterisk_password;
- requestData["region"] = m_scene.RegionInfo.RegionID.ToString();
- if (!String.IsNullOrEmpty(m_confDomain))
- {
- requestData["region"] += String.Format("@{0}", m_confDomain);
- }
-
- ArrayList SendParams = new ArrayList();
- SendParams.Add(requestData);
- XmlRpcRequest updateAccountRequest = new XmlRpcRequest("region_update", SendParams);
- XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout);
- Hashtable responseData = (Hashtable) updateAccountResponse.Value;
-
- if (!responseData.ContainsKey("success")) throw new Exception("region_update call failed");
-
- bool success = Convert.ToBoolean((string) responseData["success"]);
- if (!success) throw new Exception("region_update failed");
-
-
- m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: {0}", r);
- return r;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0}, retry later", e.Message);
- m_log.DebugFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0} failed", e.ToString());
-
- return "undef";
- }
- }
-
- ///
- /// Callback for a client request for Voice Account Details
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public string ProvisionVoiceAccountRequest(string request, string path, string param,
- UUID agentID, Caps caps)
- {
- // we need to
- // - get user data from UserProfileCacheService
- // - generate nonce for user voice account password
- // - issue XmlRpc request to asterisk opensim front end:
- // + user: base 64 encoded user name (otherwise SL
- // client is unhappy)
- // + password: nonce
- // - the XmlRpc call to asteris-opensim was successful:
- // send account details back to client
- try
- {
- m_log.DebugFormat("[ASTERISKVOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
- request, path, param);
-
- // get user data & prepare voice account response
- string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes());
- voiceUser = voiceUser.Replace('+', '-').Replace('/', '_');
-
- CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
- if (null == userInfo) throw new Exception("cannot get user details");
-
- // we generate a nonce everytime
- string voicePassword = "$1$" + Util.Md5Hash(DateTime.UtcNow.ToLongTimeString() + m_asterisk_salt);
- LLSDVoiceAccountResponse voiceAccountResponse =
- new LLSDVoiceAccountResponse(voiceUser, voicePassword);
- string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
- m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);
-
-
- // update user account on asterisk frontend
- Hashtable requestData = new Hashtable();
- requestData["admin_password"] = m_asterisk_password;
- requestData["username"] = voiceUser;
- if (!String.IsNullOrEmpty(m_sipDomain))
- {
- requestData["username"] += String.Format("@{0}", m_sipDomain);
- }
- requestData["password"] = voicePassword;
-
- ArrayList SendParams = new ArrayList();
- SendParams.Add(requestData);
- XmlRpcRequest updateAccountRequest = new XmlRpcRequest("account_update", SendParams);
- XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout);
- Hashtable responseData = (Hashtable) updateAccountResponse.Value;
-
- if (!responseData.ContainsKey("success")) throw new Exception("account_update call failed");
-
- bool success = Convert.ToBoolean((string) responseData["success"]);
- if (!success) throw new Exception("account_update failed");
-
- return r;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0}, retry later", e.Message);
- m_log.DebugFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0} failed", e.ToString());
-
- return "undef";
- }
- }
- }
-}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
deleted file mode 100644
index d00a256..0000000
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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 OpenSim 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;
-using System.Collections;
-using System.Reflection;
-using OpenMetaverse;
-using log4net;
-using Nini.Config;
-using OpenSim.Framework;
-using OpenSim.Framework.Communications.Cache;
-using OpenSim.Framework.Communications.Capabilities;
-using OpenSim.Framework.Servers;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
-
-namespace OpenSim.Region.OptionalModules.Avatar.Voice.SIPVoice
-{
- public class SIPVoiceModule : IRegionModule
- {
- private static readonly ILog m_log =
- LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
- private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
- private static readonly string m_chatSessionRequestPath = "0009/";
- private IConfig m_config;
- private Scene m_scene;
- private string m_sipDomain;
-
- #region IRegionModule Members
-
- public void Initialise(Scene scene, IConfigSource config)
- {
- m_scene = scene;
- m_config = config.Configs["Voice"];
-
- if (null == m_config || !m_config.GetBoolean("enabled", false))
- {
- m_log.Info("[VOICE] plugin disabled");
- return;
- }
- m_log.Info("[VOICE] plugin enabled");
-
- m_sipDomain = m_config.GetString("sip_domain", String.Empty);
- if (String.IsNullOrEmpty(m_sipDomain))
- {
- m_log.Error("[VOICE] plugin mis-configured: missing sip_domain configuration");
- m_log.Info("[VOICE] plugin disabled");
- return;
- }
- m_log.InfoFormat("[VOICE] using SIP domain {0}", m_sipDomain);
-
- scene.EventManager.OnRegisterCaps += OnRegisterCaps;
- }
-
- public void PostInitialise()
- {
- }
-
- public void Close()
- {
- }
-
- public string Name
- {
- get { return "VoiceModule"; }
- }
-
- public bool IsSharedModule
- {
- get { return false; }
- }
-
- #endregion
-
- public void OnRegisterCaps(UUID agentID, Caps caps)
- {
- m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
- string capsBase = "/CAPS/" + caps.CapsObjectPath;
- caps.RegisterHandler("ParcelVoiceInfoRequest",
- new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
- delegate(string request, string path, string param,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
- return ParcelVoiceInfoRequest(request, path, param,
- agentID, caps);
- }));
- caps.RegisterHandler("ProvisionVoiceAccountRequest",
- new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
- delegate(string request, string path, string param,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
- return ProvisionVoiceAccountRequest(request, path, param,
- agentID, caps);
- }));
- caps.RegisterHandler("ChatSessionRequest",
- new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
- delegate(string request, string path, string param,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
- return ChatSessionRequest(request, path, param,
- agentID, caps);
- }));
-
- }
-
- ///
- /// Callback for a client request for ParcelVoiceInfo
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public string ParcelVoiceInfoRequest(string request, string path, string param,
- UUID agentID, Caps caps)
- {
- try
- {
- m_log.DebugFormat("[VOICE][PARCELVOICE]: request: {0}, path: {1}, param: {2}", request, path, param);
-
- // FIXME: get the creds from region file or from config
- Hashtable creds = new Hashtable();
-
- creds["channel_uri"] = String.Format("sip:{0}@{1}", agentID, m_sipDomain);
-
- string regionName = m_scene.RegionInfo.RegionName;
- ScenePresence avatar = m_scene.GetScenePresence(agentID);
- if (null == m_scene.LandChannel) throw new Exception("land data not yet available");
- LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
-
- LLSDParcelVoiceInfoResponse parcelVoiceInfo =
- new LLSDParcelVoiceInfoResponse(regionName, land.LocalID, creds);
-
- string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
- m_log.DebugFormat("[VOICE][PARCELVOICE]: {0}", r);
-
- return r;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[CAPS]: {0}, try again later", e.ToString());
- }
-
- return null;
- }
-
- ///
- /// Callback for a client request for Voice Account Details
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public string ProvisionVoiceAccountRequest(string request, string path, string param,
- UUID agentID, Caps caps)
- {
- try
- {
- m_log.DebugFormat("[VOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
- request, path, param);
-
- string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes());
- voiceUser = voiceUser.Replace('+', '-').Replace('/', '_');
-
- CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
- if (null == userInfo) throw new Exception("cannot get user details");
-
- LLSDVoiceAccountResponse voiceAccountResponse =
- new LLSDVoiceAccountResponse(voiceUser, "$1$" + userInfo.UserProfile.PasswordHash);
- string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
- m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);
- return r;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[CAPS][PROVISIONVOICE]: {0}, retry later", e.Message);
- }
-
- return null;
- }
-
- ///
- /// Callback for a client request for ParcelVoiceInfo
- ///
- /// current scene object of the client
- ///
- ///
- ///
- ///
- ///
- ///
- public string ChatSessionRequest(string request, string path, string param,
- UUID agentID, Caps caps)
- {
- ScenePresence avatar = m_scene.GetScenePresence(agentID);
- string avatarName = avatar.Name;
-
- m_log.DebugFormat("[CAPS][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}",
- avatarName, request, path, param);
- return "true";
- }
-
- }
-}
--
cgit v1.1
From 6aa5d3904d71c4be21e5991d9ba82dff3c1cf51f Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Wed, 22 Apr 2009 00:48:56 +0000
Subject: Add copyright headers. Formatting cleanup.
---
.../Voice/FreeSwitchVoice/FreeSwitchDialplan.cs | 60 ++++++++--------
.../Voice/FreeSwitchVoice/FreeSwitchDirectory.cs | 84 +++++++++++-----------
.../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 2 +-
3 files changed, 73 insertions(+), 73 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
index 2a2b4a3..d8fce67 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
Hashtable response = new Hashtable();
- foreach(DictionaryEntry item in request)
+ foreach (DictionaryEntry item in request)
{
m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
}
@@ -52,37 +52,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["keepalive"] = false;
response["int_response_code"]=200;
response["str_response_string"] = @"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ";
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
return response;
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index 9959d11..4113976 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
//domain=9.20.151.43
//ip=9.167.220.137 // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup
- foreach(DictionaryEntry item in request)
+ foreach (DictionaryEntry item in request)
{
m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
}
@@ -71,41 +71,41 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string eventCallingFunction = (string) request["Event-Calling-Function"];
- if(eventCallingFunction=="sofia_reg_parse_auth")
+ if (eventCallingFunction=="sofia_reg_parse_auth")
{
string sipAuthMethod = (string)request["sip_auth_method"];
-
- if(sipAuthMethod=="REGISTER")
- {
- response = HandleRegister(request);
- }
- else if(sipAuthMethod=="INVITE")
- {
- response = HandleInvite(request);
- }
- else
- {
- m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
- response["int_response_code"]=404;
- }
+
+ if (sipAuthMethod=="REGISTER")
+ {
+ response = HandleRegister(request);
+ }
+ else if (sipAuthMethod=="INVITE")
+ {
+ response = HandleInvite(request);
+ }
+ else
+ {
+ m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
+ response["int_response_code"]=404;
+ }
}
- else if(eventCallingFunction=="switch_xml_locate_user")
- {
- response = HandleLocateUser(request);
+ else if (eventCallingFunction=="switch_xml_locate_user")
+ {
+ response = HandleLocateUser(request);
}
- else if(eventCallingFunction=="user_data_function") // gets called when an avatar to avatar call is made
+ else if (eventCallingFunction=="user_data_function") // gets called when an avatar to avatar call is made
{
response = HandleLocateUser(request);
}
- else if(eventCallingFunction=="user_outgoing_channel")
+ else if (eventCallingFunction=="user_outgoing_channel")
{
response = HandleRegister(request);
}
- else if(eventCallingFunction=="config_sofia") // happens once on freeswitch startup
+ else if (eventCallingFunction=="config_sofia") // happens once on freeswitch startup
{
response = HandleConfigSofia(request);
}
- else if(eventCallingFunction=="switch_load_network_lists")
+ else if (eventCallingFunction=="switch_load_network_lists")
{
//response = HandleLoadNetworkLists(request);
response["int_response_code"]=404;
@@ -266,24 +266,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n"+
"\r\n"+
"\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
+ "\r\n"+
""+
"\r\n" +
"\r\n"+
@@ -332,4 +332,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index a8f9de6..fcb1c97 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -500,7 +500,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// is this a dialplan or directory request
string section = (string) requestBody["section"];
- if(section=="directory")
+ if (section=="directory")
response = m_FreeSwitchDirectory.HandleDirectoryRequest(requestBody);
else if (section=="dialplan")
response = m_FreeSwitchDialplan.HandleDialplanRequest(requestBody);
--
cgit v1.1
From c397f05be74487d18eb2e60d52dadffc496aa19e Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Wed, 22 Apr 2009 06:07:39 +0000
Subject: * Some tweaks to the FreeSwitchModule to allow a well known hostname
and avoid a double // in a path which causes account verification to fail *
The change shouldn't affect anyone who has it working currently and makes it
a ton easier for everyone else to get it working. * Handle a case when
there's no Event-Calling-Function but it's obviously a REGISTER method
---
.../Voice/FreeSwitchVoice/FreeSwitchDirectory.cs | 14 +++++++++++++-
.../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 21 +++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index 4113976..24f114d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -69,7 +69,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
string eventCallingFunction = (string) request["Event-Calling-Function"];
-
+ if (eventCallingFunction == null)
+ {
+ eventCallingFunction = "sofia_reg_parse_auth";
+ }
+
+ if (eventCallingFunction.Length == 0)
+ {
+ eventCallingFunction = "sofia_reg_parse_auth";
+ }
if (eventCallingFunction=="sofia_reg_parse_auth")
{
@@ -110,12 +118,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
//response = HandleLoadNetworkLists(request);
response["int_response_code"]=404;
response["keepalive"] = false;
+ response["content_type"] = "text/xml";
+ response["str_response_string"] = "";
}
else
{
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction);
response["int_response_code"]=404;
response["keepalive"] = false;
+ response["content_type"] = "text/xml";
+ response["str_response_string"] = "";
}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index fcb1c97..6fb2c53 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -90,6 +90,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private static int m_freeSwitchSubscribeRetry;
private static string m_freeSwitchUrlResetPassword;
private static IPEndPoint m_FreeSwitchServiceIP;
+ private int m_freeSwitchServicePort;
+ private string m_openSimWellKnownHTTPAddress;
private FreeSwitchDirectory m_FreeSwitchDirectory;
private FreeSwitchDialplan m_FreeSwitchDialplan;
@@ -131,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
int servicePort = m_config.GetInt("freeswitch_service_port", 80);
IPAddress serviceIPAddress = IPAddress.Parse(serviceIP);
m_FreeSwitchServiceIP = new IPEndPoint(serviceIPAddress, servicePort);
-
+ m_freeSwitchServicePort = servicePort;
m_freeSwitchRealm = m_config.GetString("freeswitch_realm", String.Empty);
m_freeSwitchSIPProxy = m_config.GetString("freeswitch_sip_proxy", m_freeSwitchRealm);
m_freeSwitchAttemptUseSTUN = m_config.GetBoolean("freeswitch_attempt_stun", true);
@@ -139,6 +141,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_freeSwitchEchoServer = m_config.GetString("freeswitch_echo_server", m_freeSwitchRealm);
m_freeSwitchEchoPort = m_config.GetInt("freeswitch_echo_port", 50505);
m_freeSwitchDefaultWellKnownIP = m_config.GetString("freeswitch_well_known_ip", m_freeSwitchRealm);
+ m_openSimWellKnownHTTPAddress = m_config.GetString("opensim_well_known_http_address", serviceIPAddress.ToString());
m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000);
m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
@@ -306,12 +309,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// those
agentname = agentname.Replace('+', '-').Replace('/', '_');
-
+
// LLSDVoiceAccountResponse voiceAccountResponse =
// new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
LLSDVoiceAccountResponse voiceAccountResponse =
new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
- String.Format("http://{0}/{1}/", m_FreeSwitchServiceIP,
+ String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress, m_freeSwitchServicePort,
m_freeSwitchAPIPrefix));
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
@@ -490,20 +493,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
{
- m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}",request.ToString());
+ m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}", (string)request["body"]);
Hashtable response = new Hashtable();
// all the params come as NVPs in the request body
Hashtable requestBody = parseRequestBody((string) request["body"]);
-
+
// is this a dialplan or directory request
string section = (string) requestBody["section"];
-
- if (section=="directory")
+
+ if (section == "directory")
response = m_FreeSwitchDirectory.HandleDirectoryRequest(requestBody);
- else if (section=="dialplan")
+ else if (section == "dialplan")
response = m_FreeSwitchDialplan.HandleDialplanRequest(requestBody);
+ else
+ m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
// XXX: re-generate dialplan:
// - conf == region UUID
--
cgit v1.1
From 458f7eb9b38609d02980afe5a6ee88d19c7dd7f8 Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Wed, 22 Apr 2009 09:42:44 +0000
Subject: cleaning up, fixing warnings
---
.../Voice/FreeSwitchVoice/FreeSwitchDialplan.cs | 2 +-
.../Voice/FreeSwitchVoice/FreeSwitchDirectory.cs | 63 ++++++++++------------
.../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 42 +++++++--------
3 files changed, 46 insertions(+), 61 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
index d8fce67..039cc2f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["content_type"] = "text/xml";
response["keepalive"] = false;
- response["int_response_code"]=200;
+ response["int_response_code"] = 200;
response["str_response_string"] = @"
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index 24f114d..fd384e4 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
foreach (DictionaryEntry item in request)
{
- m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
+ m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}", item.Key, item.Value);
}
string eventCallingFunction = (string) request["Event-Calling-Function"];
@@ -79,44 +79,44 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
eventCallingFunction = "sofia_reg_parse_auth";
}
- if (eventCallingFunction=="sofia_reg_parse_auth")
+ if (eventCallingFunction == "sofia_reg_parse_auth")
{
string sipAuthMethod = (string)request["sip_auth_method"];
- if (sipAuthMethod=="REGISTER")
+ if (sipAuthMethod == "REGISTER")
{
response = HandleRegister(request);
}
- else if (sipAuthMethod=="INVITE")
+ else if (sipAuthMethod == "INVITE")
{
response = HandleInvite(request);
}
else
{
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
- response["int_response_code"]=404;
+ response["int_response_code"] = 404;
}
}
- else if (eventCallingFunction=="switch_xml_locate_user")
+ else if (eventCallingFunction == "switch_xml_locate_user")
{
response = HandleLocateUser(request);
}
- else if (eventCallingFunction=="user_data_function") // gets called when an avatar to avatar call is made
+ else if (eventCallingFunction == "user_data_function") // gets called when an avatar to avatar call is made
{
response = HandleLocateUser(request);
}
- else if (eventCallingFunction=="user_outgoing_channel")
+ else if (eventCallingFunction == "user_outgoing_channel")
{
response = HandleRegister(request);
}
- else if (eventCallingFunction=="config_sofia") // happens once on freeswitch startup
+ else if (eventCallingFunction == "config_sofia") // happens once on freeswitch startup
{
response = HandleConfigSofia(request);
}
- else if (eventCallingFunction=="switch_load_network_lists")
+ else if (eventCallingFunction == "switch_load_network_lists")
{
//response = HandleLoadNetworkLists(request);
- response["int_response_code"]=404;
+ response["int_response_code"] = 404;
response["keepalive"] = false;
response["content_type"] = "text/xml";
response["str_response_string"] = "";
@@ -124,14 +124,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
else
{
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction);
- response["int_response_code"]=404;
+ response["int_response_code"] = 404;
response["keepalive"] = false;
response["content_type"] = "text/xml";
response["str_response_string"] = "";
}
-
-
-
return response;
}
@@ -147,7 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
Hashtable response = new Hashtable();
response["content_type"] = "text/xml";
response["keepalive"] = false;
- response["int_response_code"]=200;
+ response["int_response_code"] = 200;
response["str_response_string"] = String.Format(
"\r\n" +
"\r\n" +
@@ -165,11 +162,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n"
- , domain , user, password);
+ "\r\n",
+ domain , user, password);
return response;
-
}
private Hashtable HandleInvite(Hashtable request)
@@ -185,7 +181,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
Hashtable response = new Hashtable();
response["content_type"] = "text/xml";
response["keepalive"] = false;
- response["int_response_code"]=200;
+ response["int_response_code"] = 200;
response["str_response_string"] = String.Format(
"\r\n" +
"\r\n" +
@@ -213,8 +209,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n"
- , domain , user, password,sipRequestUser);
+ "\r\n",
+ domain , user, password,sipRequestUser);
return response;
}
@@ -231,7 +227,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
Hashtable response = new Hashtable();
response["content_type"] = "text/xml";
response["keepalive"] = false;
- response["int_response_code"]=200;
+ response["int_response_code"] = 200;
response["str_response_string"] = String.Format(
"\r\n" +
"\r\n" +
@@ -248,10 +244,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n"
- , domain , user);
-
-
+ "\r\n",
+ domain , user);
return response;
}
@@ -266,7 +260,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
Hashtable response = new Hashtable();
response["content_type"] = "text/xml";
response["keepalive"] = false;
- response["int_response_code"]=200;
+ response["int_response_code"] = 200;
response["str_response_string"] = String.Format(
"\r\n" +
"\r\n" +
@@ -303,9 +297,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n"+
"\r\n" +
"\r\n" +
- "\r\n"
- , domain);
-
+ "\r\n",
+ domain);
return response;
}
@@ -320,7 +313,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
Hashtable response = new Hashtable();
response["content_type"] = "text/xml";
response["keepalive"] = false;
- response["int_response_code"]=200;
+ response["int_response_code"] = 200;
response["str_response_string"] = String.Format(
"\r\n" +
"\r\n" +
@@ -335,13 +328,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n"+
"\r\n" +
"\r\n" +
- "\r\n"
- , domain);
+ "\r\n",
+ domain);
return response;
}
-
}
-
}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 6fb2c53..358f1cd 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -54,7 +54,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// Infrastructure
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private static readonly bool DUMP = true;
// Capability string prefixes
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
@@ -87,9 +86,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private static int m_freeSwitchEchoPort;
private static string m_freeSwitchDefaultWellKnownIP;
private static int m_freeSwitchDefaultTimeout;
- private static int m_freeSwitchSubscribeRetry;
+ // private static int m_freeSwitchSubscribeRetry;
private static string m_freeSwitchUrlResetPassword;
- private static IPEndPoint m_FreeSwitchServiceIP;
+ // private static IPEndPoint m_FreeSwitchServiceIP;
private int m_freeSwitchServicePort;
private string m_openSimWellKnownHTTPAddress;
@@ -132,7 +131,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty);
int servicePort = m_config.GetInt("freeswitch_service_port", 80);
IPAddress serviceIPAddress = IPAddress.Parse(serviceIP);
- m_FreeSwitchServiceIP = new IPEndPoint(serviceIPAddress, servicePort);
+ // m_FreeSwitchServiceIP = new IPEndPoint(serviceIPAddress, servicePort);
m_freeSwitchServicePort = servicePort;
m_freeSwitchRealm = m_config.GetString("freeswitch_realm", String.Empty);
m_freeSwitchSIPProxy = m_config.GetString("freeswitch_sip_proxy", m_freeSwitchRealm);
@@ -143,12 +142,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_freeSwitchDefaultWellKnownIP = m_config.GetString("freeswitch_well_known_ip", m_freeSwitchRealm);
m_openSimWellKnownHTTPAddress = m_config.GetString("opensim_well_known_http_address", serviceIPAddress.ToString());
m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000);
- m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
+ // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
-
-
-
if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
String.IsNullOrEmpty(m_freeSwitchServerPass) ||
String.IsNullOrEmpty(m_freeSwitchRealm) ||
@@ -163,12 +159,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// - prelogin: viv_get_prelogin.php
// - signin: viv_signin.php
scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
- FreeSwitchSLVoiceGetPreloginHTTPHandler);
+ FreeSwitchSLVoiceGetPreloginHTTPHandler);
- // RestStreamHandler h = new RestStreamHandler("GET", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
+ // RestStreamHandler h = new
+ // RestStreamHandler("GET",
+ // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
// scene.CommsManager.HttpServer.AddStreamHandler(h);
-
-
scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceSigninHTTPHandler);
@@ -307,15 +303,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// XXX: we need to cache the voice credentials, as
// FreeSwitch is later going to come and ask us for
// those
-
agentname = agentname.Replace('+', '-').Replace('/', '_');
// LLSDVoiceAccountResponse voiceAccountResponse =
// new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
LLSDVoiceAccountResponse voiceAccountResponse =
- new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
- String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress, m_freeSwitchServicePort,
- m_freeSwitchAPIPrefix));
+ new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
+ String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
+ m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
@@ -346,7 +341,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
UUID agentID, Caps caps)
{
ScenePresence avatar = scene.GetScenePresence(agentID);
- string avatarName = avatar.Name;
+ string avatarName = avatar.Name;
// - check whether we have a region channel in our cache
// - if not:
@@ -460,11 +455,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"{8}\r\n"+
"\r\n"+
"false\r\n"+
- ""
- ,
- m_freeSwitchRealm,m_freeSwitchSIPProxy,m_freeSwitchAttemptUseSTUN,
- m_freeSwitchSTUNServer,m_freeSwitchEchoServer,m_freeSwitchEchoPort,
- m_freeSwitchDefaultWellKnownIP,m_freeSwitchDefaultTimeout,m_freeSwitchUrlResetPassword,"");
+ "",
+ m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
+ m_freeSwitchSTUNServer, m_freeSwitchEchoServer, m_freeSwitchEchoPort,
+ m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
+ m_freeSwitchUrlResetPassword, "");
response["int_response_code"] = 200;
@@ -531,12 +526,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
if (s.Trim() != "")
{
string [] nvp = s.Split(new Char [] {'='});
- bodyParams.Add(HttpUtility.UrlDecode(nvp[0]),HttpUtility.UrlDecode(nvp[1]));
+ bodyParams.Add(HttpUtility.UrlDecode(nvp[0]), HttpUtility.UrlDecode(nvp[1]));
}
}
return bodyParams;
-
}
private string ChannelUri(Scene scene, LandData land)
--
cgit v1.1
From c25ceb009e644579c56811faffded540658cd4dd Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 22 Apr 2009 19:43:58 +0000
Subject: * minor: remove some compiler warnings
---
.../Voice/FreeSwitchVoice/FreeSwitchDirectory.cs | 62 +++++++++++-----------
1 file changed, 31 insertions(+), 31 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index fd384e4..c131a7f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -303,36 +303,36 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return response;
}
- private Hashtable HandleLoadNetworkLists(Hashtable request)
- {
- m_log.Info("[FreeSwitchDirectory] HandleLoadNetworkLists called");
-
- // TODO the password we return needs to match that sent in the request, this is hard coded for now
- string domain = (string) request["domain"];
-
- Hashtable response = new Hashtable();
- response["content_type"] = "text/xml";
- response["keepalive"] = false;
- response["int_response_code"] = 200;
- response["str_response_string"] = String.Format(
- "\r\n" +
- "\r\n" +
- "\r\n" +
- "\r\n" +
- "\r\n" +
- "\r\n" +
- "\r\n" +
- "\r\n" +
- "\r\n"+
- "\r\n"+
- "\r\n"+
- "\r\n" +
- "\r\n" +
- "\r\n",
- domain);
-
-
- return response;
- }
+// private Hashtable HandleLoadNetworkLists(Hashtable request)
+// {
+// m_log.Info("[FreeSwitchDirectory] HandleLoadNetworkLists called");
+//
+// // TODO the password we return needs to match that sent in the request, this is hard coded for now
+// string domain = (string) request["domain"];
+//
+// Hashtable response = new Hashtable();
+// response["content_type"] = "text/xml";
+// response["keepalive"] = false;
+// response["int_response_code"] = 200;
+// response["str_response_string"] = String.Format(
+// "\r\n" +
+// "\r\n" +
+// "\r\n" +
+// "\r\n" +
+// "\r\n" +
+// "\r\n" +
+// "\r\n" +
+// "\r\n" +
+// "\r\n"+
+// "\r\n"+
+// "\r\n"+
+// "\r\n" +
+// "\r\n" +
+// "\r\n",
+// domain);
+//
+//
+// return response;
+// }
}
}
--
cgit v1.1
From dc640465a834c3ddb586d6a7850fd1805ea2e48f Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Thu, 23 Apr 2009 05:22:02 +0000
Subject: * Tweaking the dialstring so the sip_contact_user variable is set to
the dialed user. This stops the client from complaining and might be
useful later. Resolves the 'unable to parse id from mod_sofia@ip:port'
message.
---
.../Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs | 11 ++++++-----
.../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 5 ++++-
2 files changed, 10 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index c131a7f..11797f6 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n" +
+ "\r\n" +
"\r\n" +
"\r\n" +
"\r\n" +
@@ -190,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n" +
+ "\r\n" +
"\r\n" +
"\r\n" +
"\r\n" +
@@ -200,7 +200,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n" +
+ "\r\n" +
"\r\n" +
"\r\n" +
"\r\n" +
@@ -234,7 +234,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n" +
+ "\r\n" +
"\r\n" +
"\r\n" +
"\r\n"+
@@ -267,7 +267,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"\r\n" +
"\r\n" +
"\r\n" +
- "\r\n" +
+ "\r\n" +
"\r\n" +
"\r\n"+
"\r\n"+
@@ -302,6 +302,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return response;
}
+
// private Hashtable HandleLoadNetworkLists(Hashtable request)
// {
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 358f1cd..58f1b3a 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -45,6 +45,7 @@ using OpenSim.Framework.Servers;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
+using System.Text.RegularExpressions;
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
@@ -511,7 +512,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// -> TODO Initialise(): keep track of regions via events
// re-generate accounts for all avatars
// -> TODO Initialise(): keep track of avatars via events
- m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler return {0}",response["str_response_string"]);
+ Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
+
+ m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler return {0}",normalizeEndLines.Replace(((string)response["str_response_string"]), ""));
return response;
}
--
cgit v1.1
From 77bd7da9ccce7d572c7565b8fdda8e6711ca2643 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Thu, 23 Apr 2009 06:31:32 +0000
Subject: * Fix another crash bug in the FreeSwitchVoiceModule
---
.../OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs | 2 ++
.../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index 11797f6..377a824 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -95,6 +95,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
response["int_response_code"] = 404;
+ response["content_type"] = "text/xml";
+ response["str_response_string"] = "";
}
}
else if (eventCallingFunction == "switch_xml_locate_user")
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 58f1b3a..abe7594 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -492,7 +492,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}", (string)request["body"]);
Hashtable response = new Hashtable();
-
+ response["str_response_string"] = string.Empty;
// all the params come as NVPs in the request body
Hashtable requestBody = parseRequestBody((string) request["body"]);
--
cgit v1.1
From 917849eaac7fa8a93079d2279781ce819fa04bd1 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sat, 25 Apr 2009 01:15:34 +0000
Subject: * More debug warning message removal in the FreeSwitchVoiceModule
---
.../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 296 +++++++++++++++++++--
1 file changed, 275 insertions(+), 21 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index abe7594..513d169 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -28,7 +28,9 @@
using System;
using System.IO;
using System.Net;
+using System.Net.Security;
using System.Web;
+using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Xml;
using System.Collections;
@@ -47,6 +49,7 @@ using OpenSim.Region.Framework.Scenes;
using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
using System.Text.RegularExpressions;
+
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
public class FreeSwitchVoiceModule : IRegionModule
@@ -56,6 +59,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private const bool UseProxy = false;
+
// Capability string prefixes
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
@@ -95,7 +100,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private FreeSwitchDirectory m_FreeSwitchDirectory;
private FreeSwitchDialplan m_FreeSwitchDialplan;
+
+ private readonly Dictionary m_UUIDName = new Dictionary();
+
private IConfig m_config;
public void Initialise(Scene scene, IConfigSource config)
@@ -159,22 +167,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// set up http request handlers for
// - prelogin: viv_get_prelogin.php
// - signin: viv_signin.php
- scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
- FreeSwitchSLVoiceGetPreloginHTTPHandler);
-
- // RestStreamHandler h = new
- // RestStreamHandler("GET",
- // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
- // scene.CommsManager.HttpServer.AddStreamHandler(h);
+ // - buddies: viv_buddy.php
+ // - ???: viv_watcher.php
+ // - signout: viv_signout.php
+ if (UseProxy)
+ {
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/", m_freeSwitchAPIPrefix),
+ ForwardProxyRequest);
+ }
+ else
+ {
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
+ FreeSwitchSLVoiceGetPreloginHTTPHandler);
+
+ // RestStreamHandler h = new
+ // RestStreamHandler("GET",
+ // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
+ // scene.CommsManager.HttpServer.AddStreamHandler(h);
+
+
+
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
+ FreeSwitchSLVoiceSigninHTTPHandler);
+
+ // set up http request handlers to provide
+ // on-demand FreeSwitch configuration to
+ // FreeSwitch's mod_curl_xml
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix),
+ FreeSwitchConfigHTTPHandler);
+
+ scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
+ FreeSwitchSLVoiceBuddyHTTPHandler);
+ }
- scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
- FreeSwitchSLVoiceSigninHTTPHandler);
-
- // set up http request handlers to provide
- // on-demand FreeSwitch configuration to
- // FreeSwitch's mod_curl_xml
- scene.CommsManager.HttpServer.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix),
- FreeSwitchConfigHTTPHandler);
+
+
+
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
@@ -203,7 +231,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
OnRegisterCaps(scene, agentID, caps);
};
-
+ try
+ {
+ ServicePointManager.ServerCertificateValidationCallback += CustomCertificateValidation;
+ }
+ catch (NotImplementedException)
+ {
+ try
+ {
+#pragma warning disable 0612, 0618
+ // Mono does not implement the ServicePointManager.ServerCertificateValidationCallback yet! Don't remove this!
+ ServicePointManager.CertificatePolicy = new MonoCert();
+#pragma warning restore 0612, 0618
+ }
+ catch (Exception)
+ {
+ m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
+ }
+ }
}
}
@@ -290,6 +335,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
UUID agentID, Caps caps)
{
ScenePresence avatar = scene.GetScenePresence(agentID);
+ if (avatar == null)
+ {
+ System.Threading.Thread.Sleep(2000);
+ avatar = scene.GetScenePresence(agentID);
+
+ if (avatar == null)
+ return "undef";
+ }
string avatarName = avatar.Name;
try
@@ -305,8 +358,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// FreeSwitch is later going to come and ask us for
// those
agentname = agentname.Replace('+', '-').Replace('/', '_');
-
- // LLSDVoiceAccountResponse voiceAccountResponse =
+
+ lock (m_UUIDName)
+ {
+ if (m_UUIDName.ContainsKey(agentname))
+ {
+ m_UUIDName[agentname] = avatarName;
+ }
+ else
+ {
+ m_UUIDName.Add(agentname, avatarName);
+ }
+ }
+
+ // LLSDVoiceAccountResponse voiceAccountResponse =
// new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
LLSDVoiceAccountResponse voiceAccountResponse =
new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
@@ -433,6 +498,57 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return "true";
}
+ public Hashtable ForwardProxyRequest(Hashtable request)
+ {
+ m_log.Debug("[PROXYING]: -------------------------------proxying request");
+ Hashtable response = new Hashtable();
+ response["content_type"] = "text/xml";
+ response["str_response_string"] = "";
+ response["int_response_code"] = 200;
+
+ string forwardaddress = "https://www.bhr.vivox.com/api2/";
+ string body = (string)request["body"];
+ string method = (string) request["http-method"];
+ string contenttype = (string) request["content-type"];
+ string uri = (string) request["uri"];
+ uri = uri.Replace("/api/", "");
+ forwardaddress += uri;
+
+
+ string fwdresponsestr = "";
+ int fwdresponsecode = 200;
+ string fwdresponsecontenttype = "text/xml";
+
+
+ HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress);
+ forwardreq.Method = method;
+ forwardreq.ContentType = contenttype;
+ forwardreq.KeepAlive = false;
+
+ if (method == "POST")
+ {
+ byte[] contentreq = Encoding.UTF8.GetBytes(body);
+ forwardreq.ContentLength = contentreq.Length;
+ Stream reqStream = forwardreq.GetRequestStream();
+ reqStream.Write(contentreq, 0, contentreq.Length);
+ reqStream.Close();
+ }
+
+ HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse();
+ Encoding encoding = Encoding.UTF8;
+ StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding);
+ fwdresponsestr = fwdresponsestream.ReadToEnd();
+ fwdresponsecontenttype = fwdrsp.ContentType;
+ fwdresponsecode = (int)fwdrsp.StatusCode;
+ fwdresponsestream.Close();
+
+ response["content_type"] = fwdresponsecontenttype;
+ response["str_response_string"] = fwdresponsestr;
+ response["int_response_code"] = fwdresponsecode;
+
+ return response;
+ }
+
public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
{
@@ -468,22 +584,139 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return response;
}
+ public Hashtable FreeSwitchSLVoiceBuddyHTTPHandler(Hashtable request)
+ {
+ Hashtable response = new Hashtable();
+ response["int_response_code"] = 200;
+ response["str_response_string"] = string.Empty;
+ response["content-type"] = "text/xml";
+
+ Hashtable requestBody = parseRequestBody((string)request["body"]);
+
+ if (!requestBody.ContainsKey("auth_token"))
+ return response;
+
+ string auth_token = (string)requestBody["auth_token"];
+ string[] auth_tokenvals = auth_token.Split(':');
+ string username = auth_tokenvals[0];
+ int strcount = 0;
+
+ string[] ids = new string[strcount];
+
+ int iter = -1;
+ lock (m_UUIDName)
+ {
+ strcount = m_UUIDName.Count;
+ ids = new string[strcount];
+ foreach (string s in m_UUIDName.Keys)
+ {
+ iter++;
+ ids[iter] = s;
+ }
+ }
+ StringBuilder resp = new StringBuilder();
+ resp.Append("");
+
+ resp.Append(string.Format(@"
+ OK
+ lib_session
+ {0}
+ {0}
+
+ ",auth_token));
+ /*
+ lib_session
+ {0}:{1}:9303959503950::
+ {0}:{1}:9303959503950::
+ */
+ for (int i=0;i
+ {1}
+
+ sip:{0}@{2}
+ {0}
+ {0}
+ {2}
+ A
+ {3}
+
+ ", ids[i],i,m_freeSwitchRealm,dt));
+ }
+
+
+
+ resp.Append("");
+
+ response["str_response_string"] = resp.ToString();
+ Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
+
+ m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],""));
+ return response;
+ }
+
public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request)
{
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called");
-
+ string requestbody = (string)request["body"];
+ string uri = (string)request["uri"];
+ string contenttype = (string)request["content-type"];
+
+ Hashtable requestBody = parseRequestBody((string)request["body"]);
+
+ string pwd = (string) requestBody["pwd"];
+ string userid = (string) requestBody["userid"];
+
+ string avatarName = string.Empty;
+ int pos = -1;
+ lock (m_UUIDName)
+ {
+ if (m_UUIDName.ContainsKey(userid))
+ {
+ avatarName = m_UUIDName[userid];
+ foreach (string s in m_UUIDName.Keys)
+ {
+ pos++;
+ if (s == userid)
+ break;
+
+ }
+ }
+ }
+
+ m_log.DebugFormat("[FreeSwitchVoice]: AUTH, URI: {0}, Content-Type:{1}, Body{2}", uri, contenttype,
+ requestbody);
Hashtable response = new Hashtable();
- response["str_response_string"] = @"
+ response["str_response_string"] = string.Format(@"
OK
200
+ lib_session
+ {0}:{1}:9303959503950::
+ {0}:{1}:9303959503950::
+ 1
+ {1}
+ {2}
auth successful
- ";
+ ", userid, pos, avatarName);
+
response["int_response_code"] = 200;
return response;
+ /*
+
+ OKOklib_session
+ * xMj1QJSc7TA-G7XqcW6QXAg==:1290551700:050d35c6fef96f132f780d8039ff7592::
+ * xMj1QJSc7TA-G7XqcW6QXAg==:1290551700:050d35c6fef96f132f780d8039ff7592::
+ * 1
+ * 7449
+ * Teravus Ousley
+ */
}
@@ -569,5 +802,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return channelUri;
}
+
+ private static bool CustomCertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
+ {
+ //if (cert.Subject == "E=root@lindenlab.com, CN=*.vaak.lindenlab.com, O=\"Linden Lab, Inc.\", L=San Francisco, S=California, C=US")
+ //{
+ return true;
+ //}
+
+ //return false;
+ }
+ }
+ public class MonoCert : ICertificatePolicy
+ {
+ #region ICertificatePolicy Members
+
+ public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
+ {
+ return true;
+ }
+
+ #endregion
}
}
--
cgit v1.1
From c320dca2db5c841976f5a36dab47cd3a8250c825 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 29 Apr 2009 18:11:41 +0000
Subject: * minor: remove some mono compiler warnings
---
.../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 513d169..f7001ef 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private const bool UseProxy = false;
+ private bool UseProxy = false;
// Capability string prefixes
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
@@ -598,7 +598,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string auth_token = (string)requestBody["auth_token"];
string[] auth_tokenvals = auth_token.Split(':');
- string username = auth_tokenvals[0];
+ //string username = auth_tokenvals[0];
int strcount = 0;
string[] ids = new string[strcount];
@@ -667,7 +667,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
Hashtable requestBody = parseRequestBody((string)request["body"]);
- string pwd = (string) requestBody["pwd"];
+ //string pwd = (string) requestBody["pwd"];
string userid = (string) requestBody["userid"];
string avatarName = string.Empty;
--
cgit v1.1
From 40c2e2e84f50e9a75f26b326a798a280d36687e9 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 29 Apr 2009 19:31:48 +0000
Subject: * Add test to check temp profile creation on iar load
---
.../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index f7001ef..e04b1ba 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -54,10 +54,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
public class FreeSwitchVoiceModule : IRegionModule
{
-
- // Infrastructure
- private static readonly ILog m_log =
- LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool UseProxy = false;
--
cgit v1.1
From 257fc5515ac9cb36032c2f44f040c3620ed2f328 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 4 May 2009 15:38:36 +0000
Subject: * minor: remove some mono compiler warnings, minor cleanup
---
.../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index e04b1ba..ddd0c12 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -594,7 +594,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return response;
string auth_token = (string)requestBody["auth_token"];
- string[] auth_tokenvals = auth_token.Split(':');
+ //string[] auth_tokenvals = auth_token.Split(':');
//string username = auth_tokenvals[0];
int strcount = 0;
@@ -643,9 +643,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
", ids[i],i,m_freeSwitchRealm,dt));
}
-
-
-
+
resp.Append("