diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/FreeswitchService/FreeswitchService.cs | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/OpenSim/Services/FreeswitchService/FreeswitchService.cs b/OpenSim/Services/FreeswitchService/FreeswitchService.cs index 201e72f..970d682 100644 --- a/OpenSim/Services/FreeswitchService/FreeswitchService.cs +++ b/OpenSim/Services/FreeswitchService/FreeswitchService.cs | |||
@@ -74,7 +74,7 @@ namespace OpenSim.Services.FreeswitchService | |||
74 | response["str_response_string"] = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?> | 74 | response["str_response_string"] = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?> |
75 | <document type=""freeswitch/xml""> | 75 | <document type=""freeswitch/xml""> |
76 | <section name=""dialplan""> | 76 | <section name=""dialplan""> |
77 | <context name=""{0}"">" + | 77 | <context name=""{0}"">" + |
78 | 78 | ||
79 | /* <!-- dial via SIP uri --> | 79 | /* <!-- dial via SIP uri --> |
80 | <extension name=""sip_uri""> | 80 | <extension name=""sip_uri""> |
@@ -116,21 +116,21 @@ namespace OpenSim.Services.FreeswitchService | |||
116 | { | 116 | { |
117 | Hashtable response = new Hashtable(); | 117 | Hashtable response = new Hashtable(); |
118 | string domain = (string) request["domain"]; | 118 | string domain = (string) request["domain"]; |
119 | if (domain != m_freeSwitchRealm) | 119 | if (domain != m_freeSwitchRealm) |
120 | { | 120 | { |
121 | response["content_type"] = "text/xml"; | 121 | response["content_type"] = "text/xml"; |
122 | response["keepalive"] = false; | 122 | response["keepalive"] = false; |
123 | response["int_response_code"] = 200; | 123 | response["int_response_code"] = 200; |
124 | response["str_response_string"] = ""; | 124 | response["str_response_string"] = ""; |
125 | } | 125 | } |
126 | else | 126 | else |
127 | { | 127 | { |
128 | // m_log.DebugFormat("[FreeSwitchDirectory]: HandleDirectoryRequest called with {0}",request.ToString()); | 128 | // m_log.DebugFormat("[FreeSwitchDirectory]: HandleDirectoryRequest called with {0}",request.ToString()); |
129 | 129 | ||
130 | // information in the request we might be interested in | 130 | // information in the request we might be interested in |
131 | 131 | ||
132 | // Request 1 sip_auth for users account | 132 | // Request 1 sip_auth for users account |
133 | 133 | ||
134 | //Event-Calling-Function=sofia_reg_parse_auth | 134 | //Event-Calling-Function=sofia_reg_parse_auth |
135 | //Event-Calling-Line-Number=1494 | 135 | //Event-Calling-Line-Number=1494 |
136 | //action=sip_auth | 136 | //action=sip_auth |
@@ -145,10 +145,10 @@ namespace OpenSim.Services.FreeswitchService | |||
145 | //user=xhZuXKmRpECyr2AARJYyGgg%3D%3D | 145 | //user=xhZuXKmRpECyr2AARJYyGgg%3D%3D |
146 | //domain=9.20.151.43 | 146 | //domain=9.20.151.43 |
147 | //ip=9.167.220.137 // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup | 147 | //ip=9.167.220.137 // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup |
148 | 148 | ||
149 | // foreach (DictionaryEntry item in request) | 149 | // foreach (DictionaryEntry item in request) |
150 | // m_log.DebugFormat("[FreeSwitchDirectory]: requestBody item {0} {1}", item.Key, item.Value); | 150 | // m_log.DebugFormat("[FreeSwitchDirectory]: requestBody item {0} {1}", item.Key, item.Value); |
151 | 151 | ||
152 | string eventCallingFunction = (string) request["Event-Calling-Function"]; | 152 | string eventCallingFunction = (string) request["Event-Calling-Function"]; |
153 | if (eventCallingFunction == null) | 153 | if (eventCallingFunction == null) |
154 | { | 154 | { |
@@ -159,15 +159,15 @@ namespace OpenSim.Services.FreeswitchService | |||
159 | { | 159 | { |
160 | eventCallingFunction = "sofia_reg_parse_auth"; | 160 | eventCallingFunction = "sofia_reg_parse_auth"; |
161 | } | 161 | } |
162 | 162 | ||
163 | if (eventCallingFunction == "sofia_reg_parse_auth") | 163 | if (eventCallingFunction == "sofia_reg_parse_auth") |
164 | { | 164 | { |
165 | string sipAuthMethod = (string)request["sip_auth_method"]; | 165 | string sipAuthMethod = (string)request["sip_auth_method"]; |
166 | 166 | ||
167 | if (sipAuthMethod == "REGISTER") | 167 | if (sipAuthMethod == "REGISTER") |
168 | { | 168 | { |
169 | response = HandleRegister(m_freeSwitchContext, m_freeSwitchRealm, request); | 169 | response = HandleRegister(m_freeSwitchContext, m_freeSwitchRealm, request); |
170 | } | 170 | } |
171 | else if (sipAuthMethod == "INVITE") | 171 | else if (sipAuthMethod == "INVITE") |
172 | { | 172 | { |
173 | response = HandleInvite(m_freeSwitchContext, m_freeSwitchRealm, request); | 173 | response = HandleInvite(m_freeSwitchContext, m_freeSwitchRealm, request); |
@@ -215,16 +215,16 @@ namespace OpenSim.Services.FreeswitchService | |||
215 | } | 215 | } |
216 | return response; | 216 | return response; |
217 | } | 217 | } |
218 | 218 | ||
219 | private Hashtable HandleRegister(string Context, string Realm, Hashtable request) | 219 | private Hashtable HandleRegister(string Context, string Realm, Hashtable request) |
220 | { | 220 | { |
221 | m_log.Info("[FreeSwitchDirectory]: HandleRegister called"); | 221 | m_log.Info("[FreeSwitchDirectory]: HandleRegister called"); |
222 | 222 | ||
223 | // TODO the password we return needs to match that sent in the request, this is hard coded for now | 223 | // TODO the password we return needs to match that sent in the request, this is hard coded for now |
224 | string password = "1234"; | 224 | string password = "1234"; |
225 | string domain = (string) request["domain"]; | 225 | string domain = (string) request["domain"]; |
226 | string user = (string) request["user"]; | 226 | string user = (string) request["user"]; |
227 | 227 | ||
228 | Hashtable response = new Hashtable(); | 228 | Hashtable response = new Hashtable(); |
229 | response["content_type"] = "text/xml"; | 229 | response["content_type"] = "text/xml"; |
230 | response["keepalive"] = false; | 230 | response["keepalive"] = false; |
@@ -249,20 +249,20 @@ namespace OpenSim.Services.FreeswitchService | |||
249 | "</section>\r\n" + | 249 | "</section>\r\n" + |
250 | "</document>\r\n", | 250 | "</document>\r\n", |
251 | domain , user, password, Context); | 251 | domain , user, password, Context); |
252 | 252 | ||
253 | return response; | 253 | return response; |
254 | } | 254 | } |
255 | 255 | ||
256 | private Hashtable HandleInvite(string Context, string Realm, Hashtable request) | 256 | private Hashtable HandleInvite(string Context, string Realm, Hashtable request) |
257 | { | 257 | { |
258 | m_log.Info("[FreeSwitchDirectory]: HandleInvite called"); | 258 | m_log.Info("[FreeSwitchDirectory]: HandleInvite called"); |
259 | 259 | ||
260 | // TODO the password we return needs to match that sent in the request, this is hard coded for now | 260 | // TODO the password we return needs to match that sent in the request, this is hard coded for now |
261 | string password = "1234"; | 261 | string password = "1234"; |
262 | string domain = (string) request["domain"]; | 262 | string domain = (string) request["domain"]; |
263 | string user = (string) request["user"]; | 263 | string user = (string) request["user"]; |
264 | string sipRequestUser = (string) request["sip_request_user"]; | 264 | string sipRequestUser = (string) request["sip_request_user"]; |
265 | 265 | ||
266 | Hashtable response = new Hashtable(); | 266 | Hashtable response = new Hashtable(); |
267 | response["content_type"] = "text/xml"; | 267 | response["content_type"] = "text/xml"; |
268 | response["keepalive"] = false; | 268 | response["keepalive"] = false; |
@@ -296,18 +296,18 @@ namespace OpenSim.Services.FreeswitchService | |||
296 | "</section>\r\n" + | 296 | "</section>\r\n" + |
297 | "</document>\r\n", | 297 | "</document>\r\n", |
298 | domain , user, password,sipRequestUser, Context); | 298 | domain , user, password,sipRequestUser, Context); |
299 | 299 | ||
300 | return response; | 300 | return response; |
301 | } | 301 | } |
302 | 302 | ||
303 | private Hashtable HandleLocateUser(String Realm, Hashtable request) | 303 | private Hashtable HandleLocateUser(String Realm, Hashtable request) |
304 | { | 304 | { |
305 | m_log.Info("[FreeSwitchDirectory]: HandleLocateUser called"); | 305 | m_log.Info("[FreeSwitchDirectory]: HandleLocateUser called"); |
306 | 306 | ||
307 | // TODO the password we return needs to match that sent in the request, this is hard coded for now | 307 | // TODO the password we return needs to match that sent in the request, this is hard coded for now |
308 | string domain = (string) request["domain"]; | 308 | string domain = (string) request["domain"]; |
309 | string user = (string) request["user"]; | 309 | string user = (string) request["user"]; |
310 | 310 | ||
311 | Hashtable response = new Hashtable(); | 311 | Hashtable response = new Hashtable(); |
312 | response["content_type"] = "text/xml"; | 312 | response["content_type"] = "text/xml"; |
313 | response["keepalive"] = false; | 313 | response["keepalive"] = false; |
@@ -330,17 +330,17 @@ namespace OpenSim.Services.FreeswitchService | |||
330 | "</section>\r\n" + | 330 | "</section>\r\n" + |
331 | "</document>\r\n", | 331 | "</document>\r\n", |
332 | domain , user); | 332 | domain , user); |
333 | 333 | ||
334 | return response; | 334 | return response; |
335 | } | 335 | } |
336 | 336 | ||
337 | private Hashtable HandleConfigSofia(string Context, string Realm, Hashtable request) | 337 | private Hashtable HandleConfigSofia(string Context, string Realm, Hashtable request) |
338 | { | 338 | { |
339 | m_log.Info("[FreeSwitchDirectory]: HandleConfigSofia called."); | 339 | m_log.Info("[FreeSwitchDirectory]: HandleConfigSofia called."); |
340 | 340 | ||
341 | // TODO the password we return needs to match that sent in the request, this is hard coded for now | 341 | // TODO the password we return needs to match that sent in the request, this is hard coded for now |
342 | string domain = (string) request["domain"]; | 342 | string domain = (string) request["domain"]; |
343 | 343 | ||
344 | Hashtable response = new Hashtable(); | 344 | Hashtable response = new Hashtable(); |
345 | response["content_type"] = "text/xml"; | 345 | response["content_type"] = "text/xml"; |
346 | response["keepalive"] = false; | 346 | response["keepalive"] = false; |
@@ -381,9 +381,9 @@ namespace OpenSim.Services.FreeswitchService | |||
381 | "</variables>\r\n"+ | 381 | "</variables>\r\n"+ |
382 | "</domain>\r\n" + | 382 | "</domain>\r\n" + |
383 | "</section>\r\n" + | 383 | "</section>\r\n" + |
384 | "</document>\r\n", | 384 | "</document>\r\n", |
385 | domain, Context); | 385 | domain, Context); |
386 | 386 | ||
387 | return response; | 387 | return response; |
388 | } | 388 | } |
389 | 389 | ||