Olli Heiskanen
2014-Dec-05 16:46 UTC
[asterisk-users] Inbound call from sip peer to internal webrtc peer fails while internal sip-webrtc calls work
Hello, I'd appreciate your comments on the following problem I'm having, please forgive me if this is something obvious, I've been scratching my head on this for a while: I have Asterisk+Kamailio setup where I'm currently testing inbound calls from outside. I have both webrtc and sip clients, where webrtc peers are defined according to sip.js instructions ( http://sipjs.com/guides/server-configuration/asterisk/). Calls between these work nicely without problems. Now when I call from outside, from an external Asterisk 11.5 server, I end up having problems calling from a sip client to a webrtc client. The Asterisk I have on my main testing server is the latest current 11.14.1. When there's an internal call, Asterisk changes the sdp in the INVITE message and handles the rtp nicely, but it does not do so when the call comes from outside. Why not? Instead, it sends back 488 Not acceptable here. If I react to that in Kamailio and use rtpengine to rewrite the sdp, Asterisk accepts the INVITE and sends it to the websocket peer, but the sdp contains a very simple sdp with RTP/AVP profile. This I'd consider invalid behavior, since Asterisk knows the called party is webrtc and the INVITE already contains valid sdp with RTP/SAVPF profile. It's likely I have something wrong in my setup, or maybe I've overlooked something relevant? Question is, what is causing this behavior and what can I do to fix it? Either I'd need Asterisk to handle the sdp and rtp like it does for internal calls (which would be preferable in this case) or after the 488 sent by Asterisk I'd need Asterisk to relay the sdp offered by Kamailio/rtpengine as such without rewriting it. Here the call works fine (internal call from sip peer 771 to webrtc peer 660): INVITE that Asterisk (at port 5070) receives: PU.BL.IC.IP:5060 > PU.BL.IC.IP:5070: SIP, length: 1046 INVITE sip:660 at testers.com;transport=UDP SIP/2.0 Record-Route: <sip:PU.BL.IC.IP;lr=on;ftag=41030177> Via: SIP/2.0/UDP PU.BL.IC.IP;branch=z9hG4bKd7b.ca8b6ac6a82d605cf658af0fea7c9e86.0 Via: SIP/2.0/UDP AST.ER.ISK.IP:38699;rport=38699;branch=z9hG4bK-d8754z-bd00e9fd46368417-1---d8754z- Max-Forwards: 69 Contact: <sip:771 at AST.ER.ISK.IP:38699;transport=UDP> To: <sip:660 at testers.com;transport=UDP> From: "771"<sip:771 at testers.com;transport=UDP>;tag=41030177 Call-ID: YWYwMjMwMmZlODEwM2MwODdjZWJmYjc2NjM5ZmIyNzk. CSeq: 2 INVITE Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE Content-Type: application/sdp Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri User-Agent: Z 3.2.21357 r21367 Allow-Events: presence, kpml Content-Length: 239 v=0 o=Z 0 0 IN IP4 AST.ER.ISK.IP s=Z c=IN IP4 AST.ER.ISK.IP t=0 0 m=audio 8000 RTP/AVP 3 110 8 0 98 101 a=rtpmap:110 speex/8000 a=rtpmap:98 iLBC/8000 a=fmtp:98 mode=20 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=sendrecv Invite that Asterisk sends: PU.BL.IC.IP:5070 > PU.BL.IC.IP:5060: SIP, length: 1238 INVITE sip:660 at PU.BL.IC.IP:5060 SIP/2.0 Via: SIP/2.0/UDP PU.BL.IC.IP:5070;branch=z9hG4bK26a2386a;rport Max-Forwards: 70 From: "771 win8 minipc" <sip:771 at testers.com:5070>;tag=as05e60cc6 To: <sip:660 at PU.BL.IC.IP:5060> Contact: <sip:771 at PU.BL.IC.IP:5070> Call-ID: 7985f7161fcf1a6824b8388d451bec16 at testers.com CSeq: 102 INVITE User-Agent: I Am the Devil Date: Fri, 05 Dec 2014 15:50:33 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer Content-Type: application/sdp Content-Length: 663 v=0 o=root 777617621 777617621 IN IP4 PU.BL.IC.IP s=Asterisk PBX 11.14.1 c=IN IP4 PU.BL.IC.IP t=0 0 m=audio 15662 RTP/SAVPF 0 3 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:3 GSM/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=ice-ufrag:75a7e84431d15f682bd728ee10bd867d a=ice-pwd:028c19574216643c12188a8530f278f8 a=candidate:H5bdd423d 1 UDP 2130706431 PU.BL.IC.IP 15662 typ host a=candidate:H5bdd423d 2 UDP 2130706430 PU.BL.IC.IP 15663 typ host a=connection:new a=setup:actpass a=fingerprint:SHA-256 CE:EE:D9:28:EA:B0:6E:D0:CE:4F:5A:9A:FB:53:66:74:83:47:18:37:2F:76:C1:6D:10:C0:EE:FF:A4:56:F4:05 a=sendrecv Here the call fails (sip peer 201 calls from outside the server to webrtc peer 660): Invite that Asterisk receives: PU.BL.IC.IP:5060 > PU.BL.IC.IP:5070: SIP, length: 1345 INVITE sip:660%40testers.com at PU.BL.IC.IP SIP/2.0 Record-Route: <sip:PU.BL.IC.IP;lr=on;ftag=as4647f03c;nat=yes> Via: SIP/2.0/UDP PU.BL.IC.IP;branch=z9hG4bK3264.8a896801756c527f2496fdc14e3f30ad.0 Via: SIP/2.0/UDP 192.168.0.201:5060 ;rport=5060;received=AST.ER.ISK.IP;branch=z9hG4bK56f5698e Max-Forwards: 69 From: "Pirjo Ahvenainen" <sip:201 at 192.168.0.201>;tag=as4647f03c To: <sip:660%40testers.com at PU.BL.IC.IP> Contact: <sip:201 at 192.168.0.201:5060;alias=AST.ER.ISK.IP~5060~1> Call-ID: 69e66f05330de0063b5eba760191da6c at 192.168.0.201:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 11.5.0 Date: Tue, 02 Dec 2014 08:34:57 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH Supported: replaces, timer Content-Type: application/sdp Content-Length: 547 v=0 o=root 1854132825 1854132825 IN IP4 PU.BL.IC.IP s=Asterisk PBX 11.5.0 c=IN IP4 PU.BL.IC.IP t=0 0 a=ice-lite m=audio 12516 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=rtcp:12517 a=ice-ufrag:5vj2cfWg a=ice-pwd:OdPg0e2qmExbbvAXUTLT3NI8g28s a=candidate:dEk0op4jY8ZkdPXr 1 UDP 2130706431 PU.BL.IC.IP 12516 typ host a=candidate:dEk0op4jY8ZkdPXr 2 UDP 2130706430 PU.BL.IC.IP 12517 typ host And the INVITE the Asterisk sends: PU.BL.IC.IP:5070 > PU.BL.IC.IP:5060: SIP, length: 847 INVITE sip:660 at testers.com SIP/2.0 Via: SIP/2.0/UDP PU.BL.IC.IP:5070;branch=z9hG4bK6f718231 Max-Forwards: 70 From: "771 win8 minipc" <sip:201 at PU.BL.IC.IP:5070>;tag=as2931af14 To: <sip:660 at testers.com> Contact: <sip:201 at PU.BL.IC.IP:5070> Call-ID: 04a3975e3bc84e6e32bfdc1905791913 at PU.BL.IC.IP:5070 CSeq: 102 INVITE User-Agent: I Am the Devil Date: Fri, 05 Dec 2014 15:52:18 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer Content-Type: application/sdp Content-Length: 283 v=0 o=root 1272725383 1272725383 IN IP4 PU.BL.IC.IP s=Asterisk PBX 11.14.1 c=IN IP4 PU.BL.IC.IP t=0 0 m=audio 11906 RTP/AVP 0 3 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:3 GSM/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=sendrecv And how are my peers configured? The calling peer on the separate Asterisk server is configured quickly in sip.conf: [general] bindport = 5060 bindaddr = 0.0.0.0 tcpbindaddr = 0.0.0.0 tcpenable = yes limitonpeers = yes rtcachefriends = no tos_sip = cs3 tos_audio = ef [201] type = friend secret = myverysecretpassword context = mytestcontext callerid = "201 User" <201> host = dynamic port = 5060 disallow = all allow = alaw allow = ulaw allow = gsm qualify = yes nat = no canreinvite = no and the dial command is like this: exten => 666,n,Dial(SIP/PU.BL.IC.IP/660 at testers.com) And the called number 660 is in the realtime sippeers table: id: 4 type: friend name: 660 host: dynamic secret: NULL encryption: yes avpf: yes icesupport: yes ipaddr: PU.BL.IC.IP port: 5060 regseconds: 1417782175 defaultuser: 660 fullcontact: sip:660 at PU.BL.IC.IP:5060 lastms: 0 useragent: context: mytestnumbercontext directmedia: no deny: 0.0.0.0/0.0.0.0 permit: PU.BL.IC.IP nat: force_rport,comedia transport: ws,wss,udp language: NULL disallow: NULL allow: NULL force_avp: yes callerid: 660 test amaflags: NULL mailbox: NULL regexten: NULL regserver: fromdomain: testers.com videosupport: no contactpermit: NULL contactdeny: NULL fullname: 660 win8 subscribemwi: NULL dtlsenable: yes dtlsverify: no dtlscertfile: /etc/asterisk/keys/asterisk.pem dtlsprivatekey: /etc/asterisk/keys/asterisk.pem dtlssetup: actpass sippasswd: a84a4ddcda13d13c9573d5294047b6a2 rpid: NULL domain: testers.com sippasswd2: 5c4671ae1043e6116118fed39bee091a callbackextension: NULL insecure: NULL cheers, Olli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20141205/ae825dbf/attachment.html>
Gareth Blades
2014-Dec-05 16:53 UTC
[asterisk-users] Inbound call from sip peer to internal webrtc peer fails while internal sip-webrtc calls work
On 05/12/14 16:46, Olli Heiskanen wrote:> INVITE that Asterisk (at port 5070) receives: > PU.BL.IC.IP:5060 > PU.BL.IC.IP:5070: SIP, length: 1046 > INVITE sip:660 at testers.com > <mailto:sip%3A660 at testers.com>;transport=UDP SIP/2.0 > Record-Route: <sip:PU.BL.IC.IP;lr=on;ftag=41030177> > Via: SIP/2.0/UDP > PU.BL.IC.IP;branch=z9hG4bKd7b.ca8b6ac6a82d605cf658af0fea7c9e86.0 > Via: SIP/2.0/UDP > AST.ER.ISK.IP:38699;rport=38699;branch=z9hG4bK-d8754z-bd00e9fd46368417-1---d8754z- > Max-Forwards: 69 > Contact: <sip:771 at AST.ER.ISK.IP:38699;transport=UDP> > To: <sip:660 at testers.com <mailto:sip%3A660 at testers.com>;transport=UDP> > From: "771"<sip:771 at testers.com > <mailto:sip%3A771 at testers.com>;transport=UDP>;tag=41030177 > Call-ID: YWYwMjMwMmZlODEwM2MwODdjZWJmYjc2NjM5ZmIyNzk. > CSeq: 2 INVITE > Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, > INFO, SUBSCRIBE > Content-Type: application/sdp > Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri > User-Agent: Z 3.2.21357 r21367 > Allow-Events: presence, kpml > Content-Length: 239 > > v=0 > o=Z 0 0 IN IP4 AST.ER.ISK.IP > s=Z > c=IN IP4 AST.ER.ISK.IP > t=0 0 > m=audio 8000 RTP/AVP 3 110 8 0 98 101 > a=rtpmap:110 speex/8000 > a=rtpmap:98 iLBC/8000 > a=fmtp:98 mode=20 > a=rtpmap:101 telephone-event/8000 > a=fmtp:101 0-15 > a=sendrecvThis client is saying it only supports speex and iLBC and would prefer them in that order. Your sip.conf appears to only permit alaw, ulaw and gsm so there is no mutual supported codec and hence the call fails. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20141205/f2a38d33/attachment.html>
Olli Heiskanen
2014-Dec-05 19:03 UTC
[asterisk-users] Inbound call from sip peer to internal webrtc peer fails while internal sip-webrtc calls work
Hello, Thanks Gareth for your reply. I assume you're referring to the first INVITE in my message, which is from the call that works. I don't know why the sdp displays only iLBC and speex at that point but the Zoiper client that's making the call is configured to support gsm, speex, ulaw, alaw, and iLBC, and the call works fine, audio and all, as the sdp that leaves Asterisk (thus reaches the called peer) actually contains ulaw, gsm and alaw. In the failing case Asterisk sends the INVITE via Kamailio to the called webrtc client, and in this message the rtp profile is m=audio 12902 RTP/AVP 0 3 8 101. Kamailio sends the INVITE to the client, which responds with 488. Kamailio notices this and uses rtpengine to handle the rtp, but: the client will not accept a second INVITE even though the sdp is correct this time: the client responds with 482 Loop Detected because the Call-ID is the same as the previous INVITE it got. This is why I can't handle the rtp using rtpengine, and here things have already gone wrong. So I need the INVITE to contain correct sdp when it leaves Asterisk, so sdp conversion and rtpengine would net be needed. Wonder if there's any way to do that? cheers, Olli 2014-12-05 18:53 GMT+02:00 Gareth Blades <mailinglist+asterisk at dns99.co.uk>:> On 05/12/14 16:46, Olli Heiskanen wrote: > > INVITE that Asterisk (at port 5070) receives: > PU.BL.IC.IP:5060 > PU.BL.IC.IP:5070: SIP, length: 1046 > INVITE sip:660 at testers.com;transport=UDP SIP/2.0 > Record-Route: <sip:PU.BL.IC.IP;lr=on;ftag=41030177> > Via: SIP/2.0/UDP > PU.BL.IC.IP;branch=z9hG4bKd7b.ca8b6ac6a82d605cf658af0fea7c9e86.0 > Via: SIP/2.0/UDP > AST.ER.ISK.IP:38699;rport=38699;branch=z9hG4bK-d8754z-bd00e9fd46368417-1---d8754z- > Max-Forwards: 69 > Contact: <sip:771 at AST.ER.ISK.IP:38699;transport=UDP> > <sip:771 at AST.ER.ISK.IP:38699;transport=UDP> > To: <sip:660 at testers.com;transport=UDP> > From: "771"<sip:771 at testers.com;transport=UDP>;tag=41030177 > Call-ID: YWYwMjMwMmZlODEwM2MwODdjZWJmYjc2NjM5ZmIyNzk. > CSeq: 2 INVITE > Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, > SUBSCRIBE > Content-Type: application/sdp > Supported: replaces, norefersub, extended-refer, timer, > X-cisco-serviceuri > User-Agent: Z 3.2.21357 r21367 > Allow-Events: presence, kpml > Content-Length: 239 > > v=0 > o=Z 0 0 IN IP4 AST.ER.ISK.IP > s=Z > c=IN IP4 AST.ER.ISK.IP > t=0 0 > m=audio 8000 RTP/AVP 3 110 8 0 98 101 > a=rtpmap:110 speex/8000 > a=rtpmap:98 iLBC/8000 > a=fmtp:98 mode=20 > a=rtpmap:101 telephone-event/8000 > a=fmtp:101 0-15 > a=sendrecv > > > This client is saying it only supports speex and iLBC and would prefer > them in that order. > Your sip.conf appears to only permit alaw, ulaw and gsm so there is no > mutual supported codec and hence the call fails. > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20141205/a3685c6d/attachment.html>
Reasonably Related Threads
- Inbound call from sip peer to internal webrtc peer fails while internal sip-webrtc calls work
- Asterisk removes ice lines in sdp when calling between webrtc clients
- Letting rtp profiles be handled by rtpengine instead of Asterisk
- Rejecting secure audio stream without encryption details - when using ws clients and Kamailio integration
- Asterisk rejects sdp from webrtc client