/// <summary>
        /// Disposes the softphone engine. Hangs up calls, unregisters phone lines and disposes the media handlers.
        /// </summary>
        public void Dispose()
        {
            lock (_sync)
            {
                PhoneCalls.Clear();

                // unregister phone lines
                foreach (IPhoneLine line in PhoneLines)
                {
                    if (line.RegState == RegState.RegistrationSucceeded)
                    {
                        softPhone.UnregisterPhoneLine(line);
                    }

                    UnsubscribeFromLineEvents(line);
                    line.Dispose();
                }
                PhoneLines.Clear();

                // dispose media
                MediaHandlers.Dispose();

                // close softphone
                softPhone.Close();
            }
        }
Example #2
0
        /// <summary>
        /// Disposes the selected phone line and removes it from the collection.
        /// </summary>
        public void RemovePhoneLine()
        {
            if (SelectedLine == null)
            {
                return;
            }

            ClosePhoneLine(SelectedLine);
            PhoneLines.Remove(SelectedLine);
        }
Example #3
0
        /// <summary>
        /// Creates a phone line and adds it to the collection.
        /// </summary>
        public IPhoneLine AddPhoneLine(SIPAccount account, Ozeki.Network.TransportType transportType, NatConfiguration natConfig, SRTPMode srtpMode)
        {
            IPhoneLine line = softPhone.CreatePhoneLine(account, natConfig, transportType, srtpMode);

            SubscribeToLineEvents(line);

            // add to collection
            PhoneLines.Add(line);

            return(line);
        }
        /// <summary>
        /// Creates a phone line and adds it to the collection.
        /// </summary>
        public IPhoneLine AddPhoneLine(PhoneLineConfiguration config)
        {
            IPhoneLine line = softPhone.CreatePhoneLine(config);

            SubscribeToLineEvents(line);

            // add to collection
            PhoneLines.Add(line);

            return(line);
        }
Example #5
0
        /// <summary>
        /// Updates the line picker view with information from the calling info singleton.
        /// </summary>
        public void UpdateLinePickerInfo()
        {
            //Color Values to be used during update
            Color NoColor            = Color.FromArgb(0, 0, 0, 0);
            Color DisplayAccentColor = (Color)Application.Current.Resources["SystemAccentColor"];

            //Show and setup multiSIM components
            if (CallingInfo.CallingInfoInstance.NoOfLines >= 2)
            {
                //Show Multi line controls
                VisibilityState = "Visible";

                //Set Phone Lines
                if (CallingInfo.CallingInfoInstance.AllPhoneLines != null)
                {
                    PhoneLines.Clear();

                    //Sortphonelines by slot index to ensure cosistent line picker order
                    var phoneLinesQuery = from phoneLine in CallingInfo.CallingInfoInstance.AllPhoneLines.Values
                                          orderby((PhoneLine)phoneLine).CellularDetails.SimSlotIndex
                                          select phoneLine;

                    foreach (var line in phoneLinesQuery)
                    {
                        Color ActualLineColor = line.DisplayColor;
                        if (ActualLineColor == NoColor)
                        {
                            ActualLineColor = DisplayAccentColor;
                        }
                        SolidColorBrush ActualLineColorBrush = new SolidColorBrush(ActualLineColor);
                        PhoneLines.Add(new PhoneLinePickerItem(line.DisplayName, line.Id, ActualLineColorBrush));
                    }
                }
            }

            //Set branding info
            DisplayName = CallingInfo.CallingInfoInstance.CurrentDisplayName;
            Color DisplayColorObject = CallingInfo.CallingInfoInstance.CurrentDisplayColor;

            //Set Accent highlight based on display
            if (DisplayColorObject == NoColor)
            {
                DisplayColorObject = DisplayAccentColor;
            }
            DisplayAccentBrush = new SolidColorBrush(DisplayColorObject);
        }