| | |
| | | |
| | | CallIdHeader callIdHeader = sipSender.getNewCallIdHeader(parentPlatform.getDeviceIp(),parentPlatform.getTransport()); |
| | | |
| | | Request request = headerProviderPlatformProvider.createMessageRequest( |
| | | parentPlatform, |
| | | keepaliveXml.toString(), |
| | | SipUtils.getNewFromTag(), |
| | | SipUtils.getNewViaTag(), |
| | | callIdHeader); |
| | | sipSender.transmitRequest(parentPlatform.getDeviceIp(), request, errorEvent, okEvent); |
| | | Request request = headerProviderPlatformProvider.createMessageRequest( |
| | | parentPlatform, |
| | | keepaliveXml.toString(), |
| | | SipUtils.getNewFromTag(), |
| | | SipUtils.getNewViaTag(), |
| | | callIdHeader); |
| | | sipSender.transmitRequest(parentPlatform.getDeviceIp(), request, errorEvent, okEvent); |
| | | return callIdHeader.getCallId(); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException { |
| | | if (parentPlatform == null || deviceChannels == null || deviceChannels.size() == 0 || subscribeInfo == null) { |
| | | if (parentPlatform == null || deviceChannels == null || deviceChannels.isEmpty() || subscribeInfo == null) { |
| | | return; |
| | | } |
| | | if (index == null) { |
| | |
| | | Integer finalIndex = index; |
| | | String catalogXmlContent = getCatalogXmlContentForCatalogAddOrUpdate(parentPlatform, channels, |
| | | deviceChannels.size(), type, subscribeInfo); |
| | | logger.info("[发送NOTIFY通知]类型: {},发送数量: {}", type, channels.size()); |
| | | sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> { |
| | | logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); |
| | | }, (eventResult -> { |
| | |
| | | |
| | | SIPRequest notifyRequest = headerProviderPlatformProvider.createNotifyRequest(parentPlatform, catalogXmlContent, subscribeInfo); |
| | | |
| | | sipSender.transmitRequest(parentPlatform.getDeviceIp(), notifyRequest); |
| | | sipSender.transmitRequest(parentPlatform.getDeviceIp(), notifyRequest, errorEvent, okEvent); |
| | | } |
| | | |
| | | private String getCatalogXmlContentForCatalogAddOrUpdate(ParentPlatform parentPlatform, List<DeviceChannel> channels, int sumNum, String type, SubscribeInfo subscribeInfo) { |
| | |
| | | .append("<CmdType>Catalog</CmdType>\r\n") |
| | | .append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n") |
| | | .append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n") |
| | | .append("<SumNum>1</SumNum>\r\n") |
| | | .append("<SumNum>"+ sumNum +"</SumNum>\r\n") |
| | | .append("<DeviceList Num=\"" + channels.size() + "\">\r\n"); |
| | | if (channels.size() > 0) { |
| | | if (!channels.isEmpty()) { |
| | | for (DeviceChannel channel : channels) { |
| | | if (parentPlatform.getServerGBId().equals(channel.getParentId())) { |
| | | channel.setParentId(parentPlatform.getDeviceGBId()); |