[asterisk-users] SIP trunks going to the wrong context

Ade Vickers asterisk at solutionengineers.com
Thu Dec 14 15:10:23 CST 2017


Hi all,

I'm trying to resolve a weird issue with SIP routing.

I have a number of SIP trunks, from a selection of providers, all of 
which are registered in sip.conf:

    [general]
    context=default
    allowguest=no
    allowoverlap=no
    udpbindaddr=0.0.0.0
    tcpenable=yes
    tcpbindaddr=0.0.0.0
    transport=udp
    bindport=15060
    srvlookup=yes
    allowsubscribe=yes
    limitonpeers=yes
    callcounter=yes
    vmexten=5199
    nat=no

    ; SE registrations
    register => user1:password1 at sipgate.co.uk:5060/se2489
    register => user2:password2 at sipgate.co.uk:5060/se1268
    register => user3:password3 at sipgate.co.uk:5060/se0845
    register => user4:password4 at callcentric.com:5060/se1777
    register => user5:password5 at sipgate.co.uk:5060/se4130
    register => user9:password9 at sip.vohippo.com:5060/se1413

    ; SJ registrations
    register => user6:password6 at sipgate.co.uk:5060/sj0151
    register => user7:password7 at callcentric.com:5060/sj1777
    register => user8:password8 at sipgate.co.uk:5060/sj0203

I then have a selection of #included files. The first defines se2489:

    [se2489]
    type=friend
    insecure=port,invite
    secret=password1
    defaultuser=user1
    fromuser=user1
    fromdomain=sipgate.co.uk
    host=sipgate.co.uk
    port=5060
    outboundproxy=proxy.live.sipgate.co.uk
    disallow=all
    allow=ulaw
    context=external-se
    qualify=yes
    canreinvite=no
    dtmfmode=rfc2833

The second defines sj0151:

    [sj0151]
    type=friend
    insecure=port,invite
    secret=password6
    defaultuser=user6
    fromuser=user6
    fromdomain=sipgate.co.uk
    host=sipgate.co.uk
    outboundproxy=proxy.live.sipgate.co.uk
    disallow=all
    allow=ulaw
    context=sj-main
    regcontext=sj-main       ; Added to try to fix wrong context on IB calls
    subscribecontext=sj-main ; Added to try to fix wrong context on IB calls
    qualify=yes
    canreinvite=no
    dtmfmode=rfc2833

When an inbound call comes in to sj0151, I get the following error:

    NOTICE[10777][C-00000000]: chan_sip.c:26407 handle_request_invite:
    Call from 'user1' (217.10.79.23:5060) to extension 'sj0151' rejected
    because extension not found in context 'external-se'.

Surely it should have looked in sj-main, not external-se?

Also, the "Call from 'user1' is always 'user1' no matter which sipgate 
account originated the call. The Callcentric numbers can't receive 
inbound calls, the vohippo number shows "Call from 'user9'" as one would 
expect. ALL of them look in context 'external-se', but the SJ 
registrations should all be looking in 'sj-main'. What's more, it seems 
to be struggling with pattern matching... The extension is passed 
correctly (albeit to the wrong context, for 3 of the numbers), so the 
following dialplan should pick them all up, surely?:

    [external-se]
    ; Transfer any call from any SE external trunk to the IVR @ the office.
    ; If the office is unavailable (no internet, for example), then go
    to voicemail)
    exten => _se.,1,Dial(IAX2/cloud/1000,30,r)
    same  => n,Voicemail(5000)
    same  => n,Hangup()

However, it simply doesn't work. If I replace _se. with _se2489. (or 
just se2489), it works fine (for calls arriving on the se2489 extension; 
obviously the others bork).


Can anyone tell me what I'm doing wrong, based on the above?

FWIW; this seems to have occurred because I've been attempting to prune 
my dialplan; I used to have them all going into a single context, and I 
picked them out & routed them individually. I am _trying_ to simplify 
the structure/mess that is extensions.conf... but as a result I ran into 
this little conundrum. The main problem is to resolve the "wrong 
context"; I have a suspicion I could fix the "can't find extension" 
problem by getting rid of the letters & using a purely numeric extension.

Many thanks,

Ade.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20171214/98729d02/attachment.html>


More information about the asterisk-users mailing list