sipwise / rtpengine

The Sipwise media proxy for Kamailio
GNU General Public License v3.0
787 stars 370 forks source link

SDP Parsing Error in Chrome #1128

Closed n8twj closed 3 years ago

n8twj commented 3 years ago

Hi - Running CentOS 7.9 with a manually compiled mr9.1.1.2 tagged version with Kernel extension.

We are attempting to call from a SIP.js client using Websockets via kamailio+RTPEngine to an SBC hosted on a private network. SIP.js clients will be on the "public" interface and SBC is on the "private" interface, as defined interfaces in the rtpengine configuration.

Calls from Websocket to/from Websocket/TLS/UDP/TCP clients via RTPEngine work as expected/no issues. When we attempt to call out to the PSTN, via the SBC, SIP.js returns a 488 - Not Acceptable Here. Chrome also complains about "Failed to parse SessionDescription. Failed to parse audio codecs correctly." in the javascript console.

The only thing we can find as being "wrong" is the fact that the SDP that gets sent to the WebSocket client defines "a=rtcp-fb:111 transport-cc" but only offers Codec 0 in the M line: "m=audio 50010 UDP/TLS/RTP/SAVPF 0"

Here is the INVITE from SIP.js:

INVITE sip:+12487...@illumy.com SIP/2.0 Via: SIP/2.0/WSS 4p699813jcvv.invalid;branch=z9hG4bK7278145 To: sip:+12487...@illumy.com From: "jer...@stage.illumy.com" sip:jer...@stage.illumy.com;tag=9r52q35le2 CSeq: 2 INVITE Call-ID: 9t2muhfd39ocltbjjq1b Max-Forwards: 70 Proxy-Authorization: Digest algorithm=MD5, username="foo", realm="stage.illumy.com", nonce="X8mw3l/JsKIRBFRpCNlaqpaG7F4+exgjLnatI7E/CpbSpMckIUWDvF6OgwqA", uri="sip:+12487...@illumy.com", response="bcc8567b1aefe06b7d0c3e0c4ea862bf" phone: true Contact: sip:87dr...@4p699813jcvv.invalid;transport=ws;ob Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER Supported: outbound User-Agent: jer...@stage.illumy.com Content-Type: application/sdp Content-Length: 2617

v=0 o=- 3991796062834646556 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE 0 a=msid-semantic: WMS gMY5EobH7EOLjyaRaZH9oNeFujiMFjhciVl2 m=audio 60188 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126 c=IN IP4 10.42.0.8 a=rtcp:9 IN IP4 0.0.0.0 a=candidate:2109231183 1 tcp 1518280447 100.64.0.2 9 typ host tcptype active generation 0 network-id 2 network-cost 50 a=candidate:16903578 1 tcp 1518214911 10.0.0.9 9 typ host tcptype active generation 0 network-id 1 a=candidate:859548863 1 udp 2122260223 100.64.0.2 53874 typ host generation 0 network-id 2 network-cost 50 a=candidate:1333924202 1 udp 2122194687 10.0.0.9 62687 typ host generation 0 network-id 1 a=candidate:1894053187 1 udp 1685987071 24.231.252.173 62687 typ srflx raddr 10.0.0.9 rport 62687 generation 0 network-id 1 a=candidate:3491375699 1 udp 1686052607 204.89.189.219 53874 typ srflx raddr 100.64.0.2 rport 53874 generation 0 network-id 2 network-cost 50 a=candidate:4119938982 1 udp 41885439 10.42.0.8 60188 typ relay raddr 204.89.189.219 rport 53874 generation 0 network-id 2 network-cost 50 a=candidate:3778874972 1 udp 41819903 204.89.189.216 50040 typ relay raddr 24.231.252.173 rport 62687 generation 0 network-id 1 a=ice-ufrag:eIsX a=ice-pwd:wSgkpFITfYTTzd7rCJAVKujU a=ice-options:trickle a=fingerprint:sha-256 13:73:DA:5B:A0:3E:91:36:40:B9:F9:E6:53:93:4D:CC:7F:5F:A4:49:35:7E:AE:25:ED:50:F2:CA:B9:DF:9A:26 a=setup:actpass a=mid:0 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=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id a=sendrecv a=msid:gMY5EobH7EOLjyaRaZH9oNeFujiMFjhciVl2 c414d569-dc6e-4776-83d9-2dbdd7ebf341 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:2981223395 cname:JLmCNdeYxonEBZ+F a=ssrc:2981223395 msid:gMY5EobH7EOLjyaRaZH9oNeFujiMFjhciVl2 c414d569-dc6e-4776-83d9-2dbdd7ebf341 a=ssrc:2981223395 mslabel:gMY5EobH7EOLjyaRaZH9oNeFujiMFjhciVl2 a=ssrc:2981223395 label:c414d569-dc6e-4776-83d9-2dbdd7ebf341

183 Back from SBC (carrier):

SIP/2.0 183 Session Progress Record-Route: <sip:10.42.0.3;r2=on;lr=on;ftag=l3m7avnf9s;nat=yes> Record-Route: <sip:204.89.189.214:443;transport=ws;r2=on;lr=on;ftag=l3m7avnf9s;nat=yes> Via: SIP/2.0/WSS 4p699813jcvv.invalid;rport=56823;received=24.231.252.173;branch=z9hG4bK2340602 To: sip:+12487...@illumy.com;tag=3A350177-5FC9B7E0000077B2-B91F3700 From: "jer...@stage.illumy.com" sip:jer...@stage.illumy.com;tag=l3m7avnf9s CSeq: 2 INVITE Call-ID: 9t2mu8ocbrn1alm9f6k8 User-Agent: Orchid 2.6.54.109 Supported: 100rel,replaces Allow: PRACK,BYE,CANCEL,ACK,INVITE,SUBSCRIBE,PUBLISH,REGISTER,NOTIFY,REFER,INFO,MESSAGE,UPDATE,OPTIONS Contact: sip:3A350177-5FC9B7E0...@10.42.0.26;transport=udp Content-Type: application/sdp Content-Length: 743

v=0 o=- 128014 28014 IN IP4 204.89.189.214 s=- c=IN IP4 204.89.189.214 t=0 0 a=ice-lite m=audio 51484 UDP/TLS/RTP/SAVPF 0 a=rtcp-fb:111 transport-cc a=ssrc:3518926492 cname:R2ai+pStRLcEDFud a=ssrc:3518926492 msid:GSmIBGOgN1z0AerwpQcahcx8h4BMTp7LJjM1 3119655e-9b42-41fa-bc6f-111314a4af58 a=ssrc:3518926492 mslabel:GSmIBGOgN1z0AerwpQcahcx8h4BMTp7LJjM1 a=ssrc:3518926492 label:3119655e-9b42-41fa-bc6f-111314a4af58 a=ice-ufrag:5+C9HfNJxi3mlV a=ice-pwd:eWaTT4qZi5SUKo5zQtrdeIOPv1+qrz a=candidate:z 1 UDP 659136 10.42.0.26 10798 typ host a=candidate:z 2 UDP 659134 10.42.0.26 10799 typ host a=mid:0 a=rtpmap:0 PCMU/8000 a=sendrecv a=rtcp:51484 a=rtcp-mux a=candidate:UqgAI1GUm2olBKRP 1 UDP 659455 204.89.189.214 51484 typ host

Then the 200 OK:

SIP/2.0 200 OK Record-Route: <sip:10.42.0.3;r2=on;lr=on;ftag=l3m7avnf9s;nat=yes> Record-Route: <sip:204.89.189.214:443;transport=ws;r2=on;lr=on;ftag=l3m7avnf9s;nat=yes> Via: SIP/2.0/WSS 4p699813jcvv.invalid;rport=56823;received=24.231.252.173;branch=z9hG4bK2340602 To: sip:+12487...@illumy.com;tag=3A350177-5FC9B7E0000077B2-B91F3700 From: "jer...@stage.illumy.com" sip:jer...@stage.illumy.com;tag=l3m7avnf9s CSeq: 2 INVITE Call-ID: 9t2mu8ocbrn1alm9f6k8 User-Agent: Orchid 2.6.54.109 Supported: 100rel,replaces Allow: PRACK,BYE,CANCEL,ACK,INVITE,SUBSCRIBE,PUBLISH,REGISTER,NOTIFY,REFER,INFO,MESSAGE,UPDATE,OPTIONS Contact: sip:3A350177-5FC9B7E0...@10.42.0.26;transport=udp Content-Type: application/sdp Content-Length: 743

v=0 o=- 128014 28014 IN IP4 204.89.189.214 s=- c=IN IP4 204.89.189.214 t=0 0 a=ice-lite m=audio 51484 UDP/TLS/RTP/SAVPF 0 a=rtcp-fb:111 transport-cc a=ssrc:3518926492 cname:R2ai+pStRLcEDFud a=ssrc:3518926492 msid:GSmIBGOgN1z0AerwpQcahcx8h4BMTp7LJjM1 3119655e-9b42-41fa-bc6f-111314a4af58 a=ssrc:3518926492 mslabel:GSmIBGOgN1z0AerwpQcahcx8h4BMTp7LJjM1 a=ssrc:3518926492 label:3119655e-9b42-41fa-bc6f-111314a4af58 a=ice-ufrag:5+C9HfNJxi3mlV a=ice-pwd:eWaTT4qZi5SUKo5zQtrdeIOPv1+qrz a=candidate:z 1 UDP 659136 10.42.0.26 10798 typ host a=candidate:z 2 UDP 659134 10.42.0.26 10799 typ host a=mid:0 a=rtpmap:0 PCMU/8000 a=sendrecv a=rtcp:51484 a=rtcp-mux a=candidate:UqgAI1GUm2olBKRP 1 UDP 659455 204.89.189.214 51484 typ host

We receive an ACK and then an immediate BYE:

BYE sip:3A350177-5FC9B7E0...@10.42.0.26;transport=udp SIP/2.0 Route: <sip:204.89.189.214:443;transport=ws;r2=on;lr=on;ftag=l3m7avnf9s;nat=yes> Route: <sip:10.42.0.3;r2=on;lr=on;ftag=l3m7avnf9s;nat=yes> Via: SIP/2.0/WSS 4p699813jcvv.invalid;branch=z9hG4bK8448615 To: sip:+12487...@illumy.com;tag=3A350177-5FC9B7E0000077B2-B91F3700 From: "jer...@stage.illumy.com" sip:jer...@stage.illumy.com;tag=l3m7avnf9s CSeq: 3 BYE Call-ID: 9t2mu8ocbrn1alm9f6k8 Max-Forwards: 70 Reason: SIP;cause=488;text="Not Acceptable Here" Supported: outbound User-Agent: jer...@stage.illumy.com Content-Length: 0

Here is the relevant kamailio.cfg natmanage:

   $xavp(r=>$T_branch_idx) = "replace-origin replace-session-connection";
if (is_request()) {
    if (!has_totag()) {
        if (!t_is_failure_route()) {
            $avp(extra_id) = @via[1].branch + $T_branch_idx;
            $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " via-branch=extra";
        }
    }
}
if (is_reply()) {
    $avp(extra_id) = @via[2].branch + $T_branch_idx;
    $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " via-branch=extra";
}
if (isbflagset(FLB_PSTN)) {
    if ($proto =~ "ws") {
        xlog("L_INFO", "[R-NATMANAGE]: Web to SIP\n");
        $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " rtcp-mux-demux direction=public direction=private ICE=remove DTLS=off SDES=off RTP/AVP";
    } else {
        xlog("L_INFO", "[R-NATMANAGE]: SIP to Web\n");
        $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " rtcp-mux-offer direction=private direction=public ICE=remove SDES-off UDP/TLS/RTP/SAVPF";
    }
}
    xlog("L_INFO", "[R-NATMANAGE]: branch_id:$T_branch_idx ruri: $ru, proto: $proto, method:$rm, status:$rs, extra_id: 
   $avp(extra_id), rtpengine_manage: $xavp(r=>$T_branch_idx)\n");
   rtpengine_manage($xavp(r=>$T_branch_idx));

Relevant Syslog output:

Dec 6 14:37:14 proxy2-iad /usr/sbin/kamailio[17311]: INFO: Githubissues.

  • Githubissues is a development platform for aggregating issues.