Esempio n. 1
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;
            }
        }
Esempio n. 2
0
        public void SipMssGateway_Basic()
        {
            Assert.Inconclusive("Manual Test: Comment this out to perform this test.");

            SipBasicCore  core    = null;
            SipMssGateway gateway = null;
            int           quit;

            try
            {
                Config.SetConfig(@"
&section Core

    LocalContact     = sip:jslill@$(ip-address):8899
    AutoAuthenticate = yes
    UserName         = jslill
    Password         = q0jsrd7y
    Diagnostics      = yes

    &section Transport[0]

        Type    = UDP
        Binding = ANY:8899

    &endsection

    &section Transport[1]

        Type    = TCP
        Binding = ANY:8899

    &endsection

&endsection

&section Gateway

    SpeechServerUri = sip:$(ip-address):5060
    TrunkUri        = sip:sip4.vitelity.net
    Register[0]     = sip:[email protected]

&endsection

".Replace('&', '#'));

                core = new SipBasicCore(SipCoreSettings.LoadConfig("Core"));
                core.SetTraceMode(traceMode);

                gateway = new SipMssGateway(core, SipMssGatewaySettings.LoadConfig("Gateway"));
                gateway.Start();

                quit = 0;
                while (quit == 0)
                {
                    quit = 0;
                    Thread.Sleep(500);  // Break here and manually set quit=1 to terminate the test
                }
            }
            finally
            {
                Config.SetConfig(null);

                if (gateway != null)
                {
                    gateway.Stop();
                }

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