diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs index 150df45cb2..da56b8778d 100644 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs +++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs @@ -35,6 +35,8 @@ using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; using log4net; +using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace OpenSim.Server.Handlers.Freeswitch { @@ -67,12 +69,16 @@ namespace OpenSim.Server.Handlers.Freeswitch ServerUtils.LoadPlugin(freeswitchService, args); server.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler); + server.AddHTTPHandler(String.Format("{0}/region-config", m_freeSwitchAPIPrefix), RegionConfigHTTPHandler); } public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request) { Hashtable response = new Hashtable(); response["str_response_string"] = string.Empty; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["int_response_code"] = 500; Hashtable requestBody = ParseRequestBody((string) request["body"]); @@ -105,5 +111,18 @@ namespace OpenSim.Server.Handlers.Freeswitch return bodyParams; } + + public Hashtable RegionConfigHTTPHandler(Hashtable request) + { + Hashtable response = new Hashtable(); + response["content_type"] = "text/json"; + response["keepalive"] = false; + response["int_response_code"] = 200; + + response["str_response_string"] = m_FreeswitchService.GetJsonConfig(); + + return response; + } + } } diff --git a/OpenSim/Services/FreeswitchService/FreeswitchService.cs b/OpenSim/Services/FreeswitchService/FreeswitchService.cs index b62a65aad5..21518f320d 100644 --- a/OpenSim/Services/FreeswitchService/FreeswitchService.cs +++ b/OpenSim/Services/FreeswitchService/FreeswitchService.cs @@ -34,6 +34,7 @@ using OpenSim.Framework; using OpenSim.Data; using OpenSim.Services.Interfaces; using OpenMetaverse; +using OpenMetaverse.StructuredData; using System.Collections; namespace OpenSim.Services.FreeswitchService @@ -384,5 +385,24 @@ namespace OpenSim.Services.FreeswitchService return response; } + + public string GetJsonConfig() + { + OSDMap map = new OSDMap(11); + + map.Add("Realm", m_freeSwitchRealm); + map.Add("SIPProxy", m_freeSwitchSIPProxy); + map.Add("AttemptUseSTUN", m_freeSwitchAttemptUseSTUN); + map.Add("EchoServer", m_freeSwitchEchoServer); + map.Add("EchoPort", m_freeSwitchEchoPort); + map.Add("DefaultWellKnownIP", m_freeSwitchDefaultWellKnownIP); + map.Add("DefaultTimeout", m_freeSwitchDefaultTimeout); + map.Add("Context", m_freeSwitchContext); + map.Add("ServerUser", m_freeSwitchServerUser); + map.Add("ServerPass", m_freeSwitchServerPass); + map.Add("APIPrefix", m_freeSwitchAPIPrefix); + + return OSDParser.SerializeJsonString(map); + } } } diff --git a/OpenSim/Services/Interfaces/IFreeswitchService.cs b/OpenSim/Services/Interfaces/IFreeswitchService.cs index 2b3ffeb8a4..e7941d5406 100644 --- a/OpenSim/Services/Interfaces/IFreeswitchService.cs +++ b/OpenSim/Services/Interfaces/IFreeswitchService.cs @@ -35,5 +35,6 @@ namespace OpenSim.Services.Interfaces { Hashtable HandleDirectoryRequest(Hashtable requestBody); Hashtable HandleDialplanRequest(Hashtable requestBody); + string GetJsonConfig(); } } diff --git a/prebuild.xml b/prebuild.xml index ac003d9a17..00be4f9a37 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1023,6 +1023,7 @@ ../../../bin/ +