diff options
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 36 |
1 files changed, 30 insertions, 6 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; | |||
58 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | 58 | namespace 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 |