Пример #1
0
        public async Task AddReply_WhenDataIsValid_IsSuccessful()
        {
            // Arrange
            var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext);

            var meetingCommentId = await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(meetingId, "The meeting was great."));

            var date = new DateTime(2020, 1, 1, 01, 00, 00);

            SystemClock.Set(date);
            var reply = "Absolutely!";

            // Act
            var replyId = await MeetingsModule.ExecuteCommandAsync(new AddReplyToMeetingCommentCommand(meetingCommentId, reply));

            // Assert
            var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId));

            Assert.That(meetingComments.Count, Is.EqualTo(2));
            var commentReply = meetingComments.Single(c => c.Id == replyId);

            Assert.That(commentReply.InReplyToCommentId, Is.EqualTo(meetingCommentId));
            Assert.That(commentReply.Comment, Is.EqualTo(reply));
            Assert.That(commentReply.AuthorId, Is.EqualTo(ExecutionContext.UserId));
            Assert.That(commentReply.CreateDate, Is.EqualTo(date));
            Assert.That(commentReply.EditDate, Is.Null);
        }
        public async Task UnlikeMeetingComment_WhenDataIsValid_IsSuccessful()
        {
            // Arrange
            await MeetingsModule.ExecuteCommandAsync(
                new CreateMemberCommand(
                    Guid.NewGuid(),
                    ExecutionContext.UserId,
                    "ivan_petrov",
                    "*****@*****.**",
                    "Ivan",
                    "Petrov",
                    "Ivan Petrov"));

            var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext);

            var meetingCommentId = await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(meetingId, "The meeting was awesome."));

            await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentLikeCommand(meetingCommentId));

            await AssertEventually(
                new GetMeetingCommentsProbe(MeetingsModule, meetingId, meetingCommentId, expectedCommentLikesCount : 1),
                10000);

            // Act
            await MeetingsModule.ExecuteCommandAsync(new RemoveMeetingCommentLikeCommand(meetingCommentId));

            // Assert
            var meetingCommentLikers = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentLikersQuery(meetingCommentId));

            Assert.That(meetingCommentLikers.Count, Is.EqualTo(0));

            await AssertEventually(
                new GetMeetingCommentsProbe(MeetingsModule, meetingId, meetingCommentId, expectedCommentLikesCount : 0),
                10000);
        }
Пример #3
0
        public async Task AddMeetingComment_WhenDataIsValid_IsSuccessful()
        {
            // Arrange
            var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext);

            var date = new DateTime(2020, 1, 1, 01, 00, 00);

            SystemClock.Set(date);
            var comment = "The meeting was great.";

            // Act
            var meetingCommentId =
                await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(meetingId, comment));

            // Assert
            var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId));

            Assert.That(meetingComments.Count, Is.EqualTo(1));
            var meetingComment = meetingComments.Single();

            Assert.That(meetingComment.Id, Is.EqualTo(meetingCommentId));
            Assert.That(meetingComment.Comment, Is.EqualTo(comment));
            Assert.That(meetingComment.AuthorId, Is.EqualTo(ExecutionContext.UserId));
            Assert.That(meetingComment.CreateDate, Is.EqualTo(date));
            Assert.That(meetingComment.EditDate, Is.Null);
        }
Пример #4
0
        public async Task CreateMeetingCommentingCofiguration_WhenDataIsValid_IsSuccessful()
        {
            // Act
            var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext);

            // Assert
            var meetingCommentingConfiguration = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentingConfigurationQuery(meetingId));

            Assert.NotNull(meetingCommentingConfiguration);
        }
Пример #5
0
        /// <summary>
        /// 开始会议
        /// </summary>
        public void Start()
        {
            //check
            Meeting.CheckNull();
            Microphone.CheckNull();
            recorderService.CheckNull();

            //server[speech]
            server.SpeechStart(Setting);

            //recorder
            recorderService.Configruation((opt) =>
            {
                opt.DeviceNum          = Microphone.Key;
                opt.Rate               = Setting.Rate;
                opt.BitDepth           = Setting.BitDepth;
                opt.Channel            = Setting.Channel;
                opt.BufferMilliseconds = Setting.BufferMilliseconds;
                opt.DataEvent          = (sender, e) =>
                {
                    //server.MeetingSend(Meeting.Id, e.Buffer, 0, e.BytesRecorded);
                    server.SpeechSend(new Plug.Speech.SpeechData()
                    {
                        Key    = Meeting.Id,
                        Data   = e.Buffer,
                        Offset = 0,
                        Length = e.BytesRecorded,
                        LastDt = DateTime.Now
                    });
                };
                opt.VolumeEvent = (sender, e, volume) =>
                {
                    MicrophoneVolume = volume;
                    if (PreVol != volume)
                    {
                        PreVolDt = DateTime.Now;
                    }
                    PreVol = volume;
                    //Trace.WriteLine($"v:{volume} / {PreVolDt}  {DateTime.Now - PreVolDt}");
                };
                opt.StopedEvent = (sender, e) =>
                {
                    Trace.WriteLine($"stop: {DateTime.Now}");
                };
                opt.FileName = MeetingHelper.GetMeetingWavFile(Meeting.Id);
            });
            recorderService.Start();

            //task
            SyncTask();

            //sync
            SyncUI(EnumTaskStatus.Started);
        }
Пример #6
0
        public async Task DisableMeetingCommenting_WhenDataIsValid_IsSuccess()
        {
            // Arrange
            var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext);

            // Act
            await MeetingsModule.ExecuteCommandAsync(new DisableMeetingCommentingConfigurationCommand(meetingId));

            // Assert
            var meetingConfiguration = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentingConfigurationQuery(meetingId));

            Assert.NotNull(meetingConfiguration);
            Assert.False(meetingConfiguration.IsCommentingEnabled);
        }
Пример #7
0
        public void SpeechStart(MeetingSettingModel setting)
        {
            speechService.Configruation((opt) =>
            {
                opt.AppId                = "5a31dec7";
                opt.Rate                 = setting.Rate;
                opt.BitDepth             = setting.BitDepth;
                opt.Channel              = setting.Channel;
                opt.BufferMilliseconds   = setting.BufferMilliseconds;
                opt.SentenceMilliseconds = setting.SentenceMilliseconds;
                opt.ByteLength           = setting.ByteLength;
                opt.Speed                = MeetingHelper.ConvertiFlySpeed(setting.Speed);

                opt.Language = MeetingHelper.GetiFlySpeechLang(setting.SourceLang);
                opt.Accent   = MeetingHelper.ConvertiFlyAccent(setting.Accent);//"mandarin";

                opt.OnResult = (key, result, complete) =>
                {
                    MeetingDataAdd(key, new MeetingSyncModel()
                    {
                        MeetingId = key,
                        Content   = result,
                        SyncType  = complete ? 0 : -1,
                    });

                    var msg = $" Speech - OnResult : key[{key}] / result[{result}] / complete[{complete} / {DateTime.Now.ToString()} \n\r";
                    Console.WriteLine(msg);
                    speechLog.Info(msg);
                };
                opt.OnSentence = (key, sentence) =>
                {
                    speechLog.Info($" Speech - OnSentence : key[{key}] / sentence[{sentence}] / {DateTime.Now}");
                };
                opt.OnMessage = (key, msg) =>
                {
                    speechLog.Info($" Speech - OnMessage : key[{key}] / OnMessage[{msg}] / {DateTime.Now} \n\r");
                };
                opt.OnError = (key, error) =>
                {
                    //Trace.WriteLine
                    //Console.WriteLine

                    speechLog.Info($" Speech - OnError : key[{key}] / error[{error}] / {DateTime.Now}");
                    EngineHelper.LoggingError(error);
                    speechService.Restart();
                };
            });
            speechService.Start();
        }
        public async Task <ActionResult> Guest(string uri)
        {
            var userAgent = HttpContext.Request.UserAgent;

            var isMobileDevice =
                MeetingHelper.IsMobileDevice(userAgent) || HttpContext.Request.Browser.IsMobileDevice;

            // For mobile requests, redirect to lamna application.
            if (isMobileDevice)
            {
                return(await MobileIndex(uri));
            }

            return(View((object)uri));
        }
Пример #9
0
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            if (txtNum.Text.IsEmpty())
            {
                throw new DbxException(EnumCode.提示消息, culture.Lang.metHuiYiCuoWu);
            }

            var model = MeetingHelper.GetMeeting(code: txtNum.Text);

            if (model.IsNull())
            {
                throw new DbxException(EnumCode.提示消息, culture.Lang.metHuiYiCuoWu);
            }

            parent.mainFrame.Navigate(new Areas.Conference.View.Meeting(meeting: model));
        }
        public async Task GetMeetingComments_Test()
        {
            // Arrange
            var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext);

            await MeetingsModule.ExecuteCommandAsync(
                new AddMeetingCommentCommand(meetingId, "The meeting was great."));

            await MeetingsModule.ExecuteCommandAsync(
                new AddMeetingCommentCommand(meetingId, "The meeting was wonderful."));

            await MeetingsModule.ExecuteCommandAsync(
                new AddMeetingCommentCommand(meetingId, "The meeting was amazing."));

            // Act
            var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId));

            // Assert
            Assert.That(meetingComments.Count, Is.EqualTo(3));
        }
        public async Task RemoveMeetingComment_ByAuthor_WhenDataIsValid_IsSuccessful()
        {
            // Arrange
            var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext);

            var meetingCommentId =
                await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(
                                                             meetingId,
                                                             "The meeting was great."));

            // Act
            await MeetingsModule.ExecuteCommandAsync(new RemoveMeetingCommentCommand(
                                                         meetingCommentId,
                                                         reason : string.Empty));

            // Assert
            var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId));

            Assert.IsEmpty(meetingComments);
        }
Пример #12
0
        /// <summary>
        /// 保存远程会议/翻译记录
        /// </summary>
        /// <param name="model"></param>
        private void MeetingLocalDBSave(Guid meetingId, MeetingSyncOutput model)
        {
            if (model.IsNull())
            {
                return;
            }

            if (model.Records.IsEmpty() && model.Translations.IsEmpty())
            {
                return;
            }

            var recordService      = MeetingHelper.GetRecordService(meetingId);
            var translationService = MeetingHelper.GetTranslateService(meetingId);

            ThreadPool.QueueUserWorkItem((Object state) =>
            {
                if (!model.Records.IsEmpty())
                {
                    model.Records.ForEach(x =>
                    {
                        if (recordService.Find(where : i => i.Id == x.RecordId).Count() == 0)
                        {
                            recordService.Insert(EngineHelper.Map <MeetingRecordEntity>(x));
                        }
                    });
                }

                if (!model.Translations.IsEmpty())
                {
                    model.Translations.ForEach(x =>
                    {
                        if (translationService.Find(where : i => i.Id == x.TranslationId).Count() == 0)
                        {
                            translationService.Insert(EngineHelper.Map <MeetingTranslationEntity>(x));
                        }
                    });
                }
            });
        }
Пример #13
0
        }                                      //根据语音音量变化判断是否在录音中

        /// <summary>
        /// 加载会议
        /// </summary>
        public void Loading(string code = null, MeetingDTO meeting = null)
        {
            //meeting
            if (!meeting.IsNull())
            {
                Meeting = meeting;
            }
            else if (!code.IsEmpty())
            {
                var result = PlugCoreHelper.ApiUrl.Meeting.MeetingGetCode.GetResult <MeetingDTO, MeetingEditInput>(new MeetingEditInput()
                {
                    Num = code
                });
                if (result.Code == EnumCode.成功)
                {
                    Meeting = meeting;
                }
            }
            else if (Meeting.IsNull())
            {
                //else if(Meeting.IsNull()) 全局会议保持
                var result = PlugCoreHelper.ApiUrl.Meeting.MeetingInsert.GetResult <MeetingDTO, MeetingEditInput>(new MeetingEditInput()
                {
                    Id       = Guid.Empty,
                    Name     = culture.Lang.metName,
                    Descript = culture.Lang.metDescript,
                    Setting  = JsonHelper.Serialize(Setting)
                });
                if (result.Code == EnumCode.成功)
                {
                    Meeting = result.Obj;
                }
            }
            if (Meeting.IsNull() || (!Meeting.IsNull() && (Meeting.Id.IsEmpty() || Meeting.Num.IsEmpty())))
            {
                throw new DbxException(EnumCode.初始失败);
            }

            //device
            Microphones = RecordingHelper.Microphones();
            Microphone  = Microphones.FirstOrDefault();

            //二维码
            var codeBitmap = QrCodeHelper.GetCode(string.Format(EngineHelper.Configuration.Settings.GetValue("meetingViewUrl"), Meeting.Id));

            MeetingCode = WpfHelper.BitmapToSource(codeBitmap);

            //本地数据库
            var meetingDatabasePath = MeetingHelper.GetMeetingDatabaseFile(Meeting.Id);

            if (!File.Exists(meetingDatabasePath))
            {
                FilesHelper.CopyFile(MeetingHelper.TemplateDatabaseFilePath, meetingDatabasePath);
            }

            //记录字体
            RecordFontSize = Setting.FontSize;

            //同步任务
            SyncTask();

            //同步状态
            SyncUI(EnumTaskStatus.Default);
            SyncUI(EnumTaskStatus.Init);

            //远程服务同步任务
            AppHelper.ServerObj.MeetingSyncTask();
        }
        public async Task <IHttpActionResult> GetMeetingUri(string encryptedData)
        {
            var skypeMeeting = new SkypeMeeting();

            var userAgent      = HttpContext.Current.Request.UserAgent;
            var isMobileDevice =
                MeetingHelper.IsMobileDevice(userAgent) || HttpContext.Current.Request.Browser.IsMobileDevice;

            encryptedData = encryptedData.Replace(" ", "+");

            var values      = EncryptionHelper.Decrypt(encryptedData.Trim());
            var queryParams = values.Split('&');

            foreach (string param in queryParams)
            {
                string[] paramValue = param.Split('=');

                switch (paramValue[0].ToUpper())
                {
                case "CUSTOMID":
                    skypeMeeting.CustomId = paramValue[1];
                    break;

                case "DISPLAYNAME":
                    skypeMeeting.DisplayName = string.IsNullOrEmpty(paramValue[1])
              ? "Guest" : paramValue[1];
                    break;

                case "EMRID":
                    skypeMeeting.EmrId = paramValue[1];
                    break;

                case "STARTTIME":
                    skypeMeeting.StartTime = !string.IsNullOrEmpty(paramValue[1])
              ? Convert.ToDateTime(paramValue[1], CultureInfo.InvariantCulture) : DateTime.Now;
                    break;

                case "PATIENT":
                    bool isPatient;
                    Boolean.TryParse(paramValue[1], out isPatient);
                    skypeMeeting.IsPatient = isPatient;
                    break;

                case "MEETINGID":
                    skypeMeeting.ItemId = paramValue[1];
                    break;

                case "USERTYPE":
                    skypeMeeting.UserType  = paramValue[1];
                    skypeMeeting.IsPatient = skypeMeeting.UserType.Equals("Doctor", StringComparison.InvariantCultureIgnoreCase) ? false : true;
                    break;

                case "JOINSKYPECLIENT":
                    bool isSkypeClient;
                    Boolean.TryParse(paramValue[1], out isSkypeClient);
                    skypeMeeting.IsSkypeClient = isSkypeClient;
                    break;
                }
            }

            skypeMeeting.MeetingId = skypeMeeting.CustomId + skypeMeeting.EmrId;

            if (string.IsNullOrEmpty(skypeMeeting.UserType))
            {
                skypeMeeting.UserType = skypeMeeting.IsPatient ? "Patient" : "Doctor";
            }

            if (string.IsNullOrEmpty(skypeMeeting.ItemId))
            {
                skypeMeeting.ItemId = SharePointRepository.CheckMeetingExists(skypeMeeting.MeetingId);
            }

            dynamic jsonResponse = null;

            if (string.IsNullOrEmpty(skypeMeeting.ItemId))
            {
                if (isMobileDevice)
                {
                    string response = await MeetingHelper.GetAnonMeeting(string.Empty, string.Empty, SharePointRepository.GetDoctorsByDepartment("HealthCare"));

                    jsonResponse        = JsonConvert.DeserializeObject(response);
                    skypeMeeting.ItemId = SharePointRepository.InsertMeetingData(jsonResponse, skypeMeeting.StartTime, skypeMeeting.StartTime.AddHours(1), string.Empty, skypeMeeting.DisplayName, string.Empty, skypeMeeting.MeetingId);
                }
                else
                {
                    //TODO: SQL Changes
                    skypeMeeting.ItemId = InsertBlankMeetingDetails(skypeMeeting.StartTime, skypeMeeting.StartTime.AddHours(1), string.Empty, string.Empty, skypeMeeting.DisplayName, string.Empty, skypeMeeting.MeetingId);
                }
            }
            else
            {
                ListItem meetingDetails = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId);
                skypeMeeting.Url = Convert.ToString(meetingDetails["JoinURL"]);

                if (string.IsNullOrEmpty(skypeMeeting.Url) && !(skypeMeeting.IsSkypeClient))
                {
                    string response = await MeetingHelper.GetAnonMeeting(string.Empty, string.Empty, SharePointRepository.GetDoctorsByDepartment("HealthCare"));

                    jsonResponse = JsonConvert.DeserializeObject(response);
                    string onlineMeetingUri     = jsonResponse.OnlineMeetingUri;
                    string onlineMeetingJoinUrl = jsonResponse.JoinUrl;
                    SharePointRepository.UpdateMeetingUri(onlineMeetingUri, onlineMeetingJoinUrl, skypeMeeting.ItemId);
                    ListItem meetingUri = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId);
                    skypeMeeting.Url = Convert.ToString(meetingUri["JoinURL"]);
                    //ListItem meetingUri = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId);
                    //skypeMeeting.Url = Convert.ToString(meetingDetails["JoinURL"]);
                    //skypeMeeting.Url = onlineMeetingJoinUrl;
                }
            }

            if (isMobileDevice)
            {
                if (jsonResponse != null)
                {
                    skypeMeeting.Url = jsonResponse.JoinUrl;
                }

                skypeMeeting.Url = $"{ConfigurationManager.AppSettings["MobileSiteUri"]}?uri={skypeMeeting.Url}&id={skypeMeeting.ItemId}&questReq=yes&displayName={skypeMeeting.DisplayName}";
            }
            else
            {
                if (skypeMeeting.IsSkypeClient)
                {
                    skypeMeeting.Url = "conf:sip:" + skypeMeeting.Url;
                }
            }

            return(Ok(skypeMeeting));
        }