Example #1
1
        public Call(IPEndPoint Address)
        {
            UdpSender = new UdpClient();
            UdpSender.Connect(Address);
            this.Address = Address;

            _encoder = new SpeexEncoder(BandMode.Wide);
            SpeexProvider = new JitterBufferWaveProvider();

            SoundOut = new WaveOutEvent();
            SoundOut.Init(SpeexProvider);
            SoundOut.Play();
        }
Example #2
0
        public VoiceCallCore()
        {
            UDPPort = new Random().Next(25050, 26050);

            Any = new IPEndPoint(IPAddress.Any, UDPPort);

            SoundOutProvider = new JitterBufferWaveProvider();

            SoundOut = new WaveOutEvent();
            SoundOut.Init(SoundOutProvider);
            SoundOut.Play();

            try
            {
                SoundIn                    = new WaveInEvent();
                SoundIn.WaveFormat         = new WaveFormat(encoder.FrameSize * 50, 16, 1);
                SoundIn.DataAvailable     += SoundIn_DataAvailable;
                SoundIn.BufferMilliseconds = 40;
                //SoundIn.StartRecording();
            }
            catch { SoundInEnabled = false; }

            UdpListener = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            //UdpListener.SendTo(new byte[] { 0x0 }, new IPEndPoint(IPAddress.Broadcast, UDPPort));
            UdpListener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            UdpListener.Bind(new IPEndPoint(IPAddress.Any, UDPPort));

            UdpListener.BeginReceiveFrom(TmpBuffer, 0, 20480, SocketFlags.None, ref Any, DoReceiveFrom, null);
        }
Example #3
0
        public NewCall(string CallID)
        {
            this.CallID = CallID;
            UdpConnection = new UdpClient();
            UdpConnection.Connect("209.141.53.112", 25000);

            _encoder = new SpeexEncoder(BandMode.Wide);
            SpeexProvider = new JitterBufferWaveProvider();

            SoundOut = new WaveOutEvent();
            SoundOut.Init(SpeexProvider);
            SoundOut.Play();
        }
Example #4
0
        public NewCall(string CallID)
        {
            this.CallID   = CallID;
            UdpConnection = new UdpClient();
            UdpConnection.Connect("209.141.53.112", 25000);

            _encoder      = new SpeexEncoder(BandMode.Wide);
            SpeexProvider = new JitterBufferWaveProvider();

            SoundOut = new WaveOutEvent();
            SoundOut.Init(SpeexProvider);
            SoundOut.Play();
        }
Example #5
0
        public Call(IPEndPoint Address)
        {
            UdpSender = new UdpClient();
            UdpSender.Connect(Address);
            this.Address = Address;

            _encoder      = new SpeexEncoder(BandMode.Wide);
            SpeexProvider = new JitterBufferWaveProvider();



            SoundOut = new WaveOutEvent();
            SoundOut.Init(SpeexProvider);
            SoundOut.Play();
        }
Example #6
0
        public VoiceCallCore()
        {
            UDPPort = new Random().Next(25050, 26050);

            Any = new IPEndPoint(IPAddress.Any, UDPPort);

            SoundOutProvider = new JitterBufferWaveProvider();

            SoundOut = new WaveOutEvent();
            SoundOut.Init(SoundOutProvider);
            SoundOut.Play();

            try
            {
                SoundIn = new WaveInEvent();
                SoundIn.WaveFormat = new WaveFormat(encoder.FrameSize * 50, 16, 1);
                SoundIn.DataAvailable += SoundIn_DataAvailable;
                SoundIn.BufferMilliseconds = 40;
                //SoundIn.StartRecording();
            }
            catch { SoundInEnabled = false; }

            UdpListener = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            //UdpListener.SendTo(new byte[] { 0x0 }, new IPEndPoint(IPAddress.Broadcast, UDPPort));
            UdpListener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            UdpListener.Bind(new IPEndPoint(IPAddress.Any, UDPPort));

            UdpListener.BeginReceiveFrom(TmpBuffer, 0, 20480, SocketFlags.None, ref Any, DoReceiveFrom, null);
        }