| | |
| | | |
| | | private final String method = "MESSAGE"; |
| | | |
| | | private static Map<String, IMessageHandler> messageHandlerMap = new ConcurrentHashMap<>(); |
| | | private static final Map<String, IMessageHandler> messageHandlerMap = new ConcurrentHashMap<>(); |
| | | |
| | | @Autowired |
| | | private SIPProcessorObserver sipProcessorObserver; |
| | |
| | | deviceNotFoundEvent.setCallId(callIdHeader.getCallId()); |
| | | SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(deviceNotFoundEvent); |
| | | sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()).response(eventResult); |
| | | }; |
| | | } |
| | | }else { |
| | | Element rootElement = null; |
| | | Element rootElement; |
| | | try { |
| | | rootElement = getRootElement(evt); |
| | | if (rootElement == null) { |
| | | logger.error("处理MESSAGE请求 未获取到消息体{}", evt.getRequest()); |
| | | responseAck(request, Response.BAD_REQUEST, "content is null"); |
| | | return; |
| | | } |
| | | } catch (DocumentException e) { |
| | | logger.warn("解析XML消息内容异常", e); |
| | | // 不存在则回复404 |
| | | responseAck(request, Response.BAD_REQUEST, e.getMessage()); |
| | | } |
| | | String name = rootElement.getName(); |
| | | IMessageHandler messageHandler = messageHandlerMap.get(name); |
| | |
| | | // 不存在则回复415 |
| | | responseAck(request, Response.UNSUPPORTED_MEDIA_TYPE, "Unsupported message type, must Control/Notify/Query/Response"); |
| | | } |
| | | } catch (DocumentException e) { |
| | | logger.warn("解析XML消息内容异常", e); |
| | | // 不存在则回复404 |
| | | responseAck(request, Response.BAD_REQUEST, e.getMessage()); |
| | | } |
| | | } |
| | | } catch (SipException e) { |
| | | logger.warn("SIP 回复错误", e); |