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/FreeSwitchVoice') 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