|
@@ -21,6 +21,11 @@ namespace Vinno.vCloud.Common.FIS.Consultation
|
|
|
/// </summary>
|
|
|
public event EventHandler<ConsultationInfo> ConsultationRequestArrived;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 当开始Web会诊时
|
|
|
+ /// </summary>
|
|
|
+ public event EventHandler<string> StartWebConsultationEvent;
|
|
|
+
|
|
|
public ConsultationRecipientV2(ConsultationLiveVideoProviderV2 videoProvider, string deviceId, ILiveConsultationService liveConsultationService, IUserService userService, IDeviceService deviceService) : base(videoProvider, liveConsultationService, userService, deviceService)
|
|
|
{
|
|
|
_deviceId = deviceId;
|
|
@@ -30,13 +35,66 @@ namespace Vinno.vCloud.Common.FIS.Consultation
|
|
|
/// Send a join Rtc Consultation Live request
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public ResultInfoDTO StartLiveConsultation(LiveConsultationRequestDTO liveConsultationRequestDTO, string cameraHardwareId, string micHardwareId, string speakerHardwareId)
|
|
|
+ public ResultInfoDTO StartWebConsultation(FlutterLiveConsultationInfo flutterLiveConsultationInfo)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (CurrentLiveStatus == LiveStates.RecipientAcceptting || CurrentLiveStatus == LiveStates.RecipientAcceptted)
|
|
|
{
|
|
|
Logger.WriteLineInfo($"Consultation Live-- accept Consultation failed due to CurrentLiveStatus is {CurrentLiveStatus}");
|
|
|
+ return new ResultInfoDTO
|
|
|
+ {
|
|
|
+ IsSuccess = false,
|
|
|
+ FailMessage = $"StartWebConsultation Fail,Consultation is busy.",
|
|
|
+ ErrorCode = 861,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (string.IsNullOrEmpty(flutterLiveConsultationInfo.ConsulationId))
|
|
|
+ {
|
|
|
+ return new ResultInfoDTO
|
|
|
+ {
|
|
|
+ IsSuccess = false,
|
|
|
+ FailMessage = $"StartWebConsultation Fail,Consultation id is null.",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ IsSecondViewMode = true;
|
|
|
+ ConsultationInfo consultationInfo = new ConsultationInfo(ChatRole.Recipient)
|
|
|
+ {
|
|
|
+ ConsultationId = flutterLiveConsultationInfo.ConsulationId,
|
|
|
+ };
|
|
|
+ lock (ConsultationInfoLocker)
|
|
|
+ {
|
|
|
+ ConsultationInfo = consultationInfo;
|
|
|
+ }
|
|
|
+ StartWebConsultationEvent?.Invoke(this, flutterLiveConsultationInfo.LiveConsultationFlutterUrl);
|
|
|
+ return new ResultInfoDTO
|
|
|
+ {
|
|
|
+ IsSuccess = true,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"Exception happened when StartWebConsultation {ex}");
|
|
|
+ Hangup(true);
|
|
|
+ return new ResultInfoDTO
|
|
|
+ {
|
|
|
+ IsSuccess = false,
|
|
|
+ FailMessage = $"StartWebConsultation Error:{ex}",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Send a join Rtc Consultation Live request
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ResultInfoDTO StartLiveConsultation(LiveConsultationRequestDTO liveConsultationRequestDTO, string cameraHardwareId, string micHardwareId, string speakerHardwareId)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (CurrentLiveStatus == LiveStates.RecipientAcceptting || CurrentLiveStatus == LiveStates.RecipientAcceptted || IsSecondViewMode)
|
|
|
+ {
|
|
|
+ Logger.WriteLineInfo($"Consultation Live-- accept Consultation failed due to CurrentLiveStatus is {CurrentLiveStatus},IsSecondViewMode:{IsSecondViewMode}");
|
|
|
if (liveConsultationRequestDTO.IsInvite)
|
|
|
{
|
|
|
return new ResultInfoDTO
|
|
@@ -73,7 +131,7 @@ namespace Vinno.vCloud.Common.FIS.Consultation
|
|
|
var initiateLiveConsultationRequest = new InitiateLiveConsultationRequest
|
|
|
{
|
|
|
ConsultationCode = liveConsultationRequestDTO.ConsultationCode,
|
|
|
- Token = liveConsultationRequestDTO.Token,
|
|
|
+ Token = AccountToken,
|
|
|
CheckOnly = false,
|
|
|
};
|
|
|
var initiateLiveConsultationResult = JsonRpcHelper.InitiateLiveConsultation(LiveConsultationService, initiateLiveConsultationRequest, out var errorCode);
|
|
@@ -94,7 +152,7 @@ namespace Vinno.vCloud.Common.FIS.Consultation
|
|
|
var joinLiveConsultationRequest = new JoinLiveConsultationRequest
|
|
|
{
|
|
|
ConsultationCode = liveConsultationRequestDTO.ConsultationCode,
|
|
|
- Token = liveConsultationRequestDTO.Token,
|
|
|
+ Token = AccountToken,
|
|
|
CheckOnly = false,
|
|
|
};
|
|
|
var joinLiveConsultationResult = JsonRpcHelper.JoinInLiveConsultation(LiveConsultationService, joinLiveConsultationRequest, out var errorCode);
|
|
@@ -218,7 +276,6 @@ namespace Vinno.vCloud.Common.FIS.Consultation
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
-
|
|
|
lock (ConsultationInfoLocker)
|
|
|
{
|
|
|
ConsultationInfo = consultationInfo;
|
|
@@ -258,6 +315,13 @@ namespace Vinno.vCloud.Common.FIS.Consultation
|
|
|
};
|
|
|
}
|
|
|
ConsultationInfo.ConsultationId = changeLiveConsultation0RequestDTO.ConsultationCode;
|
|
|
+ if (IsSecondViewMode && !IsOnlyForRtmpPushing)//第二屏且不是rtmp推流的情况下
|
|
|
+ {
|
|
|
+ return new ResultInfoDTO
|
|
|
+ {
|
|
|
+ IsSuccess = true,
|
|
|
+ };
|
|
|
+ }
|
|
|
VideoProvider.ChangeConsultationCodeForConsultationConnectionKeeper(changeLiveConsultation0RequestDTO.ConsultationCode);
|
|
|
if (IsOnlyForRtmpPushing)
|
|
|
{
|