Page 140 - Asterisk™: The Future of Telephony
P. 140
Configuring Our Asterisk Boxes
We’ll be utilizing a simple topology where we have two Asterisk boxes registered to
each other directly, and separate phones registered to each Asterisk box. We’ll call the
two Asterisk boxes Toronto and Osakafi (see “Connecting Two Asterisk Boxes To-
gether via SIP”). Bob’s phone will be registered and connected to Toronto, while Alice’s
phone will be registered and connected to Osaka.
The first thing we want to do is create a new channel file (iax.conf) by renaming the
current sample file to iax.conf.sample and creating a new blank iax.conf:
# cd /etc/asterisk
# mv iax.conf iax.conf.sample
# touch iax.conf
Next, open up the iax.conf file and enter the following configuration on the Toronto
Asterisk box:
[general]
autokill=yes
register => toronto:welcome@192.168.1.107
[osaka]
type=friend
host=dynamic
trunk=yes
secret=welcome
context=incoming_osaka
deny=0.0.0.0/0.0.0.0
permit=192.168.1.107/255.255.255.255
autokill=yes was explained in the previous section, but its purpose is to make sure new
calls being set up to a remote system that are not acknowledged within a reasonable
amount of time (two seconds by default) are torn down correctly. This saves us from
having a lot of hung channels simply waiting for an acknowledgement that probably
isn’t coming.
The register line is used to tell the remote Asterisk box where we are so that when the
box at 192.168.1.107 is ready to send us a call, it sends it to our IP address (in this case
our IP address is 192.168.1.104, which you’ll see in the iax.conf configuration of the
Osaka box). We send the username Toronto and the password welcome to Osaka, which
authenticates our registration, and if accepted, writes the location of our Asterisk box
into its memory for when it needs to send us a call.
The [Osaka] definition is used to control the authentication of the remote box and
delivery into our dialplan. Osaka is the username used in the incoming authentication.
We set the type to friend because we want to have both the ability to send calls to
Osaka and to receive calls from Osaka. The host option is set to dynamic which tells
Asterisk to send calls to the IP address obtained when the opposite endpoint registers
with us.
112 | Chapter 4: Initial Configuration of Asterisk