示例#1
0
        public Form1()
        {
            InitializeComponent();

            bool success;

            mydel = new PrintDebug(PrintDebugMethod);

            /* Create call back */
            callback = new MyCallback(this);
            /* Create and configure the IMS/LTE stack */
            // stack = new SipStack(callback, String.Format("sip:{0}", REALM), String.Format("{0}@{1}", USER, REALM), String.Format("sip:{0}@{1}", USER, REALM));
            stack = new SipStack(callback, String.Format("sip:{0}", REALM), String.Format("{0}@{1}", USER, REALM), String.Format("sip:{0}@{1}", USER, REALM));

            if (!stack.isValid())
            {
                this.textBoxDebug.Text = "Invalid stack";
                return;
            }

            stack.addHeader("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER");
            stack.addHeader("Privacy", "header; id");
            stack.addHeader("P-Access-Network-Info", "ADSL;utran-cell-id-3gpp=00000000");
            stack.addHeader("User-Agent", "IM-client/OMA1.0 doubango/v1.0.0");

            /* set password */
            success = stack.setPassword(PASSWORD);
            /* Sets Proxy-CSCF */
            success = stack.setProxyCSCF(PROXY_CSCF_IP, PROXY_CSCF_PORT, "udp", "ipv4");
            /* Starts the stack */
            success = stack.start();
        }
示例#2
0
        public Form1()
        {
            InitializeComponent();

            bool success;

            mydel = new PrintDebug(PrintDebugMethod);

            /* Create call back */
            callback = new MyCallback(this);
            /* Create and configure the IMS/LTE stack */
            // stack = new SipStack(callback, String.Format("sip:{0}", REALM), String.Format("{0}@{1}", USER, REALM), String.Format("sip:{0}@{1}", USER, REALM));
            stack = new SipStack(callback, String.Format("sip:{0}", REALM), String.Format("{0}@{1}", USER, REALM), String.Format("sip:{0}@{1}", USER, REALM));

            if (!stack.isValid())
            {
                this.textBoxDebug.Text = "Invalid stack";
                return;
            }

            stack.addHeader("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER");
            stack.addHeader("Privacy", "header; id");
            stack.addHeader("P-Access-Network-Info", "ADSL;utran-cell-id-3gpp=00000000");
            stack.addHeader("User-Agent", "IM-client/OMA1.0 doubango/v1.0.0");

            /* set password */
            success = stack.setPassword(PASSWORD);
            /* Sets Proxy-CSCF */
            success = stack.setProxyCSCF(PROXY_CSCF_IP, PROXY_CSCF_PORT, "udp", "ipv4");
            /* Starts the stack */
            success = stack.start();
        }
示例#3
0
        public static ISoftPhone CreateSoftPhone(IPEndPoint listeningPoint)
        {
            var sipStack          = new SipStack();
            var sipListeningPoint = sipStack.CreateUdpListeningPoint(listeningPoint);
            var provider          = sipStack.CreateSipProvider(sipListeningPoint);

            return(new SoftPhone(provider, sipStack.CreateMessageFactory(), sipStack.CreateHeaderFactory(), sipStack.CreateAddressFactory(), new SoftPhoneStateProvider(), new TimerFactory(), sipListeningPoint));
        }
示例#4
0
 public Win32ServiceManager()
 {
     this.multiInstance = System.IO.File.Exists(Win32ServiceManager.MULI_INSTANCE_FILE);
     if (!initialized)
     {
         SipStack.initialize();
         initialized = true;
     }
 }
示例#5
0
        private void _btnStart_Click(object sender, EventArgs e)
        {
            var ipEndPoint = SipUtil.ParseIpEndPoint(_txtLocalIPAddress.Text);

            _stack = new SipStack();
            var listeningPoint = _stack.CreateUdpListeningPoint(ipEndPoint);
            _sipProvider = _stack.CreateSipProvider(listeningPoint);
            _sipProvider.AddSipListener(this);
            _stack.Start();
            _tmrDiagnostics.Start();
        }
示例#6
0
文件: Server.cs 项目: goupviet/Hallo
        private void _btnStart_Click(object sender, EventArgs e)
        {
            var ipEndPoint = SipUtil.ParseIpEndPoint(_txtLocalIPAddress.Text);

            _stack = new SipStack();
            var listeningPoint = _stack.CreateUdpListeningPoint(ipEndPoint);

            _sipProvider = _stack.CreateSipProvider(listeningPoint);
            _sipProvider.AddSipListener(this);
            _stack.Start();
            _tmrDiagnostics.Start();
        }
示例#7
0
 protected override void  Given()
 {
     _contextSource = new FakeSipContextSource();
     _sipStack      = new SipStack();
     _provider      = new SipProvider(_sipStack, _contextSource);
     _inviteRequest = CreateInviteRequest();
     BeforeCreateInviteTransaction();
     _inviteTransaction = _provider.CreateClientTransaction(_inviteRequest).As <SipInviteClientTransaction>();
     _dialog            = _provider.CreateClientDialog(_inviteTransaction);
     _inviteTransaction.SendRequest();
     GivenOverride();
 }
        protected override void When()
        {
            var f = new SipStack();
            var messageFacttory = f.CreateMessageFactory();
            var headerFactory   = f.CreateHeaderFactory();

            foreach (string message in _messages)
            {
                var parserContext = new SipParserContext(messageFacttory, headerFactory);
                parserContext.ParseCompleted += (s, e) => _subjectFoldedRequest.Add((SipRequest)e.Message);
                parserContext.Parse(SipFormatter.FormatToBytes(message));
            }
        }
        void InitializeSecurity()
        {
            new SRtpMode[] {
                new SRtpMode(tmedia_srtp_mode_t.tmedia_srtp_mode_none),
                new SRtpMode(tmedia_srtp_mode_t.tmedia_srtp_mode_optional),
                new SRtpMode(tmedia_srtp_mode_t.tmedia_srtp_mode_mandatory)
            }.ToList().ForEach(x => this.comboBoxSRTPModes.Items.Add(x));

            new SRtpType[] {
                new SRtpType(tmedia_srtp_type_t.tmedia_srtp_type_sdes),
                new SRtpType(tmedia_srtp_type_t.tmedia_srtp_type_dtls),
                new SRtpType(tmedia_srtp_type_t.tmedia_srtp_type_sdes_dtls)
            }.ToList().ForEach(x => this.comboBoxSRTPTypes.Items.Add(x));

            checkBoxIPSecSecAgreeEnabled.IsEnabled = SipStack.isIPSecSupported();
        }
        protected override void Given()
        {
            _packet1 = new FakeUdpPacket("1", DefaultRemoteEp);
            _packet2 = new FakeUdpPacket("1", DefaultRemoteEp);

            var fakePackets = new Stack <FakeUdpPacket>();

            fakePackets.Push(_packet1);
            fakePackets.Push(_packet2);
            _fakeSocketImpl = new FakeSocketImpl(fakePackets);

            _messageprocessor = new Mock <IUdpMessageProcessor>();

            _sipStack  = new SipStack();
            _udpServer = new UdpServer(_sipStack, _listeningPoint, _fakeSocketImpl, _messageprocessor.Object);
        }
示例#11
0
        public void Setup()
        {
            _ipAddress =
                Dns.GetHostAddresses(string.Empty).Where(a => a.AddressFamily == AddressFamily.InterNetwork).First();

            /*create stack*/
            _stack = new SipStack();

            /*create sipproviders*/
            _senderProvider   = _stack.CreateSipProvider(_stack.CreateUdpListeningPoint(_ipAddress, 12345));
            _receiverProvider = _stack.CreateSipProvider(_stack.CreateUdpListeningPoint(_ipAddress, 23456));

            /*start both providers*/
            _senderProvider.Start();
            _receiverProvider.Start();
        }
示例#12
0
        private void InitializeCodecs()
        {
            codecs = new List <Codec>(new Codec[] {
                new Codec("PCMA", "PCMA (8 KHz)", tdav_codec_id_t.tdav_codec_id_pcma),
                new Codec("PCMU", "PCMU (8 KHz)", tdav_codec_id_t.tdav_codec_id_pcmu),
                new Codec("GSM", "GSM (8 KHz)", tdav_codec_id_t.tdav_codec_id_gsm),
            });
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_amr_nb_oa))
            {
                codecs.Add(new Codec("AMR-NB-OA", "AMR Narrow Band Octet Aligned (8 KHz)", tdav_codec_id_t.tdav_codec_id_amr_nb_oa));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_amr_nb_be))
            {
                codecs.Add(new Codec("AMR-NB-BE", "AMR Narrow Band Bandwidth Efficient (8 KHz)", tdav_codec_id_t.tdav_codec_id_amr_nb_be));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_ilbc))
            {
                codecs.Add(new Codec("iLBC", "internet Low Bitrate Codec (8 KHz)", tdav_codec_id_t.tdav_codec_id_ilbc));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_speex_nb))
            {
                codecs.Add(new Codec("Speex-NB", "Speex Narrow Band (8 KHz)", tdav_codec_id_t.tdav_codec_id_speex_nb));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_g729ab))
            {
                codecs.Add(new Codec("G.729", "G729 Annex A/B (8 KHz)", tdav_codec_id_t.tdav_codec_id_g729ab));
            }

            codecs.AddRange(new Codec[]
            {
                new Codec("MP4V-ES", "MPEG-4 Part 2", tdav_codec_id_t.tdav_codec_id_mp4ves_es),
                new Codec("Theora", "Theora", tdav_codec_id_t.tdav_codec_id_theora),
                new Codec("H264-BP10", "H.264 Base Profile 1.0", tdav_codec_id_t.tdav_codec_id_h264_bp10),
                new Codec("H264-BP20", "H.264 Base Profile 2.0", tdav_codec_id_t.tdav_codec_id_h264_bp20),
                new Codec("H264-BP30", "H.264 Base Profile 3.0", tdav_codec_id_t.tdav_codec_id_h264_bp30),
                new Codec("H.263", "H.263", tdav_codec_id_t.tdav_codec_id_h263),
                new Codec("H.263+", "H.263-1998", tdav_codec_id_t.tdav_codec_id_h263p),
                new Codec("H.263++", "H.263-2000", tdav_codec_id_t.tdav_codec_id_h263pp),
            });

            this.listBoxCodecs.ItemsSource = codecs;
            ICollectionView view = CollectionViewSource.GetDefaultView(this.listBoxCodecs.ItemsSource);

            view.GroupDescriptions.Add(new PropertyGroupDescription("CodecType"));
        }
示例#13
0
        public void Start()
        {
            if (_configuration == null)
            {
                throw new InvalidOperationException("The server is not configured.");
            }

            _stack = new SipStack();
            _stack.MaxWorkerThreads = _configuration.MaxThreadPoolSize;
            _stack.MinWorkerThreads = _configuration.MinThreadPoolSize;
            _stack.EnableThreadPoolPerformanceCounters = _configuration.EnableThreadPoolPerformanceCounters;
            var listeningPoint = _stack.CreateUdpListeningPoint(_ipEndPoint);

            _provider  = (SipProvider)_stack.CreateSipProvider(listeningPoint);
            _listener  = new SipServerListener();
            _registrar = InitializeRegistrar();
            _listener.AddRequestHandler(_registrar);
            _provider.AddSipListener(_listener);
            //_stack.Start();
        }
示例#14
0
        private void _btnStartStop_Click(object sender, EventArgs e)
        {
            if (!_isStarted)
            {
                var ipEndPoint    = SipUtil.ParseIpEndPoint(Configuration.BindIpEndPoint);
                var outboundProxy = SipUtil.ParseIpEndPoint(Configuration.OutboundProxyIpEndPoint);
                SipStack = new SipStack();
                var listeningPoint = SipStack.CreateUdpListeningPoint(ipEndPoint);
                SipStack.MaxWorkerThreads = Configuration.MaxThreadPoolSize;
                SipStack.MinWorkerThreads = Configuration.MinThreadPoolSize;
                SipStack.OutBoundProxy    = outboundProxy;
                SipStack.EnableThreadPoolPerformanceCounters = Configuration.EnableThreadPoolPerformanceCounters;
                //SipStack.IsStateFull = Configuration.IsStateFull;
                SipProvider     = (SipProvider)SipStack.CreateSipProvider(listeningPoint);
                MainSipListener = new SipPipeLineListener(this);
                SipProvider.AddSipListener(MainSipListener);
                SipProvider.AddExceptionHandler(this);
                SipProvider.Start();


                HeaderFactory  = SipStack.CreateHeaderFactory();
                MessageFactory = SipStack.CreateMessageFactory();
                AddressFactory = SipStack.CreateAddressFactory();

                ExecuteActionHelper.ExecuteAction(delegate()
                {
                    FormsManager.OpenForm(typeof(LogForm), null);
                });

                _lblIpAddress.Text = string.Format("IP:{0}", ipEndPoint.ToString());
            }
            else
            {
                SipProvider.Stop();
            }

            _isStarted             = !_isStarted;
            _btnStartStop.Text     = _isStarted ? "Stop" : "Start";
            _grbNavigation.Enabled = _isStarted;
        }
示例#15
0
        public static bool RegisterExt(string sExt)
        {
            try
            {
                IpAddress ip;
                int       iPort    = 5060;
                String    sRealm   = "10.0.0.8";
                String    sFromUrl = "<sip:" + sExt + "@" + sRealm + ":" + iPort.ToString() + ">"; // FROM
                String    toUrl    = "<sip:" + "1000@" + sRealm + ":" + iPort.ToString() + ">";    // TO

                if (!SipStack.IsInit())
                {
                    SipStack.Init();
                }

                ip = IpAddress.GetLocalHostAddress();

                // Having the following line enabled creates the compiler error:
                SipProvider sipProvider = new SipProvider(ip.ToString(), iPort);

                /*
                 * Error	11	Error while compiling onReceivedMessage
                 * (Lorg/zoolu/sip/provider/Transport;Lorg/zoolu/sip/message/Message;)V
                 * in
                 * org/zoolu/sip/provider/SipProvider:
                 * Unsupported type org/zoolu/sip/header/ViaHeader
                 * dot42SipTester1
                 */

                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#16
0
        /*
         * const String REALM = "sip2sip.info";
         * const String USER = "******";
         * const String PASSWORD = "******";
         * const String PROXY_CSCF_IP = "192.168.0.13";
         * const uint PROXY_CSCF_PORT = 5081;
         */

        static void Main(string[] args)
        {
            Boolean success;

            /* Create callbacks */
            sipCallback  = new MySipCallback();
            msrpCallback = new MyMsrpCallback();
            //sipDebugCallback = new MySipDebugCallback();

            /* Create consumers */
            audioConsumer = new MyProxyAudioConsumer();
            videoConsumer = new MyProxyVideoConsumer(tmedia_chroma_t.tmedia_rgb565le);
            /* Create producers */
            audioProducer = new MyProxyAudioProducer();
            videoProducer = new MyProxyVideoProducer(tmedia_chroma_t.tmedia_rgb24);


            /* Create and configure the IMS/LTE stack */
            sipStack = new SipStack(sipCallback, String.Format("sip:{0}", REALM), /*String.Format("{0}@{1}", USER, REALM)*/ USER, String.Format("sip:{0}@{1}", USER, REALM));
            sipStack.setDebugCallback(sipDebugCallback);
            sipStack.addHeader("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER");
            sipStack.addHeader("Privacy", "header; id");
            sipStack.addHeader("P-Access-Network-Info", "ADSL;utran-cell-id-3gpp=00000000");
            sipStack.addHeader("User-Agent", "IM-client/OMA1.0 doubango/v1.0.0");

            /* Do it after stack creation */
            ProxyAudioConsumer.registerPlugin();
            ProxyAudioProducer.registerPlugin();
            ProxyVideoProducer.registerPlugin();
            ProxyVideoConsumer.registerPlugin();


            /* Sets Proxy-CSCF */
            success = sipStack.setProxyCSCF(PROXY_CSCF_IP, PROXY_CSCF_PORT, "udp", "ipv4");
            // STUN
            //sipStack.setSTUNServer("numb.viagenie.ca", 3478);
            //sipStack.setSTUNCred("login", "password");
            // DNS Discovery
            //sipStack.setDnsDiscovery(true);
            /* Starts the stack */
            success = sipStack.start();

            /* Set Password */
            sipStack.setPassword(PASSWORD);

            /* Early IMS */
            sipStack.setEarlyIMS(true);
            /* AMF and Operator Id */
            sipStack.setAMF("0x00FF");
            sipStack.setOperatorId("0xFF0000000000000000000000000000FF");

            // SigComp
            //sipStack.addSigCompCompartment("urn:uuid:2e5fdc76-00be-4314-8202-1116fa82a876");

            //sipStack.setAoR("127.0.0.1", 1234);

            audioConsumer.setActivate(true);
            audioProducer.setActivate(true);
            videoProducer.setActivate(true);
            videoConsumer.setActivate(true);


            /* Send REGISTER */
            regSession = new RegistrationSession(sipStack);
            regSession.addCaps("+g.oma.sip-im");
            regSession.addCaps("+g.3gpp.smsip");
            regSession.addCaps("language", "\"en,fr\"");
            regSession.setExpires(350);
            //regSession.addSigCompCompartment("urn:uuid:2e5fdc76-00be-4314-8202-1116fa82a876");
            regSession.register_();

            Console.ReadLine();


            ActionConfig actionConfig = new ActionConfig();

            actionConfig
            .setMediaString(twrap_media_type_t.twrap_media_msrp, "file-path", "C:\\Users\\root\\Desktop\\Debian.iso")
            //.setMediaString(twrap_media_type_t.twrap_media_msrp, "file-path", "C:\\avatar.png")
            .setMediaString(twrap_media_type_t.twrap_media_msrp, "accept-types", "application/octet-stream")
            .setMediaString(twrap_media_type_t.twrap_media_msrp, "file-disposition", "attachment")
            .setMediaString(twrap_media_type_t.twrap_media_msrp, "file-icon", "cid:[email protected]")
            .setMediaInt(twrap_media_type_t.twrap_media_msrp, "chunck-duration", 500);
            MsrpSession msrpSession = new MsrpSession(sipStack, msrpCallback);

            msrpSession.callMsrp(String.Format("sip:johndoe@{0}", REALM), actionConfig);
            actionConfig.Dispose();

            Console.ReadLine();
            msrpSession.hangup();
            Console.ReadLine();

            //RPMessage rpMessage = SMSEncoder.encodeDeliver(25, SMSC, "123456789", "salut comment tu vas?\n hdjdhfjfhfjhr, ");
            //if (rpMessage != null)
            //{
            //    uint pay_len = rpMessage.getPayloadLength();
            //    if (pay_len > 0)
            //    {
            //        byte[] pay = new byte[pay_len];
            //        rpMessage.getPayload(pay, (uint)pay.Length);

            //        MessagingSession m = new MessagingSession(sipStack);
            //        m.setToUri(String.Format("sip:{0}@{1}", SMSC, REALM));
            //        m.addHeader("Content-Type", "application/vnd.3gpp.sms");
            //        m.addHeader("Content-Transfer-Encoding", "binary");
            //        m.addHeader("P-Asserted-Identity", String.Format("sip:{0}@{1}", USER, REALM));

            //        m.send(pay, (uint)pay.Length);

            //        m.Dispose();
            //    }
            //    rpMessage.Dispose();
            //}

            //Console.ReadLine();



            //String sipUri = sipStack.dnsENUM("E2U+SIP", "+1-800-555-5555", "e164.org");
            //ushort port = 0;
            //String ipAddress = sipStack.dnsNaptrSrv("sip2sip.info", "SIP+D2U", out port);
            //String ipAddress = sipStack.dnsSrv("_sip._udp.sip2sip.info", out port);

            /*ActionConfig actionConfig = new ActionConfig();
             * actionConfig.setMediaInt(twrap_media_type_t.twrap_media_audiovideo, "bandwidth-level", (int)tmedia_bandwidth_level_t.tmedia_bl_medium);
             * callSession = new CallSession(sipStack);
             * callSession.set100rel(true);
             * callSession.setSessionTimer(90, "uas");
             * callSession.setQoS(tmedia_qos_stype_t.tmedia_qos_stype_segmented, tmedia_qos_strength_t.tmedia_qos_strength_optional);
             * callSession.callVideo(String.Format("sip:bob@{0}", REALM), actionConfig);
             * actionConfig.Dispose();*/

            //tcb = new TimerCallback(OnTimer);
            //timer = new Timer(tcb, new AutoResetEvent(false), 0, 20);

            //Console.ReadLine();
            //callSession.sendDTMF(1);
            //Console.ReadLine();
            //callSession.sendDTMF(2);
            //Console.ReadLine();
            //callSession.sendDTMF(11);
            //Console.ReadLine();

            ////Console.ReadLine();
            ////callSession.hold();
            ////Console.ReadLine();
            ////callSession.resume();
            //Console.ReadLine();
            //callSession.hangup();


            ////Thread.Sleep(2000);

            /*RPData rpdata = SMSEncoder.encodeSubmit(25, "+33160188661", "+33660188661", "salut");
             * if (rpdata != null)
             * {
             *  uint pay_len = rpdata.getPayloadLength();
             *  if (pay_len > 0)
             *  {
             *      byte[] pay = new byte[pay_len];
             *      rpdata.getPayload(pay, (uint)pay.Length);
             *
             *      MessagingSession m = new MessagingSession(sipStack);
             *      m.setToUri(String.Format("sip:+33160188661@{0}", REALM));
             *      m.addHeader("Content-Type", "application/vnd.3gpp.sms");
             *      m.addHeader("Transfer-Encoding", "binary");
             *      m.send(pay, (uint)pay.Length);
             *
             *      m.Dispose();
             *  }
             *  rpdata.Dispose();
             * }
             *
             * Console.ReadLine();*/

            ///* Send SUBSCRIBE(reg) */
            //subSession = new SubscriptionSession(sipStack);
            //subSession.addHeader("Event", "reg");
            //subSession.addHeader("Accept", "application/reginfo+xml");
            //subSession.addHeader("Allow-Events", "refer, presence, presence.winfo, xcap-diff, conference");
            //subSession.setExpires(35);
            ////subSession.Subscribe();

            ///* Send MESSAGE */
            //MessagingSession msg = new MessagingSession(sipStack);
            //byte [] content = Encoding.ASCII.GetBytes("Hello World");
            //msg.setToUri(String.Format("sip:{0}@{1}", "alice", REALM));
            //msg.addHeader("NS", "imdn <urn:ietf:params:imdn>");
            //msg.addHeader("imdn.Message-ID", "34jk324j");
            //msg.addHeader("DateTime", "2006-04-04T12:16:49-05:00");
            //msg.addHeader("imdn.Disposition-Notification", "positive-delivery, negative-delivery");
            //msg.addHeader("Content-Type", "text/plain");
            ////msg.Send(content, (uint)content.Length);

            ///* Send OPTIONS */
            //OptionsSession opt = new OptionsSession(sipStack);
            //opt.setToUri(String.Format("sip:{0}@{1}", "hacking_the_aor", REALM));
            //opt.Send();

            Console.ReadLine();

            sipStack.stop();
        }
示例#17
0
 public void SetPreferences(MySipStack.Preferences preferences)
 {
     this.preferences = preferences;
     this.wrappedStack.setIMPI(preferences.impi);
     this.wrappedStack.setIMPU(preferences.impu);
     this.wrappedStack.setPassword(preferences.password);
     this.wrappedStack.setRealm(preferences.realm);
     this.wrappedStack.setLocalIP(preferences.local_ip);
     this.wrappedStack.setLocalPort((ushort)preferences.local_port);
     this.wrappedStack.setAMF(preferences.akaAmf);
     this.wrappedStack.setOperatorId(preferences.akaOpID);
     SipStack.setCodecs((tmedia_codec_id_t)preferences.codec);
     if (preferences.nattUseStun)
     {
         MySipStack.LOG.Debug("STUN=yes");
         this.wrappedStack.setSTUNEnabled(true);
         if (preferences.nattStunDisc)
         {
             string domain = preferences.realm.Substring(preferences.realm.IndexOf(':') + 1);
             ushort port   = 0;
             string server = this.wrappedStack.dnsSrv(string.Format("_stun._udp.{0}", domain), out port);
             if (server == null)
             {
                 MySipStack.LOG.Error("STUN discovery has failed");
             }
             MySipStack.LOG.Debug(string.Format("STUN1 - server={0} and port={1}", server, port));
             this.wrappedStack.setSTUNServer(server, port);
         }
         else
         {
             MySipStack.LOG.Info(string.Format("STUN2 - server={0} and port={1}", preferences.stunServer, preferences.stunPort));
             this.wrappedStack.setSTUNServer(preferences.stunServer, (ushort)preferences.stunPort);
         }
     }
     else
     {
         MySipStack.LOG.Debug("STUN=no");
         this.wrappedStack.setSTUNEnabled(false);
     }
     this.wrappedStack.setProxyCSCF(preferences.pcscf_host, (ushort)preferences.pcscf_port, preferences.transport, preferences.ipversion);
     this.wrappedStack.setSSLCertificates(preferences.privKey, preferences.pubKey, preferences.caKey);
     if (preferences.ipsec_secagree)
     {
         this.wrappedStack.setIPSecParameters(preferences.algo, preferences.ealgo, preferences.mode, preferences.proto);
         this.wrappedStack.setIPSecSecAgree(true);
     }
     else
     {
         this.wrappedStack.setIPSecSecAgree(false);
     }
     this.wrappedStack.setDnsDiscovery(preferences.dnsDiscovery);
     this.wrappedStack.setEarlyIMS(preferences.earlyIms);
     if (preferences.enableSigComp)
     {
         this.compId = string.Format("urn:uuid:{0}", System.Guid.NewGuid().ToString());
     }
     else
     {
         this.compId = null;
     }
 }
示例#18
0
 public MySipStack(SipCallback callback, MySipStack.Preferences preferences)
 {
     this.wrappedStack = new SipStack(callback, preferences.realm, preferences.impi, preferences.impu);
     this.wrappedStack.addHeader("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER");
     this.SetPreferences(preferences);
 }
示例#19
0
        private void InitializeCodecs()
        {
            codecs = new List <Codec>(new Codec[] {
                new Codec("G.722", "G.722 (16 KHz)", tdav_codec_id_t.tdav_codec_id_g722),
                new Codec("PCMA", "PCMA (8 KHz)", tdav_codec_id_t.tdav_codec_id_pcma),
                new Codec("PCMU", "PCMU (8 KHz)", tdav_codec_id_t.tdav_codec_id_pcmu),
            });
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_gsm))
            {
                codecs.Add(new Codec("GSM", "GSM (8 KHz)", tdav_codec_id_t.tdav_codec_id_gsm));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_amr_nb_oa))
            {
                codecs.Add(new Codec("AMR-NB-OA", "AMR Narrow Band Octet Aligned (8 KHz)", tdav_codec_id_t.tdav_codec_id_amr_nb_oa));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_amr_nb_be))
            {
                codecs.Add(new Codec("AMR-NB-BE", "AMR Narrow Band Bandwidth Efficient (8 KHz)", tdav_codec_id_t.tdav_codec_id_amr_nb_be));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_ilbc))
            {
                codecs.Add(new Codec("iLBC", "internet Low Bitrate Codec (8 KHz)", tdav_codec_id_t.tdav_codec_id_ilbc));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_speex_nb))
            {
                codecs.Add(new Codec("Speex-NB", "Speex (8 KHz)", tdav_codec_id_t.tdav_codec_id_speex_nb));
                codecs.Add(new Codec("Speex-WB", "Speex (16 KHz)", tdav_codec_id_t.tdav_codec_id_speex_wb));
                codecs.Add(new Codec("Speex-UWB", "Speex (32 KHz)", tdav_codec_id_t.tdav_codec_id_speex_uwb));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_g729ab))
            {
                codecs.Add(new Codec("G.729", "G729 Annex A/B (8 KHz)", tdav_codec_id_t.tdav_codec_id_g729ab));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_opus))
            {
                codecs.Add(new Codec("OPUS", "Opus (8 - 48 KHz)", tdav_codec_id_t.tdav_codec_id_opus));
            }

            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_h264_bp))
            {
                codecs.Add(new Codec("H264-BP", "H.264 Base Profile", tdav_codec_id_t.tdav_codec_id_h264_bp));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_h264_mp))
            {
                codecs.Add(new Codec("H264-MP", "H.264 Main Profile", tdav_codec_id_t.tdav_codec_id_h264_mp));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_vp8))
            {
                codecs.Add(new Codec("VP8", "Google's VP8", tdav_codec_id_t.tdav_codec_id_vp8));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_mp4ves_es))
            {
                codecs.Add(new Codec("MP4V-ES", "MPEG-4 Part 2", tdav_codec_id_t.tdav_codec_id_mp4ves_es));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_theora))
            {
                codecs.Add(new Codec("Theora", "Theora", tdav_codec_id_t.tdav_codec_id_theora));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_h263))
            {
                codecs.Add(new Codec("H.263", "H.263", tdav_codec_id_t.tdav_codec_id_h263));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_h263p))
            {
                codecs.Add(new Codec("H.263-1998", "H.263-1998", tdav_codec_id_t.tdav_codec_id_h263p));
            }
            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_h263pp))
            {
                codecs.Add(new Codec("H.263-2000", "H.263-2000", tdav_codec_id_t.tdav_codec_id_h263pp));
            }

            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_red))
            {
                codecs.Add(new Codec("RED", "Redundant data", tdav_codec_id_t.tdav_codec_id_red));
            }

            if (SipStack.isCodecSupported(tdav_codec_id_t.tdav_codec_id_t140))
            {
                codecs.Add(new Codec("T.140", "Realtime text", tdav_codec_id_t.tdav_codec_id_t140));
            }

            this.listBoxCodecs.ItemsSource = codecs;
            ICollectionView view = CollectionViewSource.GetDefaultView(this.listBoxCodecs.ItemsSource);

            view.GroupDescriptions.Add(new PropertyGroupDescription("CodecType"));
        }