public override Task <StartLiveReply> StartLive(StartLiveRequest request, ServerCallContext context) { // var restult = _sipServiceDirector.MakeVideoRequest(request.Gbid, new int[] { request.Port }, request.Ipaddr); _eventSource?.FireLivePlayRequestEvent(request, context); var reqeustProcessResult = _sipServiceDirector.MakeVideoRequest(request.Gbid, new int[] { request.Port }, request.Ipaddr); reqeustProcessResult?.Wait(System.TimeSpan.FromSeconds(1)); //get the response . var resReply = new StartLiveReply() { // Ipaddr = reqeustProcessResult.Result.Item1, //Port = reqeustProcessResult.Result.Item2, Ipaddr = "0000000", Port = 000000, Hdr = request.Hdr, Status = new MediaContract.Status() { Code = 200, Msg = "Request Successful!" } }; return(Task.FromResult(resReply)); // reqeustProcessResult.Wait(System.TimeSpan.FromSeconds(2)); // return reqeustProcessRsult; //_sipCoreMessageService.MonitorService[request.Gbid] // return base.StartLive(request, context); }
public override Task <StartLiveReply> StartLive(StartLiveRequest request, ServerCallContext context) { try { logger.Debug("StartLive: request=" + request.ToString()); _eventSource?.FileLivePlayRequestEvent(request, context); var reqeustProcessResult = _sipServiceDirector.RealVideoReq(request.Gbid, new int[] { request.Port }, request.Ipaddr); reqeustProcessResult?.Wait(System.TimeSpan.FromSeconds(1)); //get the response . var resReply = new StartLiveReply() { Ipaddr = reqeustProcessResult.Result.Item1, Port = reqeustProcessResult.Result.Item2, Hdr = GetHeaderBySipHeader(reqeustProcessResult.Result.Item3), Status = new Status() { Code = 200, Msg = "Request Successful!" } }; //add Video Session Alive Dictionary <string, DateTime> _Dictionary = new Dictionary <string, DateTime>(); _Dictionary.Add(request.Gbid + ',' + resReply.Hdr.Sessionid, DateTime.Now); _sipServiceDirector.VideoSessionAlive.Add(_Dictionary); logger.Debug("StartLive: resReply=" + resReply.ToString()); return(Task.FromResult(resReply)); } catch (Exception ex) { logger.Error("Exception GRPC StartLive: " + ex.Message); var resReply = new StartLiveReply() { Status = new Status() { Msg = ex.Message } }; return(Task.FromResult(resReply)); } }