Beispiel #1
0
        private void HandleSessionArchiveMessage(vx_evt_base_t eventMessage)
        {
            vx_evt_session_archive_message_t evt = eventMessage;

            Debug.Assert(evt != null);
            if (evt.session_handle != _sessionHandle)
            {
                return;
            }

            DateTime parsedReceivedTime;

            if (!DateTime.TryParse(evt.time_stamp, out parsedReceivedTime))
            {
                VivoxDebug.Instance.DebugMessage($"{GetType().Name}: {eventMessage.GetType().Name} invalid message: Bad time format", vx_log_level.log_error);
                Debug.Assert(false);
                return;
            }
            ChannelParticipant p = _participants[evt.participant_uri] as ChannelParticipant;

            var message = new SessionArchiveMessage()
            {
                ChannelSession = this,
                Key            = evt.message_id,
                MessageId      = evt.message_id,
                QueryId        = evt.query_id,
                ReceivedTime   = parsedReceivedTime,
                Sender         = p != null ? p.Account : new AccountId(evt.participant_uri),
                Message        = evt.message_body,
                FromSelf       = (evt.is_current_user != 0),
                Language       = evt.language
            };

            _sessionArchive.Enqueue(message);
        }
        private void HandleParticipantUpdated(vx_evt_base_t eventMessage)
        {
            vx_evt_participant_updated_t evt = eventMessage;

            Debug.Assert(evt != null);
            if (evt.session_handle != _sessionHandle)
            {
                return;
            }
            if (_participants.ContainsKey(evt.participant_uri))
            {
                ChannelParticipant p = _participants[evt.participant_uri] as ChannelParticipant;
                Debug.Assert(p != null);
                p.IsMutedForAll             = evt.is_moderator_muted != 0;
                p.SpeechDetected            = evt.is_speaking != 0;
                p.InAudio                   = (evt.active_media & 0x1) == 0x1;
                p.InText                    = (evt.active_media & 0x2) == 0x2;
                p.AudioEnergy               = evt.energy;
                p._internalVolumeAdjustment = evt.volume;
                p._internalMute             = evt.is_muted_for_me != 0;
            }
        }