diff options
author | Justin Clarke Casey | 2008-03-31 18:41:24 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-03-31 18:41:24 +0000 |
commit | 106fd2f616cdd7086cf55325faf78b597d11f092 (patch) | |
tree | b5fd1f438eef62b3530a346cd8642f86fd7122ec /OpenSim | |
parent | * Minor: If a user exists but has no inventory in standalone, automatically c... (diff) | |
download | opensim-SC-106fd2f616cdd7086cf55325faf78b597d11f092.zip opensim-SC-106fd2f616cdd7086cf55325faf78b597d11f092.tar.gz opensim-SC-106fd2f616cdd7086cf55325faf78b597d11f092.tar.bz2 opensim-SC-106fd2f616cdd7086cf55325faf78b597d11f092.tar.xz |
* From: Dr Scofield <hud@zurich.ibm.com>
* (and Ansgar/Ansi)
* Fleshes out the voice stubs to better interact with the viewer CAPS requests - no actual voice support yet!
* In his own words
"the attached patch enhances the existing voice support by returning a proper voice account user and password and is preparing the config file so that we can specify a SIP server (not yet working). currently the SIP is hardcoded. the next step is to refactor voice support into a region module. working on that. "
Diffstat (limited to '')
5 files changed, 170 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 | |||
29 | using System.Collections; | ||
30 | using libsecondlife; | ||
31 | |||
32 | namespace 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 | |||
29 | using libsecondlife; | ||
30 | |||
31 | namespace 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 | ||
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 60c6127..427fc70 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -240,7 +240,16 @@ namespace OpenSim | |||
240 | { | 240 | { |
241 | config.Set("enabled", "false"); | 241 | config.Set("enabled", "false"); |
242 | } | 242 | } |
243 | |||
244 | if (DefaultConfig.Configs["Voice"] == null) | ||
245 | DefaultConfig.AddConfig("Voice"); | ||
246 | config = DefaultConfig.Configs["Voice"]; | ||
247 | if (config != null) | ||
248 | { | ||
249 | config.Set("enabled", "false"); | ||
250 | } | ||
243 | return DefaultConfig; | 251 | return DefaultConfig; |
252 | |||
244 | } | 253 | } |
245 | 254 | ||
246 | protected void ReadConfigSettings() | 255 | protected void ReadConfigSettings() |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2f277f9..2fa0459 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1590,6 +1590,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1590 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 1590 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
1591 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 1591 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
1592 | } | 1592 | } |
1593 | |||
1593 | public void HandleRemoveKnownRegionsFromAvatar(LLUUID avatarID, List<ulong> regionslst) | 1594 | public void HandleRemoveKnownRegionsFromAvatar(LLUUID avatarID, List<ulong> regionslst) |
1594 | { | 1595 | { |
1595 | ScenePresence av = GetScenePresence(avatarID); | 1596 | ScenePresence av = GetScenePresence(avatarID); |
@@ -1740,6 +1741,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1740 | cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; | 1741 | cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; |
1741 | cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; | 1742 | cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; |
1742 | cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS; | 1743 | cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS; |
1744 | cap.CAPSGetUserDetails = CommsManager.UserProfileCacheService.GetUserDetails; | ||
1743 | 1745 | ||
1744 | m_capsHandlers[agentId] = cap; | 1746 | m_capsHandlers[agentId] = cap; |
1745 | } | 1747 | } |