Latest Asterisk SIP/SDP

Currently, I am trying to figure out where in the source code the initial SDP information is built / parsed from a local endpoint - can anyone point me in the right direction? I’ve been digging around the PJPROJECT source code in files such as sdp_neg, sip_inv, and res_pjsip_session but i cant quite stumble upon the method which first parses the media attribute data.

Essentially, the problem is that the SDP information from an inbound offer from one of our local webRTC endpoints is being stripped of a lot of H264 codec information and I just want to figure out where this process is occurring.

I can provide more details if needed.

Thanks!

If you are using chan_pjsip then it would be res_pjsip_sdp_rtp that examines the parsed information and uses it. In the case of media with fmtp then it would call to ast_format_parse_sdp_fmtp to parse the information and store it in a format structure. This then calls into the res_format_attr_h264 module which does the actual parsing. That module also generates it.

I am also seeing this problem:
Alice calls bob and her WebRTC endpoint sends this SDP to asterisk:

Blockquote
INVITE ****************** SIP/2.0
Via: SIP/2.0/WSS p816aj7ul00l.invalid;branch=z9hG4bK6177205
Max-Forwards: 69
To:
From: “ALICE” sip:ALICE;tag=4ccgnhirmm
Call-ID: 84kchtcb14nubbd1ja5m
CSeq: 5730 INVITE
Authorization: Digest algorithm=MD5, username=“", realm="", nonce=“1522686891/f113059d581074be4b0ba16743c5e688”, uri="sip:”, response=“98d6b0114cf0ffa7ae1aef3f1a9e0c00”, opaque=“11872940472bae3f”, qop=auth, cnonce=“dsnb645pkr1g”, nc=00000001
Contact: sip:6voa95cn@p816aj7ul00l.invalid;transport=ws;ob
Content-Type: application/sdp
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO
Supported: ice,replaces,outbound
User-Agent: JsSIP 3.0.13
Content-Length: 5662
v=0
o=- 6084791532454367126 2 IN IP4 ********
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS ZGVKbB69ow9JTGIzi9Lyy25no7rZmniHabgp
m=audio 64617 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 *********
a=rtcp:64619 IN IP4 ***********
a=candidate:1270274445 1 udp 2113937151 ******** 64617 typ host generation 0 network-cost 50
a=candidate:2861920991 1 udp 2113932031 2001::******** 64618 typ host generation 0 network-cost 50
a=candidate:1270274445 2 udp 2113937150 ******** 64619 typ host generation 0 network-cost 50
a=candidate:2861920991 2 udp 2113932030 2001::******** 64620 typ host generation 0 network-cost 50
a=candidate:842163049 1 udp 1677729535 ******** 64617 typ srflx raddr 192.168.1.11 rport 64617 generation 0 network-cost 50
a=candidate:842163049 2 udp 1677729534 ******** 64619 typ srflx raddr 192.168.1.11 rport 64619 generation 0 network-cost 50
a=ice-ufrag:MscI
a=ice-pwd:d8snxaq1MO1BmtIQHDHpR37p
a=ice-options:trickle
a=fingerprint:sha-256 1D:3F:FC:3D:48:55:5A:49:F9:9F:B5:FF:DD:CF:49:77:BE:04:EF:0B:4C:54:F2:87:33:B4:07:96:BF:0E:5A:C1
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:1432469694 cname:xyIW4eZ5jgJIBuUi
a=ssrc:1432469694 msid:ZGVKbB69ow9JTGIzi9Lyy25no7rZmniHabgp 597e3f1b-e629-40e4-800b-23cbd5896ceb
a=ssrc:1432469694 mslabel:ZGVKbB69ow9JTGIzi9Lyy25no7rZmniHabgp
a=ssrc:1432469694 label:597e3f1b-e629-40e4-800b-23cbd5896ceb
m=video 64621 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 123 127 122 125 107 108 109 124
c=IN IP4 70.106.224.186
a=rtcp:64623 IN IP4 70.106.224.186
a=candidate:1270274445 1 udp 2113937151 ******** 64621 typ host generation 0 network-cost 50
a=candidate:2861920991 1 udp 2113932031 2001::******** 64622 typ host generation 0 network-cost 50
a=candidate:1270274445 2 udp 2113937150 ******** 64623 typ host generation 0 network-cost 50
a=candidate:2861920991 2 udp 2113932030 2001::******** 64624 typ host generation 0 network-cost 50
a=candidate:842163049 1 udp 1677729535 ******** 64621 typ srflx raddr ******** rport 64621 generation 0 network-cost 50
a=candidate:842163049 2 udp 1677729534 70.106.224.186 64623 typ srflx raddr ******** rport 64623 generation 0 network-cost 50
a=ice-ufrag:MscI
a=ice-pwd:d8snxaq1MO1BmtIQHDHpR37p
a=ice-options:trickle
a=fingerprint:sha-256 1D:3F:FC:3D:48:55:5A:49:F9:9F:B5:FF:DD:CF:49:77:BE:04:EF:0B:4C:54:F2:87:33:B4:07:96:BF:0E:5A:C1
a=setup:actpass
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=sendrecv
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 H264/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 H264/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:123 rtx/90000
a=fmtp:123 apt=102
a=rtpmap:127 H264/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=127
a=rtpmap:125 H264/90000
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 transport-cc
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 red/90000
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:124 ulpfec/90000
a=ssrc-group:FID 2014409090 2936216669
a=ssrc:2014409090 cname:xyIW4eZ5jgJIBuUi
a=ssrc:2014409090 msid:ZGVKbB69ow9JTGIzi9Lyy25no7rZmniHabgp 3b320974-8e7d-4760-91d6-cd96b2ab8c0b
a=ssrc:2014409090 mslabel:ZGVKbB69ow9JTGIzi9Lyy25no7rZmniHabgp
a=ssrc:2014409090 label:3b320974-8e7d-4760-91d6-cd96b2ab8c0b
a=ssrc:2936216669 cname:xyIW4eZ5jgJIBuUi
a=ssrc:2936216669 msid:ZGVKbB69ow9JTGIzi9Lyy25no7rZmniHabgp 3b320974-8e7d-4760-91d6-cd96b2ab8c0b
a=ssrc:2936216669 mslabel:ZGVKbB69ow9JTGIzi9Lyy25no7rZmniHabgp
a=ssrc:2936216669 label:3b320974-8e7d-4760-91d6-cd96b2ab8c0b

Asterisk then turns and sends this invite to Bob

Blockquote
Asterisk -> Provider phone
INVITE sip:BOB;user=phone SIP/2.0
Via: SIP/2.0/TCP ********:5060;rport;branch=z9hG4bKPj58ad755a-6317-4aa7-af23-79e174aaf26c;alias
From: “Asterisk” sip:Alice;user=phone;tag=1017ae3e-87bd-4611-bba1-5e885c02c07f
To: sip:BOB
Contact: sip:asterisk@:5060********;transport=TCP
Call-ID: 998fe6e7-3850-4a66-8c32-052cf95193f4
CSeq: 11340 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Call-Info: sip:******** , purpose=trs-user-ip
P-Asserted-Identity: “Asterisk” sip:Alice@asterisk;user=phone
Max-Forwards: 70
User-Agent: Asterisk PBX 15.3.0-rc1
Content-Type: application/sdp
Content-Length: 1153
v=0
o=- 739105350 739105350 IN IP4 ********
s=Asterisk
c=IN IP4 ********
t=0 0
m=audio 32812 RTP/AVP 0 101
a=ice-ufrag:22a82a936fd134c26514c2f155057017
a=ice-pwd:276b4e1303ac11bf6351f0372c03dcb0
a=candidate:Hac150160 1 UDP 2130706431 ******** 32812 typ host
a=candidate:S22c18a72 1 UDP 1694498815 ******** 32812 typ srflx raddr 172.21.1.96 rport 32812
a=candidate:Hac150160 2 UDP 2130706430 ******** 32813 typ host
a=candidate:S22c18a72 2 UDP 1694498814 ******** 32813 typ srflx raddr 172.21.1.96 rport 32813
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
m=video 10120 RTP/AVP 99
a=ice-ufrag:776e74477c735331750171c42b306a35
a=ice-pwd:46579f1f4a1b78c543ac6b7e4b8ba999
a=candidate:Hac150160 1 UDP 2130706431 ******** 10120 typ host
a=candidate:S22c18a72 1 UDP 1694498815 ******** 10120 typ srflx raddr ******** rport 10120
a=candidate:Hac150160 2 UDP 2130706430 ******** 10121 typ host
a=candidate:S22c18a72 2 UDP 1694498814 ******** 10121 typ srflx raddr ******** rport 10121
a=rtpmap:99 H264/90000
a=sendrecv

This is where the problem occurs (at least in Asterisk 15.3), the FMTP line is not constructed on the invite from Asterisk -> Bob and thus, Bob cannot respond properly.

@jcolp I think the behavior is similar to a previous Asterisk bug from 13.6, only this time with the h264 codec: https://issues.asterisk.org/jira/browse/ASTERISK-25535

JohnE1,

This is the EXACT issue we are facing as well. Have you made any progress in finding a resolution?

Jcolp - any thoughts?

Thanks!

It’s certainly possible that something is getting missed somewhere. I can’t really dive deeply into it. Best course of action would be an issue[1] with complete details and traces.

[1] https://issues.asterisk.org/jira