<div dir="ltr"><div><br></div><div>Hello,</div><div><br></div><div>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:</div><div><br></div><div>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 (<a href="http://sipjs.com/guides/server-configuration/asterisk/">http://sipjs.com/guides/server-configuration/asterisk/</a>). 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.</div><div><br></div><div>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?</div><div><br></div><div>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.</div><div><br></div><div><br></div><div>Here the call works fine (internal call from sip peer 771 to webrtc peer 660):</div><div><br></div><div>INVITE that Asterisk (at port 5070) receives:</div><div>PU.BL.IC.IP:5060 > PU.BL.IC.IP:5070: SIP, length: 1046</div><div><span class="" style="white-space:pre">   </span>INVITE <a href="mailto:sip%3A660@testers.com">sip:660@testers.com</a>;transport=UDP SIP/2.0</div><div><span class="" style="white-space:pre">  </span>Record-Route: <sip:PU.BL.IC.IP;lr=on;ftag=41030177></div><div><span class="" style="white-space:pre">  </span>Via: SIP/2.0/UDP PU.BL.IC.IP;branch=z9hG4bKd7b.ca8b6ac6a82d605cf658af0fea7c9e86.0</div><div><span class="" style="white-space:pre">  </span>Via: SIP/2.0/UDP AST.ER.ISK.IP:38699;rport=38699;branch=z9hG4bK-d8754z-bd00e9fd46368417-1---d8754z-</div><div><span class="" style="white-space:pre">        </span>Max-Forwards: 69</div><div><span class="" style="white-space:pre">   </span>Contact: <sip:771@AST.ER.ISK.IP:38699;transport=UDP></div><div><span class="" style="white-space:pre"> </span>To: <<a href="mailto:sip%3A660@testers.com">sip:660@testers.com</a>;transport=UDP></div><div><span class="" style="white-space:pre">     </span>From: "771"<<a href="mailto:sip%3A771@testers.com">sip:771@testers.com</a>;transport=UDP>;tag=41030177</div><div><span class="" style="white-space:pre">       </span>Call-ID: YWYwMjMwMmZlODEwM2MwODdjZWJmYjc2NjM5ZmIyNzk.</div><div><span class="" style="white-space:pre">      </span>CSeq: 2 INVITE</div><div><span class="" style="white-space:pre">     </span>Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE</div><div><span class="" style="white-space:pre">  </span>Content-Type: application/sdp</div><div><span class="" style="white-space:pre">      </span>Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri</div><div><span class="" style="white-space:pre"> </span>User-Agent: Z 3.2.21357 r21367</div><div><span class="" style="white-space:pre">     </span>Allow-Events: presence, kpml</div><div><span class="" style="white-space:pre">       </span>Content-Length: 239</div><div><br></div><div><span class="" style="white-space:pre">       </span>v=0</div><div><span class="" style="white-space:pre">        </span>o=Z 0 0 IN IP4 AST.ER.ISK.IP</div><div><span class="" style="white-space:pre">       </span>s=Z</div><div><span class="" style="white-space:pre">        </span>c=IN IP4 AST.ER.ISK.IP</div><div><span class="" style="white-space:pre">     </span>t=0 0</div><div><span class="" style="white-space:pre">      </span>m=audio 8000 RTP/AVP 3 110 8 0 98 101</div><div><span class="" style="white-space:pre">      </span>a=rtpmap:110 speex/8000</div><div><span class="" style="white-space:pre">    </span>a=rtpmap:98 iLBC/8000</div><div><span class="" style="white-space:pre">      </span>a=fmtp:98 mode=20</div><div><span class="" style="white-space:pre">  </span>a=rtpmap:101 telephone-event/8000</div><div><span class="" style="white-space:pre">  </span>a=fmtp:101 0-15</div><div><span class="" style="white-space:pre">    </span>a=sendrecv</div><div><br></div><div>Invite that Asterisk sends:</div><div>PU.BL.IC.IP:5070 > PU.BL.IC.IP:5060: SIP, length: 1238</div><div><span class="" style="white-space:pre">      </span>INVITE sip:660@PU.BL.IC.IP:5060 SIP/2.0</div><div><span class="" style="white-space:pre">    </span>Via: SIP/2.0/UDP PU.BL.IC.IP:5070;branch=z9hG4bK26a2386a;rport</div><div><span class="" style="white-space:pre">     </span>Max-Forwards: 70</div><div><span class="" style="white-space:pre">   </span>From: "771 win8 minipc" <<a href="http://sip:771@testers.com:5070">sip:771@testers.com:5070</a>>;tag=as05e60cc6</div><div><span class="" style="white-space:pre">      </span>To: <sip:660@PU.BL.IC.IP:5060></div><div><span class="" style="white-space:pre">       </span>Contact: <sip:771@PU.BL.IC.IP:5070></div><div><span class="" style="white-space:pre">  </span>Call-ID: <a href="mailto:7985f7161fcf1a6824b8388d451bec16@testers.com">7985f7161fcf1a6824b8388d451bec16@testers.com</a></div><div><span class="" style="white-space:pre">      </span>CSeq: 102 INVITE</div><div><span class="" style="white-space:pre">   </span>User-Agent: I Am the Devil</div><div><span class="" style="white-space:pre"> </span>Date: Fri, 05 Dec 2014 15:50:33 GMT</div><div><span class="" style="white-space:pre">        </span>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE</div><div><span class="" style="white-space:pre"> </span>Supported: replaces, timer</div><div><span class="" style="white-space:pre"> </span>Content-Type: application/sdp</div><div><span class="" style="white-space:pre">      </span>Content-Length: 663</div><div><br></div><div><span class="" style="white-space:pre">       </span>v=0</div><div><span class="" style="white-space:pre">        </span>o=root 777617621 777617621 IN IP4 PU.BL.IC.IP</div><div><span class="" style="white-space:pre">      </span>s=Asterisk PBX 11.14.1</div><div><span class="" style="white-space:pre">     </span>c=IN IP4 PU.BL.IC.IP</div><div><span class="" style="white-space:pre">       </span>t=0 0</div><div><span class="" style="white-space:pre">      </span>m=audio 15662 RTP/SAVPF 0 3 8 101</div><div><span class="" style="white-space:pre">  </span>a=rtpmap:0 PCMU/8000</div><div><span class="" style="white-space:pre">       </span>a=rtpmap:3 GSM/8000</div><div><span class="" style="white-space:pre">        </span>a=rtpmap:8 PCMA/8000</div><div><span class="" style="white-space:pre">       </span>a=rtpmap:101 telephone-event/8000</div><div><span class="" style="white-space:pre">  </span>a=fmtp:101 0-16</div><div><span class="" style="white-space:pre">    </span>a=ptime:20</div><div><span class="" style="white-space:pre"> </span>a=ice-ufrag:75a7e84431d15f682bd728ee10bd867d</div><div><span class="" style="white-space:pre">       </span>a=ice-pwd:028c19574216643c12188a8530f278f8</div><div><span class="" style="white-space:pre"> </span>a=candidate:H5bdd423d 1 UDP 2130706431 PU.BL.IC.IP 15662 typ host</div><div><span class="" style="white-space:pre">  </span>a=candidate:H5bdd423d 2 UDP 2130706430 PU.BL.IC.IP 15663 typ host</div><div><span class="" style="white-space:pre">  </span>a=connection:new</div><div><span class="" style="white-space:pre">   </span>a=setup:actpass</div><div><span class="" style="white-space:pre">    </span>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</div><div><span class="" style="white-space:pre">      </span>a=sendrecv</div><div><br></div><div><br></div><div>Here the call fails (sip peer 201 calls from outside the server to webrtc peer 660): </div><div><br></div><div>Invite that Asterisk receives:</div><div>PU.BL.IC.IP:5060 > PU.BL.IC.IP:5070: SIP, length: 1345</div><div><span class="" style="white-space:pre">    </span>INVITE sip:660%40testers.com@PU.BL.IC.IP SIP/2.0</div><div><span class="" style="white-space:pre">   </span>Record-Route: <sip:PU.BL.IC.IP;lr=on;ftag=as4647f03c;nat=yes></div><div><span class="" style="white-space:pre">        </span>Via: SIP/2.0/UDP PU.BL.IC.IP;branch=z9hG4bK3264.8a896801756c527f2496fdc14e3f30ad.0</div><div><span class="" style="white-space:pre"> </span>Via: SIP/2.0/UDP 192.168.0.201:5060;rport=5060;received=AST.ER.ISK.IP;branch=z9hG4bK56f5698e</div><div><span class="" style="white-space:pre">       </span>Max-Forwards: 69</div><div><span class="" style="white-space:pre">   </span>From: "Pirjo Ahvenainen" <<a href="mailto:sip%3A201@192.168.0.201">sip:201@192.168.0.201</a>>;tag=as4647f03c</div><div><span class="" style="white-space:pre"> </span>To: <sip:660%40testers.com@PU.BL.IC.IP></div><div><span class="" style="white-space:pre">      </span>Contact: <sip:201@192.168.0.201:5060;alias=AST.ER.ISK.IP~5060~1></div><div><span class="" style="white-space:pre">     </span>Call-ID: <a href="http://69e66f05330de0063b5eba760191da6c@192.168.0.201:5060">69e66f05330de0063b5eba760191da6c@192.168.0.201:5060</a></div><div><span class="" style="white-space:pre">        </span>CSeq: 102 INVITE</div><div><span class="" style="white-space:pre">   </span>User-Agent: Asterisk PBX 11.5.0</div><div><span class="" style="white-space:pre">    </span>Date: Tue, 02 Dec 2014 08:34:57 GMT</div><div><span class="" style="white-space:pre">        </span>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH</div><div><span class="" style="white-space:pre">  </span>Supported: replaces, timer</div><div><span class="" style="white-space:pre"> </span>Content-Type: application/sdp</div><div><span class="" style="white-space:pre">      </span>Content-Length: 547</div><div><br></div><div><span class="" style="white-space:pre">       </span>v=0</div><div><span class="" style="white-space:pre">        </span>o=root 1854132825 1854132825 IN IP4 PU.BL.IC.IP</div><div><span class="" style="white-space:pre">    </span>s=Asterisk PBX 11.5.0</div><div><span class="" style="white-space:pre">      </span>c=IN IP4 PU.BL.IC.IP</div><div><span class="" style="white-space:pre">       </span>t=0 0</div><div><span class="" style="white-space:pre">      </span>a=ice-lite</div><div><span class="" style="white-space:pre"> </span>m=audio 12516 RTP/AVP 8 3 0 101</div><div><span class="" style="white-space:pre">    </span>a=rtpmap:8 PCMA/8000</div><div><span class="" style="white-space:pre">       </span>a=rtpmap:3 GSM/8000</div><div><span class="" style="white-space:pre">        </span>a=rtpmap:0 PCMU/8000</div><div><span class="" style="white-space:pre">       </span>a=rtpmap:101 telephone-event/8000</div><div><span class="" style="white-space:pre">  </span>a=fmtp:101 0-16</div><div><span class="" style="white-space:pre">    </span>a=silenceSupp:off - - - -</div><div><span class="" style="white-space:pre">  </span>a=ptime:20</div><div><span class="" style="white-space:pre"> </span>a=sendrecv</div><div><span class="" style="white-space:pre"> </span>a=rtcp:12517</div><div><span class="" style="white-space:pre">       </span>a=ice-ufrag:5vj2cfWg</div><div><span class="" style="white-space:pre">       </span>a=ice-pwd:OdPg0e2qmExbbvAXUTLT3NI8g28s</div><div><span class="" style="white-space:pre">     </span>a=candidate:dEk0op4jY8ZkdPXr 1 UDP 2130706431 PU.BL.IC.IP 12516 typ host</div><div><span class="" style="white-space:pre">   </span>a=candidate:dEk0op4jY8ZkdPXr 2 UDP 2130706430 PU.BL.IC.IP 12517 typ host</div><div><br></div><div>And the INVITE the Asterisk sends:</div><div>PU.BL.IC.IP:5070 > PU.BL.IC.IP:5060: SIP, length: 847</div><div><span class="" style="white-space:pre">  </span>INVITE <a href="mailto:sip%3A660@testers.com">sip:660@testers.com</a> SIP/2.0</div><div><span class="" style="white-space:pre">        </span>Via: SIP/2.0/UDP PU.BL.IC.IP:5070;branch=z9hG4bK6f718231</div><div><span class="" style="white-space:pre">   </span>Max-Forwards: 70</div><div><span class="" style="white-space:pre">   </span>From: "771 win8 minipc" <sip:201@PU.BL.IC.IP:5070>;tag=as2931af14</div><div><span class="" style="white-space:pre">  </span>To: <<a href="mailto:sip%3A660@testers.com">sip:660@testers.com</a>></div><div><span class="" style="white-space:pre">   </span>Contact: <sip:201@PU.BL.IC.IP:5070></div><div><span class="" style="white-space:pre">  </span>Call-ID: 04a3975e3bc84e6e32bfdc1905791913@PU.BL.IC.IP:5070</div><div><span class="" style="white-space:pre"> </span>CSeq: 102 INVITE</div><div><span class="" style="white-space:pre">   </span>User-Agent: I Am the Devil</div><div><span class="" style="white-space:pre"> </span>Date: Fri, 05 Dec 2014 15:52:18 GMT</div><div><span class="" style="white-space:pre">        </span>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE</div><div><span class="" style="white-space:pre"> </span>Supported: replaces, timer</div><div><span class="" style="white-space:pre"> </span>Content-Type: application/sdp</div><div><span class="" style="white-space:pre">      </span>Content-Length: 283</div><div><br></div><div><span class="" style="white-space:pre">       </span>v=0</div><div><span class="" style="white-space:pre">        </span>o=root 1272725383 1272725383 IN IP4 PU.BL.IC.IP</div><div><span class="" style="white-space:pre">    </span>s=Asterisk PBX 11.14.1</div><div><span class="" style="white-space:pre">     </span>c=IN IP4 PU.BL.IC.IP</div><div><span class="" style="white-space:pre">       </span>t=0 0</div><div><span class="" style="white-space:pre">      </span>m=audio 11906 RTP/AVP 0 3 8 101</div><div><span class="" style="white-space:pre">    </span>a=rtpmap:0 PCMU/8000</div><div><span class="" style="white-space:pre">       </span>a=rtpmap:3 GSM/8000</div><div><span class="" style="white-space:pre">        </span>a=rtpmap:8 PCMA/8000</div><div><span class="" style="white-space:pre">       </span>a=rtpmap:101 telephone-event/8000</div><div><span class="" style="white-space:pre">  </span>a=fmtp:101 0-16</div><div><span class="" style="white-space:pre">    </span>a=ptime:20</div><div><span class="" style="white-space:pre"> </span>a=sendrecv</div><div><br></div><div><br></div><div>And how are my peers configured? The calling peer on the separate Asterisk server is configured quickly in sip.conf:</div><div><br></div><div>[general]</div><div>bindport = 5060</div><div>bindaddr = 0.0.0.0</div><div>tcpbindaddr = 0.0.0.0</div><div>tcpenable = yes</div><div>limitonpeers = yes</div><div>rtcachefriends = no</div><div>tos_sip = cs3</div><div>tos_audio = ef</div><div><br></div><div>[201]</div><div>type = friend</div><div>secret = myverysecretpassword</div><div>context = mytestcontext</div><div>callerid = "201 User" <201></div><div>host = dynamic</div><div>port = 5060</div><div>disallow = all</div><div>allow = alaw</div><div>allow = ulaw</div><div>allow = gsm</div><div>qualify = yes</div><div>nat = no</div><div>canreinvite = no</div><div><br></div><div>and the dial command is like this: </div><div>exten => 666,n,Dial(SIP/PU.BL.IC.IP/<a href="mailto:660@testers.com">660@testers.com</a>)</div><div><br></div><div><br></div><div>And the called number 660 is in the realtime sippeers table: </div><div><br></div><div>               id: 4</div><div>             type: friend</div><div>             name: 660</div><div>             host: dynamic</div><div>           secret: NULL</div><div>       encryption: yes</div><div>             avpf: yes</div><div>       icesupport: yes</div><div>           ipaddr: PU.BL.IC.IP</div><div>             port: 5060</div><div>       regseconds: 1417782175</div><div>      defaultuser: 660</div><div>      fullcontact: sip:660@PU.BL.IC.IP:5060</div><div>           lastms: 0</div><div>        useragent:</div><div>          context: mytestnumbercontext</div><div>      directmedia: no</div><div>             deny: <a href="http://0.0.0.0/0.0.0.0">0.0.0.0/0.0.0.0</a></div><div>           permit: PU.BL.IC.IP</div><div>              nat: force_rport,comedia</div><div>        transport: ws,wss,udp</div><div>         language: NULL</div><div>         disallow: NULL</div><div>            allow: NULL</div><div>        force_avp: yes</div><div>         callerid: 660 test</div><div>         amaflags: NULL</div><div>          mailbox: NULL</div><div>         regexten: NULL</div><div>        regserver:</div><div>       fromdomain: <a href="http://testers.com">testers.com</a></div><div>     videosupport: no</div><div>    contactpermit: NULL</div><div>      contactdeny: NULL</div><div>         fullname: 660 win8</div><div>     subscribemwi: NULL</div><div>       dtlsenable: yes</div><div>       dtlsverify: no</div><div>     dtlscertfile: /etc/asterisk/keys/asterisk.pem</div><div>   dtlsprivatekey: /etc/asterisk/keys/asterisk.pem</div><div>        dtlssetup: actpass</div><div>        sippasswd: a84a4ddcda13d13c9573d5294047b6a2</div><div>             rpid: NULL</div><div>           domain: <a href="http://testers.com">testers.com</a></div><div>       sippasswd2: 5c4671ae1043e6116118fed39bee091a</div><div>callbackextension: NULL</div><div>         insecure: NULL</div><div><br></div><div><br></div><div>cheers,</div><div>Olli</div><div><br></div></div>