Example #1
0
        void XMPPClient_OnNewConversationItem(RosterItem item, bool bReceived, TextMessage msg)
        {
            if (msg.Message.IndexOf("Call from ") == 0 && this.hack == false)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() => ButtonStartVoice.Content = "Accept Voice Call");
                string ipen = msg.Message.Substring(10);
                int    pos  = ipen.IndexOf(':');
                me        = new MediaPart(AudioStream, null);
                me.remote = new IPEndPoint(IPAddress.Parse(ipen.Substring(0, pos)), Convert.ToInt32(ipen.Substring(pos + 1)));
            }
            else if (msg.Message.IndexOf("Call ok") == 0 && this.hack == true)
            {
                string ipen = msg.Message.Substring(8);
                int    pos  = ipen.IndexOf(':');
                me.remote = new IPEndPoint(IPAddress.Parse(ipen.Substring(0, pos)), Convert.ToInt32(ipen.Substring(pos + 1)));
                Deployment.Current.Dispatcher.BeginInvoke(() => { ButtonStartVoice.Content = "End Voice Call"; });
                Datastore.Add(me.localEp, "localEp");
                Datastore.Add(me.stream, "stream");
                Datastore.Add(me.remote, "remoteEp");
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                          this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative)));
            }



            Dispatcher.BeginInvoke(new System.Net.XMPP.XMPPClient.DelegateNewConversationItem(DoOnNewConversationItem), item, bReceived, msg);
        }
Example #2
0
 private void ButtonStartVoice_Click(object sender, RoutedEventArgs e)
 {
     /*    me = new MediaPart(AudioStream, null);
      *  me.InitCall();
      *  Datastore.Add(me.localEp, "localEp");
      *  Datastore.Add(me.stream, "stream");
      *  Datastore.Add(me.localEp,"remoteEp");
      *  this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative));
      */
     this.hack = false;
     if (ButtonStartVoice.Content.ToString() == "Start Voice Call")
     {
         this.hack = true;
         me        = new MediaPart(AudioStream, null);
         me.InitCall();
         SendMessage("Call from " + me.localEp.ToString());
         this.Focus();
     }
     else if (ButtonStartVoice.Content.ToString() == "Accept Voice Call")
     {
         me.InitCall();
         this.Focus();
         Datastore.Add(me.localEp, "localEp");
         Datastore.Add(me.stream, "stream");
         Datastore.Add(me.remote, "remoteEp");
         Deployment.Current.Dispatcher.BeginInvoke(() => { ButtonStartVoice.Content = "End Voice Call"; });
         SendMessage("Call ok " + me.localEp.ToString());
         this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative));
     }
 }
Example #3
0
        public TestPAge()
        {
            InitializeComponent();
            mediaElement1.Stop();
            AudioStream = this.mediaElement1;

            /*var _Timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(33) };
             * _Timer.Tick += (s, arg) =>
             * {
             *  FrameworkDispatcher.Update();
             *
             * };
             * _Timer.Start();
             */

            stream  = (RTPAudioStream)Datastore.Find("stream");
            localEp = (IPEndPoint)Datastore.Find("localEp");
            remote  = (IPEndPoint)Datastore.Find("remoteEp");
            Datastore.Remove("stream");
            Datastore.Remove("localEp");
            Datastore.Remove("remoteEp");


            //FindMyIP();
            //InitializeStream();
            //StartCall();
        }