Esempio n. 1
0
        /// <summary>
        /// Get the calls' history.
        /// </summary>
        /// <returns>A list of CallLogs, each one representing a type of calls (All, Missed, ...)</returns>
        public List <CallLog> GetCallsHistory()
        {
            _history = new List <CallLog>();

            if (LinphoneCore.CallLogs != null)
            {
                foreach (LinphoneCallLog log in LinphoneCore.CallLogs)
                {
                    string from = log.From.DisplayName;
                    if (from.Length == 0)
                    {
                        LinphoneAddress fromAddress = log.From;
                        from = String.Format("{0}@{1}", fromAddress.UserName, fromAddress.Domain);
                    }

                    string to = log.To.DisplayName;
                    if (to.Length == 0)
                    {
                        LinphoneAddress toAddress = log.To;
                        to = String.Format("{0}@{1}", toAddress.UserName, toAddress.Domain);
                    }

                    bool    isMissed  = log.Status == LinphoneCallStatus.Missed;
                    long    startDate = log.StartDate;
                    CallLog callLog   = new CallLog(log, from, to, log.Direction == CallDirection.Incoming, isMissed, startDate);
                    _history.Add(callLog);
                }
            }

            return(_history);
        }
Esempio n. 2
0
 /// <summary>
 /// Remove one or many entries from the calls' history.
 /// </summary>
 /// <param name="logsToRemove">A list of CallLog to remove from history</param>
 /// <returns>A list of CallLogs, without the removed entries</returns>
 public void RemoveCallLogs(IEnumerable <CallLog> logsToRemove)
 {
     // When removing log from history, it will be removed from logsToRemove list too.
     // Using foreach causing the app to crash on a InvalidOperationException, so we are using while
     for (int i = 0; i < logsToRemove.Count(); i++)
     {
         CallLog logToRemove = logsToRemove.ElementAt(i);
         LinphoneCore.RemoveCallLog(logToRemove.NativeLog as LinphoneCallLog);
     }
 }
        /// <summary>
        /// Get the calls' history.
        /// </summary>
        /// <returns>A list of CallLogs, each one representing a type of calls (All, Missed, ...)</returns>
        public List<CallLog> GetCallsHistory()
        {
            _history = new List<CallLog>();

            if (LinphoneCore.CallLogs != null)
            {
                foreach (LinphoneCallLog log in LinphoneCore.CallLogs)
                {
                    string from = log.From.DisplayName;
                    if (from.Length == 0)
                    {
                        LinphoneAddress fromAddress = log.From;
                        from = String.Format("{0}@{1}", fromAddress.UserName, fromAddress.Domain);
                    }

                    string to = log.To.DisplayName;
                    if (to.Length == 0)
                    {
                        LinphoneAddress toAddress = log.To;
                        to = String.Format("{0}@{1}", toAddress.UserName, toAddress.Domain);
                    }

                    bool isMissed = log.Status == LinphoneCallStatus.Missed;
                    long startDate = log.StartDate;
                    CallLog callLog = new CallLog(log, from, to, log.Direction == CallDirection.Incoming, isMissed, startDate);
                    _history.Add(callLog);
                }
            }

            return _history;
        }