[SR-Users] Routing incoming calls to Asterisk trunk

Olle E. Johansson oej at edvina.net
Wed May 7 07:58:03 CEST 2014


On 07 May 2014, at 02:42, Teleport Engineer <teleport.engineer at gmail.com> wrote:

> Hello,
> 
> I'd setup a test environment where Kamailio accepts external invites and routes them to an internal Asterisk (actually working as an SBC).
> 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.
Well, first you are on the wrong mailing list... Asterisk questions is better handled in Asterisk forums.
If you turn on SIP debug and the core debug level, Asterisk will tell you how it is matching and how it
is searching in the list of peers and users. 

The first error I spot in your config is "type=friend". You should
ALWAYS use type=peer for Kamailio trunks.

So hit the console, turn on debugging, find out what goes wrong in matching the peer and you are on your way.

/O

> 
> The sip trunk is configured like this:
> 
> [kamailio]
> disallow=all
> host=kamailio
> port=5060
> insecure=port,invite
> type=friend
> context=from-sip-external
> fromdomain=mydomain
> qualify=yes
> allow=alaw
> allow=g722
> 
> So I expect that all the sip invites coming from kamailio should be executed in  from-sip-external context.
> 
> But it doesn't work like this since each invite goes in the default context.
> 
> The invite that goes to Asterisk is like this
> 
> <--- SIP read from kamailio-external:5060 --->
> INVITE sip:extension at asterisk:5060;transport=UDP SIP/2.0
> Record-Route: <sip:kamailio-external:5060;nat=yes;ftag=905e4921;lr=on>
> Via: SIP/2.0/UDP kamailio-external:5060;branch=z9hG4bK277a.aea3ad87.0
> Via: SIP/2.0/UDP caller:28021;rport=28019;received=caller;branch=z9hG4bK-d8754z-d11f1fa1d0fb2ab4-1---d8754z-
> Max-Forwards: 69
> Contact: <sip:524 at caller:28019;transport=UDP>
> To: <sip:extension at kamailio-external>
> From: <sip:524 at caller:28007>;tag=905e4921
> Call-ID: YzEzMDM1NDZhZTllMTRiMDJmY2MyZTE0ZWZjMzE5OTc.
> CSeq: 1 INVITE
> Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
> Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
> User-Agent: Z 3.2.21357 r21367
> Allow-Events: presence, kpml
> Content-Type: application/sdp
> Content-Length: 260
> 
> 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.
> 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?
> Or maybe I should use kamailio-external as fromdomain in the trunk configuration?
> 
> Thanks.
> 
> 
> 
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140507/60051081/attachment.html>


More information about the sr-users mailing list