aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs132
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs52
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs49
3 files changed, 159 insertions, 74 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index c9e7507..66de991 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -55,6 +55,12 @@ namespace OpenSim.Region.Capabilities
55 public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, 55 public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
56 bool fetchFolders, bool fetchItems, int sortOrder); 56 bool fetchFolders, bool fetchItems, int sortOrder);
57 57
58 /// <summary>
59 /// FIXME This is a temporary delegate, and should disappear once the voice code is fleshed out and moved into its
60 /// own region module.
61 /// </summary>
62 public delegate CachedUserInfo GetUserDetailsCAPS(LLUUID agentID);
63
58 public class Caps 64 public class Caps
59 { 65 {
60 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 66 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -67,7 +73,7 @@ namespace OpenSim.Region.Capabilities
67 /// </summary> 73 /// </summary>
68 private string m_capsObjectPath; 74 private string m_capsObjectPath;
69 public string CapsObjectPath { get { return m_capsObjectPath; } } 75 public string CapsObjectPath { get { return m_capsObjectPath; } }
70 76
71 private static readonly string m_requestPath = "0000/"; 77 private static readonly string m_requestPath = "0000/";
72 private static readonly string m_mapLayerPath = "0001/"; 78 private static readonly string m_mapLayerPath = "0001/";
73 private static readonly string m_newInventory = "0002/"; 79 private static readonly string m_newInventory = "0002/";
@@ -93,6 +99,7 @@ namespace OpenSim.Region.Capabilities
93 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; 99 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
94 // 100 //
95 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; 101 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
102 public GetUserDetailsCAPS CAPSGetUserDetails = null;
96 103
97 public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, 104 public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
98 LLUUID agent, bool dumpAssetsToFile) 105 LLUUID agent, bool dumpAssetsToFile)
@@ -436,98 +443,75 @@ namespace OpenSim.Region.Capabilities
436 return null; 443 return null;
437 } 444 }
438 445
439 446 /// <summary>
440 public string ParcelVoiceInfoRequest(string request, string path, string param) 447 /// Callback for a client request for ParcelVoiceInfo
441 { 448 /// </summary>
449 /// <param name="request"></param>
450 /// <param name="path"></param>
451 /// <param name="param"></param>
452 /// <returns></returns>
453 public string ParcelVoiceInfoRequest(string request, string path, string param) {
442 try 454 try
443 { 455 {
444 m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); 456 m_log.DebugFormat("[CAPS][PARCELVOICE]: request: {0}, path: {1}, param: {2}", request, path, param);
445 457
446 //Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); 458 // XXX brutal hack, we need to get channel_uri, region
447 //LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); 459 // name, and parcel_local_id from somewhere
448 //LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); 460 Hashtable creds = new Hashtable();
449 461
450 //string capsBase = "/CAPS/" + m_capsObjectPath; 462 creds["channel_uri"] = "sip:testroom@testserver.com";
451 //string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 463
452 464 LLSDParcelVoiceInfoResponse parcelVoiceInfo =
453 //TaskInventoryScriptUpdater uploader = 465 new LLSDParcelVoiceInfoResponse("OpenSim Test", 1, creds);
454 //new TaskInventoryScriptUpdater( 466
455 //llsdUpdateRequest.item_id, 467 // XXX for debugging purposes:
456 //llsdUpdateRequest.task_id, 468 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
457 //llsdUpdateRequest.is_script_running, 469 m_log.DebugFormat("[CAPS][PARCELVOICE]: {0}", r);
458 //capsBase + uploaderPath, 470
459 //m_httpListener, 471 return r;
460 //m_dumpAssetsToFile);
461 //uploader.OnUpLoad += TaskScriptUpdated;
462
463 //m_httpListener.AddStreamHandler(
464 //new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
465 //string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
466 //uploaderPath;
467
468 //LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
469 //uploadResponse.uploader = uploaderURL;
470 //uploadResponse.state = "upload";
471
472 // m_log.InfoFormat("[CAPS]: " +
473 // "ScriptTaskInventory response: {0}",
474 // LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
475
476 return LLSDHelpers.SerialiseLLSDReply("<llsd><map><key>parcel_local_id</key><integer>16</integer><key>region_name</key><string>Teravus Test</string><key>voice_credentials</key><map><key>channel_uri</key><string>sip:conference@192.168.1.127\nsip:user@192.168.1.127</string></map></map></llsd>");
477 } 472 }
478 catch (Exception e) 473 catch (Exception e)
479 { 474 {
480 m_log.Error("[CAPS]: " + e.ToString()); 475 m_log.Error("[CAPS]: " + e.ToString());
481 } 476 }
482 477
483 return null; 478 return null;
484 } 479 }
485 480
486 public string ProvisionVoiceAccountRequest(string request, string path, string param) 481 /// <summary>
487 { 482 /// Callback for a client request for Voice Account Details
483 /// </summary>
484 /// <param name="request"></param>
485 /// <param name="path"></param>
486 /// <param name="param"></param>
487 /// <returns></returns>
488 public string ProvisionVoiceAccountRequest(string request, string path, string param) {
488 try 489 try
489 { 490 {
490 m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); 491 m_log.DebugFormat("[CAPS][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}", request, path, param);
491 492
492 //Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); 493 if (null == CAPSGetUserDetails) throw new Exception("CAPSGetUserDetails null");
493 //LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); 494
494 //LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); 495 string voiceUser = "x" + Convert.ToBase64String(m_agentID.GetBytes());
495 496 voiceUser = voiceUser.Replace('+', '-').Replace('/', '_');
496 //string capsBase = "/CAPS/" + m_capsObjectPath; 497
497 //string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 498 CachedUserInfo userInfo = CAPSGetUserDetails(m_agentID);
498 499 if (null == userInfo) throw new Exception("CAPSGetUserDetails returned null");
499 //TaskInventoryScriptUpdater uploader = 500
500 //new TaskInventoryScriptUpdater( 501 LLSDVoiceAccountResponse voiceAccountResponse =
501 //llsdUpdateRequest.item_id, 502 new LLSDVoiceAccountResponse(voiceUser, "$1$" + userInfo.UserProfile.passwordHash);
502 //llsdUpdateRequest.task_id, 503 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
503 //llsdUpdateRequest.is_script_running, 504 m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);
504 //capsBase + uploaderPath, 505 return r;
505 //m_httpListener,
506 //m_dumpAssetsToFile);
507 //uploader.OnUpLoad += TaskScriptUpdated;
508
509 //m_httpListener.AddStreamHandler(
510 //new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
511 //string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
512 //uploaderPath;
513
514 //LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
515 //uploadResponse.uploader = uploaderURL;
516 //uploadResponse.state = "upload";
517
518 // m_log.InfoFormat("[CAPS]: " +
519 // "ScriptTaskInventory response: {0}",
520 // LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
521
522 return LLSDHelpers.SerialiseLLSDReply("<llsd><map><key>events</key><array><map><key>body</key><map><key>major_version</key><integer>1</integer><key>minor_version</key><integer>0</integer><key>region_name</key><string>Teravus Test</string></map><key>message</key><string>RequiredVoiceVersion</string></map></array><key>id</key><integer>152477222</integer></map></llsd>");
523 } 506 }
524 catch (Exception e) 507 catch (Exception e)
525 { 508 {
526 m_log.Error("[CAPS]: " + e.ToString()); 509 m_log.Error("[CAPS][PROVISIONVOICE]: " + e.ToString());
527 } 510 }
528 511
529 return null; 512 return null;
530 } 513 }
514
531 /// <summary> 515 /// <summary>
532 /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. 516 /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset.
533 /// </summary> 517 /// </summary>
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs
new file mode 100644
index 0000000..4fb0544
--- /dev/null
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs
@@ -0,0 +1,52 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System.Collections;
30using libsecondlife;
31
32namespace OpenSim.Region.Capabilities
33{
34 [LLSDMap]
35 public class LLSDParcelVoiceInfoResponse
36 {
37 public int parcel_local_id;
38 public string region_name;
39 public Hashtable voice_credentials;
40
41 public LLSDParcelVoiceInfoResponse()
42 {
43 }
44
45 public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
46 {
47 region_name = region;
48 parcel_local_id = localID;
49 voice_credentials = creds;
50 }
51 }
52} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs
new file mode 100644
index 0000000..8a18213
--- /dev/null
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs
@@ -0,0 +1,49 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using libsecondlife;
30
31namespace OpenSim.Region.Capabilities
32{
33 [LLSDMap]
34 public class LLSDVoiceAccountResponse
35 {
36 public string username;
37 public string password;
38
39 public LLSDVoiceAccountResponse()
40 {
41 }
42
43 public LLSDVoiceAccountResponse(string user, string pass)
44 {
45 username = user;
46 password = pass;
47 }
48 }
49} \ No newline at end of file