mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
cleaning up, fixing warnings
This commit is contained in:
@@ -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"] = @"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<document type=""freeswitch/xml"">
|
||||
<section name=""dialplan"">
|
||||
|
||||
@@ -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(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
||||
"<document type=\"freeswitch/xml\">\r\n" +
|
||||
@@ -165,11 +162,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
"</user>\r\n" +
|
||||
"</domain>\r\n" +
|
||||
"</section>\r\n" +
|
||||
"</document>\r\n"
|
||||
, domain , user, password);
|
||||
"</document>\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(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
||||
"<document type=\"freeswitch/xml\">\r\n" +
|
||||
@@ -213,8 +209,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
"</user>\r\n" +
|
||||
"</domain>\r\n" +
|
||||
"</section>\r\n" +
|
||||
"</document>\r\n"
|
||||
, domain , user, password,sipRequestUser);
|
||||
"</document>\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(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
||||
"<document type=\"freeswitch/xml\">\r\n" +
|
||||
@@ -248,10 +244,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
"</user>\r\n" +
|
||||
"</domain>\r\n" +
|
||||
"</section>\r\n" +
|
||||
"</document>\r\n"
|
||||
, domain , user);
|
||||
|
||||
|
||||
"</document>\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(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
||||
"<document type=\"freeswitch/xml\">\r\n" +
|
||||
@@ -303,9 +297,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
"</variables>\r\n"+
|
||||
"</domain>\r\n" +
|
||||
"</section>\r\n" +
|
||||
"</document>\r\n"
|
||||
, domain);
|
||||
|
||||
"</document>\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(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
||||
"<document type=\"freeswitch/xml\">\r\n" +
|
||||
@@ -335,13 +328,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
"</variables>\r\n"+
|
||||
"</domain>\r\n" +
|
||||
"</section>\r\n" +
|
||||
"</document>\r\n"
|
||||
, domain);
|
||||
"</document>\r\n",
|
||||
domain);
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
"<UrlPrivacyNotice>{8}</UrlPrivacyNotice>\r\n"+
|
||||
"<UrlEulaNotice/>\r\n"+
|
||||
"<App.NoBottomLogo>false</App.NoBottomLogo>\r\n"+
|
||||
"</VCConfiguration>"
|
||||
,
|
||||
m_freeSwitchRealm,m_freeSwitchSIPProxy,m_freeSwitchAttemptUseSTUN,
|
||||
m_freeSwitchSTUNServer,m_freeSwitchEchoServer,m_freeSwitchEchoPort,
|
||||
m_freeSwitchDefaultWellKnownIP,m_freeSwitchDefaultTimeout,m_freeSwitchUrlResetPassword,"");
|
||||
"</VCConfiguration>",
|
||||
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)
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
public GroupRecord GetGroupRecord(UUID GroupID, string GroupName)
|
||||
{
|
||||
Hashtable param = new Hashtable();
|
||||
if ((GroupID != null) && (GroupID != UUID.Zero))
|
||||
if (GroupID != UUID.Zero)
|
||||
{
|
||||
param["GroupID"] = GroupID.ToString();
|
||||
}
|
||||
@@ -793,7 +793,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
{
|
||||
m_log.ErrorFormat("[GROUPDATA] Key: {0}", key);
|
||||
|
||||
object o = respData[key];
|
||||
// object o = respData[key];
|
||||
|
||||
string[] lines = respData[key].ToString().Split(new char[] { '\n' });
|
||||
foreach (string line in lines)
|
||||
|
||||
Reference in New Issue
Block a user