sipwise / rtpengine

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

rtpengine with kamailio #240

Open janfuri opened 8 years ago

janfuri commented 8 years ago

Hi all, I am not sure if it is a bug or not, but Im struggling with incoming calls to webrtc clients using rtpengine. My setup : incoming call -> MediaServer (freeswitch) -> SIP & Websocket proxy (Kamailio + Rtpengine) -> webRTC clients

I am trying to change INVITE's SDP using rtpengine from RTP/AVP or RTP/SAVP to RTP/SAVPF towards my webrtc clients. This works well.

But if I send INVITE with SDP that includes RTP/AVP and RTP/SAVP together, rtpengine creates incorrect SDP. It includes twice m=audio RTP/SAVPF and my WebRTC client does not like this INVITE and forbiddeds it by 488 Not Acceptable Here.

Example of an incorrect INVITE :

Content-Type: application/sdp Content-Disposition: session Content-Length: 1393 v=0 o=SBC 1464238673 1464238674 IN IP4 s=SBC c=IN IP4 t=0 0 m=audio 30454 RTP/SAVPF 102 9 8 0 3 18 a=rtpmap:102 SILK/8000 a=fmtp:102 useinbandfec=1; usedtx=0 a=rtpmap:9 G722/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:3 GSM/8000 a=rtpmap:18 G729/8000 a=ptime:20 a=sendrecv a=rtcp:30455 a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:5X2wgU83bIwrwkHSymjnw48SiMGa1n+eIl50yr99 a=setup:actpass a=fingerprint:sha-1 11:76:2D:2A:F7:0D:5A:23:9D:F6:0C:E7:4C:DF:1E:CB:BF:5D:76:88 a=ice-ufrag:iglHZqry a=ice-pwd:eyVXbFNoviYYlu5uuRZlnixFwQ a=candidate:cE0FGbXWIfwj6OGD 1 UDP 2130706431 30454 typ host a=candidate:cE0FGbXWIfwj6OGD 2 UDP 2130706430 30455 typ host m=audio 30484 RTP/SAVPF 102 9 8 0 3 18 a=rtpmap:102 SILK/8000 a=fmtp:102 useinbandfec=1; usedtx=0 a=rtpmap:9 G722/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:3 GSM/8000 a=rtpmap:18 G729/8000 a=ptime:20 a=sendrecv a=rtcp:30485 a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:ozDJ3G/wmaYedQbcTafbhaTIt6raIJa6ugrLUC99 a=setup:actpass a=fingerprint:sha-1 11:76:2D:2A:F7:0D:5A:23:9D:F6:0C:E7:4C:DF:1E:CB:BF:5D:76:88 a=ice-ufrag:gM1viWqu a=ice-pwd:zdS4tP1Mj4hLTe6huBWYrhtI1s a=candidate:cE0FGbXWIfwj6OGD 1 UDP 2130706431 30484 typ host a=candidate:cE0FGbXWIfwj6OGD 2 UDP 2130706430 30485 typ host

Could you guys help me with this issue ?

janfuri commented 8 years ago

I have not mentioned but I use the latest version of rtpengine

rfuchs commented 8 years ago

What does the original invite (before rtpengine rewrite) look like?

janfuri commented 8 years ago

INVITE sip:0042xxxxxxxx@:5060 SIP/2.0. Via: SIP/2.0/UDP ;rport;branch=z9hG4bKKe7mN1gy9erXr. Max-Forwards: 65. From: "0042xxxxxxxxxxxxx" sip:0042xxxxxxxxxxx@domain.xy;tag=jQeSjX3XHNUKg. To: sip:0042xxxxxxxxxx@. Call-ID: f689dfd5-8c56-4c29-8de8-2d380b46f076. CSeq: 91800866 INVITE. Contact: sip:mod_sofia@. User-Agent: SBC. Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY. Supported: timer, path, replaces. Allow-Events: talk, hold, conference, refer. Content-Type: application/sdp. Content-Disposition: session. Content-Length: 1316. X-VM-ID-TO: someID. X-VM-TRANSFER-ENABLED: 1. X-FS-Support: update_display,send_info. . v=0. o=SBC 1464241895 1464241896 IN IP4 . s=SBC. c=IN IP4 . t=0 0. m=audio 31966 RTP/SAVP 8 0 9 3 18. a=rtpmap:8 PCMA/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:9 G722/8000. a=rtpmap:3 GSM/8000. a=rtpmap:18 G729/8000. a=rtcp:31967 IN IP4 . a=crypto:1 AEAD_AES_256_GCM_8 inline:EikYVGh7GiZaN7sBMqvgt2DkAwuwrBH6gyoKTxnjRu3W/UleArQMZg3txZ0. a=crypto:2 AEAD_AES_128_GCM_8 inline:PYFwCegBXgaSPKXSP0+/ykAn0zsy5hkkbL62AA. a=crypto:3 AES_CM_256_HMAC_SHA1_80 inline:JC7rRkgwACB/nLfkcsPiAI7SVP9hGCtp7VDUlspJal+H6yLwCX788IraQ9NbAQ. a=crypto:4 AES_CM_192_HMAC_SHA1_80 inline:rR9zfBMpH/kAOwZdKVH4A+gk1hZWhy8KM0cH7JfDSEaucKqYwu4. a=crypto:5 AES_CM_128_HMAC_SHA1_80 inline:WWof3BxKTlK9jUKmfkTmEdDi0j4Vj/n0nESAqKNE. a=crypto:6 AES_CM_256_HMAC_SHA1_32 inline:g+p3Y4oK00AExVX1irz50NcoTacvpKd8mgoYjIaOf+LhLxGCcQUT40zSo+yUig. a=crypto:7 AES_CM_192_HMAC_SHA1_32 inline:COXK6tAaEvOWpLBYdESitnCIhGHAxe+lW7X3W0xpo7ilXbTJRjs. a=crypto:8 AES_CM_128_HMAC_SHA1_32 inline:u+NcuuPA+80glATBDGZlLzt0yOkoVTkO6sO6YJD8. a=crypto:9 AES_CM_128_NULL_AUTH inline:Sw44yN/OJZhFWmzUenLnvjLGDMT0svkm57bC4USY. a=ptime:20. m=audio 31966 RTP/AVP 8 0 9 3 18. a=rtpmap:8 PCMA/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:9 G722/8000. a=rtpmap:3 GSM/8000. a=rtpmap:18 G729/8000. a=rtcp:31967 IN IP4 . a=ptime:20.

rfuchs commented 8 years ago

So there's two audio m= lines in, and two audio m= lines out. What's the expected behaviour here?

janfuri commented 8 years ago

to allow a sip client to choose whether he wants to use RTP media or SRTP.

rfuchs commented 8 years ago

I mean expected behaviour for rtpengine. There's two audio m= lines and it rewrites both to RTP/SAVPF. What else is it supposed to do?

janfuri commented 8 years ago

oh sorry, my bad ;)

if it is RTP/SAVPF I guess there must be only 1 audio m line

rfuchs commented 8 years ago

Removal of media streams from the SDP is not a supported feature right now, especially since rtpengine has no way of knowing that this is what it's supposed to do. Is this "multiple choice" type SDP documented in some RFC or is it something implied by this particular RTP endpoint?

janfuri commented 8 years ago

I am afraid that I cant answer whether it is in any RFC but what I fount out is that Chrome does not like double audio m lines. On Firefox it works well (I would say, It works now).

rfuchs commented 8 years ago

At this point I can only suggest to find a way to keep your RTP client from sending double m= audio lines and instead stick to one only (either RTP or SRTP)

janfuri commented 8 years ago

Ok Richard, thx

janfuri commented 8 years ago

fyi, I have not found any info in any RFC that says it is not allowed to have more that 1 "proto" parameter. Therefore I guess I will have to ask the other side why Chrome does not like this kind of SDP. If I find any info. I will keep you updated even if it is not rtpengine issue. If you don't mind it of course ;)

oej commented 8 years ago

You can have double m= lines, but not pointing to the very same port. In that case you have to use other syntaxes if you want the other device to pick one but only one media setup.

janfuri commented 8 years ago

Mr. Johansson, What do you thing, where I should ask for resolving the issue? Which device is suppose to deal with it ? Is that my freeswitch (a media server) or is it rtpengine ?

oej commented 8 years ago

Was it a freeswitch server? Then talk with them. Say hi from me!

janfuri commented 8 years ago

Could you please help me with finding this in RFC ? Because I am sure, they won't deal with it before it is written in documentations. If I showed them the RFC I would be able to report this as a bug.