Session description is NULL

Hi,
I’ve got a problem when trying to set a remote description. I get SessionDescription is Null exception. I am 100% positive that the message is not null. From what I’ve researched it is a problem with the SDP message, but I cannot figure out what is wrong.
My only guess is that some messages look like a=null or a=. I could remove them from the SDP, but what about cases like m=null 1 RTP/AVPF null or a=fmtp:111 minptime= null; useinbandfec= null should I remove them entirely?
If there are some rules to creating sdp let me know.
There are 2 sdps that I’m trying to set as a remote description.

v=0
o=- 1599645812365 2 IN IP4 0.0.0.0
s=-
t=0 0
a=group:BUNDLE audio video
a=null
a=null
m=
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=mid:audio
a=null
m=null 1 RTP/AVPF null
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=mid:video
m=audio 1 RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtpmap:111 opus/48000/2
a=rtpmap:103 ISAC/16000/1
a=rtpmap:104 ISAC/32000/1
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000/1
a=rtpmap:8 PCMA/8000/1
a=rtpmap:106 CN/32000/1
a=rtpmap:105 CN/16000/1
a=rtpmap:13 CN/8000/1
a=rtpmap:110 telephone-event/48000/1
a=rtpmap:112 telephone-event/32000/1
a=rtpmap:113 telephone-event/16000/1
a=rtpmap:126 telephone-event/8000/1
a=fmtp:111 minptime= null; useinbandfec= null
a=rtcp:1 IN IP4 0.0.0.0
a=rtcp-fb:111 transport-cc
a=rtcp-fb:* transport-cc
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=setup:actpass
a=mid:audio
a=sendrecv
a=ice-ufrag:9pcU
a=fingerprint:sha-256 B2:A7:42:0D:39:89:8C:FE:21:9B:8B:4E:78:53:DA:2A:DF:B2:ED:FD:D6:CE:2D:63:B6:5C:42:C4:BA:16:F1:51
a=candidate:1514567149 1 udp 2122260223 192.168.0.162 63402 typ host generation 0
a=ssrc:2356578568 cname:etiJo6PeeabKxu11-5
a=ssrc:2356578568 msid:8aa6ace8-e701-4d28-b33e-4c948b9ec024-5 2c1b5dce-924b-4661-b01d-af3c33762680-5
a=ssrc:2356578568 mslabel:8aa6ace8-e701-4d28-b33e-4c948b9ec024-5
a=ssrc:2356578568 label:2c1b5dce-924b-4661-b01d-af3c33762680-5
a=rtcp-mux
a=null
m=video 1 RTP/SAVPF 102 96 97 98 99 100 101 122 121 127 120 125 107 108 109 124 119 123
c=IN IP4 0.0.0.0
a=rtpmap:102 H264/90000/1
a=rtpmap:96 VP8/90000/1
a=rtpmap:97 rtx/90000/1
a=rtpmap:98 VP9/90000/1
a=rtpmap:99 rtx/90000/1
a=rtpmap:100 VP9/90000/1
a=rtpmap:101 rtx/90000/1
a=rtpmap:122 VP9/90000/1
a=rtpmap:121 rtx/90000/1
a=rtpmap:127 H264/90000/1
a=rtpmap:120 rtx/90000/1
a=rtpmap:125 H264/90000/1
a=rtpmap:107 rtx/90000/1
a=rtpmap:108 H264/90000/1
a=rtpmap:109 rtx/90000/1
a=rtpmap:124 red/90000/1
a=rtpmap:119 rtx/90000/1
a=rtpmap:123 ulpfec/90000/1
a=fmtp:102 level-asymmetry-allowed= null; packetization-mode= null; profile-level-id= null
a=fmtp:97 apt= null
a=fmtp:98 profile-id= null
a=fmtp:99 apt= null
a=fmtp:100 profile-id= null
a=fmtp:101 apt= null
a=fmtp:122 profile-id= null
a=fmtp:121 apt= null
a=fmtp:127 level-asymmetry-allowed= null; packetization-mode= null; profile-level-id= null
a=fmtp:120 apt= null
a=fmtp:125 level-asymmetry-allowed= null; packetization-mode= null; profile-level-id= null
a=fmtp:107 apt= null
a=fmtp:108 level-asymmetry-allowed= null; packetization-mode= null; profile-level-id= null
a=fmtp:109 apt= null
a=fmtp:119 apt= null
a=rtcp:1 IN IP4 0.0.0.0
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=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=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=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=rtcp-fb:122 goog-remb
a=rtcp-fb:122 transport-cc
a=rtcp-fb:122 ccm fir
a=rtcp-fb:122 nack
a=rtcp-fb:122 nack pli
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=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=rtcp-fb:108 goog-remb
a=rtcp-fb:108 transport-cc
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* goog-remb
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:13 urn:3gpp:video-orientation
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=setup:actpass
a=mid:video
a=sendrecv
a=ice-ufrag:9pcU
a=fingerprint:sha-256 B2:A7:42:0D:39:89:8C:FE:21:9B:8B:4E:78:53:DA:2A:DF:B2:ED:FD:D6:CE:2D:63:B6:5C:42:C4:BA:16:F1:51
a=rtcp-mux
a=null

v=0
o=- 1599656604280 2 IN IP4 0.0.0.0
s=-
t=0 0
a=group:BUNDLE audio video
a=null
a=null
m=
c=IN IP4 0.0.0.0
a=rtpmap:111 opus/48000/2
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:126 telephone-event/8000
a=fmtp:111 minptime= null; useinbandfec= null
a=rtcp:1 IN IP4 0.0.0.0
a=rtcp-fb:111 transport-cc
a=rtcp-fb:* transport-cc
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=setup:actpass
a=mid:audio
a=sendrecv
a=ice-ufrag:6gfk31ehpf9l4n
a=fingerprint:sha-256 A3:EC:3E:18:7F:41:5A:7A:C5:5E:B0:52:64:1A:8C:5D:7A:41:1F:B5:68:39:41:AC:3A:12:32:8B:BA:50:93:AA
a=candidate:1 1 udp 2130706431 172.31.34.3 10000 typ host generation 0
a=candidate:2 1 udp 1694498815 3.127.9.112 10000 typ srflx raddr 172.31.34.3 rport 10000 generation 0
a=ssrc:1254790540 cname:mixed
a=ssrc:1254790540 label:mixedlabelaudio0
a=ssrc:1254790540 msid:mixedmslabel mixedlabelaudio0
a=ssrc:1254790540 mslabel:mixedmslabel
a=ssrc:3051793926 cname:eti8IuZ8VuUSXV21-18
a=ssrc:3051793926 msid:8aa6ace8-e701-4d28-b33e-4c948b9ec024-18 2c1b5dce-924b-4661-b01d-af3c33762680-18
a=rtcp-mux
a=null
a=null
m=video 1 RTP/SAVPF 107 100 101
c=IN IP4 0.0.0.0
a=rtpmap:100 VP8/90000
a=rtpmap:107 H264/90000
a=rtpmap:101 VP9/90000
a=fmtp:100 x-google-start-bitrate= null
a=fmtp:107 x-google-start-bitrate= null; profile-level-id= null
a=fmtp:101 x-google-start-bitrate= null
a=rtcp:1 IN IP4 0.0.0.0
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 transport-cc
a=rtcp-fb:107 ccm fir
a=rtcp-fb:107 nack
a=rtcp-fb:107 nack pli
a=rtcp-fb:107 transport-cc
a=rtcp-fb:101 ccm fir
a=rtcp-fb:101 nack
a=rtcp-fb:101 nack pli
a=rtcp-fb:101 transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* transport-cc
a=rtcp-fb:* ccm fir
a=rtcp-fb:* nack
a=rtcp-fb:* nack pli
a=rtcp-fb:* transport-cc
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=setup:actpass
a=mid:video
a=sendrecv
a=ice-ufrag:6gfk31ehpf9l4n
a=fingerprint:sha-256 A3:EC:3E:18:7F:41:5A:7A:C5:5E:B0:52:64:1A:8C:5D:7A:41:1F:B5:68:39:41:AC:3A:12:32:8B:BA:50:93:AA
a=candidate:1 1 udp 2130706431 172.31.34.3 10000 typ host generation 0
a=candidate:2 1 udp 1694498815 3.127.9.112 10000 typ srflx raddr 172.31.34.3 rport 10000 generation 0
a=ssrc:1679656930 cname:mixed
a=ssrc:1679656930 label:mixedlabelvideo0
a=ssrc:1679656930 msid:mixedmslabel mixedlabelvideo0
a=ssrc:1679656930 mslabel:mixedmslabel
a=rtcp-mux
a=null
m=null 1 RTP/AVPF null
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=mid:audio
m=null 1 RTP/AVPF null
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=mid:video

@damencho @saghul can you give any tips what can be wrong ?

The SDP is all kinds of wrong. The media types are missing in the RTP/APVF lines, a=null is just nothing, and there are a few m= empty lines. Whatever is generating that SDP is doing it wrong.

@saghul Do you have some validator that can help me fix this? Some examples would be helpful, at least for comparing. Or some type of instruction for creating SDP ?
In SDP.jingle2media I get sometimes null description that’s why this
m=null 1 RTP/AVPF null
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=mid:audio
looks like because let tmp = { media: desc.attr('media') }; gets null for ‘media’ and at that point I’am not sure if I should include this or not.

You can use these tests as a base: https://github.com/jitsi/lib-jitsi-meet/blob/master/modules/xmpp/SDP.spec.js