aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
diff options
context:
space:
mode:
authorJonathan Freedman2010-11-23 22:27:54 -0800
committerJonathan Freedman2010-11-23 22:27:54 -0800
commitbc51dfc45eb73e34d91fd72d0a537ffc907a9da6 (patch)
tree084062cd82e16edbff08a5e3b705458d915caf86 /OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
parentMerge branch 'master-core' into mantis5110 (diff)
parentMerge branch 'master' of /var/git/opensim/ (diff)
downloadopensim-SC_OLD-bc51dfc45eb73e34d91fd72d0a537ffc907a9da6.zip
opensim-SC_OLD-bc51dfc45eb73e34d91fd72d0a537ffc907a9da6.tar.gz
opensim-SC_OLD-bc51dfc45eb73e34d91fd72d0a537ffc907a9da6.tar.bz2
opensim-SC_OLD-bc51dfc45eb73e34d91fd72d0a537ffc907a9da6.tar.xz
Merge branch 'master-core' into mantis5110
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs42
1 files changed, 33 insertions, 9 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 294d4f0..a583cca 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)
@@ -601,7 +603,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
601 response["str_response_string"] = string.Empty; 603 response["str_response_string"] = string.Empty;
602 response["content-type"] = "text/xml"; 604 response["content-type"] = "text/xml";
603 605
604 Hashtable requestBody = parseRequestBody((string)request["body"]); 606 Hashtable requestBody = ParseRequestBody((string)request["body"]);
605 607
606 if (!requestBody.ContainsKey("auth_token")) 608 if (!requestBody.ContainsKey("auth_token"))
607 return response; 609 return response;
@@ -673,7 +675,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
673 string uri = (string)request["uri"]; 675 string uri = (string)request["uri"];
674 string contenttype = (string)request["content-type"]; 676 string contenttype = (string)request["content-type"];
675 677
676 Hashtable requestBody = parseRequestBody((string)request["body"]); 678 Hashtable requestBody = ParseRequestBody((string)request["body"]);
677 679
678 //string pwd = (string) requestBody["pwd"]; 680 //string pwd = (string) requestBody["pwd"];
679 string userid = (string) requestBody["userid"]; 681 string userid = (string) requestBody["userid"];
@@ -717,7 +719,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
717 return response; 719 return response;
718 } 720 }
719 721
720 public Hashtable parseRequestBody(string body) 722 public Hashtable ParseRequestBody(string body)
721 { 723 {
722 Hashtable bodyParams = new Hashtable(); 724 Hashtable bodyParams = new Hashtable();
723 // split string 725 // split string
@@ -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