Merge branch 'master' of /var/git/opensim/

viewer-2-initial-appearance
opensim mirror account 2010-11-22 07:20:08 -08:00
commit f9f386f73b
1 changed files with 30 additions and 6 deletions

View File

@ -58,7 +58,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FreeSwitchVoiceModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FreeSwitchVoiceModule")]
public class FreeSwitchVoiceModule : INonSharedRegionModule, IVoiceModule public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -97,8 +97,6 @@ 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 IConfig m_Config; private IConfig m_Config;
private IFreeswitchService m_FreeswitchService; private IFreeswitchService m_FreeswitchService;
@ -165,6 +163,8 @@ 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);
MainServer.Instance.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);
// 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);
@ -214,15 +214,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
} }
} }
public void PostInitialise()
{
}
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
m_Scene = scene;
// We generate these like this: The region's external host name // We generate these like this: The region's external host name
// as defined in Regions.ini is a good address to use. It's a // as defined in Regions.ini is a good address to use. It's a
// dotted quad (or should be!) and it can reach this host from // dotted quad (or should be!) and it can reach this host from
// a client. The port is grabbed from the region's HTTP server. // a client. The port is grabbed from the region's HTTP server.
m_openSimWellKnownHTTPAddress = m_Scene.RegionInfo.ExternalHostName; m_openSimWellKnownHTTPAddress = scene.RegionInfo.ExternalHostName;
m_freeSwitchServicePort = MainServer.Instance.Port; m_freeSwitchServicePort = MainServer.Instance.Port;
if (m_Enabled) if (m_Enabled)
@ -790,6 +792,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{ {
return true; return true;
} }
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"]);
string section = (string) requestBody["section"];
if (section == "directory")
response = m_FreeswitchService.HandleDirectoryRequest(requestBody);
else if (section == "dialplan")
response = m_FreeswitchService.HandleDialplanRequest(requestBody);
else
m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
return response;
}
} }
public class MonoCert : ICertificatePolicy public class MonoCert : ICertificatePolicy