Exemple #1
0
        private void CodecOnEventReceived(CiscoTelePresenceCodec codec, string name, Dictionary <string, string> properties)
        {
            switch (name)
            {
            case "CallDisconnect":
                OnCallDisconnected(_calls[int.Parse(properties["CallId"])],
                                   (DisconnectCauseType)Enum.Parse(typeof(DisconnectCauseType), properties["CauseType"], false),
                                   properties["CauseString"]);
                break;

            case "CallSuccessful":
                OnCallSuccess(_calls[int.Parse(properties["CallId"])]);
                break;

            case "OutgoingCallIndication":
                var id = int.Parse(properties["CallId"]);
                if (_calls.ContainsKey(id))
                {
                    OnCallStatusChange(_codec, CallStatusEventType.NewCall, _calls[id]);
                }
                break;

            case "IncomingCallIndication":
                var call = GetOrInsert(int.Parse(properties["CallId"]), CallStatus.Ringing, CallDirection.Incoming);
                call.Status       = CallStatus.Ringing;
                call.Direction    = CallDirection.Incoming;
                call.DisplayName  = properties["DisplayNameValue"];
                call.RemoteNumber = properties["RemoteURI"];
                OnCallIncoming(call);
                break;
            }
        }
Exemple #2
0
        private void CodecOnStatusReceived(CiscoTelePresenceCodec codec, IEnumerable <StatusUpdateItem> items)
        {
            var statusUpdateItems = items as StatusUpdateItem[] ?? items.ToArray();

            foreach (var statusUpdateItem in statusUpdateItems.Where(i => i.Path.StartsWith("Call[")))
            {
                var id = int.Parse(Regex.Match(statusUpdateItem.Path, @"Call\[([0-9]+)\]").Groups[1].Value);

                if (_calls.ContainsKey(id))
                {
                    if (statusUpdateItem.Attributes == "ghost=True")
                    {
                        _calls[id].Status = CallStatus.Idle;
                        OnCallStatusChange(_codec, CallStatusEventType.Ended, _calls[id]);
                        _calls[id].Dispose();
                        Remove(id);
                    }
                    break;
                }

                var call = new Call(codec, id,
                                    statusUpdateItems.Where(i => i.Path.StartsWith("Call[" + id + "]")).ToArray());

                _lock.Enter();
                _calls.Add(id, call);
                _lock.Leave();
            }
        }
Exemple #3
0
        private void OnStatusReceived(CiscoTelePresenceCodec codec, StatusUpdateItem[] items)
        {
            //Debug.WriteInfo(_apiNameSpace, "OnStatusReceived");
            var names = UpdateFromStatus(items);

            if (names.Any())
            {
                OnStatusChanged(this, names);
            }
        }
Exemple #4
0
 internal Call(CiscoTelePresenceCodec codec, int id, StatusUpdateItem[] statusItems)
     : base(codec, id)
 {
     _id        = id;
     _startTime = DateTime.Now;
     if (!codec.Calls.ContainsCallWithId(id))
     {
         UpdateFromStatus(statusItems);
     }
     Debug.WriteSuccess("{0} created!", this);
 }
Exemple #5
0
        protected CodecApiElement(CodecApiElement parent, string propertyName)
        {
            _codec = parent.Codec;

            _parent = parent;
            _parent.ChildElementChange += ParentOnChildElementChange;

            _apiNameSpace = string.Format("{0}{1}{2}",
                                          parent.ApiNameSpace, parent.ApiNameSpace.EndsWith("]") ? "" : ".",
                                          propertyName);
        }
Exemple #6
0
 internal virtual void OnCallStatusChange(CiscoTelePresenceCodec codec, CallStatusEventType eventType, Call call)
 {
     try
     {
         Debug.WriteSuccess(eventType.ToString(), call.ToString());
         var handler = CallStatusChange;
         if (handler != null)
         {
             handler(codec, eventType, call);
         }
     }
     catch (Exception e)
     {
         CloudLog.Exception(e, "Error Calls.OnCallStatusChange() Event");
     }
 }
        protected virtual void OnConfigurationChanged(CiscoTelePresenceCodec codec, ConfigurationChangeEventArgs args)
        {
            var handler = ConfigurationChanged;

            if (handler != null)
            {
                try
                {
                    handler(codec, args);
                }
                catch (Exception e)
                {
                    CloudLog.Exception(e);
                }
            }
        }
Exemple #8
0
 internal Calls(CiscoTelePresenceCodec codec)
 {
     _codec = codec;
     _codec.StatusReceived += CodecOnStatusReceived;
     _codec.EventReceived  += CodecOnEventReceived;
 }
Exemple #9
0
 internal Call(CiscoTelePresenceCodec codec, int id)
     : base(codec, id)
 {
     _id        = id;
     _startTime = DateTime.Now;
 }
Exemple #10
0
#pragma warning restore 649

        #endregion

        #region Constructors

        internal Standby(CiscoTelePresenceCodec codec)
            : base(codec)
        {
        }
Exemple #11
0
 protected CodecApiElement(CiscoTelePresenceCodec codec, int indexer)
     : this(codec)
 {
     _apiNameSpace = _apiNameSpace + "[" + indexer + "]";
 }
Exemple #12
0
 protected CodecApiElement(CiscoTelePresenceCodec codec)
 {
     _codec = codec;
     _codec.StatusReceived += OnStatusReceived;
     _apiNameSpace          = GetType().Name;
 }