Beispiel #1
0
        private DeviceCatalogNotify createCatalog(Gateway gw, Platform plat)
        {
            DeviceCatalogNotify notify = new DeviceCatalogNotify();

            notify.DeviceID = gw.SipNumber;
            DeviceItemsCollection items = buildDeviceItems(gw.SipNumber, plat);

            if (items != null)
            {
                notify.Items = items;
            }
            return(notify);
        }
Beispiel #2
0
        public void NotifyToPlatform(string platId)
        {
            Gateway   gw      = InfoService.Instance.CurrentGateway;
            Platform  pf      = InfoService.Instance.GetPlatform(platId);
            string    localIp = IPAddressHelper.GetLocalIp();
            SIP_Stack stack   = SipProxyWrapper.Instance.Stack;

            DeviceCatalogNotify dcd = createCatalog(gw, pf);
            string body             = SerializeHelper.Instance.Serialize(dcd);

            SIP_t_NameAddress from = new SIP_t_NameAddress($"sip:{gw.SipNumber}@{localIp}:{gw.Port}");
            SIP_t_NameAddress to   = new SIP_t_NameAddress($"sip:{pf.SipNumber}@{pf.Ip}:{pf.Port}");

            SIP_Request message = stack.CreateRequest(SIP_Methods.NOTIFY, to, from);

            message.ContentType = "Application/MANSCDP+xml";
            message.Data        = MyEncoder.Encoder.GetBytes(body);
            SIP_RequestSender send = stack.CreateRequestSender(message);

            send.Start();
        }