Multiple registrations with same SIP provider

Hi,

I am really hoping someone can help me with this…

I am not exactly a newbie to Asterisk, I use it for home and my own business. But I am trying to set it up in a corporate environment to do call processing for multiple geographically dispersed offices.

Each office has 3 SIP accounts, 2 which have 2 channels each for incoming calls and 1 for outgoing calls with 4 channels.

If anyone has done this sort of setup, I would appreciate some insight. Otherwise, please look at my configuration (which is not working).

#sip.conf

; Melbourne
register => 0390240222:secret@sip.internode.on.net/0390240222
register => 0390241597:secret@sip.internode.on.net/0390241597
register => 0390241614:secret@sip.internode.on.net/0390241614

[mlb-outgoing]
type=peer
secret=secret
username=0390241614
host=sip.internode.on.net
fromdomain=sip.internode.on.net
fromuser=0390241614
context=mlb-outgoing
canreinvite=no
insecure=very
nat=never
qualify=yes
disallow=all
allow=alaw
allow=ulaw

[mlb-incoming1]
type=peer
host=sip.internode.on.net
context=from-nodephone

[mlb-incoming2]
type=peer
host=sip.internode.on.net
context=from-nodephone

#extensions.conf

[from-nodephone]
exten => 0390240222,1,Goto(mlb-incoming,s,1)
exten => 0390241597,1,Goto(mlb-incoming,s,1)

[mlb-incoming]
exten => 0390240222,1,Dial(SIP/500,20)
exten => 0390240222,2,Voicemail(u500)

[Melbourne]
exten => 500,1,Dial(SIP/500,20) ;Reception
exten => 500,2,Voicemail(u500)

Can anyone offer any suggestions? Am I going about this the right way?

Regards,
Trent.

Found an immediate problem in extensions.conf

Calls were being passed to an extension that does not exist in the mlb-incoming content

[from-nodephone]
exten => 0390240222,1,Goto(mlb-incoming,s,1)
exten => 0390241597,1,Goto(mlb-incoming,s,1)

[mlb-incoming]
exten => 0390240222,1,Dial(SIP/500,20) <== should be ‘s’ - fixed!
exten => 0390240222,2,Voicemail(u500) <== same!

[Melbourne]
exten => 500,1,Dial(SIP/500,20) ;Reception
exten => 500,2,Voicemail(u500)

But this still is not working correctly, phone rings, I answer it, but get no audio. Will post CLI logging in a moment, it would appear Asterisk is passing the call from 0390240222 to the 0390241597 line (hence the silence / no audio).

Trent.

OK. The no audio was a firewall issue (should have checked that first). However, there is still an issue in determining the incoming extension. Please see CLI log below;

When I call 0390241597… (this is good)

-- Executing [0390241597@from-nodephone:1] 

Goto(“SIP/0390241597-097f2718”, “mlb-incoming|s|1”) in new stack
– Goto (mlb-incoming,s,1)
– Executing [s@mlb-incoming:1] Dial(“SIP/0390241597-097f2718”,
“SIP/500”) in new stack
– Called 500
– SIP/500-097f7830 is ringing
– SIP/500-097f7830 answered SIP/0390241597-097f2718
– Packet2Packet bridging SIP/0390241597-097f2718 and
SIP/500-097f7830

When I call 039024022… (this is bad)

-- Executing [0390240222@from-nodephone:1] 

Goto(“SIP/0390241597-09806f40”, “mlb-incoming|s|1”) in new stack
– Goto (mlb-incoming,s,1)
– Executing [s@mlb-incoming:1] Dial(“SIP/0390241597-09806f40”,
“SIP/500”) in new stack
– Called 500
– SIP/500-0980be00 is ringing
– SIP/500-0980be00 answered SIP/0390241597-09806f40
– Packet2Packet bridging SIP/0390241597-09806f40 and
SIP/500-0980be00

Asterisk thinks call originates from 0390241597!!! This is registered last in sip.conf … but in each register => string a /extension has been defined for matching in extensions.conf

Any ideas anyone?!?!

Trent.

OK. All seems to be working nicely now. Next step is to start implementing some common features (voicemail access, playing music on hold etc) and calling between contexts (inter-office calls).

#extensions.conf

[features]
; voicemail
exten => 121,1,VoicemailMain(s${CALLERID(num)})
exten => 125121,1,VoicemailMain

; music on hold
exten => 122,1,Answer
exten => 122,2,MusicOnHold()

[melbourne]
include => features

exten => 500,1,Dial(SIP/500,20) ;Reception
exten => 500,2,Voicemail(u500)

[perth]
include => features
include => melbourne
include => per-outgoing

exten => 700,1,Dial(SIP/700,20) ;Reception
exten => 700,2,Voicemail(u700)

[per-outgoing]
exten => _X.,1,Dial(SIP/${EXTEN}@per-outgoing)

This works great, both Melbourne and Perth office users can access common features like voicemail and music on hold. Perth users can call Melbourne and if there is no extension match it is forwarded to the Perth outgoing SIP provider.

BUT how can we do this for Melbourne? To include => mlb-outgoing in the [melbourne] context and have include => melbourne in the [perth] context creates a situation where calls with no extension match are forwarded to the Merlbourne outgoing SIP provider?!?!

Essentially we have lower level ‘includes’ (‘includes’ within ‘includes’) taking precedence over the top-level ‘includes’?

I am probably going about it the wrong way, and would welcome someone to set me straight.

Perhaps include => features (for all things common to all our offices eg. voicemail, music on hold etc.) and pattern matching within each office context for determining outgoing calls and inter-office calls?

At the moment, any calls that do not match an extension in the current context are forwarded to the SIP provider;

eg. exten => _X.,1,Dial(SIP/${EXTEN}@per-outgoing)

All Perth extensions start with 7xx, Melbourne 5xx and Adelaide 8xx. Can anyone advise what pattern string I would use?

I have tried the following to no avail;

exten => 5XX,1,Dial(SIP/${EXTEN}@melbourne)
exten => 8XX,1,Dial(SIP/${EXTEN}@adelaide)

Regards,
Trent.

OK. For anyone who is interested… My configuration is complete and works perfectly for 3 branch offices on 1 Asterisk server using 9 SIP providers. I started this thread hoping to get some help along the way, but instead worked it all out myself.

I won’t paste my final extensions.conf and sip.conf here … Instead, anyone trying to duplicate my setup please drop me a line. Am happy to help.

Cheers,
Trent.

I’m facing with the problem of registering two external sip number from the same VOIP provider I receive the calls on the one of the two account.

Both peers are correctly registered but when I call from external to number A the active channel shows me that it is receiving from trunk A.
When I call to number B active channel shows that call coming from the trunk A instead of trunkB.
If I use trixbox no problems on receiving.

could you help me?

thanks in advance

Max, post some of your settings so we can check it out?