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>
<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 sip:extension@asterisk:5060;transport=UDP SIP/2.0</div>
<div><font><span style="background-color:rgba(255,255,255,0)">Record-Route: <sip:kamailio-external</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: <sip:524@caller:28019;transport=UDP></div><div><span style="font-size:small;background-color:rgba(255,255,255,0)">To: <sip:extension@</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: <sip:524@caller:28007>;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>