| | |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentLinkedQueue; |
| | | |
| | | /** |
| | | * 目录查询的回复 |
| | | */ |
| | | @Component |
| | | public class CatalogResponseMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| | | |
| | |
| | | // 回复200 OK |
| | | try { |
| | | responseAck(evt, Response.OK); |
| | | } catch (SipException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (InvalidArgumentException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (!taskQueueHandlerRun) { |
| | | taskQueueHandlerRun = true; |
| | | taskExecutor.execute(()-> { |
| | | while (!taskQueue.isEmpty()) { |
| | | HandlerCatchData take = taskQueue.poll(); |
| | | String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + take.getDevice().getDeviceId(); |
| | | Element rootElement = null; |
| | | try { |
| | | rootElement = getRootElement(take.getEvt(), take.getDevice().getCharset()); |
| | | Element rootElement = getRootElement(take.getEvt(), take.getDevice().getCharset()); |
| | | Element deviceListElement = rootElement.element("DeviceList"); |
| | | Element sumNumElement = rootElement.element("SumNum"); |
| | | Element snElement = rootElement.element("SN"); |
| | |
| | | e.printStackTrace(); |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } finally { |
| | | taskQueueHandlerRun = false; |
| | | }); |
| | | |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } catch (SipException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (InvalidArgumentException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } finally { |
| | | taskQueueHandlerRun = false; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) { |