aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-04-20 01:02:40 +0100
committerJustin Clark-Casey (justincc)2011-04-20 01:02:40 +0100
commitccc26f74436f0e3069587efd96497053e4129c3c (patch)
treeeb12030259e5797288c181e6be13e61c06756f9e /OpenSim
parentsynchronize Robust.HG.ini.example FreeSWITCH config with other config files (diff)
downloadopensim-SC_OLD-ccc26f74436f0e3069587efd96497053e4129c3c.zip
opensim-SC_OLD-ccc26f74436f0e3069587efd96497053e4129c3c.tar.gz
opensim-SC_OLD-ccc26f74436f0e3069587efd96497053e4129c3c.tar.bz2
opensim-SC_OLD-ccc26f74436f0e3069587efd96497053e4129c3c.tar.xz
Get Viewer 2 voice working with OpenSim.
See http://opensimulator.org/mantis/view.php?id=5336 It turns out that viewer 2 was upset by the lack of a response to viv_watcher.php. This would send it into a continuous login loop. Viewer 1 was quite happy to ignore the lack of response. This commit puts in the bare minimum 'OK' message in response to viv_watcher.php. This allows viewer 2 voice to connect and appears to work. However, at some point we need to fill out the watcher response, whatever that is.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs79
2 files changed, 67 insertions, 14 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index ccec9b7..ba89e21 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -430,7 +430,7 @@ namespace OpenSim.Framework.Servers.HttpServer
430 string path = request.RawUrl; 430 string path = request.RawUrl;
431 string handlerKey = GetHandlerKey(request.HttpMethod, path); 431 string handlerKey = GetHandlerKey(request.HttpMethod, path);
432 432
433 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 433// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
434 434
435 if (TryGetStreamHandler(handlerKey, out requestHandler)) 435 if (TryGetStreamHandler(handlerKey, out requestHandler))
436 { 436 {
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 962b5ca..373ffeb 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -163,13 +163,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
163 // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); 163 // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
164 // MainServer.Instance.AddStreamHandler(h); 164 // MainServer.Instance.AddStreamHandler(h);
165 165
166
167
168 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix), 166 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
169 FreeSwitchSLVoiceSigninHTTPHandler); 167 FreeSwitchSLVoiceSigninHTTPHandler);
170 168
171 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix), 169 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
172 FreeSwitchSLVoiceBuddyHTTPHandler); 170 FreeSwitchSLVoiceBuddyHTTPHandler);
171
172 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_watcher.php", m_freeSwitchAPIPrefix),
173 FreeSwitchSLVoiceWatcherHTTPHandler);
173 174
174 m_log.InfoFormat("[FreeSwitchVoice]: using FreeSwitch server {0}", m_freeSwitchRealm); 175 m_log.InfoFormat("[FreeSwitchVoice]: using FreeSwitch server {0}", m_freeSwitchRealm);
175 176
@@ -301,7 +302,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
301 public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps) 302 public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps)
302 { 303 {
303 m_log.DebugFormat( 304 m_log.DebugFormat(
304 "[FreeSwitchVoice]: OnRegisterCaps called with agentID {0} caps {1} in scene {2}", 305 "[FreeSwitchVoice]: OnRegisterCaps() called with agentID {0} caps {1} in scene {2}",
305 agentID, caps, scene.RegionInfo.RegionName); 306 agentID, caps, scene.RegionInfo.RegionName);
306 307
307 string capsBase = "/CAPS/" + caps.CapsObjectPath; 308 string capsBase = "/CAPS/" + caps.CapsObjectPath;
@@ -344,6 +345,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
344 public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param, 345 public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param,
345 UUID agentID, Caps caps) 346 UUID agentID, Caps caps)
346 { 347 {
348 m_log.DebugFormat(
349 "[FreeSwitchVoice][PROVISIONVOICE]: ProvisionVoiceAccountRequest() request: {0}, path: {1}, param: {2}", request, path, param);
350
347 ScenePresence avatar = scene.GetScenePresence(agentID); 351 ScenePresence avatar = scene.GetScenePresence(agentID);
348 if (avatar == null) 352 if (avatar == null)
349 { 353 {
@@ -357,9 +361,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
357 361
358 try 362 try
359 { 363 {
360 //m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
361 // request, path, param);
362
363 //XmlElement resp; 364 //XmlElement resp;
364 string agentname = "x" + Convert.ToBase64String(agentID.GetBytes()); 365 string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
365 string password = "1234";//temp hack//new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16); 366 string password = "1234";//temp hack//new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16);
@@ -416,6 +417,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
416 public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param, 417 public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
417 UUID agentID, Caps caps) 418 UUID agentID, Caps caps)
418 { 419 {
420// m_log.DebugFormat(
421// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
422// scene.RegionInfo.RegionName, agentID);
423
419 ScenePresence avatar = scene.GetScenePresence(agentID); 424 ScenePresence avatar = scene.GetScenePresence(agentID);
420 string avatarName = avatar.Name; 425 string avatarName = avatar.Name;
421 426
@@ -502,6 +507,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
502 507
503 m_log.DebugFormat("[FreeSwitchVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}", 508 m_log.DebugFormat("[FreeSwitchVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}",
504 avatarName, request, path, param); 509 avatarName, request, path, param);
510
505 return "<llsd>true</llsd>"; 511 return "<llsd>true</llsd>";
506 } 512 }
507 513
@@ -555,7 +561,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
555 return response; 561 return response;
556 } 562 }
557 563
558
559 public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request) 564 public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
560 { 565 {
561 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceGetPreloginHTTPHandler called"); 566 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceGetPreloginHTTPHandler called");
@@ -592,6 +597,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
592 597
593 public Hashtable FreeSwitchSLVoiceBuddyHTTPHandler(Hashtable request) 598 public Hashtable FreeSwitchSLVoiceBuddyHTTPHandler(Hashtable request)
594 { 599 {
600 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceBuddyHTTPHandler called");
601
595 Hashtable response = new Hashtable(); 602 Hashtable response = new Hashtable();
596 response["int_response_code"] = 200; 603 response["int_response_code"] = 200;
597 response["str_response_string"] = string.Empty; 604 response["str_response_string"] = string.Empty;
@@ -650,18 +657,61 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
650 <bdy_status>A</bdy_status> 657 <bdy_status>A</bdy_status>
651 <modified_ts>{3}</modified_ts> 658 <modified_ts>{3}</modified_ts>
652 <b2g_group_id></b2g_group_id> 659 <b2g_group_id></b2g_group_id>
653 </level3>", ids[i],i,m_freeSwitchRealm,dt)); 660 </level3>", ids[i], i ,m_freeSwitchRealm, dt));
654 } 661 }
655 662
656 resp.Append("</buddies><groups></groups></body></level0></response>"); 663 resp.Append("</buddies><groups></groups></body></level0></response>");
657 664
658 response["str_response_string"] = resp.ToString(); 665 response["str_response_string"] = resp.ToString();
659// Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); 666// Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
660 667//
661 //m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],"")); 668// m_log.DebugFormat(
669// "[FREESWITCH]: FreeSwitchSLVoiceBuddyHTTPHandler() response {0}",
670// normalizeEndLines.Replace((string)response["str_response_string"],""));
671
662 return response; 672 return response;
663 } 673 }
664 674
675 public Hashtable FreeSwitchSLVoiceWatcherHTTPHandler(Hashtable request)
676 {
677 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceWatcherHTTPHandler called");
678
679 Hashtable response = new Hashtable();
680 response["int_response_code"] = 200;
681 response["content-type"] = "text/xml";
682
683 Hashtable requestBody = ParseRequestBody((string)request["body"]);
684
685 string auth_token = (string)requestBody["auth_token"];
686 //string[] auth_tokenvals = auth_token.Split(':');
687 //string username = auth_tokenvals[0];
688
689 StringBuilder resp = new StringBuilder();
690 resp.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><response xmlns=\"http://www.vivox.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"/xsd/buddy_list.xsd\">");
691
692 // FIXME: This is enough of a response to stop viewer 2 complaining about a login failure and get voice to work. If we don't
693 // give an OK response, then viewer 2 engages in an continuous viv_signin.php, viv_buddy.php, viv_watcher.php loop
694 // Viewer 1 appeared happy to ignore the lack of reply and still works with this reply.
695 //
696 // However, really we need to fill in whatever watcher data should be here (whatever that is).
697 resp.Append(string.Format(@"<level0>
698 <status>OK</status>
699 <cookie_name>lib_session</cookie_name>
700 <cookie>{0}</cookie>
701 <auth_token>{0}</auth_token>
702 <body/></level0></response>", auth_token));
703
704 response["str_response_string"] = resp.ToString();
705
706// Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
707//
708// m_log.DebugFormat(
709// "[FREESWITCH]: FreeSwitchSLVoiceWatcherHTTPHandler() response {0}",
710// normalizeEndLines.Replace((string)response["str_response_string"],""));
711
712 return response;
713 }
714
665 public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request) 715 public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request)
666 { 716 {
667 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceSigninHTTPHandler called"); 717 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceSigninHTTPHandler called");
@@ -709,7 +759,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
709 </level0> 759 </level0>
710 </response>", userid, pos, avatarName); 760 </response>", userid, pos, avatarName);
711 761
712 response["int_response_code"] = 200; 762 response["int_response_code"] = 200;
763
764// m_log.DebugFormat("[FreeSwitchVoice]: Sending FreeSwitchSLVoiceSigninHTTPHandler response");
765
713 return response; 766 return response;
714 } 767 }
715 768
@@ -823,4 +876,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
823 876
824 #endregion 877 #endregion
825 } 878 }
826} 879} \ No newline at end of file