/// <summary>
        /// Update the state of the various audio route buttons
        /// </summary>
        private void UpdateAudioRouteButtonStates(BackEnd.CallAudioRoute audioRoute)
        {
            if (base.CallStatus == BackEnd.CallStatus.InProgress)
            {
                // There is a call in progress - update the audio routing button states

                // First, get the available audio devices
                BackEnd.CallAudioRoute availableDevices = BackgroundProcessController.Instance.CallController.AvailableAudioRoutes;

                // Enable/disable buttons based on availability
                this.IsEarpieceButtonEnabled  = ((availableDevices & BackEnd.CallAudioRoute.Earpiece) != BackEnd.CallAudioRoute.None);
                this.IsSpeakerButtonEnabled   = ((availableDevices & BackEnd.CallAudioRoute.Speakerphone) != BackEnd.CallAudioRoute.None);
                this.IsBluetoothButtonEnabled = ((availableDevices & BackEnd.CallAudioRoute.Bluetooth) != BackEnd.CallAudioRoute.None);

                // Set the border color of the currently selected audio route button
                Brush accentBrush = (Brush)App.Current.Resources["PhoneAccentBrush"];
                Brush borderBrush = (Brush)App.Current.Resources["PhoneForegroundBrush"];
                this.EarpieceButtonBorder  = (audioRoute == BackEnd.CallAudioRoute.Earpiece) ? accentBrush : borderBrush;
                this.SpeakerButtonBorder   = (audioRoute == BackEnd.CallAudioRoute.Speakerphone) ? accentBrush : borderBrush;
                this.BluetoothButtonBorder = (audioRoute == BackEnd.CallAudioRoute.Bluetooth) ? accentBrush : borderBrush;
            }
            else
            {
                // There is no call in progress - disable audio routing buttons
                this.DisableAllAudioRouteButtons();
            }
        }
        /// <summary>
        /// The camera location value has changed
        /// </summary>


        /// <summary>
        /// The audio route or the available audio devices has changed
        /// </summary>
        /// <param name="newRoute"></param>
        public override void OnCallAudioRouteChanged(BackEnd.CallAudioRoute newRoute)
        {
            // Note, this call is called on some IPC thread - dispatch to the UI thread before doing anything else
            this.Page.Dispatcher.BeginInvoke(() =>
            {
                // Call the base class method first
                base.OnCallAudioRouteChanged(newRoute);

                // Now, update the states of the various audio route buttons
                this.UpdateAudioRouteButtonStates(newRoute);
            });
        }
        /// <summary>
        /// Change the audio route for this call
        /// </summary>
        public void SetAudioRoute(BackEnd.CallAudioRoute newRoute)
        {
            // We must have a call at this point
            Debug.Assert(base.CallStatus != BackEnd.CallStatus.None);

            // Change the audio route, if it has changed
            if (newRoute != BackgroundProcessController.Instance.CallController.AudioRoute)
            {
                BackgroundProcessController.Instance.CallController.AudioRoute = newRoute;

                // Disable all audio route buttons, so the user doesn't press them again and again.
                // The buttons will get re-enabled if required when the audio route changes.
                this.DisableAllAudioRouteButtons();
            }
        }