You are on page 1of 11

Search....

LOGIN | REGISTER

GET A FREE VOIP QUOTE

Home

Cut Business Phone Costs


& Save Money!

Wholesale VOIP

Quick Links

Business VOIP

Residential VOIP

SIP

Call Center Software

Forums

How many phones do you have?

1 - 2
3 - 5
6 - 10
11 - 20
21 - 50
51 - 100

View

100+

Discussion (14)

History

Asterisk - dual servers


Connecting two Asterisk servers
Want Free buying advice? Call
us now at

Overview
Of course you can also use SIP or H.323 (but not MGCP) to interlink two Asterisk servers, however IAX
is the most common approach (Note: SIP > IAX > SIP does not currently work for video calls as of Jan

BUSINESS VOIP

08). In order to share a dialplan you can

intelligently design the dialplan on each server so that it becomes immediately clear when
an extension on the other server is dialed, e.g. use 3xxx for server A, 4xxx for server B,
and 5xxx for extensions on server C.
use the "switch" statement to make server A lookup locally unknown extensions on server
B (both boxes must be permanently on-line, if that is not the case you'll experience large
open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

delays when dialing!)


use DUNDi: Distributed Universal Number Directory (DUNDi)
use EnumLookup (e.164)
RESIDENTIAL VOIP

SIP methods
Unlike with IAX there is no clean distinction between type=peer and type=user when it comes to
sip.conf. You can start out with type=friend on both sides, and if you get that working you'll probably
want to split the entry into a peer and a user. Also take a look at the sip.conf parameters
"insecure=very" and maybe "autocreatepeer=yes".

server A with static IP, server B with dynamic IP: Register server B with server A in
sip.conf
both servers with static IP: No need to register at all
both servers with dynamic IP: That's a bit tricky, you'll need to resort to a service like
LAST MODIF PAGES

dyndns.org in to be able to register the servers with each other; in any case this is not a

1. Call Center Software

good setup as during IP change connectivity will be lost until the update has been

2. VOIP Service Providers


Business
3. voip-info.org

propagated through dyndns.


both servers behind their own NAT: Don't use SIP, turn to IAX2 instead

4. VoIP Recording Software


5. Asterisk sound files
international
6. Automatic Call Distributor
7. Asterisk Consultants
Belgium
8. Michigan VoIP
9. Asterisk Consultants
Switzerland
10. IVR

IAX setup details


An IAX connection between two Asterisk servers is setup in steps:

Configure Asterisk servers at both ends in iax.conf, one as peer and the other as user.
Set up the user's dialplan in extensions.conf so that calls can be made from the user to
the peer.

Show More

open in browser PRO version

Optionally, register the peer with the user (for when the peer's ip is dynamic and therefore
Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

unknown by the user.)


VOIP SPEED TEST

Repeat the previous steps in the opposite direction (swap peer and user) if you want to
be able to place calls in both directions.

Declaration of IAX2 user


A peer receives calls. The following would be needed in iax.conf on the peer machine to verify
(authenticate) the identify of the user before allowing calls from that user.
GET HELP

Ask a question
Re: International Call
disconnect at a random time
by sylric Wed 21 of Oct, 2015

[username]
type=user
auth=md5
secret=secretword
context=iax2users

International Call disconnect


at a random time
by sylric Wed 21 of Oct, 2015
Re: VoIP over VPN (Because
ISP Blocking my IP)
by safevpn Wed 21 of Oct,
2015
View More...

The "context" is important as it sets the local context in which to place any calls incoming from this user
(see extensions.conf ).
This setup lets the remote user register to your system from any host. If you want to restrict which IPaddress or hostname the remote user connects from, add permit or deny settings when describing the
user in the peer's iax.conf.

Declaration of IAX2 peer


A user makes calls. The following would be needed in iax.conf on the user machine to identify
(authenticate) itself to the peer before the peer will take the call.

[peername]

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

type=peer
host=hostname.domain.tld (or "dynamic" which would then require a "register" command by the
peer.)
auth=md5
secret=secretword ; redundant when already embedded in Dial string
username=username-at-the-peer ; redundant when already embedded in Dial string

Please note:

a type=user is to authenticate an incoming call


a type=peer is someone you send a call to
type=friend, of course, is both

Using type=friend makes life easier, but treat it as a shortcut. If you add both type=friend and
host=hostname, domain.ext you limit the hosts your peer can place calls from, which may not be
what you want.

For instructions on using auth=rsa, see Asterisk IAX RSA authentication wiki page.
Now that we have completed steps 1 and 2 the only thing left is to set up the dialplan. Read the
examples below for how to accomplish that.

Connecting the dial plans


Example 1
extensions.conf:

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

exten => _7XXX,1,Dial(IAX2/myserver:passwordA@IAXserverA/${EXTEN:1},30,r)


exten => _7XXX,2,Dial(SIP/myserver:passwordA@SIPserverA/${EXTEN:1},30,r)
exten => _7XXX,3,Congestion
exten => _8XXX,1,Dial(IAX2/myserver:passwordB@IAXserverB/${EXTEN:1},30,r)
exten => _8XXX,2,Dial(SIP/myserver:passwordB@SIPserverB/${EXTEN:1},30,r)
exten => _8XXX,3,Congestion
Of course we'll need matching entries like [IAXserverA] etc. in iax.conf and sip.conf in order for the
above to work as intended. The example uses SIP as a fallback in case we have problems with your
IAX connection.
Note that with this approach username and password will be shown in the CDR records (you might
want to use the second example or to look at using keys instead of a username/password
combination)!

Example 2
This example doesn't show the username and secret in the CDR.
Note: As if 1.0.9 this shortcut is still not part of the Asterisk Stable branch, so still requires the
user and password as part of the dial string in extensions.conf. e.g.
exten => _7XXX,1,Dial(IAX2/username:pass@serverB/${EXTEN:1},30,r)

(serverA)
iax.conf
[general]
register => <username>:<password>@<serverB hostname or IP>
[serverB]
type=friend
user=<username>
secret=<password>
host=<serverB hostname or IP>

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

extensions.conf
exten => _7XXX,1,Dial(IAX2/serverB/${EXTEN:1},30,r)
exten => _7XXX,2,Congestion
(serverB)
iax.conf
[serverA]
type=friend
user=<username>
secret=<password>
host=<dynamic> | <serverA hostname or IP>
extensions.conf
exten => _8XXX,1,Dial(IAX2/serverA/${EXTEN:1},30,r)
exten => _8XXX,2,Congestion
In some cases the serverA and serverB, will be the usernames of the server.

Example 3
With the Switch object in extensions.conf you may connect two Asterisk servers and the other servers
dial plan. In this case our own box "server C" will either connect to "server A" or "server B":
[default]
exten => _801XXX,1,Goto,srvA|${EXTEN}|1
exten => _802XXX,1,Goto,srvB|${EXTEN}|1
[srvA]
exten => _801XXX,1,StripMSD,3
exten => _XXX,2,Goto,1
switch => IAX/serverA
[srvB]
exten => _802XXX,1,StripMSD,3
exten => _XXX,2,Goto,1

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

switch => IAX/serverB


Notes: You may not establish circular links by switching serverA to serverB and serverB to serverA!
Also take a look at the (new) iax.conf setting "autokill=" to prevent a long hang when the remote server
is down or disconnected.

Example 4
In extensions.conf: (on slave)
[outbound]
switch => IAX2/master:secret@iax-gw1.company.net/outbound
In iax.conf (on master):
[slave]
type=user
auth=plaintext
context=outbound
context=outbound2 ; (can have multiple if you want)
secret=secret
host=dynamic
callerid="slave"
trunk=yes
notransfer=yes
[slave]
type=peer
auth=plaintext
context=outbound-nuphone
secret=secret
host=dynamic
trunk=yes
notransfer=yes

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

In extensions.conf (slave):
[assigned-dids]
; uncomment a dial mechanism, first one goes to specific extension
; other one goes to dial parameter s.
;exten => 7046446999,1,Dial,IAX2/master@slave/${EXTEN}
;exten => 7046446999,1,Dial,IAX2/master@slave
In iax.conf (slave):
register => slave:secret@iax-gw1.company.net
[master]
type=peer
host=iax-gw1.company.net
secret=secret
context=outbound
trunk=yes
canreinvite=no
[master]
type=user
secret=secret
context=acontext
trunk=yes
canreinvite=no

The register command


When the ip of the peer is unknown, a user has no way to place a call (e.g. when an office/user calls a
teleworker/peer at home, where the teleworker has only a dynamic ip or is behind NAT.) To

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

compensate for this, the teleworker/peer actively registers with the office/user by providing its identity
and ip location.
On the peer, in the [general] section of iax.conf, add a registration entry:
register => user:password@hostname.domain.ext
The continually updates the user so it will always know how to reach the peer even if the peer's ip
changes.
The "register" statement only works if you want to hook up a server with a dynamic IP to a server with a
static (public) IP, i.e. on the user you must add "host=dynamic" in the iax.conf for that peer. If both
servers are at known, static IPs then there is no need for a register statement as you'd use
host=hostname on both ends.
--

This page just has Chinese version

Back to asterisk tips and tricks


swipe left for more details

Business PBX Solutions


Prov ider

Solution Details

3CX Software PBX for Windows


Windows Software Solution
Easy to Install and Manage
Auto Configures Phones & Trunks
Android, iOS, Windows & Mac c lients

Details

FreePBX worlds most popular PBX platform


Highly scalable, full-featured system
Easy to deploy with friendly GUI
Full support & training available
No IT bac kground needed

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

Details

pdfcrowd.com

Become an ITSP Now!


Bec ome a serious c ompetitor in VoIP Immediately
FULL Consultanc y, Installation, Training & Support
Sell Hosted IP PBXs, Biz Lines, Call Centre
Turnkey Provisioning at your data center

Details

*Rates shown do not include E-911 charges or government mandated taxes. Providers offering unlimited calling plans may have
restrictions. Read providers terms and conditions carefully before buying.

swipe left for more details

VoIP Hardware Solutions


Prov ider

Solution Details

Yeastar Communications Solutions


Cost-effective IP-PBX Solution for SMB
FXS, FXO, GSM, BRI and PRI VoIP Gateways
Ric h features and reliable performance

Details

swipe left for more details


Created by: oej, Last modification: Thu 14 of Mar, 2013 (07:09 UTC) by dominic16y

Links to this page...

Please update this page with new information, just login and click on the "Edit" or "Discussion" tab.
Get a free login here: Register Thanks! - Find us on Google+
Page Changes | Comments

Featured -

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

Terms of Service | Privacy Policy


2003-2015 VOIP-Info.org LLC
Powered by bitweaver

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

You might also like