From 71114d4ad1c4aacbfedea9f4ab5307162ae5d9e0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 21:34:26 +0100 Subject: [PATCH 01/12] refactor: rename DeleteToInventory() to CopyToInventory() DeleteToInventory() is misleading - it is the caller that decides whether to delete or not --- .../InventoryAccess/InventoryAccessModule.cs | 2 +- .../Interfaces/IInventoryAccessModule.cs | 18 +++++++++++++++++- .../Scenes/AsyncSceneObjectGroupDeleter.cs | 3 ++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 326ef28b9e..666f35339c 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess /// /// /// - public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, + public virtual UUID CopyToInventory(DeRezAction action, UUID folderID, List objectGroups, IClientAPI remoteClient) { Dictionary> deletes = new Dictionary>(); diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 05fc2add3e..305975e855 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs @@ -38,7 +38,23 @@ namespace OpenSim.Region.Framework.Interfaces public interface IInventoryAccessModule { UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); - UUID DeleteToInventory(DeRezAction action, UUID folderID, List objectGroups, IClientAPI remoteClient); + + /// + /// Copy objects to a user's inventory. + /// + /// + /// Is it left to the caller to delete them from the scene if required. + /// + /// + /// + /// + /// + /// + /// Returns the UUID of the newly created item asset (not the item itself). + /// FIXME: This is not very useful. It would be far more useful to return a list of items instead. + /// + UUID CopyToInventory(DeRezAction action, UUID folderID, List objectGroups, IClientAPI remoteClient); + SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 8feb0227fc..342354257d 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -143,7 +143,8 @@ namespace OpenSim.Region.Framework.Scenes { IInventoryAccessModule invAccess = m_scene.RequestModuleInterface(); if (invAccess != null) - invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient); + invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient); + if (x.permissionToDelete) { foreach (SceneObjectGroup g in x.objectGroups) From 61619ddefc96be2c1f802360cca48b1b36be8bb2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 21:59:01 +0100 Subject: [PATCH 02/12] refactor: split out the code which actually copies a particular bundle to inventory --- .../InventoryAccess/InventoryAccessModule.cs | 237 +++++++++--------- 1 file changed, 123 insertions(+), 114 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 666f35339c..6b3df9ddd6 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -213,19 +213,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return UUID.Zero; } - - /// - /// Delete a scene object from a scene and place in the given avatar's inventory. - /// Returns the UUID of the newly created asset. - /// - /// - /// - /// - /// + public virtual UUID CopyToInventory(DeRezAction action, UUID folderID, List objectGroups, IClientAPI remoteClient) { - Dictionary> deletes = new Dictionary>(); + Dictionary> bundlesToCopy = new Dictionary>(); if (CoalesceMultipleObjectsToInventory) { @@ -234,10 +226,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // reasons. foreach (SceneObjectGroup g in objectGroups) { - if (!deletes.ContainsKey(g.OwnerID)) - deletes[g.OwnerID] = new List(); + if (!bundlesToCopy.ContainsKey(g.OwnerID)) + bundlesToCopy[g.OwnerID] = new List(); - deletes[g.OwnerID].Add(g); + bundlesToCopy[g.OwnerID].Add(g); } } else @@ -247,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { List bundle = new List(); bundle.Add(g); - deletes[g.UUID] = bundle; + bundlesToCopy[g.UUID] = bundle; } } @@ -257,112 +249,129 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // Each iteration is really a separate asset being created, // with distinct destinations as well. - foreach (List objlist in deletes.Values) + foreach (List bundle in bundlesToCopy.Values) + assetID = CopyBundleToInventory(action, folderID, bundle, remoteClient); + + return assetID; + } + + /// + /// Copy a bundle of objects to inventory. If there is only one object, then this will create an object + /// item. If there are multiple objects then these will be saved as a single coalesced item. + /// + /// + /// + /// + /// + /// + protected UUID CopyBundleToInventory( + DeRezAction action, UUID folderID, List objlist, IClientAPI remoteClient) + { + UUID assetID = UUID.Zero; + + CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); + Dictionary originalPositions = new Dictionary(); + + foreach (SceneObjectGroup objectGroup in objlist) { - CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); - Dictionary originalPositions = new Dictionary(); + Vector3 inventoryStoredPosition = new Vector3 + (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : objectGroup.AbsolutePosition.X) + , + (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) + ? 250 + : objectGroup.AbsolutePosition.Y, + objectGroup.AbsolutePosition.Z); - foreach (SceneObjectGroup objectGroup in objlist) - { - Vector3 inventoryStoredPosition = new Vector3 - (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : objectGroup.AbsolutePosition.X) - , - (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) - ? 250 - : objectGroup.AbsolutePosition.Y, - objectGroup.AbsolutePosition.Z); + originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; - originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; + objectGroup.AbsolutePosition = inventoryStoredPosition; - objectGroup.AbsolutePosition = inventoryStoredPosition; - - // Make sure all bits but the ones we want are clear - // on take. - // This will be applied to the current perms, so - // it will do what we want. - objectGroup.RootPart.NextOwnerMask &= - ((uint)PermissionMask.Copy | - (uint)PermissionMask.Transfer | - (uint)PermissionMask.Modify); - objectGroup.RootPart.NextOwnerMask |= - (uint)PermissionMask.Move; - - coa.Add(objectGroup); - } - - string itemXml; - - if (objlist.Count > 1) - itemXml = CoalescedSceneObjectsSerializer.ToXml(coa); - else - itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]); + // Make sure all bits but the ones we want are clear + // on take. + // This will be applied to the current perms, so + // it will do what we want. + objectGroup.RootPart.NextOwnerMask &= + ((uint)PermissionMask.Copy | + (uint)PermissionMask.Transfer | + (uint)PermissionMask.Modify); + objectGroup.RootPart.NextOwnerMask |= + (uint)PermissionMask.Move; - // Restore the position of each group now that it has been stored to inventory. - foreach (SceneObjectGroup objectGroup in objlist) - objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; - - InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); - if (item == null) - return UUID.Zero; - - // Can't know creator is the same, so null it in inventory - if (objlist.Count > 1) - { - item.CreatorId = UUID.Zero.ToString(); - item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; - } - else - { - item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); - item.SaleType = objlist[0].RootPart.ObjectSaleType; - item.SalePrice = objlist[0].RootPart.SalePrice; - } - - AssetBase asset = CreateAsset( - objlist[0].GetPartName(objlist[0].RootPart.LocalId), - objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), - (sbyte)AssetType.Object, - Utils.StringToBytes(itemXml), - objlist[0].OwnerID.ToString()); - m_Scene.AssetService.Store(asset); - - item.AssetID = asset.FullID; - assetID = asset.FullID; - - if (DeRezAction.SaveToExistingUserInventoryItem == action) - { - m_Scene.InventoryService.UpdateItem(item); - } - else - { - AddPermissions(item, objlist[0], objlist, remoteClient); - - item.CreationDate = Util.UnixTimeSinceEpoch(); - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; - - m_Scene.AddInventoryItem(item); - - if (remoteClient != null && item.Owner == remoteClient.AgentId) - { - remoteClient.SendInventoryItemCreateUpdate(item, 0); - } - else - { - ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); - if (notifyUser != null) - { - notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); - } - } - } - - // This is a hook to do some per-asset post-processing for subclasses that need that - ExportAsset(remoteClient.AgentId, assetID); + coa.Add(objectGroup); } + + string itemXml; + + if (objlist.Count > 1) + itemXml = CoalescedSceneObjectsSerializer.ToXml(coa); + else + itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]); + + // Restore the position of each group now that it has been stored to inventory. + foreach (SceneObjectGroup objectGroup in objlist) + objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; + + InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); + if (item == null) + return UUID.Zero; + + // Can't know creator is the same, so null it in inventory + if (objlist.Count > 1) + { + item.CreatorId = UUID.Zero.ToString(); + item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; + } + else + { + item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); + item.SaleType = objlist[0].RootPart.ObjectSaleType; + item.SalePrice = objlist[0].RootPart.SalePrice; + } + + AssetBase asset = CreateAsset( + objlist[0].GetPartName(objlist[0].RootPart.LocalId), + objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), + (sbyte)AssetType.Object, + Utils.StringToBytes(itemXml), + objlist[0].OwnerID.ToString()); + m_Scene.AssetService.Store(asset); + + item.AssetID = asset.FullID; + assetID = asset.FullID; + + if (DeRezAction.SaveToExistingUserInventoryItem == action) + { + m_Scene.InventoryService.UpdateItem(item); + } + else + { + AddPermissions(item, objlist[0], objlist, remoteClient); + + item.CreationDate = Util.UnixTimeSinceEpoch(); + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; + + m_Scene.AddInventoryItem(item); + + if (remoteClient != null && item.Owner == remoteClient.AgentId) + { + remoteClient.SendInventoryItemCreateUpdate(item, 0); + } + else + { + ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); + if (notifyUser != null) + { + notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); + } + } + } + + // This is a hook to do some per-asset post-processing for subclasses that need that + ExportAsset(remoteClient.AgentId, assetID); return assetID; } From e00e518692bd3d123db69dceb98b80d3bdd59156 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 22:24:42 +0100 Subject: [PATCH 03/12] add test to ensure that an IAR starts with the control file --- .../Archiver/InventoryArchiveReadRequest.cs | 21 +++++++------- .../Archiver/Tests/InventoryArchiverTests.cs | 29 ++++++++++++++++++- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index f3d2f26cfe..9acdc9040d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -77,12 +77,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// private Stream m_loadStream; - /// - /// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things - /// (I thought they weren't). We will need to bump the version number and perform this check on all - /// subsequent IAR versions only - /// - protected bool m_controlFileLoaded = true; + public bool ControlFileLoaded { get; private set; } + protected bool m_assetsLoaded; protected bool m_inventoryNodesLoaded; @@ -131,6 +127,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_userInfo = userInfo; m_invPath = invPath; m_loadStream = loadStream; + + // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things + // (I thought they weren't). We will need to bump the version number and perform this check on all + // subsequent IAR versions only + ControlFileLoaded = true; } /// @@ -522,7 +523,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// /// - protected void LoadControlFile(string path, byte[] data) + public void LoadControlFile(string path, byte[] data) { XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); XElement archiveElement = doc.Element("archive"); @@ -538,7 +539,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver majorVersion, MAX_MAJOR_VERSION)); } - m_controlFileLoaded = true; + ControlFileLoaded = true; m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); } @@ -550,7 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) { - if (!m_controlFileLoaded) + if (!ControlFileLoaded) throw new Exception( string.Format( "The IAR you are trying to load does not list {0} before {1}. Aborting load", @@ -597,7 +598,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// protected void LoadAssetFile(string path, byte[] data) { - if (!m_controlFileLoaded) + if (!ControlFileLoaded) throw new Exception( string.Format( "The IAR you are trying to load does not list {0} before {1}. Aborting load", diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index d03f6da295..52232a0c9e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -94,7 +94,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); - } + } + + /// + /// Test that the IAR has the required files in the right order. + /// + /// + /// At the moment, the only thing that matters is that the control file is the very first one. + /// + [Test] + public void TestOrder() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes); + TarArchiveReader tar = new TarArchiveReader(archiveReadStream); + string filePath; + TarArchiveReader.TarEntryType tarEntryType; + + byte[] data = tar.ReadEntry(out filePath, out tarEntryType); + Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); + + InventoryArchiveReadRequest iarr + = new InventoryArchiveReadRequest(null, null, null, (Stream)null, false); + iarr.LoadControlFile(filePath, data); + + Assert.That(iarr.ControlFileLoaded, Is.True); + } /// /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive From 6600aa2baf56e1f58e50eb5589de876e910131bb Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 22:35:33 +0100 Subject: [PATCH 04/12] Add regression test to check that OARs start with the control file. --- .../Archiver/InventoryArchiveReadRequest.cs | 3 +++ .../World/Archiver/ArchiveReadRequest.cs | 9 ++++++++- .../World/Archiver/Tests/ArchiverTests.cs | 18 ++++++++++-------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 9acdc9040d..a12931f5e9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -77,6 +77,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// private Stream m_loadStream; + /// + /// Has the control file been loaded for this archive? + /// public bool ControlFileLoaded { get; private set; } protected bool m_assetsLoaded; diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index fd8f546737..82bef48c8c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -57,6 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// bumps here should be compatible. /// public static int MAX_MAJOR_VERSION = 1; + + /// + /// Has the control file been loaded for this archive? + /// + public bool ControlFileLoaded { get; private set; } protected Scene m_scene; protected Stream m_loadStream; @@ -527,7 +532,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// /// - protected void LoadControlFile(string path, byte[] data) + public void LoadControlFile(string path, byte[] data) { XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); @@ -573,6 +578,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver } currentRegionSettings.Save(); + + ControlFileLoaded = true; } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index e2760a2065..2307c8e585 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests MemoryStream archiveReadStream = new MemoryStream(archive); TarArchiveReader tar = new TarArchiveReader(archiveReadStream); - bool gotControlFile = false; bool gotNcAssetFile = false; string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt"); @@ -182,15 +181,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests expectedPaths.Add(ArchiveHelpers.CreateObjectPath(sog2)); string filePath; - TarArchiveReader.TarEntryType tarEntryType; + TarArchiveReader.TarEntryType tarEntryType; + byte[] data = tar.ReadEntry(out filePath, out tarEntryType); + Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); + + ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); + arr.LoadControlFile(filePath, data); + + Assert.That(arr.ControlFileLoaded, Is.True); + while (tar.ReadEntry(out filePath, out tarEntryType) != null) { - if (ArchiveConstants.CONTROL_FILE_PATH == filePath) - { - gotControlFile = true; - } - else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) + if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) { string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); @@ -203,7 +206,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests } } - Assert.That(gotControlFile, Is.True, "No control file in archive"); Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive"); Assert.That(foundPaths, Is.EquivalentTo(expectedPaths)); From 61096050386c8ec63d8d92c6ac7b183ddaa77c26 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 22:42:36 +0100 Subject: [PATCH 05/12] bump oar version number to 0.6. This commit contains no data changes - the version bump is to establish a version at which the control file must come first in the archive. --- .../World/Archiver/ArchiveWriteRequestPreparation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index f2d487ef94..597b7809e5 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public static string CreateControlFile(Dictionary options) { - int majorVersion = MAX_MAJOR_VERSION, minorVersion = 5; + int majorVersion = MAX_MAJOR_VERSION, minorVersion = 6; // // if (options.ContainsKey("version")) // { From f5a041d01292adb2b1e650cb9eba0806121d2ddf Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 23:00:41 +0100 Subject: [PATCH 06/12] bump default IAR version to 0.2 and 1.1 for the --profile version. There are no changes in this bump, they just signal a point at which the control file comes first in the archive. --- .../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index dc4900f5a7..c039b5a387 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -394,12 +394,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (options.ContainsKey("profile")) { majorVersion = 1; - minorVersion = 0; + minorVersion = 1; } else { majorVersion = 0; - minorVersion = 1; + minorVersion = 2; } m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); From 36c4e94ef739f2d58ff26ae2313e5a930ff02021 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 23:22:04 +0100 Subject: [PATCH 07/12] Move mesh on/off swtich from [Startup] to [Mesh] in anticipation of future config parameters. Default remains true. OpenSimDefault.ini changed so if you haven't overriden this switch then you don't need to do anything. --- .../Region/CoreModules/Avatar/Assets/GetMeshModule.cs | 7 +++---- .../Assets/NewFileAgentInventoryVariablePriceModule.cs | 7 +++---- .../Inventory/Archiver/InventoryArchiveReadRequest.cs | 6 ++++++ bin/OpenSimDefaults.ini | 10 ++++++---- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs index d2278bc3de..deec444e8b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs @@ -66,12 +66,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets public void Initialise(IConfigSource source) { - IConfig startupConfig = source.Configs["Startup"]; - if (startupConfig == null) + IConfig meshConfig = source.Configs["Mesh"]; + if (meshConfig == null) return; - if (!startupConfig.GetBoolean("ColladaMesh",true)) - m_enabled = false; + m_enabled = meshConfig.GetBoolean("ColladaMesh", true); } public void AddRegion(Scene pScene) diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs index fb07cc9ca0..d651cb26f8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs @@ -68,12 +68,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets public void Initialise(IConfigSource source) { - IConfig startupConfig = source.Configs["Startup"]; - if (startupConfig == null) + IConfig meshConfig = source.Configs["Mesh"]; + if (meshConfig == null) return; - if (!startupConfig.GetBoolean("ColladaMesh",true)) - m_enabled = false; + m_enabled = meshConfig.GetBoolean("ColladaMesh", true); } public void AddRegion(Scene pScene) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index a12931f5e9..6b247180d8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -82,6 +82,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// public bool ControlFileLoaded { get; private set; } + /// + /// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't + /// enforce. + /// + public bool EnforceControlFileCheck { get; private set; } + protected bool m_assetsLoaded; protected bool m_inventoryNodesLoaded; diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 2e0a22bc8a..e72e85103f 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -155,10 +155,6 @@ ; it may cause unexpected physics problems. ;UseMeshiesPhysicsMesh = false - ; enable / disable Collada mesh support - ; default is true - ; ColladaMesh = true - ; Choose one of the physics engines below ; OpenDynamicsEngine is by some distance the most developed physics engine ; basicphysics effectively does not model physics at all, making all objects phantom @@ -460,6 +456,12 @@ CoalesceMultipleObjectsToInventory = true +[Mesh] + ; enable / disable Collada mesh support + ; default is true + ; ColladaMesh = true + + [ODEPhysicsSettings] ;## ;## World Settings From 2fa210243b64bb10fbca37f89176f10efeb25f41 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 19 Apr 2011 21:54:26 +0100 Subject: [PATCH 08/12] Clean up freeswitch config to what is currently required. Add explanation to config parameters. Clean up some log messages. --- .../FreeSwitchVoice/FreeSwitchVoiceModule.cs | 28 +++++++------ .../FreeswitchService/FreeswitchService.cs | 29 +++++++------ .../FreeswitchServiceBase.cs | 2 +- bin/OpenSim.ini.example | 42 +++++++++++++------ bin/Robust.ini.example | 38 ++++++++++++----- .../StandaloneCommon.ini.example | 18 +++----- 6 files changed, 95 insertions(+), 62 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 7909d8a8ec..962b5cabfb 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice if (serviceDll == String.Empty) { - m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice"); + m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice. Not starting."); return; } @@ -143,8 +143,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice if (String.IsNullOrEmpty(m_freeSwitchRealm) || String.IsNullOrEmpty(m_freeSwitchAPIPrefix)) { - m_log.Error("[FreeSwitchVoice] plugin mis-configured"); - m_log.Info("[FreeSwitchVoice] plugin disabled: incomplete configuration"); + m_log.Error("[FreeSwitchVoice]: Freeswitch service mis-configured. Not starting."); return; } @@ -172,16 +171,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceBuddyHTTPHandler); - m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm); + m_log.InfoFormat("[FreeSwitchVoice]: using FreeSwitch server {0}", m_freeSwitchRealm); m_Enabled = true; - m_log.Info("[FreeSwitchVoice] plugin enabled"); + m_log.Info("[FreeSwitchVoice]: plugin enabled"); } catch (Exception e) { - m_log.ErrorFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.Message); - m_log.DebugFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.ToString()); + m_log.ErrorFormat("[FreeSwitchVoice]: plugin initialization failed: {0} {1}", e.Message, e.StackTrace); return; } @@ -240,7 +238,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { if (m_Enabled) { - m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); + m_log.Info("[FreeSwitchVoice]: registering IVoiceModule with the scene"); // register the voice interface for this module, so the script engine can call us scene.RegisterModuleInterface(this); @@ -302,7 +300,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice // public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps) { - m_log.DebugFormat("[FreeSwitchVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); + m_log.DebugFormat( + "[FreeSwitchVoice]: OnRegisterCaps called with agentID {0} caps {1} in scene {2}", + agentID, caps, scene.RegionInfo.RegionName); string capsBase = "/CAPS/" + caps.CapsObjectPath; caps.RegisterHandler("ProvisionVoiceAccountRequest", @@ -558,7 +558,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request) { - m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called"); + m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceGetPreloginHTTPHandler called"); Hashtable response = new Hashtable(); response["content_type"] = "text/xml"; @@ -664,7 +664,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request) { - m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called"); + m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceSigninHTTPHandler called"); // string requestbody = (string)request["body"]; // string uri = (string)request["uri"]; // string contenttype = (string)request["content-type"]; @@ -795,16 +795,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice response["keepalive"] = false; response["int_response_code"] = 500; - Hashtable requestBody = ParseRequestBody((string) request["body"]); + Hashtable requestBody = ParseRequestBody((string)request["body"]); string section = (string) requestBody["section"]; + + m_log.DebugFormat("[FreeSwitchVoice]: Received request for config section {0}", section); if (section == "directory") response = m_FreeswitchService.HandleDirectoryRequest(requestBody); else if (section == "dialplan") response = m_FreeswitchService.HandleDialplanRequest(requestBody); else - m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section); + m_log.WarnFormat("[FreeSwitchVoice]: Unknown section {0} was requested.", section); return response; } diff --git a/OpenSim/Services/FreeswitchService/FreeswitchService.cs b/OpenSim/Services/FreeswitchService/FreeswitchService.cs index fe6f5cd503..1ec89da5f7 100644 --- a/OpenSim/Services/FreeswitchService/FreeswitchService.cs +++ b/OpenSim/Services/FreeswitchService/FreeswitchService.cs @@ -50,13 +50,13 @@ namespace OpenSim.Services.FreeswitchService public Hashtable HandleDialplanRequest(Hashtable request) { - m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString()); + m_log.DebugFormat("[FreeSwitchVoice]: HandleDialplanRequest called with {0}",request.ToString()); Hashtable response = new Hashtable(); foreach (DictionaryEntry item in request) { - m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value); + m_log.InfoFormat("[FreeSwitchDirectory]: requestBody item {0} {1}",item.Key, item.Value); } string requestcontext = (string) request["Hunt-Context"]; @@ -66,7 +66,7 @@ namespace OpenSim.Services.FreeswitchService if (m_freeSwitchContext != String.Empty && m_freeSwitchContext != requestcontext) { - m_log.Debug("[FreeSwitchDirectory] returning empty as it's for another context"); + m_log.Debug("[FreeSwitchDirectory]: returning empty as it's for another context"); response["str_response_string"] = ""; } else @@ -116,13 +116,16 @@ namespace OpenSim.Services.FreeswitchService { Hashtable response = new Hashtable(); string domain = (string) request["domain"]; - if (domain != m_freeSwitchRealm) { + if (domain != m_freeSwitchRealm) + { response["content_type"] = "text/xml"; response["keepalive"] = false; response["int_response_code"] = 200; response["str_response_string"] = ""; - } else { - m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString()); + } + else + { +// m_log.DebugFormat("[FreeSwitchDirectory]: HandleDirectoryRequest called with {0}",request.ToString()); // information in the request we might be interested in @@ -145,7 +148,7 @@ namespace OpenSim.Services.FreeswitchService foreach (DictionaryEntry item in request) { - m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}", item.Key, item.Value); + m_log.DebugFormat("[FreeSwitchDirectory]: requestBody item {0} {1}", item.Key, item.Value); } string eventCallingFunction = (string) request["Event-Calling-Function"]; @@ -173,7 +176,7 @@ namespace OpenSim.Services.FreeswitchService } else { - m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod); + m_log.ErrorFormat("[FreeSwitchVoice]: HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod); response["int_response_code"] = 404; response["content_type"] = "text/xml"; response["str_response_string"] = ""; @@ -205,7 +208,7 @@ namespace OpenSim.Services.FreeswitchService } else { - m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction); + m_log.ErrorFormat("[FreeSwitchVoice]: HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction); response["int_response_code"] = 404; response["keepalive"] = false; response["content_type"] = "text/xml"; @@ -217,7 +220,7 @@ namespace OpenSim.Services.FreeswitchService private Hashtable HandleRegister(string Context, string Realm, Hashtable request) { - m_log.Info("[FreeSwitchDirectory] HandleRegister called"); + m_log.Info("[FreeSwitchDirectory]: HandleRegister called"); // TODO the password we return needs to match that sent in the request, this is hard coded for now string password = "1234"; @@ -254,7 +257,7 @@ namespace OpenSim.Services.FreeswitchService private Hashtable HandleInvite(string Context, string Realm, Hashtable request) { - m_log.Info("[FreeSwitchDirectory] HandleInvite called"); + m_log.Info("[FreeSwitchDirectory]: HandleInvite called"); // TODO the password we return needs to match that sent in the request, this is hard coded for now string password = "1234"; @@ -301,7 +304,7 @@ namespace OpenSim.Services.FreeswitchService private Hashtable HandleLocateUser(String Realm, Hashtable request) { - m_log.Info("[FreeSwitchDirectory] HandleLocateUser called"); + m_log.Info("[FreeSwitchDirectory]: HandleLocateUser called"); // TODO the password we return needs to match that sent in the request, this is hard coded for now string domain = (string) request["domain"]; @@ -335,7 +338,7 @@ namespace OpenSim.Services.FreeswitchService private Hashtable HandleConfigSofia(string Context, string Realm, Hashtable request) { - m_log.Info("[FreeSwitchDirectory] HandleConfigSofia called"); + m_log.Info("[FreeSwitchDirectory]: HandleConfigSofia called."); // TODO the password we return needs to match that sent in the request, this is hard coded for now string domain = (string) request["domain"]; diff --git a/OpenSim/Services/FreeswitchService/FreeswitchServiceBase.cs b/OpenSim/Services/FreeswitchService/FreeswitchServiceBase.cs index ebbb1b06ec..25c18b6a23 100644 --- a/OpenSim/Services/FreeswitchService/FreeswitchServiceBase.cs +++ b/OpenSim/Services/FreeswitchService/FreeswitchServiceBase.cs @@ -64,7 +64,7 @@ namespace OpenSim.Services.FreeswitchService m_freeSwitchDefaultWellKnownIP = freeswitchConfig.GetString("ServerAddress", String.Empty); if (m_freeSwitchDefaultWellKnownIP == String.Empty) { - m_log.Error("[FREESWITCH]: No FreeswitchServerAddress given, can't continue"); + m_log.Error("[FREESWITCH]: No ServerAddress given, cannot start service."); return; } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index c05c3de2c4..fbaa590aed 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -621,10 +621,11 @@ ;; You need to load a local service for a standalone, and a remote service ;; for a grid region. Use one of the lines below, as appropriate + ;; If you're using Freeswitch on a standalone then you will also need to configure the [FreeswitchService] section ; LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService ; LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector - ;; If using a remote module, specify the server URL + ;; If using a remote connector, specify the server URL ; FreeswitchServiceURL = http://my.grid.server:8003/fsapi @@ -632,20 +633,37 @@ ;; !!!!!!!!!!!!!!!!!!!!!!!!!!! ;; !!!!!!STANDALONE ONLY!!!!!! ;; !!!!!!!!!!!!!!!!!!!!!!!!!!! - ;; IP of your FS server - ;ServerAddress = 85.25.142.92 + ;; The IP address of your FreeSWITCH server. The common case is for this to be the same as the server running the OpenSim standalone + ;; This has to be set for the FreeSWITCH service to work + ;ServerAddress = 127.0.0.1 - ;; All other options are - well - optional - ; Realm = "127.0.0.1" - ; SIPProxy = "127.0.0.1:5060" - ; EchoServer = "127.0.0.1" - ; EchoPort = 50505 - ; AttemptSTUN = "false" + ;; The following configuration parameters are optional + + ;; By default, this is the same as the ServerAddress + ; Realm = 127.0.0.1 + + ;; By default, this is the same as the ServerAddress on port 5060 + ; SIPProxy = 127.0.0.1:5060 + + ;; Default is 5000ms ; DefaultTimeout = 5000 - ; Context = "default" - ; UserName = "freeswitch" - ; Password = "password" + ;; The dial plan context. Default is "default" + ; Context = default + + ;; Currently unused + ; UserName = freeswitch + + ;; Currently unused + ; Password = password + + ;; The following parameters are for STUN = Simple Traversal of UDP through NATs + ;; See http://wiki.freeswitch.org/wiki/NAT_Traversal + ;; stun.freeswitch.org is not guaranteed to be running so use it in + ;; production at your own risk + ; EchoServer = 127.0.0.1 + ; EchoPort = 50505 + ; AttemptSTUN = false [Groups] ;# {Enabled} {} {Enable groups?} {true false} false diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 7c13076eb8..4d16236044 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -69,19 +69,37 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * This is the configuration for the freeswitch server in grid mode [FreeswitchService] LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" - ;; IP of your FS server + + ;; The IP address of your FreeSWITCH server. ; ServerAddress = 127.0.0.1 - ;; All other options are - well - optional - ; Realm = "127.0.0.1" - ; SIPProxy = "127.0.0.1:5060" - ; EchoServer = "127.0.0.1" - ; EchoPort = 50505 - ; AttemptSTUN = "false" + ;; The following configuration parameters are optional + + ;; By default, this is the same as the ServerAddress + ; Realm = 127.0.0.1 + + ;; By default, this is the same as the ServerAddress on port 5060 + ; SIPProxy = 127.0.0.1:5060 + + ;; Default is 5000ms ; DefaultTimeout = 5000 - ; Context = "default" - ; UserName = "freeswitch" - ; Password = "password" + + ;; The dial plan context. Default is "default" + ; Context = default + + ;; Currently unused + ; UserName = freeswitch + + ;; Currently unused + ; Password = password + + ;; The following parameters are for STUN = Simple Traversal of UDP through NATs + ;; See http://wiki.freeswitch.org/wiki/NAT_Traversal + ;; stun.freeswitch.org is not guaranteed to be running so use it in + ;; production at your own risk + ; EchoServer = 127.0.0.1 + ; EchoPort = 50505 + ; AttemptSTUN = false ; * This is the new style authentication service. Currently, only MySQL ; * is implemented. diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index d6f15bbf3b..dcebd63184 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -28,10 +28,10 @@ [HGInventoryAccessModule] ProfileServerURI = "http://127.0.0.1:9000/profiles" - ;; If you want to protect your assets from being copied by foreign visitors - ;; uncomment the next line. You may want to do this on sims that have licensed content. - ; OutboundPermission = False + ;; If you want to protect your assets from being copied by foreign visitors + ;; uncomment the next line. You may want to do this on sims that have licensed content. + ; OutboundPermission = False [Modules] ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. @@ -45,16 +45,9 @@ AssetCaching = "CenomeMemoryAssetCache" Include-CenomeCache = "config-include/CenomeCache.ini" - ;; Enable this to use Freeswitch on a standalone - ;FreeswitchServiceInConnector = True - ;; Authorization is not on by default, as it depends on external php ;AuthorizationServices = "LocalAuthorizationServicesConnector" -[FreeswitchService] - ;; Configuration for the freeswitch service goes here - LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" - [GridService] ;; For in-memory region storage (default) StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" @@ -74,9 +67,8 @@ Region_Welcome_Area = "DefaultRegion, FallbackRegion" ; === HG ONLY === - ;; change this to the address of your simulator - Gatekeeper="http://127.0.0.1:9000" - + ;; change this to the address of your simulator + Gatekeeper="http://127.0.0.1:9000" [LibraryModule] ; Set this if you want to change the name of the OpenSim Library From 575257f3fe7c18bd831c6b0ad63ba30488b075cc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 19 Apr 2011 21:58:55 +0100 Subject: [PATCH 09/12] For consistency, uncomment ColladaMesh option in OpenSimDefaults.ini. Thanks for the spot, Ai Austin. --- bin/OpenSimDefaults.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index e72e85103f..30ebf84dcc 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -459,7 +459,7 @@ [Mesh] ; enable / disable Collada mesh support ; default is true - ; ColladaMesh = true + ColladaMesh = true [ODEPhysicsSettings] From b786860bac7adec165843374ebe72b28f9519b78 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 19 Apr 2011 22:38:15 +0100 Subject: [PATCH 10/12] synchronize Robust.HG.ini.example FreeSWITCH config with other config files --- bin/Robust.HG.ini.example | 42 +++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index f12a1434ef..ced2857331 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -85,19 +85,41 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * This is the configuration for the freeswitch server in grid mode [FreeswitchService] LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" - ;; IP of your FS server + + ;; The IP address of your FreeSWITCH server. ; ServerAddress = 127.0.0.1 - ;; All other options are - well - optional - ; Realm = "127.0.0.1" - ; SIPProxy = "127.0.0.1:5060" - ; EchoServer = "127.0.0.1" - ; EchoPort = 50505 - ; AttemptSTUN = "false" + ;; The following configuration parameters are optional + + ;; By default, this is the same as the ServerAddress + ; Realm = 127.0.0.1 + + ;; By default, this is the same as the ServerAddress on port 5060 + ; SIPProxy = 127.0.0.1:5060 + + ;; Default is 5000ms ; DefaultTimeout = 5000 - ; Context = "default" - ; UserName = "freeswitch" - ; Password = "password" + + ;; The dial plan context. Default is "default" + ; Context = default + + ;; Currently unused + ; UserName = freeswitch + + ;; Currently unused + ; Password = password + + ;; The following parameters are for STUN = Simple Traversal of UDP through NATs + ;; See http://wiki.freeswitch.org/wiki/NAT_Traversal + ;; stun.freeswitch.org is not guaranteed to be running so use it in + ;; production at your own risk + ; EchoServer = 127.0.0.1 + ; EchoPort = 50505 + ; AttemptSTUN = false + + LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" + ;; IP of your FS server + ; ServerAddress = 127.0.0.1 ; * This is the new style authentication service. Currently, only MySQL ; * is implemented. From ccc26f74436f0e3069587efd96497053e4129c3c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 20 Apr 2011 01:02:40 +0100 Subject: [PATCH 11/12] 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. --- .../Servers/HttpServer/BaseHttpServer.cs | 2 +- .../FreeSwitchVoice/FreeSwitchVoiceModule.cs | 79 ++++++++++++++++--- 2 files changed, 67 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ccec9b70eb..ba89e2117b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -430,7 +430,7 @@ namespace OpenSim.Framework.Servers.HttpServer string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); - //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); +// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); if (TryGetStreamHandler(handlerKey, out requestHandler)) { diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 962b5cabfb..373ffeb00b 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 // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); // MainServer.Instance.AddStreamHandler(h); - - MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceSigninHTTPHandler); MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceBuddyHTTPHandler); + + MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_watcher.php", m_freeSwitchAPIPrefix), + FreeSwitchSLVoiceWatcherHTTPHandler); m_log.InfoFormat("[FreeSwitchVoice]: using FreeSwitch server {0}", m_freeSwitchRealm); @@ -301,7 +302,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps) { m_log.DebugFormat( - "[FreeSwitchVoice]: OnRegisterCaps called with agentID {0} caps {1} in scene {2}", + "[FreeSwitchVoice]: OnRegisterCaps() called with agentID {0} caps {1} in scene {2}", agentID, caps, scene.RegionInfo.RegionName); string capsBase = "/CAPS/" + caps.CapsObjectPath; @@ -344,6 +345,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param, UUID agentID, Caps caps) { + m_log.DebugFormat( + "[FreeSwitchVoice][PROVISIONVOICE]: ProvisionVoiceAccountRequest() request: {0}, path: {1}, param: {2}", request, path, param); + ScenePresence avatar = scene.GetScenePresence(agentID); if (avatar == null) { @@ -357,9 +361,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice try { - //m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}", - // request, path, param); - //XmlElement resp; string agentname = "x" + Convert.ToBase64String(agentID.GetBytes()); 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 public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param, UUID agentID, Caps caps) { +// m_log.DebugFormat( +// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}", +// scene.RegionInfo.RegionName, agentID); + ScenePresence avatar = scene.GetScenePresence(agentID); string avatarName = avatar.Name; @@ -502,6 +507,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice m_log.DebugFormat("[FreeSwitchVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}", avatarName, request, path, param); + return "true"; } @@ -555,7 +561,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice return response; } - public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request) { m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceGetPreloginHTTPHandler called"); @@ -592,6 +597,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public Hashtable FreeSwitchSLVoiceBuddyHTTPHandler(Hashtable request) { + m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceBuddyHTTPHandler called"); + Hashtable response = new Hashtable(); response["int_response_code"] = 200; response["str_response_string"] = string.Empty; @@ -650,18 +657,61 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice A {3} - ", ids[i],i,m_freeSwitchRealm,dt)); + ", ids[i], i ,m_freeSwitchRealm, dt)); } resp.Append(""); response["str_response_string"] = resp.ToString(); -// Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); - - //m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],"")); +// Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); +// +// m_log.DebugFormat( +// "[FREESWITCH]: FreeSwitchSLVoiceBuddyHTTPHandler() response {0}", +// normalizeEndLines.Replace((string)response["str_response_string"],"")); + return response; } + public Hashtable FreeSwitchSLVoiceWatcherHTTPHandler(Hashtable request) + { + m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceWatcherHTTPHandler called"); + + Hashtable response = new Hashtable(); + response["int_response_code"] = 200; + response["content-type"] = "text/xml"; + + Hashtable requestBody = ParseRequestBody((string)request["body"]); + + string auth_token = (string)requestBody["auth_token"]; + //string[] auth_tokenvals = auth_token.Split(':'); + //string username = auth_tokenvals[0]; + + StringBuilder resp = new StringBuilder(); + resp.Append(""); + + // 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 + // give an OK response, then viewer 2 engages in an continuous viv_signin.php, viv_buddy.php, viv_watcher.php loop + // Viewer 1 appeared happy to ignore the lack of reply and still works with this reply. + // + // However, really we need to fill in whatever watcher data should be here (whatever that is). + resp.Append(string.Format(@" + OK + lib_session + {0} + {0} + ", auth_token)); + + response["str_response_string"] = resp.ToString(); + +// Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); +// +// m_log.DebugFormat( +// "[FREESWITCH]: FreeSwitchSLVoiceWatcherHTTPHandler() response {0}", +// normalizeEndLines.Replace((string)response["str_response_string"],"")); + + return response; + } + public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request) { m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceSigninHTTPHandler called"); @@ -709,7 +759,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice ", userid, pos, avatarName); - response["int_response_code"] = 200; + response["int_response_code"] = 200; + +// m_log.DebugFormat("[FreeSwitchVoice]: Sending FreeSwitchSLVoiceSigninHTTPHandler response"); + return response; } @@ -823,4 +876,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice #endregion } -} +} \ No newline at end of file From 212326eeb0a7aa2180661e4c0ad253e2e7ae4515 Mon Sep 17 00:00:00 2001 From: dahlia Date: Tue, 19 Apr 2011 22:16:10 -0700 Subject: [PATCH 12/12] fix meshing failure on sculpt maps smaller than 64x64 --- OpenSim/Region/Physics/Meshing/SculptMap.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/Meshing/SculptMap.cs b/OpenSim/Region/Physics/Meshing/SculptMap.cs index d2d71deade..740424ef91 100644 --- a/OpenSim/Region/Physics/Meshing/SculptMap.cs +++ b/OpenSim/Region/Physics/Meshing/SculptMap.cs @@ -62,6 +62,8 @@ namespace PrimMesher bool needsScaling = false; + bool smallMap = bmW * bmH <= lod * lod; + width = bmW; height = bmH; while (width * height > numLodPixels) @@ -104,9 +106,14 @@ namespace PrimMesher { for (int x = 0; x <= width; x++) { - int bmY = y < height ? y * 2 : y * 2 - 1; - int bmX = x < width ? x * 2 : x * 2 - 1; - Color c = bm.GetPixel(bmX, bmY); + Color c; + + if (smallMap) + c = bm.GetPixel(x < width ? x : x - 1, + y < height ? y : y - 1); + else + c = bm.GetPixel(x < width ? x * 2 : x * 2 - 1, + y < height ? y * 2 : y * 2 - 1); redBytes[byteNdx] = c.R; greenBytes[byteNdx] = c.G;