aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs36
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs6
2 files changed, 34 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 294d4f0..9a17233 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -58,7 +58,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
58namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 58namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
59{ 59{
60 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FreeSwitchVoiceModule")] 60 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FreeSwitchVoiceModule")]
61 public class FreeSwitchVoiceModule : INonSharedRegionModule, IVoiceModule 61 public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule
62 { 62 {
63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
64 64
@@ -97,8 +97,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
97 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); 97 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
98 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); 98 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
99 99
100 private Scene m_Scene;
101
102 private IConfig m_Config; 100 private IConfig m_Config;
103 101
104 private IFreeswitchService m_FreeswitchService; 102 private IFreeswitchService m_FreeswitchService;
@@ -165,6 +163,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
165 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), 163 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
166 FreeSwitchSLVoiceGetPreloginHTTPHandler); 164 FreeSwitchSLVoiceGetPreloginHTTPHandler);
167 165
166 MainServer.Instance.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);
167
168 // RestStreamHandler h = new 168 // RestStreamHandler h = new
169 // RestStreamHandler("GET", 169 // RestStreamHandler("GET",
170 // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); 170 // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
@@ -214,15 +214,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
214 } 214 }
215 } 215 }
216 216
217 public void AddRegion(Scene scene) 217 public void PostInitialise()
218 { 218 {
219 m_Scene = scene; 219 }
220 220
221 public void AddRegion(Scene scene)
222 {
221 // We generate these like this: The region's external host name 223 // We generate these like this: The region's external host name
222 // as defined in Regions.ini is a good address to use. It's a 224 // as defined in Regions.ini is a good address to use. It's a
223 // dotted quad (or should be!) and it can reach this host from 225 // dotted quad (or should be!) and it can reach this host from
224 // a client. The port is grabbed from the region's HTTP server. 226 // a client. The port is grabbed from the region's HTTP server.
225 m_openSimWellKnownHTTPAddress = m_Scene.RegionInfo.ExternalHostName; 227 m_openSimWellKnownHTTPAddress = scene.RegionInfo.ExternalHostName;
226 m_freeSwitchServicePort = MainServer.Instance.Port; 228 m_freeSwitchServicePort = MainServer.Instance.Port;
227 229
228 if (m_Enabled) 230 if (m_Enabled)
@@ -790,6 +792,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
790 { 792 {
791 return true; 793 return true;
792 } 794 }
795
796 public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
797 {
798 Hashtable response = new Hashtable();
799 response["str_response_string"] = string.Empty;
800 response["content_type"] = "text/plain";
801 response["keepalive"] = false;
802 response["int_response_code"] = 500;
803
804 Hashtable requestBody = ParseRequestBody((string) request["body"]);
805
806 string section = (string) requestBody["section"];
807
808 if (section == "directory")
809 response = m_FreeswitchService.HandleDirectoryRequest(requestBody);
810 else if (section == "dialplan")
811 response = m_FreeswitchService.HandleDialplanRequest(requestBody);
812 else
813 m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
814
815 return response;
816 }
793 } 817 }
794 818
795 public class MonoCert : ICertificatePolicy 819 public class MonoCert : ICertificatePolicy
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 623cb7d..5288cd3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -393,13 +393,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
393 { 393 {
394// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); 394// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
395 PostEvent(new EventParams("changed", 395 PostEvent(new EventParams("changed",
396 new Object[] { (int)Changed.REGION_RESTART }, new DetectParams[0])); 396 new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) },
397 new DetectParams[0]));
397 } 398 }
398 else if (m_stateSource == StateSource.PrimCrossing) 399 else if (m_stateSource == StateSource.PrimCrossing)
399 { 400 {
400 // CHANGED_REGION 401 // CHANGED_REGION
401 PostEvent(new EventParams("changed", 402 PostEvent(new EventParams("changed",
402 new Object[] { (int)Changed.REGION }, new DetectParams[0])); 403 new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) },
404 new DetectParams[0]));
403 } 405 }
404 } 406 }
405 else 407 else