Re: PJSUA2 does not answer calls, 500 sent instead. #1923 #1916

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

Thank you for your private replies.
I enabled the Null Sound device and made TCP transport and STUN working in my PJSUA2 example.

I was able to compile trunk on my host (macOS) with —without-ssl and —without-sound.
I have a running, stripped down version of pjsua-x86_64-apple-darwin17.5.0. I can answer calls with 180 and 200.
The on_incoming_call callback is called AFTER media_channel_init finished and the Initial answer Response msg 100/INVITE was sent.

The PJSUA2 API behaves differently when a call arrives.
In my PJSUA2 example the on_incoming_callback is called before the initial answer Response msg was created and sent. It is called right after media_channel_init, before media_channel_init returned.

Might this be related to #1923 and #1916?
There is no difference if I try to answer with 180 or 200.

How can this behaviour be fixed so PJSUA2 works as expected?

Thanks for all replies in advance,

best regards

Sascha


Working trace from pjsua-x86_64-apple-darwin17.5.0

14:45:29.174         sip_endpoint.c  Processing incoming message: Request msg INVITE/cseq=103 (rdata0x7f979802da28)
14:45:29.174           pjsua_core.c  .RX 1313 bytes Request msg INVITE/cseq=103 (rdata0x7f979802da28) from UDP 217.10.79.9:5060:
INVITE sip: XXXXXXXXXX@XXXXXXXXXX:40984;ob SIP/2.0
Record-Route: <sip:217.10.79.9;lr;ftag=as1f7268d3>
Record-Route: <sip:172.20.40.7;lr>
Record-Route: <sip:217.10.68.137;lr;ftag=as1f7268d3>
Via: SIP/2.0/UDP 217.10.79.9;branch=z9hG4bKd32b.a06be3fa68fd4436b6ee7002a55d2a5b.0
Via: SIP/2.0/UDP 172.20.40.7;branch=z9hG4bKd32b.15fa37ab70f368719e6acae297bdba12.0
Via: SIP/2.0/UDP 217.10.68.137;branch=z9hG4bKd32b.adc97d37b9c2c1dd5a3fa0462022ea1f.0
Via: SIP/2.0/UDP 217.10.77.105:5060;branch=z9hG4bK19903a75
Max-Forwards: 67
From: “XXXXXXXXXX" <sip: XXXXXXXXXX@xxxxxxxxxx>;tag=as1f7268d3
To: <sip: XXXXXXXXXX@xxxxxxxxxx>
Contact: <sip: XXXXXXXXXX@217.10.77.105:5060>
Call-ID: 67da93b618218d9547ffdf8447b1f4b9@xxxxxxxxxx
CSeq: 103 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Content-Type: application/sdp
Content-Length: 403

v=0
o=root 1371948874 1371948875 IN IP4 217.10.77.105
s=sipgate VoIP GW
c=IN IP4 217.10.77.105
t=0 0
m=audio 28116 RTP/AVP 8 0 3 97 18 112 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:112 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

--end msg--
14:45:29.174           pjsua_call.c  .Incoming Request msg INVITE/cseq=103 (rdata0x7f979802da28)
14:45:29.174           pjsua_call.c  ..Resetting call_id 0
14:45:29.174           pjsua_call.c  ..call = 0x105c0d0b8
14:45:29.174           pjsua_call.c  ..call->incoming_data = 0
14:45:29.174           pjsua_call.c  ..pjsip_replaces_verify_request is ok.
14:45:29.174           pjsua_call.c  ..Invite does not contain a Replaces header.
14:45:29.174           pjsua_call.c  ..Clone rdata to call->incoming_data.
14:45:29.175           pjsua_call.c  ..Quick SDP check OK.
14:45:29.175           pjsua_call.c  ..SDP check OK.
14:45:29.175           pjsua_call.c  ..Get contact:
14:45:29.175           pjsua_call.c  ..Create Dialog.
14:45:29.175      tsx0x7f979901d2a8  ...Transaction created for Request msg INVITE/cseq=103 (rdata0x7f979802da28)
14:45:29.175      tsx0x7f979901d2a8  ..Incoming Request msg INVITE/cseq=103 (rdata0x7f979802da28) in state Null
14:45:29.175      tsx0x7f979901d2a8  ...State changed from Null to Trying, event=RX_MSG
14:45:29.175      dlg0x7f9799018aa8  ....Transaction tsx0x7f979901d2a8 state changed to Trying
14:45:29.175      dlg0x7f9799018aa8  ..UAS dialog created
14:45:29.175           pjsua_call.c  ..Allow rewrite and via_addr set.
14:45:29.175      dlg0x7f9799018aa8  ..Module mod-invite added as dialog usage, data=0x7f9797f2d998
14:45:29.175      dlg0x7f9799018aa8  ...Session count inc to 3 by mod-invite
14:45:29.175      inv0x7f9799018aa8  ..UAS invite session created for dialog dlg0x7f9799018aa8
14:45:29.175      dlg0x7f9799018aa8  ...Session count inc to 3 by mod-pjsua
14:45:29.175           pjsua_call.c  ..Trace 1.
14:45:29.175           pjsua_call.c  ..Call media_channel_init.
14:45:29.175          pjsua_media.c  ..Call 0: initializing media..
14:45:29.211          stun_simple.c  ...Warning: unknown attr type 8020 in attr 3. Attribute was ignored.
14:45:29.211          stun_simple.c  ...Warning: unknown attr type 8022 in attr 4. Attribute was ignored.
14:45:29.211          stun_simple.c  ...Warning: unknown attr type 8020 in attr 3. Attribute was ignored.
14:45:29.211          stun_simple.c  ...Warning: unknown attr type 8022 in attr 4. Attribute was ignored.
14:45:29.211          pjsua_media.c  ...Note: STUN mapped RTCP port 60115 is not adjacent to RTP port 43711
14:45:29.211          pjsua_media.c  ...RTP socket reachable at XXXXXXXXXX:43711
14:45:29.211          pjsua_media.c  ...RTCP socket reachable at XXXXXXXXXX:60115
14:45:29.211     srtp0x7f979b801c00  ...SRTP keying SDES created
14:45:29.211          pjsua_media.c  ...Media index 0 selected for audio call 0
14:45:29.211          pjsua_media.c  ...Call 0: media transport initialization complete: Success
14:45:29.211           pjsua_call.c  ..media_channel_init OK.
14:45:29.211      dlg0x7f9799018aa8  ...Session count dec to 3 by mod-pjsua
14:45:29.211           pjsua_call.c  ..Timer init OK.
14:45:29.211           pjsua_call.c  ..Update NAT.
14:45:29.211           pjsua_call.c  ..pjmedia_sdp_neg_get_neg_remote OK.
14:45:29.211           pjsua_call.c  ..Call 0: remote NAT type is 0 (Unknown)
14:45:29.211               endpoint  ...Response msg 100/INVITE/cseq=103 (tdta0x7f979b8024a8) created
14:45:29.211      dlg0x7f9799018aa8  ...Initial answer Response msg 100/INVITE/cseq=103 (tdta0x7f979b8024a8)
14:45:29.211           pjsua_call.c  ..pjsip_inv_initial_answer OK
14:45:29.211      inv0x7f9799018aa8  ...Sending Response msg 100/INVITE/cseq=103 (tdta0x7f979b8024a8)
14:45:29.211      dlg0x7f9799018aa8  ....Sending Response msg 100/INVITE/cseq=103 (tdta0x7f979b8024a8)
14:45:29.211      tsx0x7f979901d2a8  ....Sending Response msg 100/INVITE/cseq=103 (tdta0x7f979b8024a8) in state Trying
14:45:29.211          sip_resolve.c  .....Target '217.10.79.9:5060' type=UDP resolved to '217.10.79.9:5060' type=UDP (UDP transport)
14:45:29.211           pjsua_core.c  .....TX 688 bytes Response msg 100/INVITE/cseq=103 (tdta0x7f979b8024a8) to UDP 217.10.79.9:5060:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 217.10.79.9;received=217.10.79.9;branch=z9hG4bKd32b.a06be3fa68fd4436b6ee7002a55d2a5b.0
Via: SIP/2.0/UDP 172.20.40.7;branch=z9hG4bKd32b.15fa37ab70f368719e6acae297bdba12.0
Via: SIP/2.0/UDP 217.10.68.137;branch=z9hG4bKd32b.adc97d37b9c2c1dd5a3fa0462022ea1f.0
Via: SIP/2.0/UDP 217.10.77.105:5060;branch=z9hG4bK19903a75
Record-Route: <sip:217.10.79.9;lr;ftag=as1f7268d3>
Record-Route: <sip:172.20.40.7;lr>
Record-Route: <sip:217.10.68.137;lr;ftag=as1f7268d3>
Call-ID: 67da93b618218d9547ffdf8447b1f4b9@xxxxxxxxxx
From: "XXXXXXXXXX" <sip: XXXXXXXXXX@xxxxxxxxxx>;tag=as1f7268d3
To: <sip: XXXXXXXXXX@xxxxxxxxxx>
CSeq: 103 INVITE
Content-Length:  0


--end msg--
14:45:29.211      tsx0x7f979901d2a8  .....State changed from Trying to Proceeding, event=TX_MSG
14:45:29.236      dlg0x7f9799018aa8  ......Transaction tsx0x7f979901d2a8 state changed to Proceeding
14:45:29.236           pjsua_call.c  ..pjsip_inv_initial_answer OK.
14:45:29.236           pjsua_call.c  ..Call on_incoming_call callback now.





Failing trace from PJSUA2

14:46:27.235         sip_endpoint.c  Processing incoming message: Request msg INVITE/cseq=103 (rdata0x7f90ce80bc28)
14:46:27.235           pjsua_core.c  .RX 1313 bytes Request msg INVITE/cseq=103 (rdata0x7f90ce80bc28) from UDP 217.10.79.9:5060:
INVITE sip: XXXXXXXXXX@ XXXXXXXXXX:40984;ob SIP/2.0
Record-Route: <sip: XXXXXXXXXX;lr;ftag=as1d6c896b>
Record-Route: <sip:172.20.40.7;lr>
Record-Route: <sip: XXXXXXXXXX;lr;ftag=as1d6c896b>
Via: SIP/2.0/UDP 217.10.79.9;branch=z9hG4bK6f5f.b2d582d1382df29a93b35dc9758059cf.0
Via: SIP/2.0/UDP 172.20.40.7;branch=z9hG4bK6f5f.efc0b26a3a3307206e7dd88963aa4397.0
Via: SIP/2.0/UDP 217.10.68.137;branch=z9hG4bK6f5f.9b1773a4515b6a2e06cc7d12752a648d.0
Via: SIP/2.0/UDP 217.10.77.107:5060;branch=z9hG4bK703571c7
Max-Forwards: 67
From: "XXXXXXXXXX" <sip: XXXXXXXXXX@xxxxxxxxxx>;tag=as1d6c896b
To: <sip: XXXXXXXXXX@xxxxxxxxxx>
Contact: <sip: XXXXXXXXXX@ XXXXXXXXXX:5060>
Call-ID: 6c2b84e108d10561291bb34d1d46d0ab@xxxxxxxxxx
CSeq: 103 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Content-Type: application/sdp
Content-Length: 403

v=0
o=root 1194626159 1194626160 IN IP4 217.10.77.107
s=sipgate VoIP GW
c=IN IP4 217.10.77.107
t=0 0
m=audio 19442 RTP/AVP 8 0 3 97 18 112 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:112 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

--end msg--
14:46:27.235           pjsua_call.c  .Incoming Request msg INVITE/cseq=103 (rdata0x7f90ce80bc28)
14:46:27.235      tsx0x7f90cd826aa8  ...Transaction created for Request msg INVITE/cseq=103 (rdata0x7f90ce80bc28)
14:46:27.235      tsx0x7f90cd826aa8  ..Incoming Request msg INVITE/cseq=103 (rdata0x7f90ce80bc28) in state Null
14:46:27.235      tsx0x7f90cd826aa8  ...State changed from Null to Trying, event=RX_MSG
14:46:27.235      dlg0x7f90cd822aa8  ....Transaction tsx0x7f90cd826aa8 state changed to Trying
14:46:27.235      dlg0x7f90cd822aa8  ..UAS dialog created
14:46:27.235      dlg0x7f90cd822aa8  ..Module mod-invite added as dialog usage, data=0x7f90cd403198
14:46:27.235      dlg0x7f90cd822aa8  ...Session count inc to 3 by mod-invite
14:46:27.235      inv0x7f90cd822aa8  ..UAS invite session created for dialog dlg0x7f90cd822aa8
14:46:27.235      dlg0x7f90cd822aa8  ...Session count inc to 3 by mod-pjsua
14:46:27.235          pjsua_media.c  ..Call 0: initializing media..
14:46:27.259          stun_simple.c  ...Warning: unknown attr type 8020 in attr 3. Attribute was ignored.
14:46:27.259          stun_simple.c  ...Warning: unknown attr type 8022 in attr 4. Attribute was ignored.
14:46:27.260          stun_simple.c  ...Warning: unknown attr type 8020 in attr 3. Attribute was ignored.
14:46:27.260          stun_simple.c  ...Warning: unknown attr type 8022 in attr 4. Attribute was ignored.
14:46:27.260          pjsua_media.c  ...Note: STUN mapped RTCP port 42112 is not adjacent to RTP port 10949
14:46:27.260          pjsua_media.c  ...RTP socket reachable at XXXXXXXXXX:10949
14:46:27.260          pjsua_media.c  ...RTCP socket reachable at XXXXXXXXXX:42112
14:46:27.260     srtp0x7f90cf003000  ...SRTP keying SDES created
14:46:27.260          pjsua_media.c  ...Media index 0 selected for audio call 0
14:46:27.260          pjsua_media.c  ...Call 0: media transport initialization complete: Success
*** onIncomingCall callId=0
    accId = 0
    remAudioCount = 1
    remVideoCount = 0
Sleep ...
Answer ...
14:46:28.261           pjsua_call.c  ...Answering call 0: code=180
14:46:28.261           pjsua_call.c  ....Pending answering call 0 upon completion of media transport
14:46:28.261           pjsua_call.c  ...Call 0 hanging up: code=0..
14:46:28.261           pjsua_call.c  ....Pending call 0 hangup upon completion of media transport
14:46:28.261           pjsua_call.c  ...Call 0 hanging up: code=500..
14:46:28.261           pjsua_call.c  ....Pending call 0 hangup upon completion of media transport
14:46:28.261      dlg0x7f90cd822aa8  ...Session count dec to 3 by mod-pjsua
14:46:28.261           pjsua_call.c  ..Call 0: remote NAT type is 0 (Unknown)
14:46:28.261               endpoint  ...Response msg 100/INVITE/cseq=103 (tdta0x7f90cf00a2a8) created
14:46:28.261      dlg0x7f90cd822aa8  ...Initial answer Response msg 100/INVITE/cseq=103 (tdta0x7f90cf00a2a8)
14:46:28.261      inv0x7f90cd822aa8  ...Sending Response msg 100/INVITE/cseq=103 (tdta0x7f90cf00a2a8)
14:46:28.261      dlg0x7f90cd822aa8  ....Sending Response msg 100/INVITE/cseq=103 (tdta0x7f90cf00a2a8)
14:46:28.261      tsx0x7f90cd826aa8  ....Sending Response msg 100/INVITE/cseq=103 (tdta0x7f90cf00a2a8) in state Trying
14:46:28.261          sip_resolve.c  .....Target '217.10.79.9:5060' type=UDP resolved to '217.10.79.9:5060' type=UDP (UDP transport)
14:46:28.261           pjsua_core.c  .....TX 688 bytes Response msg 100/INVITE/cseq=103 (tdta0x7f90cf00a2a8) to UDP 217.10.79.9:5060:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 217.10.79.9;received=217.10.79.9;branch=z9hG4bK6f5f.b2d582d1382df29a93b35dc9758059cf.0
Via: SIP/2.0/UDP 172.20.40.7;branch=z9hG4bK6f5f.efc0b26a3a3307206e7dd88963aa4397.0
Via: SIP/2.0/UDP 217.10.68.137;branch=z9hG4bK6f5f.9b1773a4515b6a2e06cc7d12752a648d.0
Via: SIP/2.0/UDP 217.10.77.107:5060;branch=z9hG4bK703571c7
Record-Route: <sip:217.10.79.9;lr;ftag=as1d6c896b>
Record-Route: <sip:172.20.40.7;lr>
Record-Route: <sip:217.10.68.137;lr;ftag=as1d6c896b>
Call-ID: 6c2b84e108d10561291bb34d1d46d0ab@xxxxxxxxxx
From: "XXXXXXXXXX" <sip: XXXXXXXXXX@xxxxxxxxxx>;tag=as1d6c896b
To: <sip: XXXXXXXXXX@xxxxxxxxxx>
CSeq: 103 INVITE
Content-Length:  0


--end msg--
14:46:28.262      tsx0x7f90cd826aa8  .....State changed from Trying to Proceeding, event=TX_MSG
14:46:28.262      dlg0x7f90cd822aa8  ......Transaction tsx0x7f90cd826aa8 state changed to Proceeding
14:46:28.262           pjsua_call.c  ..Call 0 hanging up: code=500..
14:46:28.262      inv0x7f90cd822aa8  ....Sending Response msg 500/INVITE/cseq=103 (tdta0x7f90cf00a2a8)
14:46:28.262      dlg0x7f90cd822aa8  .....Sending Response msg 500/INVITE/cseq=103 (tdta0x7f90cf00a2a8)
14:46:28.262      tsx0x7f90cd826aa8  .....Sending Response msg 500/INVITE/cseq=103 (tdta0x7f90cf00a2a8) in state Proceeding
14:46:28.262           pjsua_core.c  ......TX 719 bytes Response msg 500/INVITE/cseq=103 (tdta0x7f90cf00a2a8) to UDP 217.10.79.9:5060:
SIP/2.0 500
Via: SIP/2.0/UDP 217.10.79.9;received=217.10.79.9;branch=z9hG4bK6f5f.b2d582d1382df29a93b35dc9758059cf.0
Via: SIP/2.0/UDP 172.20.40.7;branch=z9hG4bK6f5f.efc0b26a3a3307206e7dd88963aa4397.0
Via: SIP/2.0/UDP 217.10.68.137;branch=z9hG4bK6f5f.9b1773a4515b6a2e06cc7d12752a648d.0
Via: SIP/2.0/UDP 217.10.77.107:5060;branch=z9hG4bK703571c7
Record-Route: <sip:217.10.79.9;lr;ftag=as1d6c896b>
Record-Route: <sip:172.20.40.7;lr>
Record-Route: <sip:217.10.68.137;lr;ftag=as1d6c896b>
Call-ID: 6c2b84e108d10561291bb34d1d46d0ab@xxxxxxxxxx
From: "XXXXXXXXXX" <sip:XXXXXXXXXX@xxxxxxxxxx>;tag=as1d6c896b
To: <sip:XXXXXXXXXX@xxxxxxxxxx>;tag=gPQlSfEw6u0X92Hi1O5lOWLMWJXkglD2
CSeq: 103 INVITE
Content-Length:  0


--end msg--
14:46:28.262      tsx0x7f90cd826aa8  ......State changed from Proceeding to Completed, event=TX_MSG
14:46:28.262      dlg0x7f90cd822aa8  .......Transaction tsx0x7f90cd826aa8 state changed to Completed
14:46:28.262          pjsua_media.c  .........Call 0: deinitializing media..
14:46:28.262          pjsua_media.c  ..........Call 0: cleaning up provisional media, prov_med_cnt=1, med_cnt=0
14:46:28.262      dlg0x7f90cd822aa8  .........Session count dec to 4 by mod-invite

> On 24. Apr 2018, at 13:44, Sascha <sascha@xxxxxxxxxxx> wrote:
> 
> Dear all,
> 
> I am currently trying to use PJSUA2 in C++ to answer calls (version 2.7.2, compiled from source on Ubuntu 16.04).
> I created a minimalistic example using the documentation [1].
> 
> It registers successfully with the SIP provider (Spigate.de in this case).
> When I receive an incoming call, I receive an INVITE message and the onIncomingCall callback is called. That’s fine.
> Answering the call does not work.
> 
> std::cout << "*** onIncomingCall callId=" << iprm.callId << std::endl;
> Call *call = new MyCall(*this, iprm.callId);
> CallOpParam op;
> op.statusCode = PJSIP_SC_RINGING;
> call->answer(op);
> 
> Instead, pjsua is replying with 500 and I do not hear it ringing. Instead, I get a “The person you have called is temporarily not available."
> 
> 11:38:08.548           pjsua_call.c  .Incoming Request msg INVITE/cseq=103 (rdata0x7f69d4001d38)
> 11:38:08.548          pjsua_media.c  ..Call 0: initializing media..
> 11:38:08.548          pjsua_media.c  ...RTP socket reachable at 172.18.0.2:4000
> 11:38:08.549          pjsua_media.c  ...RTCP socket reachable at 172.18.0.2:4001
> 11:38:08.549          pjsua_media.c  ...Media index 0 selected for audio call 0
> *** onIncomingCall callId=0
> 11:38:08.550           pjsua_call.c  ...Answering call 0: code=180
> 11:38:08.550           pjsua_call.c  ....Pending answering call 0 upon completion of media transport
> 11:38:08.550           pjsua_call.c  ...Call 0 hanging up: code=0..
> 11:38:08.550           pjsua_call.c  ....Pending call 0 hangup upon completion of media transport
> 11:38:08.550           pjsua_call.c  ...Call 0 hanging up: code=500..
> 11:38:08.550           pjsua_call.c  ....Pending call 0 hangup upon completion of media transport
> 11:38:08.550           pjsua_core.c  .....TX 690 bytes Response msg 100/INVITE/cseq=103 (tdta0x7f69d4013198) to UDP 217.10.79.9:5060:
> SIP/2.0 100 Trying
> 
> There is a full log of the software running on the Gitlab CI. It actually was connected to Sipgate and I called the number during the run of the CI. Hope not do disclose too much personal information :-) You can find all the compile steps in the Dockerfile and build.sh. Hope this gives a reproducible environment with a full log.
> 
> What is the correct way to answer a call?
> 
> Thank you very much in advance.
> 
> Sascha
> 
> [1] https://github.com/strongly-typed/pjsua2-demo/blob/master/main.cpp
> [2] https://gitlab.com/strongly-typed/pjsua2-demo/-/jobs/64690392
> 
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip@xxxxxxxxxxxxxxx
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux