예제 #1
0
 public void CallHistoryEntryAdded(CallHistoryEntry entry)
 {
     try
     {
         Client.CallHistoryEntryAdded(entry);
     }
     catch (Exception)
     {
         OnDisconnected(EventArgs.Empty);
     }
 }
 public void CallHistoryEntryAdded(CallHistoryEntry entry)
 {
     OnCrmServerCallHistoryEntryAdded(entry);
 }
 private void OnCrmServerCallHistoryEntryAdded(CallHistoryEntry e)
 {
     EventHandler<CallHistoryEntry> handler = CrmServerCallHistoryEntryAdded;
     if (handler != null) handler(this, e);
 }
        private void ClientOnSessionCompleted(object sender, VoIPEventArgs<ISession> voIpEventArgs)
        {
            var callHistoryentry = new CallHistoryEntry();

            callHistoryentry.Callee = voIpEventArgs.Item.Callee;
            callHistoryentry.Caller = voIpEventArgs.Item.Caller;
            callHistoryentry.StartDate = voIpEventArgs.Item.StartTime;
            callHistoryentry.CallLength = voIpEventArgs.Item.TalkDuration;

            try
            {
                var affectedEntries = _databaseClient.GetAll().Where(entry => entry.PhoneNumber.Equals(callHistoryentry.Callee) || entry.PhoneNumber.Equals(callHistoryentry.Caller));
                foreach (var affectedEntry in affectedEntries)
                {
                    affectedEntry.CallHistoryEntries.Add(callHistoryentry);
                    _databaseClient.Set(affectedEntry);
                }

                CallHistoryEntryAdded(callHistoryentry);
            }
            catch (Exception) { }
        }
        private void CallHistoryEntryAdded(CallHistoryEntry entry)
        {
            try
            {
                foreach (var crmClient in _clients.Values)
                    crmClient.CallHistoryEntryAdded(entry);

                OnNotificationReceived(new NotificationEventArgs() { Notification = string.Format("New call history entry added: {0} -> {1}", entry.Caller, entry.Callee) });
            }
            catch (Exception) { }
        }