<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 07 May 2014, at 02:42, Teleport Engineer <<a href="mailto:teleport.engineer@gmail.com">teleport.engineer@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello,<div><br></div><div>I'd setup a test environment where Kamailio accepts external invites and routes them to an internal Asterisk (actually working as an SBC).</div><div>My dialplan works fine routing the INVITE to the internal Asterisk, but the SIP message goes into the defaul sip context (the one configured in sip general), and not in the context defined for the sip trunk between Kamailio and Asterisk.</div></blockquote>Well, first you are on the wrong mailing list... Asterisk questions is better handled in Asterisk forums.</div><div>If you turn on SIP debug and the core debug level, Asterisk will tell you how it is matching and how it</div><div>is searching in the list of peers and users. </div><div><br></div><div>The first error I spot in your config is "type=friend". You should</div><div>ALWAYS use type=peer for Kamailio trunks.</div><div><br></div><div>So hit the console, turn on debugging, find out what goes wrong in matching the peer and you are on your way.</div><div><br></div><div>/O</div><div><br></div><div><blockquote type="cite">
<div><br></div><div>The sip trunk is configured like this:</div><div><br></div><div>[kamailio]</div><div><div>disallow=all</div><div>host=kamailio</div><div>port=5060</div><div>insecure=port,invite</div><div>type=friend</div>
<div>context=from-sip-external</div><div>fromdomain=mydomain</div><div>qualify=yes</div><div>allow=alaw</div><div>allow=g722</div></div><div><br></div><div>So I expect that all the sip invites coming from kamailio should be executed in  <font><span style="background-color:rgba(255,255,255,0)">from-sip-external context.</span></font></div>
<div><font><span style="background-color:rgba(255,255,255,0)"><br></span></font></div><div><font><span style="background-color:rgba(255,255,255,0)">But it doesn't work like this since each invite goes in the default context.</span></font></div>
<div><font><span style="background-color:rgba(255,255,255,0)"><br></span></font></div><div><font><span style="background-color:rgba(255,255,255,0)">The invite that goes to Asterisk is like this</span></font></div><div><font><span style="background-color:rgba(255,255,255,0)"><br>
</span></font></div><div><div style="font-size:small;background-color:rgba(255,255,255,0)"><--- SIP read from kamailio-external:5060 ---></div><div style="font-size:small;background-color:rgba(255,255,255,0)">INVITE <a href="sip:extension@asterisk:5060;transport=UDP">sip:extension@asterisk:5060;transport=UDP</a> SIP/2.0</div>
<div><font><span style="background-color:rgba(255,255,255,0)">Record-Route: <<a href="sip:kamailio-external">sip:kamailio-external</a></span></font><span style="background-color:rgba(255,255,255,0);font-size:small">:5060;nat=yes;ftag=905e4921;lr=on></span></div>
<div><span style="font-size:small;background-color:rgba(255,255,255,0)">Via: SIP/2.0/UDP </span><font><span style="background-color:rgba(255,255,255,0)">kamailio-external:</span></font><span style="background-color:rgba(255,255,255,0);font-size:small">5060;branch=z9hG4bK277a.aea3ad87.0</span></div>
<div style="font-size:small;background-color:rgba(255,255,255,0)">Via: SIP/2.0/UDP caller:28021;rport=28019;received=caller;branch=z9hG4bK-d8754z-d11f1fa1d0fb2ab4-1---d8754z-</div><div style="font-size:small;background-color:rgba(255,255,255,0)">
Max-Forwards: 69</div><div style="font-size:small;background-color:rgba(255,255,255,0)">Contact: <<a href="sip:524@caller:28019;transport=UDP">sip:524@caller:28019;transport=UDP</a>></div><div><span style="font-size:small;background-color:rgba(255,255,255,0)">To: <<a href="sip:extension@">sip:extension@</a></span><font><span style="background-color:rgba(255,255,255,0)">kamailio-external></span></font></div>
<div style="font-size:small;background-color:rgba(255,255,255,0)">From: <<a href="sip:524@caller:28007">sip:524@caller:28007</a>>;tag=905e4921</div><div style="font-size:small;background-color:rgba(255,255,255,0)">Call-ID: YzEzMDM1NDZhZTllMTRiMDJmY2MyZTE0ZWZjMzE5OTc.</div>
<div style="font-size:small;background-color:rgba(255,255,255,0)">CSeq: 1 INVITE</div><div style="font-size:small;background-color:rgba(255,255,255,0)">Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE</div>
<div style="font-size:small;background-color:rgba(255,255,255,0)">Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri</div><div style="font-size:small;background-color:rgba(255,255,255,0)">User-Agent: Z 3.2.21357 r21367</div>
<div style="font-size:small;background-color:rgba(255,255,255,0)">Allow-Events: presence, kpml</div><div style="font-size:small;background-color:rgba(255,255,255,0)">Content-Type: application/sdp</div><div style="font-size:small;background-color:rgba(255,255,255,0)">
Content-Length: 260</div><div style="font-size:small;background-color:rgba(255,255,255,0)"><br></div></div><div style="font-size:small;background-color:rgba(255,255,255,0)">What I think is that in the sip message there is no information about kamailio internal ip address but only about kamailio-external address and then Asterisk put it into the default context.</div>
<div style="font-size:small;background-color:rgba(255,255,255,0)">If this is the reason, should I change the trunk ip address in Asterisk and should I do some manipulation on the incoming packet on kamailio?</div><div style="font-size:small;background-color:rgba(255,255,255,0)">
Or maybe I should use kamailio-external as fromdomain in the trunk configuration?</div><div style="font-size:small;background-color:rgba(255,255,255,0)"><br></div><div style="font-size:small;background-color:rgba(255,255,255,0)">
Thanks.</div><div style="font-size:small;background-color:rgba(255,255,255,0)"><br></div><br><div><br></div>
_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users<br></blockquote></div><br></body></html>