Beispiel #1
0
 void MakeCall(bool bWithVideo)
 {
     if (!String.IsNullOrEmpty(textBlockNumber.Text))
     {
         NavigationService.Navigate(new Uri(NavigationUri.BuildMakeCallUriString("/CallPage.xaml", textBlockNumber.Text, bWithVideo), UriKind.Relative));
     }
 }
Beispiel #2
0
        void mNativeEventsListener_onAVCallEvent(object sender, SipAVCallEventArgs e)
        {
            this.Dispatcher.BeginInvoke((System.Threading.ThreadStart) delegate
            {
                mViewModel.CallState = e.State;

                if ((e.State == SipAVCallState.Incoming || e.State == SipAVCallState.InCall) && !(mViewModel is CallStatusViewModel))
                {
                    SipService sipService = BackgroundProcessController.Instance.SipService;
                    if (sipService != null)
                    {
                        SipAVCall avCall = sipService.SipActiveAVCall;
                        if (avCall != null && avCall.UriRemote != null)
                        {
                            mViewModel.Page.NavigationService.Navigate(new Uri(NavigationUri.BuildReceiveCallUriString("/CallPage.xaml", avCall.UriRemote.getUserName(), avCall.WithVideo), UriKind.Relative));
                            return;
                        }
                    }
                }

                if (mViewModel is CallStatusViewModel)
                {
                    (mViewModel as CallStatusViewModel).Update();
                }

                if (e.SipCode > 299)
                {
                    mViewModel.CallStateText = e.Description;
                }
            });
        }
Beispiel #3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SipService sipService = BackgroundProcessController.Instance.SipService;

            // Register for the Obscured/Unobscured events
            PhoneApplicationFrame rootFrame = ((App)Application.Current).RootFrame;

            rootFrame.Obscured   += ((CallStatusViewModel)this.ViewModel).RootFrame_Obscured;
            rootFrame.Unobscured += ((CallStatusViewModel)this.ViewModel).RootFrame_Unobscured;

            NavigationUriCall navigationUri = NavigationUri.Build(e.Uri) as NavigationUriCall;

            // navigationUri could be null if the app was put on the background
            Debug.Assert(navigationUri != null || sipService.SipActiveAVCall != null);
            if (navigationUri != null)
            {
                switch (navigationUri.Type)
                {
                case NavigationUriType.MakeCall:
                {
                    Debug.Assert(!String.IsNullOrEmpty(navigationUri.RemoteParty));

                    base.ViewModel.RemotePartyDisplayName = base.ViewModel.RemotePartyNumber = navigationUri.RemoteParty;
                    rtSipUri toUri    = BackgroundProcessController.Instance.rtSipUriNew(UriUtils.GetValidSipUri(navigationUri.RemoteParty), navigationUri.RemoteParty);
                    bool     bSuccess = navigationUri.WithVideo
                                ? (rtServiceManager.Instance.SipService.MakeCallAudioVideo(toUri, null) != null)
                                : (rtServiceManager.Instance.SipService.MakeCallAudio(toUri, null) != null);
                    if (!bSuccess)
                    {
                        base.ViewModel.CallState = SipAVCallState.Terminated;
                    }
                    break;
                }

                case NavigationUriType.ReceiveCall:
                {
                    break;
                }

                default:
                {
                    Debug.Assert(false);
                    break;
                }
                }
            }

            // Re-bind MediaElements explictly, so video will play after app has been resumed
            bigHead.SetBinding(MediaElement.SourceProperty, new System.Windows.Data.Binding("BigHeadPreviewUri"));
            littleHead.SetBinding(MediaElement.SourceProperty, new System.Windows.Data.Binding("LittleHeadPreviewUri"));

            ((CallStatusViewModel)this.ViewModel).Update();
        }