|
|
|
|
@@ -50,7 +50,6 @@ using OpenSim.Region.Framework.Scenes;
|
|
|
|
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
{
|
|
|
|
|
public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
|
|
|
|
|
@@ -76,7 +75,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
// SLVoice client will do a GET on this prefix
|
|
|
|
|
private static string m_freeSwitchAPIPrefix;
|
|
|
|
|
|
|
|
|
|
// We need to return some information to SLVoice
|
|
|
|
|
// We need to return some information to SLVoice
|
|
|
|
|
// figured those out via curl
|
|
|
|
|
// http://vd1.vivox.com/api2/viv_get_prelogin.php
|
|
|
|
|
//
|
|
|
|
|
@@ -102,9 +101,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
|
|
|
|
|
private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
|
|
|
|
|
private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Scene m_scene;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IConfig m_config;
|
|
|
|
|
|
|
|
|
|
@@ -136,9 +135,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
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);
|
|
|
|
|
@@ -156,7 +155,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
// m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
|
|
|
|
|
m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
|
|
|
|
|
m_freeSwitchContext = m_config.GetString("freeswitch_context", "default");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
|
|
|
|
|
String.IsNullOrEmpty(m_freeSwitchServerPass) ||
|
|
|
|
|
String.IsNullOrEmpty(m_freeSwitchRealm) ||
|
|
|
|
|
@@ -182,9 +181,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
{
|
|
|
|
|
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
|
|
|
|
|
FreeSwitchSLVoiceGetPreloginHTTPHandler);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// RestStreamHandler h = new
|
|
|
|
|
// RestStreamHandler("GET",
|
|
|
|
|
// RestStreamHandler("GET",
|
|
|
|
|
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
|
|
|
|
|
// MainServer.Instance.AddStreamHandler(h);
|
|
|
|
|
|
|
|
|
|
@@ -202,13 +201,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
|
|
|
|
|
FreeSwitchSLVoiceBuddyHTTPHandler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_FreeSwitchDirectory = new FreeSwitchDirectory();
|
|
|
|
|
m_FreeSwitchDialplan = new FreeSwitchDialplan();
|
|
|
|
|
|
|
|
|
|
@@ -225,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_pluginEnabled)
|
|
|
|
|
if (m_pluginEnabled)
|
|
|
|
|
{
|
|
|
|
|
// we need to capture scene in an anonymous method
|
|
|
|
|
// here as we need it later in the callbacks
|
|
|
|
|
@@ -233,8 +228,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
{
|
|
|
|
|
OnRegisterCaps(scene, agentID, caps);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
@@ -254,16 +247,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
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.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void PostInitialise()
|
|
|
|
|
{
|
|
|
|
|
if (m_pluginEnabled)
|
|
|
|
|
{
|
|
|
|
|
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// register the voice interface for this module, so the script engine can call us
|
|
|
|
|
m_scene.RegisterModuleInterface<IVoiceModule>(this);
|
|
|
|
|
}
|
|
|
|
|
@@ -282,15 +274,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
{
|
|
|
|
|
get { return true; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <summary>
|
|
|
|
|
// implementation of IVoiceModule, called by osSetParcelSIPAddress script function
|
|
|
|
|
// </summary>
|
|
|
|
|
public void setLandSIPAddress(string SIPAddress,UUID GlobalID)
|
|
|
|
|
{
|
|
|
|
|
m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
|
|
|
|
|
m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
|
|
|
|
|
GlobalID, SIPAddress);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lock (m_ParcelAddress)
|
|
|
|
|
{
|
|
|
|
|
if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
|
|
|
|
|
@@ -303,18 +295,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <summary>
|
|
|
|
|
// 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.
|
|
|
|
|
//
|
|
|
|
|
@@ -371,7 +363,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
{
|
|
|
|
|
System.Threading.Thread.Sleep(2000);
|
|
|
|
|
avatar = scene.GetScenePresence(agentID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (avatar == null)
|
|
|
|
|
return "<llsd>undef</llsd>";
|
|
|
|
|
}
|
|
|
|
|
@@ -407,8 +399,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
// 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));
|
|
|
|
|
String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
|
|
|
|
|
m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
|
|
|
|
|
|
|
|
|
|
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
|
|
|
|
|
|
|
|
|
|
@@ -442,7 +434,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
string avatarName = avatar.Name;
|
|
|
|
|
|
|
|
|
|
// - check whether we have a region channel in our cache
|
|
|
|
|
// - if not:
|
|
|
|
|
// - if not:
|
|
|
|
|
// create it and cache it
|
|
|
|
|
// - send it to the client
|
|
|
|
|
// - send channel_uri: as "sip:regionID@m_sipDomain"
|
|
|
|
|
@@ -451,12 +443,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
LLSDParcelVoiceInfoResponse parcelVoiceInfo;
|
|
|
|
|
string channelUri;
|
|
|
|
|
|
|
|
|
|
if (null == scene.LandChannel)
|
|
|
|
|
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
|
|
|
|
|
@@ -493,22 +483,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
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}",
|
|
|
|
|
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",
|
|
|
|
|
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",
|
|
|
|
|
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
|
|
|
|
|
scene.RegionInfo.RegionName, avatarName, e.ToString());
|
|
|
|
|
|
|
|
|
|
return "<llsd>undef</llsd>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Callback for a client request for ChatSessionRequest
|
|
|
|
|
/// </summary>
|
|
|
|
|
@@ -550,7 +539,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
string fwdresponsestr = "";
|
|
|
|
|
int fwdresponsecode = 200;
|
|
|
|
|
string fwdresponsecontenttype = "text/xml";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress);
|
|
|
|
|
forwardreq.Method = method;
|
|
|
|
|
@@ -577,7 +565,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
response["content_type"] = fwdresponsecontenttype;
|
|
|
|
|
response["str_response_string"] = fwdresponsestr;
|
|
|
|
|
response["int_response_code"] = fwdresponsecode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -585,11 +573,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
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(
|
|
|
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
|
|
|
|
"<VCConfiguration>\r\n"+
|
|
|
|
|
@@ -607,9 +595,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
"</VCConfiguration>",
|
|
|
|
|
m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
|
|
|
|
|
m_freeSwitchEchoServer, m_freeSwitchEchoPort,
|
|
|
|
|
m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
|
|
|
|
|
m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
|
|
|
|
|
m_freeSwitchUrlResetPassword, "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response["int_response_code"] = 200;
|
|
|
|
|
|
|
|
|
|
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
|
|
|
|
|
@@ -624,7 +612,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
response["content-type"] = "text/xml";
|
|
|
|
|
|
|
|
|
|
Hashtable requestBody = parseRequestBody((string)request["body"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!requestBody.ContainsKey("auth_token"))
|
|
|
|
|
return response;
|
|
|
|
|
|
|
|
|
|
@@ -632,7 +620,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
//string[] auth_tokenvals = auth_token.Split(':');
|
|
|
|
|
//string username = auth_tokenvals[0];
|
|
|
|
|
int strcount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string[] ids = new string[strcount];
|
|
|
|
|
|
|
|
|
|
int iter = -1;
|
|
|
|
|
@@ -648,7 +636,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
}
|
|
|
|
|
StringBuilder resp = new StringBuilder();
|
|
|
|
|
resp.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><response xmlns=\"http://www.vivox.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"/xsd/buddy_list.xsd\">");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resp.Append(string.Format(@"<level0>
|
|
|
|
|
<status>OK</status>
|
|
|
|
|
<cookie_name>lib_session</cookie_name>
|
|
|
|
|
@@ -678,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
<b2g_group_id></b2g_group_id>
|
|
|
|
|
</level3>", ids[i],i,m_freeSwitchRealm,dt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resp.Append("</buddies><groups></groups></body></level0></response>");
|
|
|
|
|
|
|
|
|
|
response["str_response_string"] = resp.ToString();
|
|
|
|
|
@@ -694,7 +682,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
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"];
|
|
|
|
|
@@ -712,7 +700,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
pos++;
|
|
|
|
|
if (s == userid)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -735,7 +722,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
</body>
|
|
|
|
|
</level0>
|
|
|
|
|
</response>", userid, pos, avatarName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response["int_response_code"] = 200;
|
|
|
|
|
return response;
|
|
|
|
|
/*
|
|
|
|
|
@@ -752,13 +739,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
|
|
|
|
|
{
|
|
|
|
|
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"]);
|
|
|
|
|
|
|
|
|
|
// is this a dialplan or directory request
|
|
|
|
|
// is this a dialplan or directory request
|
|
|
|
|
string section = (string) requestBody["section"];
|
|
|
|
|
|
|
|
|
|
if (section == "directory")
|
|
|
|
|
@@ -767,40 +754,39 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
response = m_FreeSwitchDialplan.HandleDialplanRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody);
|
|
|
|
|
else
|
|
|
|
|
m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
|
|
|
|
|
|
|
|
|
|
// XXX: re-generate dialplan:
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
// re-generate accounts for all avatars
|
|
|
|
|
// -> TODO Initialise(): keep track of avatars via events
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Hashtable parseRequestBody(string body)
|
|
|
|
|
{
|
|
|
|
|
Hashtable bodyParams = new Hashtable();
|
|
|
|
|
// split string
|
|
|
|
|
string [] nvps = body.Split(new Char [] {'&'});
|
|
|
|
|
|
|
|
|
|
foreach (string s in nvps) {
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
@@ -808,12 +794,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
|
|
|
|
|
// Create parcel voice channel. If no parcel exists, then the voice channel ID is the same
|
|
|
|
|
// as the directory ID. Otherwise, it reflects the parcel's ID.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lock (m_ParcelAddress)
|
|
|
|
|
{
|
|
|
|
|
if (m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
|
|
|
|
|
{
|
|
|
|
|
m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
|
|
|
|
|
m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
|
|
|
|
|
land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]);
|
|
|
|
|
return m_ParcelAddress[land.GlobalID.ToString()];
|
|
|
|
|
}
|
|
|
|
|
@@ -823,22 +809,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
{
|
|
|
|
|
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}",
|
|
|
|
|
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}",
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// slvoice handles the sip address differently if it begins with confctl, hiding it from the user in the friends list. however it also disables
|
|
|
|
|
// the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator.
|
|
|
|
|
channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lock (m_ParcelAddress)
|
|
|
|
|
{
|
|
|
|
|
if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
|
|
|
|
|
@@ -849,14 +835,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|
|
|
|
|
|
|
|
|
return channelUri;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static bool CustomCertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MonoCert : ICertificatePolicy
|
|
|
|
|
{
|
|
|
|
|
#region ICertificatePolicy Members
|
|
|
|
|
|