diff options
Patch from otakup0pe:
A better solution for making the FreeSwitch module cooperate with
existing installations
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs index c05d598..b1f93e9 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using System; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text; | ||
30 | using System.Collections; | 32 | using System.Collections; |
31 | 33 | ||
32 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | 34 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice |
@@ -37,7 +39,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
37 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 39 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
38 | 40 | ||
39 | 41 | ||
40 | public Hashtable HandleDialplanRequest(Hashtable request) | 42 | public Hashtable HandleDialplanRequest(string Context, string Realm, Hashtable request) |
41 | { | 43 | { |
42 | m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString()); | 44 | m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString()); |
43 | 45 | ||
@@ -48,33 +50,39 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
48 | m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value); | 50 | m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value); |
49 | } | 51 | } |
50 | 52 | ||
53 | string requestcontext = (string) request["Hunt-Context"]; | ||
51 | response["content_type"] = "text/xml"; | 54 | response["content_type"] = "text/xml"; |
52 | response["keepalive"] = false; | 55 | response["keepalive"] = false; |
53 | response["int_response_code"] = 200; | 56 | response["int_response_code"] = 200; |
54 | response["str_response_string"] = @"<?xml version=""1.0"" encoding=""utf-8""?> | 57 | if ( Context != String.Empty && Context != requestcontext) |
58 | { | ||
59 | m_log.Debug("[FreeSwitchDirectory] returning empty as it's for another context"); | ||
60 | response["str_response_string"] = ""; | ||
61 | } else { | ||
62 | response["str_response_string"] = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?> | ||
55 | <document type=""freeswitch/xml""> | 63 | <document type=""freeswitch/xml""> |
56 | <section name=""dialplan""> | 64 | <section name=""dialplan""> |
57 | <context name=""default""> | 65 | <context name=""{0}"">" + |
58 | 66 | ||
59 | <!-- dial via SIP uri --> | 67 | /* <!-- dial via SIP uri --> |
60 | <extension name=""sip_uri""> | 68 | <extension name=""sip_uri""> |
61 | <condition field=""destination_number"" expression=""^sip:(.*)$""> | 69 | <condition field=""destination_number"" expression=""^sip:(.*)$""> |
62 | <action application=""bridge"" data=""sofia/${use_profile}/$1""/> | 70 | <action application=""bridge"" data=""sofia/${use_profile}/$1""/> |
63 | <!--<action application=""bridge"" data=""$1""/>--> | 71 | <!--<action application=""bridge"" data=""$1""/>--> |
64 | </condition> | 72 | </condition> |
65 | </extension> | 73 | </extension>*/ |
66 | 74 | ||
67 | <extension name=""opensim_conferences""> | 75 | @"<extension name=""opensim_conferences""> |
68 | <condition field=""destination_number"" expression=""^confctl-(.*)$""> | 76 | <condition field=""destination_number"" expression=""^confctl-(.*)$""> |
69 | <action application=""answer""/> | 77 | <action application=""answer""/> |
70 | <action application=""conference"" data=""$1-${domain_name}@default""/> | 78 | <action application=""conference"" data=""$1-{1}@{0}""/> |
71 | </condition> | 79 | </condition> |
72 | </extension> | 80 | </extension> |
73 | 81 | ||
74 | <extension name=""opensim_conf""> | 82 | <extension name=""opensim_conf""> |
75 | <condition field=""destination_number"" expression=""^conf-(.*)$""> | 83 | <condition field=""destination_number"" expression=""^conf-(.*)$""> |
76 | <action application=""answer""/> | 84 | <action application=""answer""/> |
77 | <action application=""conference"" data=""$1-${domain_name}@default""/> | 85 | <action application=""conference"" data=""$1-{1}@{0}""/> |
78 | </condition> | 86 | </condition> |
79 | </extension> | 87 | </extension> |
80 | 88 | ||
@@ -86,7 +94,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
86 | 94 | ||
87 | </context> | 95 | </context> |
88 | </section> | 96 | </section> |
89 | </document>"; | 97 | </document>", Context, Realm); |
98 | } | ||
90 | 99 | ||
91 | return response; | 100 | return response; |
92 | } | 101 | } |