Example #1
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);
        }
Example #2
0
        //{
        //    new CallViewModel { CallId = 1, CallStatus = "Connected", FloorStatus = FloorStatus.Idle, Transmitting = false, Highlight = new SolidColorBrush() },
        //    new CallViewModel { CallId = 2, CallStatus = "Connected", FloorStatus = FloorStatus.Idle, Transmitting = false, Highlight = new SolidColorBrush() },
        //    new CallViewModel { CallId = 3, CallStatus = "Connected", FloorStatus = FloorStatus.Granted, Transmitting = true, Highlight = new SolidColorBrush(Colors.LightGreen)},
        //    new CallViewModel { CallId = 4, CallStatus = "Connected", FloorStatus = FloorStatus.Idle, Transmitting = false, Highlight = new SolidColorBrush() },
        //    new CallViewModel { CallId = 5, CallStatus = "Connected", FloorStatus = FloorStatus.Granted, Transmitting = true, Highlight = new SolidColorBrush(Colors.LightGreen) },
        //};

        internal void CallUpdate(CallUpdate callUpdate)
        {
            App.Current.Dispatcher.Invoke(() =>
            {
                var call = Calls.FirstOrDefault(c => c.CallId == callUpdate.CallId);

                if (call == null)
                {
                    call = new CallViewModel();
                    Calls.Add(call);
                }

                call.CallId      = callUpdate.CallId;
                call.ChannelId   = callUpdate.ChannelId;
                call.CallStatus  = callUpdate.CallStatus;
                call.FloorStatus = callUpdate.FloorStatus;
                call.Talker      = callUpdate.Talker;
                call.GroupId     = callUpdate.GroupId;

                call.Transmitting = callUpdate.FloorStatus == FloorStatus.Granted;
                call.Receiving    = callUpdate.FloorStatus == FloorStatus.Taken;
                call.Highlight    = call.Transmitting ? new SolidColorBrush(Colors.LightGreen) : new SolidColorBrush();
            });
        }
Example #3
0
        public void OnEventReceived(EslMessage eslMessage)
        {
            var eslEvent  = new EslEvent(eslMessage);
            var eventName = eslEvent.EventName;
            var eventType = Enumm.Parse <EslEventType>(eventName);

            switch (eventType)
            {
            case EslEventType.BACKGROUND_JOB:
                var backgroundJob = new BackgroundJob(eslMessage);
                eslEvent = backgroundJob;
                break;

            case EslEventType.CALL_UPDATE:
                var callUpdate = new CallUpdate(eslMessage);
                eslEvent = callUpdate;
                break;

            case EslEventType.CHANNEL_BRIDGE:
                var channelBridge = new ChannelBridge(eslMessage);
                eslEvent = channelBridge;
                break;

            case EslEventType.CHANNEL_HANGUP:
            case EslEventType.CHANNEL_HANGUP_COMPLETE:
                var channelHangup = new ChannelHangup(eslMessage);
                eslEvent = channelHangup;
                break;

            case EslEventType.CHANNEL_PROGRESS:
                var channelProgress = new ChannelProgress(eslMessage);
                eslEvent = channelProgress;
                break;

            case EslEventType.CHANNEL_PROGRESS_MEDIA:
                var channelProgressMedia = new ChannelProgressMedia(eslMessage);
                eslEvent = channelProgressMedia;
                break;

            case EslEventType.CHANNEL_EXECUTE:
                var channelExecute = new ChannelExecute(eslMessage);
                eslEvent = channelExecute;
                break;

            case EslEventType.CHANNEL_EXECUTE_COMPLETE:
                var channelExecuteComplete = new ChannelExecuteComplete(eslMessage);
                eslEvent = channelExecuteComplete;
                break;

            case EslEventType.CHANNEL_UNBRIDGE:
                var channelUnbridge = new ChannelUnbridge(eslMessage);
                eslEvent = channelUnbridge;
                break;

            case EslEventType.SESSION_HEARTBEAT:
                var sessionHeartbeat = new SessionHeartbeat(eslMessage);
                eslEvent = sessionHeartbeat;
                break;

            case EslEventType.DTMF:
                var dtmf = new Dtmf(eslMessage);
                eslEvent = dtmf;
                break;

            case EslEventType.RECORD_STOP:
                var recordStop = new RecordStop(eslMessage);
                eslEvent = recordStop;
                break;

            case EslEventType.CUSTOM:
                var custom = new Custom(eslMessage);
                eslEvent = custom;
                break;

            case EslEventType.CHANNEL_STATE:
                var channelState = new ChannelStateEvent(eslMessage);
                eslEvent = channelState;
                break;

            case EslEventType.CHANNEL_ANSWER:
                eslEvent = new EslEvent(eslMessage);
                break;

            case EslEventType.CHANNEL_ORIGINATE:
                eslEvent = new EslEvent(eslMessage);
                break;

            case EslEventType.CHANNEL_PARK:
                var channelPark = new ChannelPark(eslMessage);
                eslEvent = channelPark;
                break;

            case EslEventType.CHANNEL_UNPARK:
                eslEvent = new EslEvent(eslMessage);
                break;

            default:
                OnUnhandledEvents(new EslEvent(eslMessage));
                break;
            }
            HandleEvents(eslEvent,
                         eventType);
        }