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/Framework/Communications/Capabilities/Caps.cs | |
parent | * Minor: If a user exists but has no inventory in standalone, automatically c... (diff) | |
download | opensim-SC_OLD-106fd2f616cdd7086cf55325faf78b597d11f092.zip opensim-SC_OLD-106fd2f616cdd7086cf55325faf78b597d11f092.tar.gz opensim-SC_OLD-106fd2f616cdd7086cf55325faf78b597d11f092.tar.bz2 opensim-SC_OLD-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 'OpenSim/Framework/Communications/Capabilities/Caps.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 132 |
1 files changed, 58 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> |