Exemple #1
0
        private void ProcessCdeEvent(CdeCall cdeEvent)
        {
            var call = callStore.Get(cdeEvent.CallId);

            if (cdeEvent.IncomingCall != null)
            {
                call.IncomingCall = cdeEvent.IncomingCall;

                if (call.IncomingCall != null && call.CallInfo != null)
                {
                    Publish(call);
                }
            }

            if (cdeEvent.CallStatusChanged != null)
            {
                call.CallStatusChanged = cdeEvent.CallStatusChanged;

                if (call.IncomingCall != null) //  && call.CallInfo != null
                {
                    Publish(call);
                }
            }

            if (cdeEvent.CallInfo != null)
            {
                call.CallInfo = cdeEvent.CallInfo;

                if (call.IncomingCall != null && call.CallStatusChanged != null)
                {
                    Publish(call);
                }
            }
        }
Exemple #2
0
        private void Publish(CdeCall call)
        {
            var callUpdate = new CallUpdate
            {
                CallId     = call.IncomingCall.CallId,
                ChannelId  = call.IncomingCall.ChannelId,
                GroupId    = call.IncomingCall.Info.CalledPartyId,
                CallStatus = call.CallStatusChanged.CallStatus.ToString(),
            };

            if (call.CallStatusChanged.FloorStatus == CdeFloorStatus.Taken)
            {
                callUpdate.FloorStatus = FloorStatus.Taken;

                if (call.CallInfo != null)
                {
                    callUpdate.Talker = call.CallInfo.TalkerInfo.MemberIdentity.Name;
                }
            }
            else if (call.CallStatusChanged.FloorStatus == CdeFloorStatus.Granted)
            {
                callUpdate.FloorStatus = FloorStatus.Granted;
                callUpdate.Talker      = "You";
            }
            else
            {
                callUpdate.FloorStatus = FloorStatus.Idle;
                callUpdate.Talker      = null;
            }

            logger.LogInformation("[{EventName}] {@EventArgs}", "CallUpdate", callUpdate);
            mediator.Publish(callUpdate);
        }
Exemple #3
0
        public CdeCall Get(uint callId)
        {
            if (!calls.TryGetValue(callId, out var call))
            {
                call = new CdeCall();
                calls.Add(callId, call);
            }

            return(call);
        }