Formatting cleanup.
parent
68b494b2cc
commit
d1f2fae348
|
@ -50,7 +50,6 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
{
|
{
|
||||||
public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
|
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
|
// SLVoice client will do a GET on this prefix
|
||||||
private static string m_freeSwitchAPIPrefix;
|
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
|
// figured those out via curl
|
||||||
// http://vd1.vivox.com/api2/viv_get_prelogin.php
|
// 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 readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
|
||||||
private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
|
private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
|
||||||
|
|
||||||
private IConfig m_config;
|
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_freeSwitchServerUser = m_config.GetString("freeswitch_server_user", String.Empty);
|
||||||
m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty);
|
m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty);
|
||||||
m_freeSwitchAPIPrefix = m_config.GetString("freeswitch_api_prefix", 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)
|
// 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);
|
string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty);
|
||||||
int servicePort = m_config.GetInt("freeswitch_service_port", 80);
|
int servicePort = m_config.GetInt("freeswitch_service_port", 80);
|
||||||
IPAddress serviceIPAddress = IPAddress.Parse(serviceIP);
|
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_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
|
||||||
m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
|
m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
|
||||||
m_freeSwitchContext = m_config.GetString("freeswitch_context", "default");
|
m_freeSwitchContext = m_config.GetString("freeswitch_context", "default");
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
|
if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
|
||||||
String.IsNullOrEmpty(m_freeSwitchServerPass) ||
|
String.IsNullOrEmpty(m_freeSwitchServerPass) ||
|
||||||
String.IsNullOrEmpty(m_freeSwitchRealm) ||
|
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),
|
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
|
||||||
FreeSwitchSLVoiceGetPreloginHTTPHandler);
|
FreeSwitchSLVoiceGetPreloginHTTPHandler);
|
||||||
|
|
||||||
// RestStreamHandler h = new
|
// RestStreamHandler h = new
|
||||||
// RestStreamHandler("GET",
|
// RestStreamHandler("GET",
|
||||||
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
|
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
|
||||||
// MainServer.Instance.AddStreamHandler(h);
|
// 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),
|
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
|
||||||
FreeSwitchSLVoiceBuddyHTTPHandler);
|
FreeSwitchSLVoiceBuddyHTTPHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
|
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
|
||||||
|
|
||||||
m_FreeSwitchDirectory = new FreeSwitchDirectory();
|
m_FreeSwitchDirectory = new FreeSwitchDirectory();
|
||||||
m_FreeSwitchDialplan = new FreeSwitchDialplan();
|
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
|
// we need to capture scene in an anonymous method
|
||||||
// here as we need it later in the callbacks
|
// here as we need it later in the callbacks
|
||||||
|
@ -233,8 +228,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
{
|
{
|
||||||
OnRegisterCaps(scene, agentID, caps);
|
OnRegisterCaps(scene, agentID, caps);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try
|
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.");
|
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()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (m_pluginEnabled)
|
if (m_pluginEnabled)
|
||||||
{
|
{
|
||||||
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
|
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
|
||||||
|
|
||||||
// register the voice interface for this module, so the script engine can call us
|
// register the voice interface for this module, so the script engine can call us
|
||||||
m_scene.RegisterModuleInterface<IVoiceModule>(this);
|
m_scene.RegisterModuleInterface<IVoiceModule>(this);
|
||||||
}
|
}
|
||||||
|
@ -282,15 +274,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
// <summary>
|
||||||
// implementation of IVoiceModule, called by osSetParcelSIPAddress script function
|
// implementation of IVoiceModule, called by osSetParcelSIPAddress script function
|
||||||
// </summary>
|
// </summary>
|
||||||
public void setLandSIPAddress(string SIPAddress,UUID GlobalID)
|
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);
|
GlobalID, SIPAddress);
|
||||||
|
|
||||||
lock (m_ParcelAddress)
|
lock (m_ParcelAddress)
|
||||||
{
|
{
|
||||||
if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
|
if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
|
||||||
|
@ -303,18 +295,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
// <summary>
|
||||||
// OnRegisterCaps is invoked via the scene.EventManager
|
// OnRegisterCaps is invoked via the scene.EventManager
|
||||||
// everytime OpenSim hands out capabilities to a client
|
// everytime OpenSim hands out capabilities to a client
|
||||||
// (login, region crossing). We contribute two capabilities to
|
// (login, region crossing). We contribute two capabilities to
|
||||||
// the set of capabilities handed back to the client:
|
// the set of capabilities handed back to the client:
|
||||||
// ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
|
// ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
|
||||||
//
|
//
|
||||||
// ProvisionVoiceAccountRequest allows the client to obtain
|
// ProvisionVoiceAccountRequest allows the client to obtain
|
||||||
// the voice account credentials for the avatar it is
|
// the voice account credentials for the avatar it is
|
||||||
// controlling (e.g., user name, password, etc).
|
// controlling (e.g., user name, password, etc).
|
||||||
//
|
//
|
||||||
// ParcelVoiceInfoRequest is invoked whenever the client
|
// ParcelVoiceInfoRequest is invoked whenever the client
|
||||||
// changes from one region or parcel to another.
|
// changes from one region or parcel to another.
|
||||||
//
|
//
|
||||||
|
@ -371,7 +363,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(2000);
|
System.Threading.Thread.Sleep(2000);
|
||||||
avatar = scene.GetScenePresence(agentID);
|
avatar = scene.GetScenePresence(agentID);
|
||||||
|
|
||||||
if (avatar == null)
|
if (avatar == null)
|
||||||
return "<llsd>undef</llsd>";
|
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");
|
// new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
|
||||||
LLSDVoiceAccountResponse voiceAccountResponse =
|
LLSDVoiceAccountResponse voiceAccountResponse =
|
||||||
new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
|
new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
|
||||||
String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
|
String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
|
||||||
m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
|
m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
|
||||||
|
|
||||||
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
|
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
|
||||||
|
|
||||||
|
@ -442,7 +434,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
string avatarName = avatar.Name;
|
string avatarName = avatar.Name;
|
||||||
|
|
||||||
// - check whether we have a region channel in our cache
|
// - check whether we have a region channel in our cache
|
||||||
// - if not:
|
// - if not:
|
||||||
// create it and cache it
|
// create it and cache it
|
||||||
// - send it to the client
|
// - send it to the client
|
||||||
// - send channel_uri: as "sip:regionID@m_sipDomain"
|
// - send channel_uri: as "sip:regionID@m_sipDomain"
|
||||||
|
@ -451,12 +443,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
LLSDParcelVoiceInfoResponse parcelVoiceInfo;
|
LLSDParcelVoiceInfoResponse parcelVoiceInfo;
|
||||||
string channelUri;
|
string channelUri;
|
||||||
|
|
||||||
if (null == scene.LandChannel)
|
if (null == scene.LandChannel)
|
||||||
throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
|
throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
|
||||||
scene.RegionInfo.RegionName, avatarName));
|
scene.RegionInfo.RegionName, avatarName));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get channel_uri: check first whether estate
|
// get channel_uri: check first whether estate
|
||||||
// settings allow voice, then whether parcel allows
|
// settings allow voice, then whether parcel allows
|
||||||
// voice, if all do retrieve or obtain the parcel
|
// 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);
|
parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
|
||||||
string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
|
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);
|
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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);
|
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());
|
scene.RegionInfo.RegionName, avatarName, e.ToString());
|
||||||
|
|
||||||
return "<llsd>undef</llsd>";
|
return "<llsd>undef</llsd>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback for a client request for ChatSessionRequest
|
/// Callback for a client request for ChatSessionRequest
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -550,7 +539,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
string fwdresponsestr = "";
|
string fwdresponsestr = "";
|
||||||
int fwdresponsecode = 200;
|
int fwdresponsecode = 200;
|
||||||
string fwdresponsecontenttype = "text/xml";
|
string fwdresponsecontenttype = "text/xml";
|
||||||
|
|
||||||
|
|
||||||
HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress);
|
HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress);
|
||||||
forwardreq.Method = method;
|
forwardreq.Method = method;
|
||||||
|
@ -577,7 +565,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
response["content_type"] = fwdresponsecontenttype;
|
response["content_type"] = fwdresponsecontenttype;
|
||||||
response["str_response_string"] = fwdresponsestr;
|
response["str_response_string"] = fwdresponsestr;
|
||||||
response["int_response_code"] = fwdresponsecode;
|
response["int_response_code"] = fwdresponsecode;
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,11 +573,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
|
public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
|
||||||
{
|
{
|
||||||
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
|
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
|
||||||
|
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
response["content_type"] = "text/xml";
|
response["content_type"] = "text/xml";
|
||||||
response["keepalive"] = false;
|
response["keepalive"] = false;
|
||||||
|
|
||||||
response["str_response_string"] = String.Format(
|
response["str_response_string"] = String.Format(
|
||||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
||||||
"<VCConfiguration>\r\n"+
|
"<VCConfiguration>\r\n"+
|
||||||
|
@ -607,9 +595,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
"</VCConfiguration>",
|
"</VCConfiguration>",
|
||||||
m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
|
m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
|
||||||
m_freeSwitchEchoServer, m_freeSwitchEchoPort,
|
m_freeSwitchEchoServer, m_freeSwitchEchoPort,
|
||||||
m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
|
m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
|
||||||
m_freeSwitchUrlResetPassword, "");
|
m_freeSwitchUrlResetPassword, "");
|
||||||
|
|
||||||
response["int_response_code"] = 200;
|
response["int_response_code"] = 200;
|
||||||
|
|
||||||
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
|
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";
|
response["content-type"] = "text/xml";
|
||||||
|
|
||||||
Hashtable requestBody = parseRequestBody((string)request["body"]);
|
Hashtable requestBody = parseRequestBody((string)request["body"]);
|
||||||
|
|
||||||
if (!requestBody.ContainsKey("auth_token"))
|
if (!requestBody.ContainsKey("auth_token"))
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
|
@ -632,7 +620,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
//string[] auth_tokenvals = auth_token.Split(':');
|
//string[] auth_tokenvals = auth_token.Split(':');
|
||||||
//string username = auth_tokenvals[0];
|
//string username = auth_tokenvals[0];
|
||||||
int strcount = 0;
|
int strcount = 0;
|
||||||
|
|
||||||
string[] ids = new string[strcount];
|
string[] ids = new string[strcount];
|
||||||
|
|
||||||
int iter = -1;
|
int iter = -1;
|
||||||
|
@ -648,7 +636,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
}
|
}
|
||||||
StringBuilder resp = new StringBuilder();
|
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("<?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>
|
resp.Append(string.Format(@"<level0>
|
||||||
<status>OK</status>
|
<status>OK</status>
|
||||||
<cookie_name>lib_session</cookie_name>
|
<cookie_name>lib_session</cookie_name>
|
||||||
|
@ -678,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
<b2g_group_id></b2g_group_id>
|
<b2g_group_id></b2g_group_id>
|
||||||
</level3>", ids[i],i,m_freeSwitchRealm,dt));
|
</level3>", ids[i],i,m_freeSwitchRealm,dt));
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.Append("</buddies><groups></groups></body></level0></response>");
|
resp.Append("</buddies><groups></groups></body></level0></response>");
|
||||||
|
|
||||||
response["str_response_string"] = resp.ToString();
|
response["str_response_string"] = resp.ToString();
|
||||||
|
@ -694,7 +682,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
string requestbody = (string)request["body"];
|
string requestbody = (string)request["body"];
|
||||||
string uri = (string)request["uri"];
|
string uri = (string)request["uri"];
|
||||||
string contenttype = (string)request["content-type"];
|
string contenttype = (string)request["content-type"];
|
||||||
|
|
||||||
Hashtable requestBody = parseRequestBody((string)request["body"]);
|
Hashtable requestBody = parseRequestBody((string)request["body"]);
|
||||||
|
|
||||||
//string pwd = (string) requestBody["pwd"];
|
//string pwd = (string) requestBody["pwd"];
|
||||||
|
@ -712,7 +700,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
pos++;
|
pos++;
|
||||||
if (s == userid)
|
if (s == userid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -735,7 +722,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
</body>
|
</body>
|
||||||
</level0>
|
</level0>
|
||||||
</response>", userid, pos, avatarName);
|
</response>", userid, pos, avatarName);
|
||||||
|
|
||||||
response["int_response_code"] = 200;
|
response["int_response_code"] = 200;
|
||||||
return response;
|
return response;
|
||||||
/*
|
/*
|
||||||
|
@ -752,13 +739,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
|
public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}", (string)request["body"]);
|
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}", (string)request["body"]);
|
||||||
|
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
response["str_response_string"] = string.Empty;
|
response["str_response_string"] = string.Empty;
|
||||||
// all the params come as NVPs in the request body
|
// all the params come as NVPs in the request body
|
||||||
Hashtable requestBody = parseRequestBody((string) 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"];
|
string section = (string) requestBody["section"];
|
||||||
|
|
||||||
if (section == "directory")
|
if (section == "directory")
|
||||||
|
@ -767,40 +754,39 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
response = m_FreeSwitchDialplan.HandleDialplanRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody);
|
response = m_FreeSwitchDialplan.HandleDialplanRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody);
|
||||||
else
|
else
|
||||||
m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
|
m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
|
||||||
|
|
||||||
// XXX: re-generate dialplan:
|
// XXX: re-generate dialplan:
|
||||||
// - conf == region UUID
|
// - conf == region UUID
|
||||||
// - conf number = region port
|
// - conf number = region port
|
||||||
// -> TODO Initialise(): keep track of regions via events
|
// -> 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
|
// -> TODO Initialise(): keep track of avatars via events
|
||||||
Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
|
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"]), ""));
|
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler return {0}",normalizeEndLines.Replace(((string)response["str_response_string"]), ""));
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable parseRequestBody(string body)
|
public Hashtable parseRequestBody(string body)
|
||||||
{
|
{
|
||||||
Hashtable bodyParams = new Hashtable();
|
Hashtable bodyParams = new Hashtable();
|
||||||
// split string
|
// split string
|
||||||
string [] nvps = body.Split(new Char [] {'&'});
|
string [] nvps = body.Split(new Char [] {'&'});
|
||||||
|
|
||||||
foreach (string s in nvps) {
|
foreach (string s in nvps)
|
||||||
|
{
|
||||||
if (s.Trim() != "")
|
if (s.Trim() != "")
|
||||||
{
|
{
|
||||||
string [] nvp = s.Split(new Char [] {'='});
|
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;
|
return bodyParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ChannelUri(Scene scene, LandData land)
|
private string ChannelUri(Scene scene, LandData land)
|
||||||
{
|
{
|
||||||
|
|
||||||
string channelUri = null;
|
string channelUri = null;
|
||||||
|
|
||||||
string landUUID;
|
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
|
// 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.
|
// as the directory ID. Otherwise, it reflects the parcel's ID.
|
||||||
|
|
||||||
lock (m_ParcelAddress)
|
lock (m_ParcelAddress)
|
||||||
{
|
{
|
||||||
if (m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
|
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()]);
|
land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]);
|
||||||
return 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);
|
landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name);
|
||||||
landUUID = land.GlobalID.ToString();
|
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);
|
landName, land.LocalID, landUUID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionName);
|
landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionName);
|
||||||
landUUID = scene.RegionInfo.RegionID.ToString();
|
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);
|
landName, land.LocalID, landUUID);
|
||||||
}
|
}
|
||||||
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
|
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
|
// 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.
|
// 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);
|
channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm);
|
||||||
|
|
||||||
lock (m_ParcelAddress)
|
lock (m_ParcelAddress)
|
||||||
{
|
{
|
||||||
if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
|
if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
|
||||||
|
@ -849,14 +835,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
|
|
||||||
return channelUri;
|
return channelUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CustomCertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
|
private static bool CustomCertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
|
||||||
{
|
{
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MonoCert : ICertificatePolicy
|
public class MonoCert : ICertificatePolicy
|
||||||
{
|
{
|
||||||
#region ICertificatePolicy Members
|
#region ICertificatePolicy Members
|
||||||
|
|
|
@ -121,19 +121,19 @@ namespace OpenSim.Region.Modules.SvnSerialiser
|
||||||
{
|
{
|
||||||
serialiser.LoadPrimsFromXml2(
|
serialiser.LoadPrimsFromXml2(
|
||||||
scene,
|
scene,
|
||||||
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
|
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
|
||||||
+ Slash.DirectorySeparatorChar + "objects.xml");
|
+ Slash.DirectorySeparatorChar + "objects.xml");
|
||||||
|
|
||||||
scene.RequestModuleInterface<ITerrainModule>().LoadFromFile(
|
scene.RequestModuleInterface<ITerrainModule>().LoadFromFile(
|
||||||
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
|
m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
|
||||||
+ Slash.DirectorySeparatorChar + "heightmap.r32");
|
+ Slash.DirectorySeparatorChar + "heightmap.r32");
|
||||||
|
|
||||||
m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ").");
|
m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ").");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[SVNBACKUP]: Region load of {0} failed - no serialisation module available",
|
"[SVNBACKUP]: Region load of {0} failed - no serialisation module available",
|
||||||
scene.RegionInfo.RegionName);
|
scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue