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

2017-12-15 Thread Julian Beach
On Thursday, December 14, 2017, 10:05:23 PM, Tony Mountifield
(t...@softins.co.uk) wrote:

> 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.

That is what I do - all my incoming calls (which originate from the
same IP and Port) go into a single context in extensions.conf, from
where they are directed into individual call handlers depending on the
DCID

[incoming calls]

exten => 4420,n,Goto(handler-a,s,1)
exten => 4400,n,Goto(handler-b,s,1)
exten => 4421,n,Goto(handlet-c,s,1)
exten => 4422,n,Goto(handler d,s,1)

-- 
Best regards,
 Julianmailto:jb_s...@trink.co.uk


-- 
_
-- 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


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

2017-12-14 Thread Tony Mountifield
In article <1513290358.2926.4.ca...@linuxista.com>,
Frank Vanoni  wrote:
> I don't know if it applies to your problem, but I also had some
> troubles with multiple account on same SIP provider. 
> Here what works for me:
> 
> 
> In sip.conf:
> 
> 
> register => 11:qwe...@sip.provider.zz/11 ; Trunk1
> register => 22:asd...@sip.provider.zz/22 ; Trunk2
> register => 22:yxc...@sip.provider.zz/22 ; Trunk3
> 
> 
> [trunk1]
> type=friend
> host=sip.provider.zz
> defaultuser=11
> secret=qwertz
> canreinvite=no
> insecure=invite
> nat=force_rport,comedia
> qualify=yes
> context=trunkincoming
> description=Trunk 1
> 
> [trunk2]
> type=friend
> host=sip.provider.zz
> defaultuser=22
> secret=asdfgh
> canreinvite=no
> insecure=invite
> nat=force_rport,comedia
> qualify=yes
> context=trunkincoming
> description=Trunk 2
> 
> [trunk3]
> type=friend
> host=sip.provider.zz
> defaultuser=33
> secret=yxcvbn
> canreinvite=no
> insecure=invite
> nat=force_rport,comedia
> qualify=yes
> context=trunkincoming
> description=Trunk 3
> 
> 
> 
> In extensions.conf:
> 
> [trunkincoming]
> exten => 11,1,GoTo(firstline,11,1)
> exten => 22,1,GoTo(secondline,22,1)
> exten => 33,1,GoTo(thirdline,33,1)
> 
> [firstline]
> exten => 11,1,Dial(SIP/officephone,120,m)
> 
> [secondline]
> exten => 22,1,Dial(SIP/livingroomphone,120,m)
> 
> [thirdline]
> exten => 33,1,Dial(SIP/bedroomphone,120,m)

But because you have all three of your trunk peers pointing to the
same context, you don't necessarily know whether the inbound calls
are matching different peers or all the same one.

If you had each trunk pointing at a different context, you would
probably run into the same problem as the OP.

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

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

2017-12-14 Thread Frank Vanoni
I don't know if it applies to your problem, but I also had some
troubles with multiple account on same SIP provider. 
Here what works for me:


In sip.conf:


register => 11:qwe...@sip.provider.zz/11 ; Trunk1
register => 22:asd...@sip.provider.zz/22 ; Trunk2
register => 22:yxc...@sip.provider.zz/22 ; Trunk3


[trunk1]
type=friend
host=sip.provider.zz
defaultuser=11
secret=qwertz
canreinvite=no
insecure=invite
nat=force_rport,comedia
qualify=yes
context=trunkincoming
description=Trunk 1

[trunk2]
type=friend
host=sip.provider.zz
defaultuser=22
secret=asdfgh
canreinvite=no
insecure=invite
nat=force_rport,comedia
qualify=yes
context=trunkincoming
description=Trunk 2

[trunk3]
type=friend
host=sip.provider.zz
defaultuser=33
secret=yxcvbn
canreinvite=no
insecure=invite
nat=force_rport,comedia
qualify=yes
context=trunkincoming
description=Trunk 3



In extensions.conf:

[trunkincoming]
exten => 11,1,GoTo(firstline,11,1)
exten => 22,1,GoTo(secondline,22,1)
exten => 33,1,GoTo(thirdline,33,1)

[firstline]
exten => 11,1,Dial(SIP/officephone,120,m)

[secondline]
exten => 22,1,Dial(SIP/livingroomphone,120,m)

[thirdline]
exten => 33,1,Dial(SIP/bedroomphone,120,m)





-- 
_
-- 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


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

2017-12-14 Thread Tony Mountifield
In article ,
Ade Vickers  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-]: 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
-- 

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

2017-12-14 Thread Ade Vickers

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-]: 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.

-- 
_
-- 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