Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-11-22 14:14:45 +00:00
commit 87f30709a2
2 changed files with 34 additions and 8 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

View File

@ -393,13 +393,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); // m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
PostEvent(new EventParams("changed", PostEvent(new EventParams("changed",
new Object[] { (int)Changed.REGION_RESTART }, new DetectParams[0])); new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) },
new DetectParams[0]));
} }
else if (m_stateSource == StateSource.PrimCrossing) else if (m_stateSource == StateSource.PrimCrossing)
{ {
// CHANGED_REGION // CHANGED_REGION
PostEvent(new EventParams("changed", PostEvent(new EventParams("changed",
new Object[] { (int)Changed.REGION }, new DetectParams[0])); new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) },
new DetectParams[0]));
} }
} }
else else