示例#1
0
        public override int OnRegistrationEvent(RegistrationEvent e)
        {
            short code = e.getCode();
            tsip_register_event_type_t type = e.getType();
            String text;

            RegistrationSession session = e.getSession();

            switch (type)
            {
            case tsip_register_event_type_t.tsip_i_register:
            case tsip_register_event_type_t.tsip_ao_register:
            case tsip_register_event_type_t.tsip_i_unregister:
            case tsip_register_event_type_t.tsip_ao_unregister:
                break;
            }

            text = String.Format("OnRegistrationChanged() ==> {0}:{1}", code, e.getPhrase());

            if (this.form.InvokeRequired)
            {
                this.form.Invoke(this.form.mydel, new object[] { text });
            }

            return(0);
        }
示例#2
0
 public override void Setup()
 {
     base.Setup();
     _fixture.Customize(new AccountCustomization());
     _account = _fixture.CreateAnonymous <Mock <Account> >();
     _session = _fixture.CreateAnonymous <RegistrationSession>();
 }
 public MyRegistrationSession(MySipStack sipStack) : base(sipStack)
 {
     this.session = new RegistrationSession(sipStack.WrappedStack);
     base.init();
     base.SigCompId = sipStack.SigCompId;
     this.session.addHeader("Ptt-Extension", "pttregister");
 }
        public IActionResult SetRegistration(string id)
        {
            Int32.TryParse(id, out int cid);
            var session = new RegistrationSession(HttpContext.Session);

            session.SetId(cid);
            return(RedirectToAction("Registrations"));
        }
示例#5
0
 private void buttonRegister_Click(object sender, EventArgs e)
 {
     if (this.regSession == null)
     {
         this.regSession = new RegistrationSession(stack);
         this.regSession.addCaps("+g.oma.sip-im");
         this.regSession.addCaps("+g.3gpp.smsip");
         this.regSession.addCaps("language", "\"en,fr\"");
         this.regSession.setExpires(30);
     }
     this.regSession.Register();
 }
        public IActionResult Registrations()
        {
            var session = new RegistrationSession(HttpContext.Session);
            var cid     = session.GetId();

            if (cid == -1)
            {
                return(RedirectToAction("GetCustomer"));
            }

            var customer      = unitOfWork.CustomerRepository.Get(cid);
            var products      = unitOfWork.ProductRepository.Get(orderBy: p => p.OrderBy(q => q.Name)).ToList();
            var registrations = unitOfWork.RegistrationRepository.Get().Where(r => r.CustomerId == cid).ToList();

            var viewModel = new RegistrationViewModel {
                Customer = customer, Products = products, Registrations = registrations
            };

            return(View(viewModel));
        }
        public IActionResult AddRegistration(int id)
        {
            var    session = new RegistrationSession(HttpContext.Session);
            var    cid     = session.GetId();
            string name    = unitOfWork.ProductRepository.Get(id).Name;

            if (ModelState.IsValid)
            {
                // check if product is already registered
                if (unitOfWork.RegistrationRepository.Get().Where(r => r.ProductId == id).Where(r => r.CustomerId == cid).ToList().Count() != 0)
                {
                    TempData["message"] = name + " already registered";
                }
                else
                {
                    unitOfWork.RegistrationRepository.Insert(new Registration {
                        CustomerId = cid, ProductId = id
                    });
                    unitOfWork.RegistrationRepository.Save();
                    TempData["message"] = name + " Added!";
                }
            }
            return(RedirectToAction("Registrations"));
        }
示例#8
0
        public override int OnRegistrationEvent(RegistrationEvent e)
        {
            short code = e.getCode();
            tsip_register_event_type_t type    = e.getType();
            RegistrationSession        session = e.getSession();
            SipMessage message = e.getSipMessage();

            if (message != null)
            {
                Console.WriteLine("call-id={0}", message.getSipHeaderValue("call-id"));
                //byte[] bytes = message.getContent();
            }

            switch (type)
            {
            case tsip_register_event_type_t.tsip_ao_register:
            case tsip_register_event_type_t.tsip_ao_unregister:
                break;
            }

            Console.WriteLine("OnRegistrationChanged() ==> {0}:{1}", code, e.getPhrase());

            return(0);
        }
        public MyRegistrationSession(MySipStack sipStack)
            : base(sipStack)
        {
            this.session = new RegistrationSession(sipStack);

            // commons
            base.init();

            // SigComp
            base.SigCompId = sipStack.SigCompId;

            /* support for 3GPP SMS over IP */
            this.session.addCaps("+g.3gpp.smsip");

            /* support for OMA Large message (as per OMA SIMPLE IM v1) */
            this.session.addCaps("+g.oma.sip-im.large-message");

            /* 3GPP TS 24.173
             *
             * 5.1 IMS communication service identifier
             * URN used to define the ICSI for the IMS Multimedia Telephony Communication Service: urn:urn-7:3gpp-service.ims.icsi.mmtel.
             * The URN is registered at http://www.3gpp.com/Uniform-Resource-Name-URN-list.html.
             * Summary of the URN: This URN indicates that the device supports the IMS Multimedia Telephony Communication Service.
             *
             * 5.2 Session control procedures
             * The multimedia telephony participant shall include the g.3gpp. icsi-ref feature tag equal to the ICSI value defined
             * in subclause 5.1 in the Contact header field in initial requests and responses as described in 3GPP TS 24.229 [13].
             */
            /* GSMA RCS phase 3 - 3.2 Registration */
            this.session.addCaps("audio");
            this.session.addCaps("+g.3gpp.icsi-ref", "\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"");
            this.session.addCaps("+g.3gpp.icsi-ref", "\"urn%3Aurn-7%3A3gpp-application.ims.iari.gsma-vs\"");
            // In addition, in RCS Release 3 the BA Client when used as a primary device will indicate the capability to receive SMS
            // messages over IMS by registering the SMS over IP feature tag in accordance with [24.341]:
            this.session.addCaps("+g.3gpp.cs-voice");
        }
 public override void Teardown()
 {
     base.Teardown();
     _account = null;
     _session = null;
 }
 public override void Setup()
 {
     base.Setup();
     _account = _fixture.Freeze <Mock <IAccountInternal> >();
     _session = _fixture.CreateAnonymous <RegistrationSession>();
 }
示例#12
0
 private void buttonRegister_Click(object sender, EventArgs e)
 {
     if (this.regSession == null)
     {
         this.regSession = new RegistrationSession(stack);
         this.regSession.addCaps("+g.oma.sip-im");
         this.regSession.addCaps("+g.3gpp.smsip");
         this.regSession.addCaps("language", "\"en,fr\"");
         this.regSession.setExpires(30);
     }
     this.regSession.Register();
 }
示例#13
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();
        }