* 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. "
0.6.0-stable
Justin Clarke Casey 2008-03-31 18:41:24 +00:00
parent 93303072dd
commit 106fd2f616
6 changed files with 173 additions and 67 deletions

View File

@ -55,6 +55,12 @@ namespace OpenSim.Region.Capabilities
public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder); bool fetchFolders, bool fetchItems, int sortOrder);
/// <summary>
/// FIXME This is a temporary delegate, and should disappear once the voice code is fleshed out and moved into its
/// own region module.
/// </summary>
public delegate CachedUserInfo GetUserDetailsCAPS(LLUUID agentID);
public class Caps public class Caps
{ {
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -67,7 +73,7 @@ namespace OpenSim.Region.Capabilities
/// </summary> /// </summary>
private string m_capsObjectPath; private string m_capsObjectPath;
public string CapsObjectPath { get { return m_capsObjectPath; } } public string CapsObjectPath { get { return m_capsObjectPath; } }
private static readonly string m_requestPath = "0000/"; private static readonly string m_requestPath = "0000/";
private static readonly string m_mapLayerPath = "0001/"; private static readonly string m_mapLayerPath = "0001/";
private static readonly string m_newInventory = "0002/"; private static readonly string m_newInventory = "0002/";
@ -93,6 +99,7 @@ namespace OpenSim.Region.Capabilities
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
// //
public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
public GetUserDetailsCAPS CAPSGetUserDetails = null;
public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
LLUUID agent, bool dumpAssetsToFile) LLUUID agent, bool dumpAssetsToFile)
@ -436,98 +443,75 @@ namespace OpenSim.Region.Capabilities
return null; return null;
} }
/// <summary>
public string ParcelVoiceInfoRequest(string request, string path, string param) /// Callback for a client request for ParcelVoiceInfo
{ /// </summary>
/// <param name="request"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <returns></returns>
public string ParcelVoiceInfoRequest(string request, string path, string param) {
try try
{ {
m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); m_log.DebugFormat("[CAPS][PARCELVOICE]: request: {0}, path: {1}, param: {2}", request, path, param);
//Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); // XXX brutal hack, we need to get channel_uri, region
//LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); // name, and parcel_local_id from somewhere
//LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); Hashtable creds = new Hashtable();
//string capsBase = "/CAPS/" + m_capsObjectPath; creds["channel_uri"] = "sip:testroom@testserver.com";
//string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
LLSDParcelVoiceInfoResponse parcelVoiceInfo =
new LLSDParcelVoiceInfoResponse("OpenSim Test", 1, creds);
// XXX for debugging purposes:
string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
m_log.DebugFormat("[CAPS][PARCELVOICE]: {0}", r);
//TaskInventoryScriptUpdater uploader = return r;
//new TaskInventoryScriptUpdater(
//llsdUpdateRequest.item_id,
//llsdUpdateRequest.task_id,
//llsdUpdateRequest.is_script_running,
//capsBase + uploaderPath,
//m_httpListener,
//m_dumpAssetsToFile);
//uploader.OnUpLoad += TaskScriptUpdated;
//m_httpListener.AddStreamHandler(
//new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
//string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
//uploaderPath;
//LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
//uploadResponse.uploader = uploaderURL;
//uploadResponse.state = "upload";
// m_log.InfoFormat("[CAPS]: " +
// "ScriptTaskInventory response: {0}",
// LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
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>");
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[CAPS]: " + e.ToString()); m_log.Error("[CAPS]: " + e.ToString());
} }
return null; return null;
} }
public string ProvisionVoiceAccountRequest(string request, string path, string param) /// <summary>
{ /// Callback for a client request for Voice Account Details
/// </summary>
/// <param name="request"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <returns></returns>
public string ProvisionVoiceAccountRequest(string request, string path, string param) {
try try
{ {
m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); m_log.DebugFormat("[CAPS][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}", request, path, param);
//Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); if (null == CAPSGetUserDetails) throw new Exception("CAPSGetUserDetails null");
//LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate();
//LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest);
//string capsBase = "/CAPS/" + m_capsObjectPath; string voiceUser = "x" + Convert.ToBase64String(m_agentID.GetBytes());
//string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); voiceUser = voiceUser.Replace('+', '-').Replace('/', '_');
//TaskInventoryScriptUpdater uploader = CachedUserInfo userInfo = CAPSGetUserDetails(m_agentID);
//new TaskInventoryScriptUpdater( if (null == userInfo) throw new Exception("CAPSGetUserDetails returned null");
//llsdUpdateRequest.item_id,
//llsdUpdateRequest.task_id,
//llsdUpdateRequest.is_script_running,
//capsBase + uploaderPath,
//m_httpListener,
//m_dumpAssetsToFile);
//uploader.OnUpLoad += TaskScriptUpdated;
//m_httpListener.AddStreamHandler( LLSDVoiceAccountResponse voiceAccountResponse =
//new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); new LLSDVoiceAccountResponse(voiceUser, "$1$" + userInfo.UserProfile.passwordHash);
//string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
//uploaderPath; m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);
return r;
//LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
//uploadResponse.uploader = uploaderURL;
//uploadResponse.state = "upload";
// m_log.InfoFormat("[CAPS]: " +
// "ScriptTaskInventory response: {0}",
// LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
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>");
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[CAPS]: " + e.ToString()); m_log.Error("[CAPS][PROVISIONVOICE]: " + e.ToString());
} }
return null; return null;
} }
/// <summary> /// <summary>
/// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset.
/// </summary> /// </summary>

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Collections;
using libsecondlife;
namespace OpenSim.Region.Capabilities
{
[LLSDMap]
public class LLSDParcelVoiceInfoResponse
{
public int parcel_local_id;
public string region_name;
public Hashtable voice_credentials;
public LLSDParcelVoiceInfoResponse()
{
}
public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
{
region_name = region;
parcel_local_id = localID;
voice_credentials = creds;
}
}
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using libsecondlife;
namespace OpenSim.Region.Capabilities
{
[LLSDMap]
public class LLSDVoiceAccountResponse
{
public string username;
public string password;
public LLSDVoiceAccountResponse()
{
}
public LLSDVoiceAccountResponse(string user, string pass)
{
username = user;
password = pass;
}
}
}

View File

@ -240,7 +240,16 @@ namespace OpenSim
{ {
config.Set("enabled", "false"); config.Set("enabled", "false");
} }
if (DefaultConfig.Configs["Voice"] == null)
DefaultConfig.AddConfig("Voice");
config = DefaultConfig.Configs["Voice"];
if (config != null)
{
config.Set("enabled", "false");
}
return DefaultConfig; return DefaultConfig;
} }
protected void ReadConfigSettings() protected void ReadConfigSettings()

View File

@ -1590,6 +1590,7 @@ namespace OpenSim.Region.Environment.Scenes
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
//m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
} }
public void HandleRemoveKnownRegionsFromAvatar(LLUUID avatarID, List<ulong> regionslst) public void HandleRemoveKnownRegionsFromAvatar(LLUUID avatarID, List<ulong> regionslst)
{ {
ScenePresence av = GetScenePresence(avatarID); ScenePresence av = GetScenePresence(avatarID);
@ -1740,6 +1741,7 @@ namespace OpenSim.Region.Environment.Scenes
cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS; cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS;
cap.CAPSGetUserDetails = CommsManager.UserProfileCacheService.GetUserDetails;
m_capsHandlers[agentId] = cap; m_capsHandlers[agentId] = cap;
} }

View File

@ -155,6 +155,16 @@ msgformat = "PRIVMSG {0} : {3} - {1} of {2}"
;for <bot>:<message> - from <user> : ;for <bot>:<message> - from <user> :
;msgformat = "PRIVMSG {0} : {3} - from {1}" ;msgformat = "PRIVMSG {0} : {3} - from {1}"
[Voice]
enabled = false
; This is not supported by the SLViewer right now and
; hardcoded within the SL Viewer. Maybe it will be
; changed in future. :-)
account_management_server = https://www.bhr.vivox.com/api2
; Global SIP Server for conference calls
sip_uri = sip:testroom@testserver.com
; Uncomment the following to control the progression of daytime ; Uncomment the following to control the progression of daytime
; in the Sim. The defaults are what is shown below ; in the Sim. The defaults are what is shown below
;[Sun] ;[Sun]