1

我正在尝试使用 RestComm SipServlet 开发 IMS 应用程序服务器。最初,我的目标只是将 AS 插入到呼叫流程中,而不做任何特别的事情。 在此处输入图像描述

应用程序服务器只需做事并转发初始邀请。问题是 RestComm 的 sip 堆栈没有从 Invite 中删除 Route 并将其添加到路由标头中,因此邀请再次路由到 AS 生成循环。当我尝试编辑 SipRequest 删除路由标头时,由于我无法修改系统标头,AS 的答案为 500。

这里是代码片段

    @Override
protected final void doInvite(SipServletRequest request)
        throws ServletException, IOException {

    //DO STUFF
    System.out.println("RECEIVED AN INVITE");

    //      These lines generate a 500
    //      request.removeHeader("route");
    //      request.removeHeader("route");

    ProxyImpl p = (ProxyImpl) request.getProxy(true);
    p.setRecordRoute(false);
    p.setSupervised(true);
    p.setParallel(true);
    p.proxyTo(request.getRequestURI());
    p.startProxy();

}

我快疯了:/希望有人能给我一些建议......

4

3 回答 3

0

不太可能我仍在努力解决最初的问题。我一直在检查 Bartek 给我的暗示。不幸的是,文档很差,可能我没有完全理解它。无论如何,我将分享我处理 dar 属性文件的结果。定义取自 SipServlet Specification v1.1

ROUTE修饰符指示 SipApplicationRouterInfo.getRoutes() 返回有效路由。由容器决定它们是外部路由还是返回内部路由。所有返回的路由必须是相同的类型,因此容器可以通过仅检查第一个路由来做出决定。

    2017-10-10 15:55:01,372 ERROR [SipApplicationDispatcherImpl] (pool-AffinityJAIN-thread-1) Unexpected exception while processing request 
    INVITE sip:test2@mydomain.net SIP/2.0
    Via: SIP/2.0/TCP 10.39.117.121:50302;rport=50302;branch=z9hG4bKPj921L-Q-IghWuH.rSX.uNoNMh9T7gZilB;received=10.39.117.121
    Via: SIP/2.0/TCP 10.39.117.93:6560;received=10.39.117.93;branch=z9hG4bK+aa78dad05a4a559d9e4635f37906172a1+sip+5+a64ded2b
    Route: <sip:moby@moby.dev.mydomain.sys;lr>
    Route: <sip:odi_6fWaVvB68v@10.39.117.121:5054;lr;orig>
    Record-Route: <sip:sprout.dev.mydomain.sys:5054;transport=TCP;lr;service=scscf;billing-role=charge-orig>
    Record-Route: <sip:10.39.117.93:6560;lr>
    From: "itsme" <sip:test_1@mydomain.net>;tag=10.39.117.93+5+2cdeefc2+8fc7709c
    To: <sip:test2@mydomain.net>
    CSeq: 1 INVITE
    Expires: 180
    Call-Info: <sip:10.39.117.93:6560>;method="NOTIFY;Event=telephone-event;Duration=2000"
    P-Charging-Function-Addresses: ccf=pri_ccf_address
    Supported: outbound,path,replaces
    P-Charging-Vector: icid-value="0be3bd9333dd5089baf80bf17225e3d6";orig-ioi=mydomain.net
    Contact: <sip:test_1@195.130.246.72:46973;transport=tcp;rinstance=e637627c20b12d87;ob>;+sip.instance="<urn:uuid:968fdfa1-95d3-59cb-acb3-403d721daeee>"
    P-Asserted-Identity: <sip:test_1@mydomain.net>
    Max-Forwards: 68
    Call-ID: 0gQAAC8WAAACBAAALxYAAOYHyDdZmVO7ntMtj/uEnAYHN75Z51iTlNo7aI6WHcJ6VqorSJqCC0eLxClj9KOJnw--@10.39.117.93
    Allow: SUBSCRIBE,NOTIFY,INVITE,ACK,CANCEL,BYE,REFER,INFO,OPTIONS
    User-Agent: X-Lite release 5.0.1 stamp 86895
    P-Visited-Network-ID: perim.dev.ims.ext1.net
    Accept: application/sdp,application/dtmf-relay
    Session-Expires: 600
    P-Served-User: <sip:test_1@mydomain.net>;regstate=reg;sescase=orig
    Content-Type: application/sdp
    Content-Length: 281

    v=0
    o=- 14048926850737 14048926850737 IN IP4 10.39.117.93
    s=-
    c=IN IP4 10.39.117.93
    t=0 0
    m=audio 45234 RTP/AVP 120 0 101
    a=sendrecv
    a=rtpmap:120 opus/48000/2
    a=rtpmap:101 telephone-event/8000
    a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
    a=fmtp:101 0-15

    org.mobicents.servlet.sip.core.DispatcherException: Impossible to parse the route returned by the application router into a compliant address
            at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher.checkRouteModifier(InitialRequestDispatcher.java:575)
            at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher.dispatchMessage(InitialRequestDispatcher.java:299)
            at org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl.processRequest(SipApplicationDispatcherImpl.java:927)
            at gov.nist.javax.sip.EventScanner.deliverRequestEvent(EventScanner.java:250)
            at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:146)
            at gov.nist.javax.sip.SipProviderImpl.handleEvent(SipProviderImpl.java:185)
            at gov.nist.javax.sip.DialogFilter.processRequest(DialogFilter.java:1328)
            at gov.nist.javax.sip.stack.SIPServerTransactionImpl.processRequest(SIPServerTransactionImpl.java:851)
            at gov.nist.javax.sip.stack.ConnectionOrientedMessageChannel.processMessage(ConnectionOrientedMessageChannel.java:473)
            at gov.nist.javax.sip.parser.NioPipelineParser$Dispatch.run(NioPipelineParser.java:132)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
            at gov.nist.javax.sip.MDCScheduledTHExecutor$MDCFuture.run(MDCScheduledTHExecutor.java:57)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
    Caused by: java.text.ParseException: :Bad address spec
            at gov.nist.javax.sip.parser.Parser.createParseException(Parser.java:45)
            at gov.nist.javax.sip.parser.AddressParser.address(AddressParser.java:120)
            at gov.nist.javax.sip.parser.StringMsgParser.parseAddress(StringMsgParser.java:328)
            at gov.nist.javax.sip.address.AddressFactoryImpl.createAddress(AddressFactoryImpl.java:124)
            at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher.checkRouteModifier(InitialRequestDispatcher.java:537)
    ... 17 more

我还尝试使用路由字段指向 IMS 节点,以便转发回 SIP 消息。它可以工作,但我认为通过这种方式,AS 不会添加到 Record-Route 标头中,并且会导致循环。

ROUTE_BACK指示容器在推送从 SipApplicationRouterInfo.getRoutes() 获得的外部路由之前先推送自己的路由。应用程序路由器行为

在这种情况下,我有以下错误和 500 的 AS 答案。

    2017-10-10 15:52:57,276 ERROR [SipApplicationDispatcherImpl] (pool-AffinityJAIN-thread-14) Unexpected exception while processing request 
    INVITE sip:test2@mydomain.net SIP/2.0
    Via: SIP/2.0/TCP 10.39.117.121:43312;rport=43312;branch=z9hG4bKPj5IBDrImFUbO1J.J1LrwUcUQ-rsT28TRh;received=10.39.117.121
    Via: SIP/2.0/TCP 10.39.117.93:6560;received=10.39.117.93;branch=z9hG4bK+84bf75e3c2c4ccae314be5e5849bd4961+sip+3+a64ded21
    Route: <sip:moby@moby.dev.mydomain.sys;lr>
    Route: <sip:odi_kMFF/TQSEV@10.39.117.121:5054;lr;orig>
    Record-Route: <sip:sprout.dev.mydomain.sys:5054;transport=TCP;lr;service=scscf;billing-role=charge-orig>
    Record-Route: <sip:10.39.117.93:6560;lr>
    From: "Gennaro" <sip:test_1@mydomain.net>;tag=10.39.117.93+3+7334eef2+84ee6a06
    To: <sip:test2@mydomain.net>
    CSeq: 1 INVITE
    Expires: 180
    Call-Info: <sip:10.39.117.93:6560>;method="NOTIFY;Event=telephone-event;Duration=2000"
    P-Charging-Function-Addresses: ccf=pri_ccf_address
    Supported: outbound,path,replaces
    P-Charging-Vector: icid-value="4167d34dd3fb232bb1f5fcf458dc1a9e";orig-ioi=mydomain.net
    Contact: <sip:test_1@195.130.246.72:46973;transport=tcp;rinstance=e637627c20b12d87;ob>;+sip.instance="<urn:uuid:968fdfa1-95d3-59cb-acb3-403d721daeee>"
    P-Asserted-Identity: <sip:test_1@mydomain.net>
    Max-Forwards: 68
    Call-ID: 0gQAAC8WAAACBAAALxYAAK2OW7qCKhw2LAbw9q+UyCfK2Js5PtCkUUpQsljED2+H/KOnkWSV97W3n9Uqpa3r4w--@10.39.117.93
    Allow: SUBSCRIBE,NOTIFY,INVITE,ACK,CANCEL,BYE,REFER,INFO,OPTIONS
    User-Agent: X-Lite release 5.0.1 stamp 86895
    P-Visited-Network-ID: perim.dev.ims.ext1.net
    Accept: application/sdp,application/dtmf-relay
    Session-Expires: 600
    P-Served-User: <sip:test_1@mydomain.net>;regstate=reg;sescase=orig
    Content-Type: application/sdp
    Content-Length: 281

    v=0
    o=- 76884298267467 76884298267467 IN IP4 10.39.117.93
    s=-
    c=IN IP4 10.39.117.93
    t=0 0
    m=audio 45230 RTP/AVP 120 0 101
    a=sendrecv
    a=rtpmap:120 opus/48000/2
    a=rtpmap:101 telephone-event/8000
    a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
    a=fmtp:101 0-15

    java.lang.IllegalArgumentException: not allowed to set parameter, the URI is not modifiable
            at org.mobicents.servlet.sip.address.SipURIImpl.setParameter(SipURIImpl.java:401)
            at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher.checkRouteModifier(InitialRequestDispatcher.java:591)
            at org.mobicents.servlet.sip.core.dispatchers.InitialRequestDispatcher.dispatchMessage(InitialRequestDispatcher.java:299)
            at org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl.processRequest(SipApplicationDispatcherImpl.java:927)
            at gov.nist.javax.sip.EventScanner.deliverRequestEvent(EventScanner.java:250)
            at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:146)
            at gov.nist.javax.sip.SipProviderImpl.handleEvent(SipProviderImpl.java:185)
            at gov.nist.javax.sip.DialogFilter.processRequest(DialogFilter.java:1328)
            at gov.nist.javax.sip.stack.SIPServerTransactionImpl.processRequest(SIPServerTransactionImpl.java:851)
            at gov.nist.javax.sip.stack.ConnectionOrientedMessageChannel.processMessage(ConnectionOrientedMessageChannel.java:473)
            at gov.nist.javax.sip.parser.NioPipelineParser$Dispatch.run(NioPipelineParser.java:132)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
            at gov.nist.javax.sip.MDCScheduledTHExecutor$MDCFuture.run(MDCScheduledTHExecutor.java:57)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)

NO_ROUTE表示应用路由器没有返回任何路由,并且 SipApplicationRouterInfo.getRoutes() 值(如果有)应该被忽略。

在这种情况下,请求似乎停留在 AS 中,无法将请求转发到 IMS 节点。

希望这能说明情况。谢谢

于 2017-10-11T10:51:33.573 回答
0

我也是 Sip Servlets 的新手,但是当我阅读文档时,我遇到了以下信息:

“路由修饰符,由以下字符串之一组成:ROUTE、ROUTE_BACK 或 NO_ROUTE。路由修饰符与路由信息结合使用,以在外部路由请求。” 与 mobicents-dar.properties 相关。

也许它有帮助。

于 2017-10-09T12:37:06.833 回答
0

问题是应用路由器不承认路由是到它自己的,所以它不会删除它。如果您打开 DEBUG 级别的日志记录,您将看到如下内容:

DEBUG [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (Mobicents-SIP-Servlets-UDPMessageChannelThread-1) the triplet host/port/transport : tas.core.ims1.test/-1/UDP is external : true

请注意,它解析为外部。尝试向hostnamesSIP 连接器添加属性:

<subsystem xmlns="urn:org.mobicents:sip-servlets-as8:1.0" application-router="configuration/dars/mobicents-dar.properties" stack-properties="configuration/mss-sip-stack.properties" path-name="org.mobicents.ext" app-dispatcher-class="org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl" concurrency-control-mode="SipApplicationSession" congestion-control-interval="-1">
    <connector name="sip-udp" protocol="SIP/2.0" scheme="sip" socket-binding="sip-udp" use-static-address="true" static-server-address="2345:470:eb88:150::23" hostnames="tas.core.ims1.test"/>
    <connector name="sip-tcp" protocol="SIP/2.0" scheme="sip" socket-binding="sip-tcp" use-static-address="true" static-server-address="2345:470:eb88:150::23" hostnames="tas.core.ims1.test"/>
    ...
</subsystem>

另一种选择是在static-server-address属性中使用主机名而不是 IP 地址:

<subsystem xmlns="urn:org.mobicents:sip-servlets-as8:1.0" application-router="configuration/dars/mobicents-dar.properties" stack-properties="configuration/mss-sip-stack.properties" path-name="org.mobicents.ext" app-dispatcher-class="org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl" concurrency-control-mode="SipApplicationSession" congestion-control-interval="-1">
    <connector name="sip-udp" protocol="SIP/2.0" scheme="sip" socket-binding="sip-udp" use-static-address="true" static-server-address="tas.core.ims1.test"/>
    <connector name="sip-tcp" protocol="SIP/2.0" scheme="sip" socket-binding="sip-tcp" use-static-address="true" static-server-address="tas.core.ims1.test"/>
    ...
</subsystem>

再次检查日志,您会注意到它现在解析为内部:

DEBUG [org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl] (Mobicents-SIP-Servlets-UDPMessageChannelThread-1) the triplet host/port/transport : tas.core.ims1.test/-1/UDP is external : false

它现在也将弹出通往自身的路线。就我而言,如果我通过调用打印出弹出的路线SipServletRequest::getPoppedRoute(),我会看到:

Route: <sip:defaultapp@tas.core.ims1.test;lr>
于 2018-10-23T17:22:34.037 回答