In article <f10ac6bb-665f-0423-7963-9124aef8e...@solutionengineers.com>,
Ade Vickers <aster...@solutionengineers.com> wrote:
> 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:passwo...@sipgate.co.uk:5060/se2489
>     register => user2:passwo...@sipgate.co.uk:5060/se1268
>     register => user3:passwo...@sipgate.co.uk:5060/se0845
>     register => user4:passwo...@callcentric.com:5060/se1777
>     register => user5:passwo...@sipgate.co.uk:5060/se4130
>     register => user9:passwo...@sip.vohippo.com:5060/se1413
> 
>     ; SJ registrations
>     register => user6:passwo...@sipgate.co.uk:5060/sj0151
>     register => user7:passwo...@callcentric.com:5060/sj1777
>     register => user8:passwo...@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.

I think your problem is that the "/se2489" or "/sj0151" in your register
statement (for example) is not used to select or match the inbound SIP
peer.

When the call comes in from sipgate, it probably doesn't have a fromuser.
The fromuser can be used to select the peer based on matching the [string]
that names the peer.

Otherwise, when Asterisk is looking for a matching peer section, I believe
it only matches on the host from which the call comes. So when your call
comes in from sipgate.co.uk, that is the only piece of information it uses,
and so it always matches the first one, irrespective of the registration
that originated the call.

So I think you really do need to have a single peer section for all sipgate
calls, pointing to one sipgate context in your dialplan that contains all
your various extensions like se2489, sj0151, etc.

Cheers
Tony
-- 
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to