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; } }
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(); } }
private void OnStatusReceived(CiscoTelePresenceCodec codec, StatusUpdateItem[] items) { //Debug.WriteInfo(_apiNameSpace, "OnStatusReceived"); var names = UpdateFromStatus(items); if (names.Any()) { OnStatusChanged(this, names); } }
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); }
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); }
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); } } }
internal Calls(CiscoTelePresenceCodec codec) { _codec = codec; _codec.StatusReceived += CodecOnStatusReceived; _codec.EventReceived += CodecOnEventReceived; }
internal Call(CiscoTelePresenceCodec codec, int id) : base(codec, id) { _id = id; _startTime = DateTime.Now; }
#pragma warning restore 649 #endregion #region Constructors internal Standby(CiscoTelePresenceCodec codec) : base(codec) { }
protected CodecApiElement(CiscoTelePresenceCodec codec, int indexer) : this(codec) { _apiNameSpace = _apiNameSpace + "[" + indexer + "]"; }
protected CodecApiElement(CiscoTelePresenceCodec codec) { _codec = codec; _codec.StatusReceived += OnStatusReceived; _apiNameSpace = GetType().Name; }