Getting Free Long Distance, Part 2 - page 2

Exploring DUNDi

June 27, 2006

By
Carla Schroder

Warm up your favorite text editor, because we're going to edit three Asterisk
configuration files. The three files are dundi.conf, iax.conf, and extensions.conf.
These are in /etc/asterisk/ on Asterisk@Home. dundi.conf controls
peer authentication, iax.conf is our transport protocol, and extensions.conf
contains your dialplans.

This example connects two peers, MyHost and OtherHost.

First edit iax.conf. Add the following lines, except for any that are duplicated in the [general] section:

Now edit dundi.conf. The default file is well commented and has lots
of examples--you'll find definitions of all the directives in there. This is where
your mapping contexts are defined, which follow this format:

You need to create RSA authentication keys for your server. You may name them anything you want; a good naming convention is to use your server's fully-qualified domain name. Create keys with these commands:

# cd /var/lib/asterisk/keys
# /usr/sbin/astgenkey -n myhost.mynet.com

This creates two keys: myhost.mynet.com.pub and myhost.mynet.com.key. The public key, myhost.mynet.com.pub, must be distributed to all servers you are peering with. Post it on your Web site if you like. The private key is unencrypted, and like all private encryption keys must be guarded carefully. Then the res_crypto.so line interface:

From here you can also run the command show keys to see all of your RSA keys. Now go back to iax.conf and add the dundi user.

Here is a quick Linux tip: you don't have to exit the Asterisk CLI to return to the Linux command line. If you're logging in remotely, just open a second SSH session. If you're on the Asterisk server, switch to a second console with Alt+F2.

dundi/secret is an encryption key automatically generated by Asterisk. You may view this key by running the database show command from the Asterisk CLI.

Finally, edit extensions.conf; this is where you define what numbers to share and what to do with them. Telephone numbers must follow this format:

country_code area_code prefix number

This is a simple example that answers incoming calls, directs them via the SIP protocol to extension 200, which is the digital assistant, sends the caller to voicemail if there is no answer, then hangs up.