예제 #1
0
        public bool Stop()
        {
            if (!_isStarted)
            {
                return(true);
            }

            if (OnCallHistoryEvent != null)
            {
                var eargs = new VATRPCallEventArgs(HistoryEventTypes.Reset);
                OnCallHistoryEvent(null, eargs);
            }

            AllCallsEvents.Clear();
            if (manager.LinphoneService != null)
            {
                manager.LinphoneService.OnLinphoneCallLogUpdatedEvent -= LinphoneCallEventAdded;
            }
            if (ServiceStopped != null)
            {
                ServiceStopped(this, EventArgs.Empty);
            }
            _isStarted = false;
            return(true);
        }
예제 #2
0
        public void ClearCallsItems()
        {
            if (manager.LinphoneService.LinphoneCore != IntPtr.Zero)
            {
                LinphoneAPI.linphone_core_clear_call_logs(manager.LinphoneService.LinphoneCore);

                if (OnCallHistoryEvent != null)
                {
                    var eargs = new VATRPCallEventArgs(HistoryEventTypes.Reset);
                    OnCallHistoryEvent(null, eargs);
                }
            }
        }
예제 #3
0
        private void OnHistoryCallEvent(object o, VATRPCallEventArgs e)
        {
            if (this.Dispatcher.Thread != System.Threading.Thread.CurrentThread)
            {
                this.Dispatcher.BeginInvoke((Action)(() => this.OnHistoryCallEvent(o, e)));
                return;
            }

            var callEvent = o as VATRPCallEvent;

            _populatingCalls = true;

            switch (e.historyEventType)
            {
            case HistoryEventTypes.Add:
                if (callEvent != null)
                {
                    AddNewCallEvent(callEvent);
                }
                break;

            case HistoryEventTypes.Load:
                this.AllCallsInfoLabel.Content    = "Loading...";
                this.MissedCallsInfoLabel.Content = "Loading...";
                lstCallsBox.Visibility            = Visibility.Collapsed;
                lstMissedCallsBox.Visibility      = Visibility.Collapsed;
                LoadAllCalls();
                PopulateCalls(CallsTab.SelectedIndex == 0);
                _populatingCalls = false;
                break;

            case HistoryEventTypes.Reset:
                CallsList.Clear();
                MissedCallsList.Clear();
                this.lstCallsBox.Visibility       = Visibility.Collapsed;
                this.lstMissedCallsBox.Visibility = Visibility.Collapsed;
                this.AllCallsInfoLabel.Content    = "Entry list is empty";
                this.MissedCallsInfoLabel.Content = "Entry list is empty";
                break;

            case HistoryEventTypes.Delete:
                if (callEvent != null)
                {
                    DeleteCallEvent(callEvent);
                }
                break;
            }
        }
예제 #4
0
        private void LinphoneCallEventAdded(IntPtr lc, IntPtr callPtr)
        {
            if (callPtr == IntPtr.Zero || lc == IntPtr.Zero)
            {
                return;
            }

            var callEvent = ParseLinphoneCallLog(callPtr);

            if (callEvent != null)
            {
                if (OnCallHistoryEvent != null)
                {
                    var eargs = new VATRPCallEventArgs(HistoryEventTypes.Add);
                    OnCallHistoryEvent(callEvent, eargs);
                }
            }
        }
예제 #5
0
        public void LoadLinphoneCallEvents()
        {
            if (manager.LinphoneService.LinphoneCore == IntPtr.Zero)
            {
                return;
            }


            AllCallsEvents.Clear();
            isLoadingCalls = true;
            IntPtr callsListPtr = LinphoneAPI.linphone_core_get_call_logs(manager.LinphoneService.LinphoneCore);



            if (callsListPtr != IntPtr.Zero)
            {
                MSList curStruct;

                do
                {
                    curStruct.next = IntPtr.Zero;
                    curStruct.prev = IntPtr.Zero;
                    curStruct.data = IntPtr.Zero;

                    curStruct = (MSList)Marshal.PtrToStructure(callsListPtr, typeof(MSList));
                    if (curStruct.data != IntPtr.Zero)
                    {
                        var callevent = ParseLinphoneCallLog(curStruct.data);
                        AllCallsEvents.Add(callevent);
                    }
                    callsListPtr = curStruct.next;
                } while (curStruct.next != IntPtr.Zero);
            }
            isLoadingCalls = false;
            if (OnCallHistoryEvent != null)
            {
                var eargs = new VATRPCallEventArgs(HistoryEventTypes.Load);
                OnCallHistoryEvent(null, eargs);
            }
        }