aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs25
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs48
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs8
3 files changed, 32 insertions, 49 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
index 94f29ea..c05d598 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
@@ -26,9 +26,7 @@
26 */ 26 */
27 27
28using log4net; 28using log4net;
29using System;
30using System.Reflection; 29using System.Reflection;
31using System.Text;
32using System.Collections; 30using System.Collections;
33 31
34namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 32namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
@@ -39,7 +37,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
39 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 37 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 38
41 39
42 public Hashtable HandleDialplanRequest(string Context, string Realm, Hashtable request) 40 public Hashtable HandleDialplanRequest(Hashtable request)
43 { 41 {
44 m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString()); 42 m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString());
45 43
@@ -50,32 +48,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
50 m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value); 48 m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
51 } 49 }
52 50
53 string requestcontext = (string) request["Hunt-Context"];
54 response["content_type"] = "text/xml"; 51 response["content_type"] = "text/xml";
55 response["keepalive"] = false; 52 response["keepalive"] = false;
56 response["int_response_code"] = 200; 53 response["int_response_code"] = 200;
57 if (Context != requestcontext && Context != "public") 54 response["str_response_string"] = @"<?xml version=""1.0"" encoding=""utf-8""?>
58 {
59 m_log.DebugFormat("[FreeSwitchDirectory] returning empty as it's for context {0} and we are using {1}", requestcontext, Context);
60 response["str_response_string"] = "";
61 } else {
62 response["str_response_string"] = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
63 <document type=""freeswitch/xml""> 55 <document type=""freeswitch/xml"">
64 <section name=""dialplan""> 56 <section name=""dialplan"">
65 <context name=""{0}"">" + 57 <context name=""default"">
66 58
67/* <!-- dial via SIP uri --> 59 <!-- dial via SIP uri -->
68 <extension name=""sip_uri""> 60 <extension name=""sip_uri"">
69 <condition field=""destination_number"" expression=""^sip:(.*)$""> 61 <condition field=""destination_number"" expression=""^sip:(.*)$"">
70 <action application=""bridge"" data=""sofia/${use_profile}/$1""/> 62 <action application=""bridge"" data=""sofia/${use_profile}/$1""/>
71 <!--<action application=""bridge"" data=""$1""/>--> 63 <!--<action application=""bridge"" data=""$1""/>-->
72 </condition> 64 </condition>
73 </extension>*/ 65 </extension>
74 66
75 @"<extension name=""opensim_conferences""> 67 <extension name=""opensim_conferences"">
76 <condition field=""destination_number"" expression=""^confctl-(.*)$""> 68 <condition field=""destination_number"" expression=""^confctl-(.*)$"">
77 <action application=""answer""/> 69 <action application=""answer""/>
78 <action application=""conference"" data=""$1-{1}@grid""/> 70 <action application=""conference"" data=""$1-${domain_name}@default""/>
79 </condition> 71 </condition>
80 </extension> 72 </extension>
81 73
@@ -94,8 +86,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
94 86
95 </context> 87 </context>
96 </section> 88 </section>
97 </document>", Context, Realm); 89 </document>";
98 }
99 90
100 return response; 91 return response;
101 } 92 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index 5d90a8f..0a9f69d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -38,18 +38,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
38 private static readonly ILog m_log = 38 private static readonly ILog m_log =
39 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 40
41 public Hashtable HandleDirectoryRequest(string Context, string Realm, Hashtable request) 41 public Hashtable HandleDirectoryRequest(Hashtable request)
42 { 42 {
43 Hashtable response = new Hashtable();
44 string domain = (string) request["domain"];
45 if (domain != Realm) {
46 response["content_type"] = "text/xml";
47 response["keepalive"] = false;
48 response["int_response_code"] = 200;
49 response["str_response_string"] = "";
50 } else {
51 m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString()); 43 m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString());
52 44
45 Hashtable response = new Hashtable();
46
53 // information in the request we might be interested in 47 // information in the request we might be interested in
54 48
55 // Request 1 sip_auth for users account 49 // Request 1 sip_auth for users account
@@ -91,11 +85,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
91 85
92 if (sipAuthMethod == "REGISTER") 86 if (sipAuthMethod == "REGISTER")
93 { 87 {
94 response = HandleRegister(Context, Realm, request); 88 response = HandleRegister(request);
95 } 89 }
96 else if (sipAuthMethod == "INVITE") 90 else if (sipAuthMethod == "INVITE")
97 { 91 {
98 response = HandleInvite(Context, Realm, request); 92 response = HandleInvite(request);
99 } 93 }
100 else 94 else
101 { 95 {
@@ -107,19 +101,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
107 } 101 }
108 else if (eventCallingFunction == "switch_xml_locate_user") 102 else if (eventCallingFunction == "switch_xml_locate_user")
109 { 103 {
110 response = HandleLocateUser(Realm, request); 104 response = HandleLocateUser(request);
111 } 105 }
112 else if (eventCallingFunction == "user_data_function") // gets called when an avatar to avatar call is made 106 else if (eventCallingFunction == "user_data_function") // gets called when an avatar to avatar call is made
113 { 107 {
114 response = HandleLocateUser(Realm, request); 108 response = HandleLocateUser(request);
115 } 109 }
116 else if (eventCallingFunction == "user_outgoing_channel") 110 else if (eventCallingFunction == "user_outgoing_channel")
117 { 111 {
118 response = HandleRegister(Context, Realm, request); 112 response = HandleRegister(request);
119 } 113 }
120 else if (eventCallingFunction == "config_sofia") // happens once on freeswitch startup 114 else if (eventCallingFunction == "config_sofia") // happens once on freeswitch startup
121 { 115 {
122 response = HandleConfigSofia(Context, Realm, request); 116 response = HandleConfigSofia(request);
123 } 117 }
124 else if (eventCallingFunction == "switch_load_network_lists") 118 else if (eventCallingFunction == "switch_load_network_lists")
125 { 119 {
@@ -137,11 +131,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
137 response["content_type"] = "text/xml"; 131 response["content_type"] = "text/xml";
138 response["str_response_string"] = ""; 132 response["str_response_string"] = "";
139 } 133 }
140 }
141 return response; 134 return response;
142 } 135 }
143 136
144 private Hashtable HandleRegister(string Context, string Realm, Hashtable request) 137 private Hashtable HandleRegister(Hashtable request)
145 { 138 {
146 m_log.Info("[FreeSwitchDirectory] HandleRegister called"); 139 m_log.Info("[FreeSwitchDirectory] HandleRegister called");
147 140
@@ -166,19 +159,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
166 "<param name=\"dial-string\" value=\"{{sip_contact_user={1}}}{{presence_id=${{dialed_user}}@${{dialed_domain}}}}${{sofia_contact(${{dialed_user}}@${{dialed_domain}})}}\"/>\r\n" + 159 "<param name=\"dial-string\" value=\"{{sip_contact_user={1}}}{{presence_id=${{dialed_user}}@${{dialed_domain}}}}${{sofia_contact(${{dialed_user}}@${{dialed_domain}})}}\"/>\r\n" +
167 "</params>\r\n" + 160 "</params>\r\n" +
168 "<variables>\r\n" + 161 "<variables>\r\n" +
169 "<variable name=\"user_context\" value=\"{3}\" />\r\n" + 162 "<variable name=\"user_context\" value=\"default\" />\r\n" +
170 "<variable name=\"presence_id\" value=\"{1}@{0}\"/>"+ 163 "<variable name=\"presence_id\" value=\"{1}@{0}\"/>"+
171 "</variables>\r\n" + 164 "</variables>\r\n" +
172 "</user>\r\n" + 165 "</user>\r\n" +
173 "</domain>\r\n" + 166 "</domain>\r\n" +
174 "</section>\r\n" + 167 "</section>\r\n" +
175 "</document>\r\n", 168 "</document>\r\n",
176 domain , user, password, Context); 169 domain , user, password);
177 170
178 return response; 171 return response;
179 } 172 }
180 173
181 private Hashtable HandleInvite(string Context, string Realm, Hashtable request) 174 private Hashtable HandleInvite(Hashtable request)
182 { 175 {
183 m_log.Info("[FreeSwitchDirectory] HandleInvite called"); 176 m_log.Info("[FreeSwitchDirectory] HandleInvite called");
184 177
@@ -203,7 +196,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
203 "<param name=\"dial-string\" value=\"{{sip_contact_user={1}}}{{presence_id=${1}@${{dialed_domain}}}}${{sofia_contact(${1}@${{dialed_domain}})}}\"/>\r\n" + 196 "<param name=\"dial-string\" value=\"{{sip_contact_user={1}}}{{presence_id=${1}@${{dialed_domain}}}}${{sofia_contact(${1}@${{dialed_domain}})}}\"/>\r\n" +
204 "</params>\r\n" + 197 "</params>\r\n" +
205 "<variables>\r\n" + 198 "<variables>\r\n" +
206 "<variable name=\"user_context\" value=\"{4}\" />\r\n" + 199 "<variable name=\"user_context\" value=\"default\" />\r\n" +
207 "<variable name=\"presence_id\" value=\"{1}@$${{domain}}\"/>"+ 200 "<variable name=\"presence_id\" value=\"{1}@$${{domain}}\"/>"+
208 "</variables>\r\n" + 201 "</variables>\r\n" +
209 "</user>\r\n" + 202 "</user>\r\n" +
@@ -213,19 +206,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
213 "<param name=\"dial-string\" value=\"{{sip_contact_user={1}}}{{presence_id=${3}@${{dialed_domain}}}}${{sofia_contact(${3}@${{dialed_domain}})}}\"/>\r\n" + 206 "<param name=\"dial-string\" value=\"{{sip_contact_user={1}}}{{presence_id=${3}@${{dialed_domain}}}}${{sofia_contact(${3}@${{dialed_domain}})}}\"/>\r\n" +
214 "</params>\r\n" + 207 "</params>\r\n" +
215 "<variables>\r\n" + 208 "<variables>\r\n" +
216 "<variable name=\"user_context\" value=\"{4}\" />\r\n" + 209 "<variable name=\"user_context\" value=\"default\" />\r\n" +
217 "<variable name=\"presence_id\" value=\"{3}@$${{domain}}\"/>"+ 210 "<variable name=\"presence_id\" value=\"{3}@$${{domain}}\"/>"+
218 "</variables>\r\n" + 211 "</variables>\r\n" +
219 "</user>\r\n" + 212 "</user>\r\n" +
220 "</domain>\r\n" + 213 "</domain>\r\n" +
221 "</section>\r\n" + 214 "</section>\r\n" +
222 "</document>\r\n", 215 "</document>\r\n",
223 domain , user, password,sipRequestUser, Context); 216 domain , user, password,sipRequestUser);
224 217
225 return response; 218 return response;
226 } 219 }
227 220
228 private Hashtable HandleLocateUser(String Realm, Hashtable request) 221
222 private Hashtable HandleLocateUser(Hashtable request)
229 { 223 {
230 m_log.Info("[FreeSwitchDirectory] HandleLocateUser called"); 224 m_log.Info("[FreeSwitchDirectory] HandleLocateUser called");
231 225
@@ -259,7 +253,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
259 return response; 253 return response;
260 } 254 }
261 255
262 private Hashtable HandleConfigSofia(string Context, string Realm, Hashtable request) 256 private Hashtable HandleConfigSofia(Hashtable request)
263 { 257 {
264 m_log.Info("[FreeSwitchDirectory] HandleConfigSofia called"); 258 m_log.Info("[FreeSwitchDirectory] HandleConfigSofia called");
265 259
@@ -292,7 +286,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
292 "<param name=\"retry-seconds\" value=\"30\"/>\r\n"+ 286 "<param name=\"retry-seconds\" value=\"30\"/>\r\n"+
293 "<param name=\"extension\" value=\"$${{default_provider_contact}}\"/>\r\n"+ 287 "<param name=\"extension\" value=\"$${{default_provider_contact}}\"/>\r\n"+
294 "<param name=\"contact-params\" value=\"domain_name=$${{domain}}\"/>\r\n"+ 288 "<param name=\"contact-params\" value=\"domain_name=$${{domain}}\"/>\r\n"+
295 "<param name=\"context\" value=\"{1}\"/>\r\n"+ 289 "<param name=\"context\" value=\"public\"/>\r\n"+
296 "</gateway>\r\n"+ 290 "</gateway>\r\n"+
297 "</gateways>\r\n"+ 291 "</gateways>\r\n"+
298 "<params>\r\n"+ 292 "<params>\r\n"+
@@ -307,7 +301,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
307 "</domain>\r\n" + 301 "</domain>\r\n" +
308 "</section>\r\n" + 302 "</section>\r\n" +
309 "</document>\r\n", 303 "</document>\r\n",
310 domain, Context); 304 domain);
311 305
312 return response; 306 return response;
313 } 307 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 5fa7efd..f9cb1c4 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -95,7 +95,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
95 // private static IPEndPoint m_FreeSwitchServiceIP; 95 // private static IPEndPoint m_FreeSwitchServiceIP;
96 private int m_freeSwitchServicePort; 96 private int m_freeSwitchServicePort;
97 private string m_openSimWellKnownHTTPAddress; 97 private string m_openSimWellKnownHTTPAddress;
98 private string m_freeSwitchContext;
99 98
100 private FreeSwitchDirectory m_FreeSwitchDirectory; 99 private FreeSwitchDirectory m_FreeSwitchDirectory;
101 private FreeSwitchDialplan m_FreeSwitchDialplan; 100 private FreeSwitchDialplan m_FreeSwitchDialplan;
@@ -152,7 +151,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
152 m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000); 151 m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000);
153 // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120); 152 // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
154 m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty); 153 m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
155 m_freeSwitchContext = m_config.GetString("freeswitch_context", "public");
156 154
157 if (String.IsNullOrEmpty(m_freeSwitchServerUser) || 155 if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
158 String.IsNullOrEmpty(m_freeSwitchServerPass) || 156 String.IsNullOrEmpty(m_freeSwitchServerPass) ||
@@ -574,7 +572,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
574 "<App.NoBottomLogo>false</App.NoBottomLogo>\r\n"+ 572 "<App.NoBottomLogo>false</App.NoBottomLogo>\r\n"+
575 "</VCConfiguration>", 573 "</VCConfiguration>",
576 m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN, 574 m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
577 m_freeSwitchEchoServer, m_freeSwitchEchoPort, 575 m_freeSwitchSTUNServer, m_freeSwitchEchoServer, m_freeSwitchEchoPort,
578 m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout, 576 m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
579 m_freeSwitchUrlResetPassword, ""); 577 m_freeSwitchUrlResetPassword, "");
580 578
@@ -730,9 +728,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
730 string section = (string) requestBody["section"]; 728 string section = (string) requestBody["section"];
731 729
732 if (section == "directory") 730 if (section == "directory")
733 response = m_FreeSwitchDirectory.HandleDirectoryRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody); 731 response = m_FreeSwitchDirectory.HandleDirectoryRequest(requestBody);
734 else if (section == "dialplan") 732 else if (section == "dialplan")
735 response = m_FreeSwitchDialplan.HandleDialplanRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody); 733 response = m_FreeSwitchDialplan.HandleDialplanRequest(requestBody);
736 else 734 else
737 m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section); 735 m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
738 736