Пример #1
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            if (args.Path.StartsWith("Status/Video"))
            {
#if DEBUG
                CrestronConsole.PrintLine("Status for {0}", args.Path);
                CrestronConsole.PrintLine(args.Data.ToString());
#endif
            }

            switch (args.Path)
            {
            case "Status/Video/Seflview":
                foreach (XElement e in args.Data.Elements())
                {
                    switch (e.XName.LocalName)
                    {
                    case "Mode": _SelfViewMode = (SelfViewMode)Enum.Parse(typeof(SelfViewMode), e.Value, false);
                        if (SelfViewChanged != null)
                        {
                            SelfViewChanged(this);
                        }
                        break;

                    case "FullscreenMode": _SelfViewFullscreenMode = (SelfViewFullscreenMode)Enum.Parse(typeof(SelfViewFullscreenMode), e.Value, false);
                        if (SelfViewChanged != null)
                        {
                            SelfViewChanged(this);
                        }
                        break;
                    }
                }
                break;
            }
        }
Пример #2
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            try
            {
                switch (args.Path)
                {
                case @"Status/Conference/Presentation":
#if DEBUG
                    CrestronConsole.PrintLine("Received feedback for {0}", args.Path);
                    CrestronConsole.PrintLine(args.Data.ToString());
#endif
                    if (args.Data.XName.LocalName == "Presentation")
                    {
                        if (args.Data.Element("LocalSendingMode") != null)
                        {
                            PresentationSendingMode = (PresentationSendingMode)Enum.Parse(typeof(PresentationSendingMode), args.Data.Element("LocalSendingMode").Value, true);
                        }
                        if (args.Data.Element("LocalSource") != null)
                        {
                            PresentationSource = int.Parse(args.Data.Element("LocalSource").Value);
                        }

                        if (PresentationSendingModeChanged != null)
                        {
                            PresentationSendingModeChanged(this);
                        }
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                ErrorLog.Exception(string.Format("Error in CiscoCodec.FeedbackServer_ReceivedData, path = {0}", args.Path), e);
            }
        }
Пример #3
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            switch (args.Path)
            {
            case @"Status/SystemUnit/State":
                foreach (XElement state in args.Data.Elements())
                {
#if DEBUG
                    if (!state.HasElements)
                    {
                        CrestronConsole.PrintLine("Codec.Status.SystemUnit.State.{0} = {1}", state.XName.LocalName, state.Value);
                    }
#endif
                    switch (state.XName.LocalName)
                    {
                    case "NumberOfActiveCalls": NumberOfActiveCalls = int.Parse(state.Value); break;

                    case "NumberOfInProgressCalls": NumberOfInProgressCalls = int.Parse(state.Value); break;

                    case "NumberOfSuspendedCalls": NumberOfSuspendedCalls = int.Parse(state.Value); break;

                    case "System": System = (SystemState)Enum.Parse(typeof(SystemState), state.Value, false); break;
                    }
                }
                break;
            }
        }
Пример #4
0
 void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
 {
     if (args.Path == "Status/Conference" && args.Data.Elements().First().XName.LocalName == "DoNotDisturb")
     {
         Active = (args.Data.Elements().First().Value == "Active");
     }
 }
Пример #5
0
 void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
 {
     switch (args.Path)
     {
     case "Status/Audio/Microphones":
         foreach (XElement element in args.Data.Elements())
         {
             switch (element.XName.LocalName)
             {
             case "Mute":
                 if (element.Value == "Off" && Mute)
                 {
                     _Mute = false;
                     OnMuteChange();
                 }
                 else if (element.Value == "On" && !Mute)
                 {
                     _Mute = true;
                     OnMuteChange();
                 }
                 break;
             }
         }
         break;
     }
 }
Пример #6
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            switch (args.Path)
            {
            case @"Status/Audio":
                foreach (XElement element in args.Data.Elements())
                {
                    switch (element.XName.LocalName)
                    {
                    case "Volume":
                        int level = int.Parse(element.Value);
                        if (level != Volume)
                        {
                            _Volume = level;
                            OnVolumeChange();
                        }
                        break;

                    case "VolumeMute":
                        if (element.Value == "Off" && Mute)
                        {
                            _Mute = false;
                            OnMuteChange();
                        }
                        else if (element.Value == "On" && !Mute)
                        {
                            _Mute = true;
                            OnMuteChange();
                        }
                        break;
                    }
                }
                break;
            }
        }
Пример #7
0
 void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
 {
     switch (args.Path)
     {
     case @"Status/SystemUnit/Diagnostics":
         break;
     }
 }
Пример #8
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            if (args.Path == @"Status/Standby")
            {
#if DEBUG
                CrestronConsole.PrintLine("Status for {0}", args.Path);
                CrestronConsole.PrintLine(args.Data.ToString());
#endif
                StandbyState state = (StandbyState)Enum.Parse(typeof(StandbyState), args.Data.Element("State").Value, true);
#if DEBUG
                CrestronConsole.PrintLine("state = {0}", state.ToString());
#endif
                OnStandbyChange(state);
            }
        }
Пример #9
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            switch (args.Path)
            {
            case @"Status/Capabilities/Conference":
                foreach (XElement state in args.Data.Elements())
                {
                    switch (state.XName.LocalName)
                    {
                    case "MaxActiveCalls": MaxActiveCalls = int.Parse(state.Value); break;

                    case "MaxAudioCalls": MaxAudioCalls = int.Parse(state.Value); break;

                    case "MaxCalls": MaxCalls = int.Parse(state.Value); break;

                    case "MaxVideoCalls": MaxVideoCalls = int.Parse(state.Value); break;
                    }
                }
                break;
            }
        }
Пример #10
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            if (args.Path == "Status/Cameras/SpeakerTrack")
            {
                foreach (XElement element in args.Data.Elements())
                {
                    switch (element.XName.LocalName)
                    {
                    case "Availability": Availability = (SpeakerTrackAvailability)Enum.Parse(typeof(SpeakerTrackAvailability), element.Value, true); break;

                    case "Status": if (element.Value.ToLower() == "active")
                        {
                            this.Active = true;
                        }
                        else
                        {
                            this.Active = false;
                        } break;
                    }
                }
            }
        }
Пример #11
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            try
            {
                int  siteID;
                bool ghost;

                switch (args.Path)
                {
                case @"Status/Conference":
                    if (args.Data.Elements().First().XName.LocalName == "Site")
                    {
                        siteID = int.Parse(args.Data.Elements().First().Attribute("item").Value);
                        ghost  = args.Data.Elements().First().Attribute("ghost") != null?bool.Parse(args.Data.Elements().First().Attribute("ghost").Value) : false;

                        if (ghost && _Sites.ContainsKey(siteID))
                        {
                            OnSiteChange(_Sites[siteID], true);
                            _Sites.Remove(siteID);
                        }
                    }
                    break;

                case @"Status/Conference/Site":
                    siteID = int.Parse(args.Data.Attribute("item").Value);
                    ghost  = args.Data.Attribute("ghost") != null?bool.Parse(args.Data.Attribute("ghost").Value) : false;

                    if (ghost && _Sites.ContainsKey(siteID))
                    {
                        OnSiteChange(_Sites[siteID], true);
                        _Sites.Remove(siteID);
                    }
                    else if (!ghost)
                    {
                        if (!_Sites.ContainsKey(siteID))
                        {
                            _Sites.Add(siteID, new Site(Codec, siteID));
                        }

                        Site site = _Sites[siteID];

                        foreach (XElement e in args.Data.Elements())
                        {
                            switch (e.XName.LocalName)
                            {
                            case "Appearance":
                                site.Appearance = int.Parse(e.Value);
                                break;

                            case "Hold":
                                site.Hold = bool.Parse(e.Value);
                                break;

                            case "MicrophonesMuted":
                                site.MicrophonesMuted = bool.Parse(e.Value);
                                break;

                            case "AttendedTransfer":
                                site.AttendedTransfer = bool.Parse(e.Value);
                                break;

                            case "Capabilities":
                                foreach (XElement e2 in e.Elements())
                                {
                                    switch (e2.XName.LocalName)
                                    {
                                    case "Presentation":
                                        site.Capabilities.Presentation = bool.Parse(e2.Value);
                                        break;
                                    }
                                }
                                break;
                            }

                            OnSiteChange(site, false);
                        }
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                CrestronConsole.PrintLine("Exception in Site.FeedbackServer_ReceivedData, {0}",
                                          e.Message);
                ErrorLog.Exception("Exception in Sites.FeedbackServer_ReceivedData", e);
            }
        }
Пример #12
0
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            try
            {
                switch (args.Path)
                {
                case @"Status/Conference/Call":
                    int confCallID = int.Parse(args.Data.Attribute("item").Value);
                    if (_Calls.ContainsKey(confCallID) &&
                        (_Calls[confCallID].Status == CallStatus.Connecting || _Calls[confCallID].Status == CallStatus.Ringing))
                    {
                        //CrestronConsole.PrintLine("Received conference status for call {0} which is currently shown as connecting... Requesting full update", confCallID);
                        //this.Update();
                    }
                    break;

                case @"Status/Call":
                    int  callID = int.Parse(args.Data.Attribute("item").Value);
                    bool ghost  = args.Data.Attribute("ghost") != null?bool.Parse(args.Data.Attribute("ghost").Value) : false;

                    if (ghost && _Calls.ContainsKey(callID))
                    {
                        Call disconnectedCall = _Calls[callID];
                        if (disconnectedCall.Status != CallStatus.Idle)
                        {
                            disconnectedCall.Status = CallStatus.Idle;
                            OnCallStatusChange(disconnectedCall, CallInfoChangeNotificationSource.HttpFeedbackServer);
                        }
                        disconnectedCall.Ghost = true;
                    }
                    else if (!ghost)
                    {
                        if (!_Calls.ContainsKey(callID))
                        {
                            _Calls.Add(callID, new Call(Codec, callID));
                        }
                        Call call = _Calls[callID];

                        foreach (XElement e in args.Data.Elements())
                        {
#if DEBUG
                            if (!e.HasElements)
                            {
                                CrestronConsole.PrintLine("Codec.Calls[{0}].{1} = {2}", call.ID, e.XName.LocalName, e.Value);
                            }
#endif
                            switch (e.XName.LocalName)
                            {
                            case "AnswerState":
                                call.AnswerState = (CallAnswerState)Enum.Parse(typeof(CallAnswerState), e.Value, false);
                                break;

                            case "CallType":
                                call.Type = (CallType)Enum.Parse(typeof(CallType), e.Value, false);
                                break;

                            case "CallbackNumber":
                                call.CallbackNumber = e.Value;
                                break;

                            case "DeviceType":
                                call.DeviceType = (CallDeviceType)Enum.Parse(typeof(CallDeviceType), e.Value, false);
                                break;

                            case "Direction":
                                call.Direction = (CallDirection)Enum.Parse(typeof(CallDirection), e.Value, false);
                                break;

                            case "Duration":
                                TimeSpan duration = TimeSpan.Parse(e.Value);
                                call.StartTime = DateTime.Now - duration;
                                break;

                            case "DisplayName":
                                call.DisplayName = e.Value;
                                break;

                            case "Protocol":
                                call.Protocol = e.Value;
                                break;

                            case "RemoteNumber":
                                if (e.Value.Length > 0)
                                {
                                    call.RemoteNumber = e.Value;
                                }
                                break;

                            case "Status":
                                //CrestronConsole.PrintLine("Codec RX - Call {0} status = {1}", call.ID, e.Value);
                                if (Codec.LoggingEnabled)
                                {
                                    Codec.Logger.Log("Codec received call Status for Call {0} - Status: {1}", call.ID, e.Value);
                                }

                                try
                                {
                                    CallStatus _Status = (CallStatus)Enum.Parse(typeof(CallStatus), e.Value, false);
                                    if (_Status != call.Status && !(_Status == CallStatus.Disconnecting && call.Status == CallStatus.Idle))
                                    {
                                        call.Status = _Status;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    ErrorLog.Error("Could not parse Enum CallStatus from value {0}, {1}", e.Value, ex.Message);
                                }
                                break;
                            }
                        }
                        OnCallStatusChange(call, CallInfoChangeNotificationSource.HttpFeedbackServer);
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                ErrorLog.Exception("Error parsing xml in Calls.FeedbackServer_ReceivedData()", e);
            }
        }