Sip Servlet setAttribute mobicent

302 views Asked by At

I'm facing on a problem with the set attribute of a Sip Servlet. I'm trying to send a 200 OK , when I receive another 200 OK from a different source. So I've thought to do in this way:

protected void doInvite(SipServletRequest req) throws ServletException, IOException {
    //...
    SipSession session = req.getSession();
    SipServletResponse response = req.createResponse(200);
    session.setAttribute("reqResponse", response);
    /...
}

And so, when I receive the 200 ok from the other side:

protected void doSuccessResponse(SipServletResponse resp)
    //...
    throws ServletException, IOException {
    SipServletResponse response = (SipServletResponse) session.getAttribute("reqResponse");
            response.send();
    //....
    }

But when I try to do response.send() I have an error:

[0m[31m09:25:15,956 ERROR [org.mobicents.servlet.sip.core.dispatchers.DispatchTask] (Mobicents-SIP-Servlets-UDPMessageChannelThread-10) Unexpected exception while processing message SIP/2.0 200 Ok
Via: SIP/2.0/UDP localhost:5080;received=127.0.0.1;branch=z9hG4bKa76ae813-561c-40ec-90b3-0cb29839c16f_d9d5d8b1_b843c7c0-2c76-4a9a-87e2-3fd9959601ea
From: "x-lite" <sip:[email protected]>;tag=15858376_d7e7552a_d9d5d8b1_a76ae813-561c-40ec-90b3-0cb29839c16f
To: <sip:[email protected]:5061>;tag=qGnECUk
Call-ID: [email protected]
CSeq: 1 INVITE
User-Agent: Linphone/3.8.5 (belle-sip/1.4.1)
Supported: outbound
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO,UPDATE
Contact: <sip:[email protected]:5061>;+sip.instance="<urn:uuid:2fc1acc8-38e5-420e-981e-70d1c82d961f>"
Content-Type: application/sdp
Content-Length: 398

v=0
o=user1 3189 2578 IN IP4 10.1.2.214
s=Talk
c=IN IP4 10.1.2.214
t=0 0
m=audio 7078 RTP/AVPF 96 0
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1; stereo=0; sprop-stereo=0
a=rtcp-fb:* trr-int 5000
m=video 9078 RTP/AVPF 102 103
a=rtpmap:102 VP8/90000
a=rtpmap:103 H264/90000
a=fmtp:103 profile-level-id=42801F
a=rtcp-fb:* trr-int 5000
a=rtcp-fb:102 ccm fir
a=rtcp-fb:103 ccm fir
: org.mobicents.servlet.sip.core.DispatcherException: Unexpected exception while processing response : SIP/2.0 200 Ok
Via: SIP/2.0/UDP localhost:5080;received=127.0.0.1;branch=z9hG4bKa76ae813-561c-40ec-90b3-0cb29839c16f_d9d5d8b1_b843c7c0-2c76-4a9a-87e2-3fd9959601ea
From: "x-lite" <sip:[email protected]>;tag=15858376_d7e7552a_d9d5d8b1_a76ae813-561c-40ec-90b3-0cb29839c16f
To: <sip:[email protected]:5061>;tag=qGnECUk
Call-ID: [email protected]
CSeq: 1 INVITE
User-Agent: Linphone/3.8.5 (belle-sip/1.4.1)
Supported: outbound
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO,UPDATE
Contact: <sip:[email protected]:5061>;+sip.instance="<urn:uuid:2fc1acc8-38e5-420e-981e-70d1c82d961f>"
Content-Type: application/sdp
Content-Length: 398

v=0
o=user1 3189 2578 IN IP4 10.1.2.214
s=Talk
c=IN IP4 10.1.2.214
t=0 0
m=audio 7078 RTP/AVPF 96 0
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1; stereo=0; sprop-stereo=0
a=rtcp-fb:* trr-int 5000
m=video 9078 RTP/AVPF 102 103
a=rtpmap:102 VP8/90000
a=rtpmap:103 H264/90000
a=fmtp:103 profile-level-id=42801F
a=rtcp-fb:* trr-int 5000
a=rtcp-fb:102 ccm fir
a=rtcp-fb:103 ccm fir

    at org.mobicents.servlet.sip.core.dispatchers.ResponseDispatcher$1.dispatch(ResponseDispatcher.java:491) [sip-servlets-impl-3.0.564.jar:3.0.564]
    at org.mobicents.servlet.sip.core.dispatchers.DispatchTask.dispatchAndHandleExceptions(DispatchTask.java:61) [sip-servlets-impl-3.0.564.jar:3.0.564]
    at org.mobicents.servlet.sip.core.dispatchers.ResponseDispatcher.dispatchMessage(ResponseDispatcher.java:512) [sip-servlets-impl-3.0.564.jar:3.0.564]
    at org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl.processResponse(SipApplicationDispatcherImpl.java:1005) [sip-servlets-impl-3.0.564.jar:3.0.564]
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.SipProviderImpl.handleEvent(SipProviderImpl.java:185) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.DialogFilter.processResponse(DialogFilter.java:1501) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.stack.SIPClientTransactionImpl.inviteClientTransaction(SIPClientTransactionImpl.java:896) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.stack.SIPClientTransactionImpl.processResponse(SIPClientTransactionImpl.java:532) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.stack.SIPClientTransactionImpl.processResponse(SIPClientTransactionImpl.java:1604) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.stack.UDPMessageChannel.processMessage(UDPMessageChannel.java:603) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.stack.UDPMessageChannel.processIncomingDataPacket(UDPMessageChannel.java:512) [jain-sip-ri-1.2.228.jar:1.2.228]
    at gov.nist.javax.sip.stack.UDPMessageChannel.run(UDPMessageChannel.java:317) [jain-sip-ri-1.2.228.jar:1.2.228]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
Caused by: java.lang.NullPointerException
    at org.mobicents.servlet.sip.example.SimpleSipServlet.doSuccessResponse(SimpleSipServlet.java:151)
    at javax.servlet.sip.SipServlet.doResponse(SipServlet.java:274) [sip-servlets-spec-3.0.564.jar:3.0.564]
    at org.mobicents.servlet.sip.example.SimpleSipServlet.doResponse(SimpleSipServlet.java:195)
    at javax.servlet.sip.SipServlet.service(SipServlet.java:334) [sip-servlets-spec-3.0.564.jar:3.0.564]
    at org.mobicents.servlet.sip.core.dispatchers.MessageDispatcher.callServlet(MessageDispatcher.java:458) [sip-servlets-impl-3.0.564.jar:3.0.564]
    at org.mobicents.servlet.sip.core.dispatchers.ResponseDispatcher$1.dispatch(ResponseDispatcher.java:479) [sip-servlets-impl-3.0.564.jar:3.0.564]
    ... 13 more

Can somebody help me to understand where is the error? Note: I've tried to print in log the 200 ok message and seems there isn't errors, I got it correctly! Thank you for your help!

0

There are 0 answers