diff --git a/OpenSim/Addons/os-webrtc-janus/Janus/JanusAudioBridge.cs b/OpenSim/Addons/os-webrtc-janus/Janus/JanusAudioBridge.cs index c2448e92ee..f71137015e 100644 --- a/OpenSim/Addons/os-webrtc-janus/Janus/JanusAudioBridge.cs +++ b/OpenSim/Addons/os-webrtc-janus/Janus/JanusAudioBridge.cs @@ -58,16 +58,20 @@ namespace osWebRtcVoice public async Task SendAudioBridgeMsg(PluginMsgReq pMsg) { - AudioBridgeResp ret = null; try { - ret = new AudioBridgeResp(await SendPluginMsg(pMsg)); + JanusMessageResp ret = await SendPluginMsg(pMsg).ConfigureAwait(false); + if(ret is not null) + return new AudioBridgeResp(ret); + else + m_log.Error($"{LogHeader} AudioBridge SendPluginMsg returned null"); + } catch (Exception e) { - m_log.ErrorFormat("{0} SendPluginMsg. Exception {1}", LogHeader, e); + m_log.Error($"{LogHeader} SendPluginMsg. Exception", e); } - return ret; + return null; } /// @@ -86,7 +90,7 @@ namespace osWebRtcVoice try { JanusMessageResp resp = await SendPluginMsg(new AudioBridgeCreateRoomReq(pRoomId, pSpatial, pRoomDesc)); - AudioBridgeResp abResp = new AudioBridgeResp(resp); + AudioBridgeResp abResp = new(resp); m_log.Debug($"{LogHeader} CreateRoom. ReturnCode: '{abResp.AudioBridgeReturnCode}'"); switch (abResp.AudioBridgeReturnCode) @@ -132,22 +136,21 @@ namespace osWebRtcVoice public async Task DestroyRoom(JanusRoom janusRoom) { - bool ret = false; try { - JanusMessageResp resp = await SendPluginMsg(new AudioBridgeDestroyRoomReq(janusRoom.RoomId)); - ret = true; + JanusMessageResp resp = await SendPluginMsg(new AudioBridgeDestroyRoomReq(janusRoom.RoomId)).ConfigureAwait(false); + return true; } catch (Exception e) { - m_log.ErrorFormat("{0} DestroyRoom. Exception {1}", LogHeader, e); + m_log.Error($"{LogHeader} DestroyRoom. Exception ", e); } - return ret; + return false; } // Constant used to denote that this is a spatial audio room for the region (as opposed to parcels) public const int REGION_ROOM_ID = -999; - private Dictionary _rooms = new Dictionary(); + private Dictionary _rooms = []; // Calculate a room number for the given parameters. The room number is a hash of the parameters. // The attempt is to deterministicly create a room number so all regions will generate the diff --git a/OpenSim/Addons/os-webrtc-janus/Janus/JanusMessages.cs b/OpenSim/Addons/os-webrtc-janus/Janus/JanusMessages.cs index e2f3a0dc3e..5c108bf042 100644 --- a/OpenSim/Addons/os-webrtc-janus/Janus/JanusMessages.cs +++ b/OpenSim/Addons/os-webrtc-janus/Janus/JanusMessages.cs @@ -529,7 +529,7 @@ namespace osWebRtcVoice { "record", false } }) { - if (!String.IsNullOrEmpty(pDesc)) + if (!string.IsNullOrEmpty(pDesc)) AddStringToBody("description", pDesc); } } @@ -558,6 +558,18 @@ namespace osWebRtcVoice } } + public class AudioBridgeAgentJoinRoomReq : PluginMsgReq + { + public AudioBridgeAgentJoinRoomReq(int pRoomId, UUID Agent) : base(new OSDMap() { + { "request", "join" }, + { "room", pRoomId }, + { "id", new OSDNLong(Math.Abs((long)(Agent.ulonga ^ Agent.ulongb)))}, + { "display", Agent.ToString() } + }) + { + } + } + // A successful response contains the participant ID and the SDP public class AudioBridgeJoinRoomResp : AudioBridgeResp { diff --git a/OpenSim/Addons/os-webrtc-janus/Janus/JanusRoom.cs b/OpenSim/Addons/os-webrtc-janus/Janus/JanusRoom.cs index f0eea7b01e..b156f25f38 100644 --- a/OpenSim/Addons/os-webrtc-janus/Janus/JanusRoom.cs +++ b/OpenSim/Addons/os-webrtc-janus/Janus/JanusRoom.cs @@ -68,7 +68,7 @@ namespace osWebRtcVoice // and, if removed, the viewer complains that the "m=" sections are // out of order. Not "cleaning" (removing the data section) seems to work. // string cleanSdp = CleanupSdp(pSdp); - AudioBridgeJoinRoomReq joinReq = new(RoomId, pVSession.AgentId.ToString()); + AudioBridgeAgentJoinRoomReq joinReq = new(RoomId, pVSession.AgentId); // joinReq.SetJsep("offer", cleanSdp); joinReq.SetJsep("offer", pVSession.Offer); @@ -89,7 +89,7 @@ namespace osWebRtcVoice bool recovered = await RecoverAlreadyInRoomAndLeave(pVSession.AgentId.ToString()); if (recovered) { - AudioBridgeJoinRoomReq retryJoinReq = new(RoomId, pVSession.AgentId.ToString()); + AudioBridgeAgentJoinRoomReq retryJoinReq = new(RoomId, pVSession.AgentId); retryJoinReq.SetJsep("offer", pVSession.Offer); JanusMessageResp retryResp = await _AudioBridge.SendPluginMsg(retryJoinReq); AudioBridgeJoinRoomResp retryJoinResp = new(retryResp); diff --git a/OpenSim/Addons/os-webrtc-janus/Janus/JanusViewerSession.cs b/OpenSim/Addons/os-webrtc-janus/Janus/JanusViewerSession.cs index f8834111f6..97ddbcfeb4 100644 --- a/OpenSim/Addons/os-webrtc-janus/Janus/JanusViewerSession.cs +++ b/OpenSim/Addons/os-webrtc-janus/Janus/JanusViewerSession.cs @@ -54,7 +54,6 @@ namespace osWebRtcVoice public OMV.UUID AgentId { get; set; } // Janus keeps track of the user by this ID -// public int ParticipantId { get; set; } public long ParticipantId { get; set; } // Connections to the Janus server diff --git a/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs b/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs index cd870c9626..0c2eae90eb 100644 --- a/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs +++ b/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs @@ -62,7 +62,7 @@ namespace osWebRtcVoice // Delay between a disconnect and next join for same agent. private int _RejoinCooldownMs = 250; - private readonly ConcurrentDictionary _LastDisconnectByAgent = new ConcurrentDictionary(); + private readonly ConcurrentDictionary _LastDisconnectByAgent = new(); private long _VoiceFlowCounter; // An extra "viewer session" that is created initially. Used to verify the service @@ -71,12 +71,6 @@ namespace osWebRtcVoice public WebRtcJanusService(IConfigSource pConfig) : base(pConfig) { -// WebRtcDebugControl.ApplyFromConfig(pConfig); - - Assembly assembly = Assembly.GetExecutingAssembly(); - string version = assembly.GetName().Version?.ToString() ?? "unknown"; - - _log.Debug($"{LogHeader} WebRtcJanusService version {version}"); _Config = pConfig; IConfig webRtcVoiceConfig = _Config.Configs["WebRtcVoice"]; @@ -156,13 +150,13 @@ namespace osWebRtcVoice private async Task ConnectToSessionAndAudioBridge(JanusViewerSession pViewerSession) { - JanusSession janusSession = new JanusSession(_JanusServerURI, _JanusAPIToken, _JanusAdminURI, _JanusAdminToken, _MessageDetails); + JanusSession janusSession = new(_JanusServerURI, _JanusAPIToken, _JanusAdminURI, _JanusAdminToken, _MessageDetails); if (await janusSession.CreateSession().ConfigureAwait(false)) { _log.DebugFormat("{0} JanusSession created", LogHeader); // Once the session is created, create a handle to the plugin for rooms - JanusAudioBridge audioBridge = new JanusAudioBridge(janusSession); + JanusAudioBridge audioBridge = new(janusSession); if (await audioBridge.Activate(_Config).ConfigureAwait(false)) { diff --git a/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServerConnector.cs b/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServerConnector.cs index f33b11af1e..4af87d07da 100644 --- a/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServerConnector.cs +++ b/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServerConnector.cs @@ -58,8 +58,6 @@ namespace osWebRtcVoice public WebRtcVoiceServerConnector(IConfigSource pConfig, IHttpServer pServer, string pConfigName) { -// WebRtcDebugControl.ApplyFromConfig(pConfig); - IConfig moduleConfig = pConfig.Configs["WebRtcVoice"]; if (moduleConfig is not null) diff --git a/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServiceConnector.cs b/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServiceConnector.cs index 803291bb19..b86de5a8cf 100644 --- a/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServiceConnector.cs +++ b/OpenSim/Addons/os-webrtc-janus/WebRtcVoice/WebRtcVoiceServiceConnector.cs @@ -52,8 +52,6 @@ namespace osWebRtcVoice public WebRtcVoiceServiceConnector(IConfigSource pConfig) { -// WebRtcDebugControl.ApplyFromConfig(pConfig); - m_Config = pConfig; IConfig moduleConfig = m_Config.Configs["WebRtcVoice"]; diff --git a/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs b/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs index 8ea6d620b4..9fb18cfad3 100644 --- a/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs +++ b/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs @@ -79,8 +79,6 @@ namespace osWebRtcVoice // ISharedRegionModule.Initialize public void Initialise(IConfigSource config) { -// WebRtcDebugControl.ApplyFromConfig(config); - m_Config = config.Configs["WebRtcVoice"]; if (m_Config is not null) { diff --git a/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceServiceModule/WebRtcVoiceServiceModule.cs b/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceServiceModule/WebRtcVoiceServiceModule.cs index a8a24ffbd1..32665310ae 100644 --- a/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceServiceModule/WebRtcVoiceServiceModule.cs +++ b/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceServiceModule/WebRtcVoiceServiceModule.cs @@ -74,8 +74,6 @@ namespace osWebRtcVoice // Get configuration and load the modules that will handle spatial and non-spatial voice. public void Initialise(IConfigSource pConfig) { -// WebRtcDebugControl.ApplyFromConfig(pConfig); - m_Config = pConfig; IConfig moduleConfig = m_Config.Configs["WebRtcVoice"]; diff --git a/bin/OpenMetaverse.Rendering.Meshmerizer.dll b/bin/OpenMetaverse.Rendering.Meshmerizer.dll index 1fa8434009..2a3e7ed3ef 100755 Binary files a/bin/OpenMetaverse.Rendering.Meshmerizer.dll and b/bin/OpenMetaverse.Rendering.Meshmerizer.dll differ diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 6c7f926369..51f346e836 100755 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index a4bca2a771..375ef4da60 100755 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index 7d61636aee..fe7f19a2e6 100755 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ