Incorrect SDP generated when answering call with RTP/AVP profile and when rtcp-fb is present

AS
Alexandrov Stanislav
Wed, Jul 24, 2019 9:31 PM

When answering incoming call with RTP/AVP profile pjsip generates wrong
sdp if at least one pjmedia_rtcp_fb_cap set to the account.

200/OK sdp from pjsip contains these lines:

m=audio 0 RTP/AVP 0 96
c=IN IP4 127.0.0.1

When receiving such sdp remote server sends BYE immediately.

Invite with RTP/SAVPF profile works with these settings.
When pjmedia_rtcp_fb_cap not set pjsip correctly answers to the invite
with RTP/AVP profile.

============

Account settings used (pjsip 2.9, TLS and UDP transport tested):

acc_cfg.mediaConfig.rtcpMuxEnabled = true
acc_cfg.natConfig.iceEnabled = true;

acc_cfg.mediaConfig.srtpOpt.keyings.push_back(PJMEDIA_SRTP_KEYING_DTLS_SRTP);
acc_cfg.mediaConfig.srtpOpt.keyings.push_back(PJMEDIA_SRTP_KEYING_SDES);

acc_cfg.mediaConfig.srtpUse = PJMEDIA_SRTP_OPTIONAL;
acc_cfg.mediaConfig.srtpSecureSignaling = 0;

RtcpFbCap cap;
cap.type = PJMEDIA_RTCP_FB_NACK;
cap.codecId = "H264";
cap.param = "pli";
acc_cfg.mediaConfig.rtcpFbConfig.caps.push_back(cap);

Incoming invite:

INVITE sip:1000@186.17.67.204:5190 SIP/2.0
Via: SIP/2.0/UDP 186.17.67.175:5160;rport;branch=z9hG4bK8cZ5XgUSK3UZH
Max-Forwards: 7
From: "l" sip:19570488@186.17.67.175;tag=HS4X211rv9c8D
To: sip:1000@186.17.67.204:5190
Call-ID: 4128449e-28f6-1238-2092-1cc1dee7574c
CSeq: 7446652 INVITE
Contact: sip:mod_sofia@186.17.67.175:5160
User-Agent: FreeSWITCH-mod_sofia/1.8.7~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE,
REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event,
dialog, line-seize, call-info, sla, include-session-description,
presence.winfo, message-summary, re
r
Privacy: none
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 222
X-FS-Support: update_display,send_info

v=0
o=FreeSWITCH 1563957786 1563957787 IN IP4 186.17.67.175
s=FreeSWITCH
c=IN IP4 186.17.67.175
t=0 0
m=audio 43102 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20

OK from pjsip:

SIP/2.0 200 OK
Via: SIP/2.0/UDP
186.17.67.175:5160;rport=5160;branch=z9hG4bK8cZ5XgUSK3UZH
From: "l" sip:19570488@186.17.67.175;tag=HS4X211rv9c8D
To: sip:1000@186.17.67.204:5190;tag=X680y47rK3pyF
Call-ID: 4128449e-28f6-1238-2092-1cc1dee7574c
CSeq: 7446652 INVITE
Contact: sip:1000@186.17.67.204:5190;transport=udp
User-Agent: FreeSWITCH-mod_sofia/1.8.7~64bit
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE,
REGISTER, REFER, NOTIFY
Supported: path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 136
X-FS-Display-Name: Outbound Call
X-FS-Display-Number: sip:1000@186.17.67.204
X-FS-Support: update_display,send_info

v=0
o=- 3772989711 3772989713 IN IP4 186.17.67.146
s=pjmedia
b=AS:117
t=0 0
a=X-nat:0
m=audio 0 RTP/AVP 0 96
c=IN IP4 127.0.0.1

Log does not contain anything interesting:

pjsua_call.c !Answering call 0: code=200
inv0x9b8b2864  ..SDP negotiation done: Success
pjsua_media.c  ...Call 0: updating media..
pjsua_media.c  .....Media stream call00:0 is destroyed
srtp0x9c4cec00  ....SRTP not active
pjsua_aud.c  ....Audio channel update..
strm0x99bfe014  .....VAD temporarily disabled
strm0x99bfe014  .....Encoder stream started
strm0x99bfe014  .....Decoder stream started
pjsua_media.c  ....Audio updated, stream #0: PCMU (sendrecv)

virtual void _PjCall::onCallMediaState(pj::OnCallMediaStateParam &)

pjsua_core.c  ....TX 809 bytes Response msg 200/INVITE/cseq=7446662
(tdta0x9b8b8064) to UDP 186.17.67.204:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP
186.17.67.204;rport=5060;received=186.17.67.204;branch=z9hG4bK3pyUU49j1NXrm
Call-ID: 4cb2c111-28f6-1238-aca7-826d5e9fa7cf
From: "l" sip:19570488@186.17.67.204;tag=Spy1Fpc5XctHD
To: sip:1000@186.17.67.146;ob;tag=1b6672c0-06b6-40a6-af5c-2e493e8a4a59
CSeq: 7446662 INVITE
Contact: sip:1000@186.17.67.146:54391;ob;+sip.ice
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY,
REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Content-Type: application/sdp
Content-Length:  137

v=0
o=- 3772989711 3772989713 IN IP4 186.17.67.146
s=pjmedia
b=AS:117
t=0 0
a=X-nat:0
m=audio 0 RTP/AVP 0 101
c=IN IP4 127.0.0.1

--end msg--

When answering incoming call with RTP/AVP profile pjsip generates wrong sdp if at least one pjmedia_rtcp_fb_cap set to the account. 200/OK sdp from pjsip contains these lines: m=audio 0 RTP/AVP 0 96 c=IN IP4 127.0.0.1 When receiving such sdp remote server sends BYE immediately. Invite with RTP/SAVPF profile works with these settings. When pjmedia_rtcp_fb_cap not set pjsip correctly answers to the invite with RTP/AVP profile. ============ Account settings used (pjsip 2.9, TLS and UDP transport tested): acc_cfg.mediaConfig.rtcpMuxEnabled = true acc_cfg.natConfig.iceEnabled = true; acc_cfg.mediaConfig.srtpOpt.keyings.push_back(PJMEDIA_SRTP_KEYING_DTLS_SRTP); acc_cfg.mediaConfig.srtpOpt.keyings.push_back(PJMEDIA_SRTP_KEYING_SDES); acc_cfg.mediaConfig.srtpUse = PJMEDIA_SRTP_OPTIONAL; acc_cfg.mediaConfig.srtpSecureSignaling = 0; RtcpFbCap cap; cap.type = PJMEDIA_RTCP_FB_NACK; cap.codecId = "H264"; cap.param = "pli"; acc_cfg.mediaConfig.rtcpFbConfig.caps.push_back(cap); Incoming invite: INVITE sip:1000@186.17.67.204:5190 SIP/2.0 Via: SIP/2.0/UDP 186.17.67.175:5160;rport;branch=z9hG4bK8cZ5XgUSK3UZH Max-Forwards: 7 From: "l" <sip:19570488@186.17.67.175>;tag=HS4X211rv9c8D To: <sip:1000@186.17.67.204:5190> Call-ID: 4128449e-28f6-1238-2092-1cc1dee7574c CSeq: 7446652 INVITE Contact: <sip:mod_sofia@186.17.67.175:5160> User-Agent: FreeSWITCH-mod_sofia/1.8.7~64bit Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE Supported: timer, path, replaces Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, re r Privacy: none Content-Type: application/sdp Content-Disposition: session Content-Length: 222 X-FS-Support: update_display,send_info v=0 o=FreeSWITCH 1563957786 1563957787 IN IP4 186.17.67.175 s=FreeSWITCH c=IN IP4 186.17.67.175 t=0 0 m=audio 43102 RTP/AVP 0 101 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 OK from pjsip: SIP/2.0 200 OK Via: SIP/2.0/UDP 186.17.67.175:5160;rport=5160;branch=z9hG4bK8cZ5XgUSK3UZH From: "l" <sip:19570488@186.17.67.175>;tag=HS4X211rv9c8D To: <sip:1000@186.17.67.204:5190>;tag=X680y47rK3pyF Call-ID: 4128449e-28f6-1238-2092-1cc1dee7574c CSeq: 7446652 INVITE Contact: <sip:1000@186.17.67.204:5190;transport=udp> User-Agent: FreeSWITCH-mod_sofia/1.8.7~64bit Accept: application/sdp Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: path, replaces Allow-Events: talk, hold, conference, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 136 X-FS-Display-Name: Outbound Call X-FS-Display-Number: sip:1000@186.17.67.204 X-FS-Support: update_display,send_info v=0 o=- 3772989711 3772989713 IN IP4 186.17.67.146 s=pjmedia b=AS:117 t=0 0 a=X-nat:0 m=audio 0 RTP/AVP 0 96 c=IN IP4 127.0.0.1 Log does not contain anything interesting: pjsua_call.c !Answering call 0: code=200 inv0x9b8b2864 ..SDP negotiation done: Success pjsua_media.c ...Call 0: updating media.. pjsua_media.c .....Media stream call00:0 is destroyed srtp0x9c4cec00 ....SRTP not active pjsua_aud.c ....Audio channel update.. strm0x99bfe014 .....VAD temporarily disabled strm0x99bfe014 .....Encoder stream started strm0x99bfe014 .....Decoder stream started pjsua_media.c ....Audio updated, stream #0: PCMU (sendrecv) virtual void _PjCall::onCallMediaState(pj::OnCallMediaStateParam &) pjsua_core.c ....TX 809 bytes Response msg 200/INVITE/cseq=7446662 (tdta0x9b8b8064) to UDP 186.17.67.204:5060: SIP/2.0 200 OK Via: SIP/2.0/UDP 186.17.67.204;rport=5060;received=186.17.67.204;branch=z9hG4bK3pyUU49j1NXrm Call-ID: 4cb2c111-28f6-1238-aca7-826d5e9fa7cf From: "l" <sip:19570488@186.17.67.204>;tag=Spy1Fpc5XctHD To: <sip:1000@186.17.67.146;ob>;tag=1b6672c0-06b6-40a6-af5c-2e493e8a4a59 CSeq: 7446662 INVITE Contact: <sip:1000@186.17.67.146:54391;ob>;+sip.ice Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Supported: replaces, 100rel, timer, norefersub Content-Type: application/sdp Content-Length: 137 v=0 o=- 3772989711 3772989713 IN IP4 186.17.67.146 s=pjmedia b=AS:117 t=0 0 a=X-nat:0 m=audio 0 RTP/AVP 0 101 c=IN IP4 127.0.0.1 --end msg--