Restcomm sip-servlets不转发INVITE请求

时间:2017-02-26 14:52:14

标签: restcomm mobicents-sip-servlets sip-servlet

我正在尝试使用Mobicents / Restcomm sip-servlet做一个简单的B2BUA应用程序。首先,它应该收到一个INVITE,更改R-URI并发送新请求 - 基本上是呼叫转发。

我遇到的问题是,当使用带域名的URI而不是IP时,我得到以下错误:

        Unexpected exception while processing message INVITE sip:dispatcher@kam.ims SIP/2.0
    ...........
    org.mobicents.servlet.sip.core.DispatcherException: An unexpected IO exception occured while routing the following initial request INVITE sip:dispatcher@kam.ims SIP/2.0
    at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher$InitialDispatchTask.dispatch(InitialRequestDispatcher.java:753) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at org.mobicents.servlet.sip.core.dispatchers.DispatchTask.dispatchAndHandleExceptions(DispatchTask.java:58) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher.dispatchInsideContainer(InitialRequestDispatcher.java:451) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher.dispatchMessage(InitialRequestDispatcher.java:306) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl.processRequest(SipApplicationDispatcherImpl.java:841) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:230) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.SipProviderImpl.handleEvent(SipProviderImpl.java:185) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.DialogFilter.processRequest(DialogFilter.java:1324) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.SIPServerTransactionImpl.processRequest(SIPServerTransactionImpl.java:807) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.UDPMessageChannel.processMessage(UDPMessageChannel.java:560) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.UDPMessageChannel.processIncomingDataPacket(UDPMessageChannel.java:512) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.UDPMessageChannel.run(UDPMessageChannel.java:317) [jain-sip-ri-1.2.242.jar:1.2.242]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_95]
    Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) [rt.jar:1.7.0_95]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744) [rt.jar:1.7.0_95]
    at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:117) [rt.jar:1.7.0_95]
    at gov.nist.javax.sip.stack.NioTcpMessageProcessor.initiateConnection(NioTcpMessageProcessor.java:96) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.NioTcpMessageProcessor.blockingConnect(NioTcpMessageProcessor.java:109) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.NIOHandler.createOrReuseSocket(NIOHandler.java:408) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.NioTcpMessageChannel.<init>(NioTcpMessageChannel.java:192) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.NioTcpMessageProcessor.createMessageChannel(NioTcpMessageProcessor.java:394) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.stack.SIPTransactionStack.createMessageChannel(SIPTransactionStack.java:1716) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.SipProviderImpl.createClientTransaction(SipProviderImpl.java:389) [jain-sip-ri-1.2.242.jar:1.2.242]
    at gov.nist.javax.sip.SipProviderImpl.getNewClientTransaction(SipProviderImpl.java:455) [jain-sip-ri-1.2.242.jar:1.2.242]
    at org.mobicents.servlet.sip.message.SipServletRequestImpl.send(SipServletRequestImpl.java:1213) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at org.mobicents.servlet.sip.message.SipServletRequestImpl.send(SipServletRequestImpl.java:1009) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at com.mycompany.app.FunctionalAddressingServlet.doInvite(FunctionalAddressingServlet.java:100)
    at javax.servlet.sip.SipServlet.doRequest(SipServlet.java:231) [sip-servlets-spec-3.1.633.jar:3.1.633]
    at javax.servlet.sip.SipServlet.service(SipServlet.java:328) [sip-servlets-spec-3.1.633.jar:3.1.633]
    at org.mobicents.servlet.sip.core.dispatchers.MessageDispatcher.callServlet(MessageDispatcher.java:369) [sip-servlets-impl-3.1.633.jar:3.1.633]
    at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher$InitialDispatchTask.dispatch(InitialRequestDispatcher.java:746) [sip-servlets-impl-3.1.633.jar:3.1.633]
    ... 12 more

这是doInvite()

protected void doInvite(SipServletRequest request) throws ServletException, IOException {       
    B2buaHelper b2buaHelper = request.getB2buaHelper();
    SipSession session = request.getSession();
    Map<String, List<String>> headerMap = new HashMap<String, List<String>>();
    SipFactory sipFactory = (SipFactory) getServletContext().getAttribute(SIP_FACTORY);
    SipURI destination = (SipURI) sipFactory.createURI("sip:bob@kam.ims");
    SipServletRequest forkedRequest = b2buaHelper.createRequest(request, true, headerMap);
    forkedRequest.setRequestURI(destination);
    forkedRequest.getSession().setAttribute("originalRequest", request);
    forkedRequest.send();   
    }

可能是应用程序无法解析域名吗?如果是这样,是否应该在JBOSS中进行一些特定的配置?

任何提示都会受到赞赏,提前谢谢!

编辑:

将gov.nist的日志记录级别提高到INFO后,可以看到:

18:52:07,921 INFO  [gov.nist.javax.sip.stack.NIOHandler] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) Problem connecting /10.0.0.102 5061 /10.0.0.102
18:52:07,922 INFO  [gov.nist.javax.sip.stack.NIOHandler] (Mobicents-SIP-Servlets-UDPMessageChannelThread-4) Problem OpeningConn:  inAddr 10.0.0.102 port = 5061 retry false

我现在不明白5061取自哪里。 请求的来源是:

18:52:07,946 INFO  [gov.nist.javax.sip.stack.UDPMessageChannel] (Mobicents-SIP-Servlets-UDPMessageChannelThread-5) Setting SIPMessage peerPacketSource to: /10.0.0.102:5060

应该将响应发送回同一个端口。

INVITE中的联系人标头包含udp作为传输协议:

Contact: <sip:alice@10.0.0.100:54479;transport=udp>;+g.oma.sip-im

0 个答案:

没有答案