Ejemplo n.º 1
0
        public void Request_Basic()
        {
            SipBasicCore    core = null;
            SipCoreSettings settings;
            SipRequest      request;
            SipResult       result;
            string          serviceUri;

            try
            {
                settings          = new SipCoreSettings();
                settings.UserName = "******";
                settings.Password = "******";

                serviceUri = "sip:" + settings.TransportSettings[0].ExternalBinding.ToString();

                core = new SipBasicCore(settings);
                core.RequestReceived += new SipRequestDelegate(OnRequest);
                core.Start();

                request = new SipRequest(SipMethod.Info, serviceUri, null);
                request.AddHeader("Test", "OK");
                result = core.Request(request);

                Assert.AreEqual(SipStatus.OK, result.Status);
            }
            finally
            {
                if (core != null)
                {
                    core.Stop();
                }
            }
        }
Ejemplo n.º 2
0
        private void StartCores()
        {
            SipCoreSettings settings;
            IPAddress       address;
            IPAddress       subnet;

            Helper.GetNetworkInfo(out address, out subnet);
            core1Uri = (SipUri)string.Format("sip:{0}:7725;transport=udp", address);
            core2Uri = (SipUri)string.Format("sip:{0}:7726;transport=udp", address);

            settings = new SipCoreSettings();
            settings.TransportSettings = new SipTransportSettings[] { new SipTransportSettings(SipTransportType.UDP, new NetworkBinding(core1Uri.Host, core1Uri.Port), 0) };
            core1 = new SipBasicCore(settings);
            core1.SetTraceMode(traceMode);

            settings = new SipCoreSettings();
            settings.TransportSettings = new SipTransportSettings[] { new SipTransportSettings(SipTransportType.UDP, new NetworkBinding(core2Uri.Host, core2Uri.Port), 0) };
            core2 = new SipBasicCore(settings);
            core2.SetTraceMode(traceMode);

            try
            {
                core1.Start();
                core2.Start();
            }
            catch
            {
                core1.Stop();
                core2.Stop();

                throw;
            }
        }
Ejemplo n.º 3
0
        public void Register_Vitelity()
        {
            Assert.Inconclusive("Manual Test: Comment this out to perform this test.");

            // Attempt a registration against the Vitelty.com SIP trunking service.

            SipBasicCore    core = null;
            SipCoreSettings settings;

            try
            {
                // These settings are hardcoded for my Vitelity.com account
                // and my home network.  This test also assumes that the router
                // is forwarding UDP port 5060 packets to the test computer.

                settings = new SipCoreSettings();
                settings.LocalContact = "sip:jslill@" + Dns.GetHostEntry("www.lilltek.com").AddressList.IPv4Only()[0].ToString() + ":5060";
                settings.UserName     = "******";
                settings.Password     = "******";

                core = new SipBasicCore(settings);
                core.Start();

                core.StartAutoRegistration("sip:sip4.vitelity.net", "sip:[email protected]");
                Assert.IsTrue(core.AutoRegistration);
                Assert.IsTrue(core.IsRegistered);

                // Sleep a while and watch for registration traffic on NetMon.

                Thread.Sleep(5 * 1000 * 60);

                core.StopAutoRegistration();
                Assert.IsFalse(core.AutoRegistration);
                Assert.IsFalse(core.IsRegistered);
            }
            finally
            {
                if (core != null)
                {
                    core.Stop();
                }
            }
        }
Ejemplo n.º 4
0
        public void Invite_Call_Vitelity()
        {
            Assert.Inconclusive("Manual Test: Comment this out to perform this test.");

            // Attempt an outbound call against the Vitelity.com service

            SipBasicCore    core   = null;
            SipDialog       dialog = null;
            SipCoreSettings settings;
            SipRequest      request;
            string          sdp;

            try
            {
                // These settings are hardcoded for my Vitelity.com account
                // and my home network.  This test also assumes that the router
                // is forwarding UDP port 5060 packets to the test computer.

                settings = new SipCoreSettings();
                settings.LocalContact = "sip:jslill@" + Dns.GetHostEntry("www.lilltek.com").AddressList.IPv4Only()[0].ToString() + ":5060";
                settings.UserName     = "******";
                settings.Password     = "******";

                core = new SipBasicCore(settings);
                core.Start();

                //core.StartAutoRegistration("sip:sip4.vitelity.net","sip:[email protected]");
                //Assert.IsTrue(core.AutoRegistration);
                //Assert.IsTrue(core.IsRegistered);

                // Make a call to my cellphone

                request = new SipRequest(SipMethod.Invite, "sip:[email protected]", null);
                request.SetHeader(SipHeader.To, new SipContactValue("sip:[email protected]"));
                request.SetHeader(SipHeader.From, new SipContactValue("sip:[email protected]"));
                request.SetHeader(SipHeader.ContentType, SipHelper.SdpMimeType);

                sdp =
                    @"v=0
o=- 0 2 IN IP4 192.168.1.200
s=LillTek SIP
c=IN IP4 192.168.1.200
t=0 0
m=audio 29318 RTP/AVP 107 119 100 106 0 105 98 8 101
a=alt:1 1 : AEnD+akt rmmTsDRh 192.168.1.200 29318
a=fmtp:101 0-15
a=rtpmap:107 BV32/16000
a=rtpmap:119 BV32-FEC/16000
a=rtpmap:100 SPEEX/16000
a=rtpmap:106 SPEEX-FEC/16000
a=rtpmap:105 SPEEX-FEC/8000
a=rtpmap:98 iLBC/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
";
                request.Contents = Helper.ToUTF8(sdp);

                dialog = core.CreateDialog(request, (SipContactValue)settings.LocalContact, null);

                Thread.Sleep(30000);    // Wait 30 seconds to monitor the packets via NetMon

                //core.StopAutoRegistration();
            }
            finally
            {
                if (core != null)
                {
                    core.Stop();
                }
            }
        }