Inbound Call From Sip Peer To Internal Webrtc Peer Fails While Internal Sip-webrtc Calls Work

Home » Asterisk Users » Inbound Call From Sip Peer To Internal Webrtc Peer Fails While Internal Sip-webrtc Calls Work
Asterisk Users 2 Comments

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@testers.com;transport=UDP SIP/2.0
Record-Route:
Via: SIP/2.0/UDP
PU.BL.IC.IP;branch=z9hG4bKd7b.ca8b6ac6a82d605cf658af0fea7c9e86.0
Via: SIP/2.0/UDP
AST.ER.ISK.IP:38699;rport8699;branch=z9hG4bK-d8754z-bd00e9fd46368417-1—d8754z-
Max-Forwards: 69
Contact:
To:
From: “771”;tagA030177
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 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@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” ;tag=as05e60cc6
To:
Contact:
Call-ID: 7985f7161fcf1a6824b8388d451bec16@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

2 thoughts on - Inbound Call From Sip Peer To Internal Webrtc Peer Fails While Internal Sip-webrtc Calls Work

  • 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.

  • 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 :