private DeviceCatalogResp createCatalogResp(Gateway gw, Platform plat) { DeviceCatalogResp resp = new DeviceCatalogResp(); resp.DeviceID = gw.SipNumber; DeviceItemsCollection items = buildDeviceItems(gw.SipNumber, plat); if (items != null) { resp.Items = items; } return(resp); }
public void ResponseToPlatform(Platform plat) { Gateway gw = InfoService.Instance.CurrentGateway; string localIp = IPAddressHelper.GetLocalIp(); SIP_Stack stack = SipProxyWrapper.Instance.Stack; DeviceCatalogResp resp = createCatalogResp(gw, plat); string body = SerializeHelper.Instance.Serialize(resp); SIP_t_NameAddress from = new SIP_t_NameAddress($"sip:{gw.SipNumber}@{localIp}:{gw.Port}"); SIP_t_NameAddress to = new SIP_t_NameAddress($"sip:{plat.SipNumber}@{plat.Ip}:{plat.Port}"); SIP_Request message = stack.CreateRequest(SIP_Methods.MESSAGE, to, from); message.ContentType = "Application/MANSCDP+xml"; message.Data = MyEncoder.Encoder.GetBytes(body); SIP_RequestSender send = stack.CreateRequestSender(message); send.Start(); }