Basic Asterisk Configuration – Editing sip.conf and extensions.conf
January 27, 2009 29 CommentsBasic Asterisk Configuration
Asterisk, Fedora Core, Telephony
I really like the stats package included with WordPress, it provides an excellent source of ideas for what I should write about next. Many of you reach me through a post titled Asterisk and Fedora Core 7 looking for more specifics on how to configure Asterisk. If you need to install Asterisk on FC7, read the Asterisk and Fedora Core 7 post first.
Alright, so you’ve got Asterisk installed but its not configured or has the default Asterisk sample configuration files.
The Asterisk configuration files are found in /etc/asterisk. If you are using Asterisk without telephony hardware, you really need to be concerned with 2 or 3 files. Of importance are the following files
1. sip.conf: this file contains everything to do with the SIP protocol, settings and authentication for Asterisk.
2. extensions.conf: At the most basic level, this file contains the call-plan; what happens on in-bound calls and how outgoing calls are to be treated.
You’re also going to need something to test Asterisk with. Either a soft-phone such as X-Lite or a handset device such as a Polycom 430, or a ATA device, such as the LinkSys PAP-2.
For the sake of this sample, we’re going to configure Asterisk to handle the SIP registration of 3 IP devices.
1. X-Lite Softphone [extension 203]
2. a Polycom 301 [extension 200]
3. a Linksys PAP-2 (Vonage un-locked) [extensions 201 and 202]
sip.conf is easy enough to get going; some advanced features found on some handsets may require additional settings but to keep things simple lets start with the softphone alone.
Backup your existing /etc/asterisk/sip.conf and go with something like this
[general]
port=5060
bindaddr=0.0.0.0
context=home
tos=0×18
nat=yes
externip=YOUR PUBLIC IP
disallow=all
allow=g729
allow=gsm
allow=ulaw
[203]
type=friend
host=dynamic
context=home
secret=agoodsippasswordgoeshere
callerid=CIA FBI ATF <1-555-555-5555>
dtmfmode=rfc2833
nat=yes
mailbox=200@home
disallow=all
allow=ulaw
Feel free to have some fun with the “callerid” parameter, you can have some great fun with your friends and family.
Make a backup of /etc/asterisk/extensions.conf and replace it with this
[general]
static=yes
writeprotect=no
[home]
exten => 55,1,Playback(demo-echotest) ; Let them know what’s going on
exten => 55,2,Echo ; Do the echo test
exten => 55,3,Playback(demo-echodone) ; Let them know it’s over
This bare bones configuration sets up extension 55 in the “home” context to be an echo server.
Get Asterisk to re-read the sip.conf and extensions.conf files (if already running, to start Asterisk, just run “asterisk” as root).
[root@athlon asterisk]# asterisk -r
Asterisk 1.2.20, Copyright (C) 1999 – 2007 Digium, Inc. and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘show license’ for details.
=========================================================================
Connected to Asterisk 1.2.20 currently running on athlon (pid = 3193)
Verbosity is at least 42
athlon*CLI> sip reload
Reloading SIP
== Parsing ‘/etc/asterisk/sip.conf’: Found
== Parsing ‘/etc/asterisk/sip_notify.conf’: Found
athlon*CLI> extensions reload
== Parsing ‘/etc/asterisk/extensions.conf’: Found
— Registered extension context ‘home’
— Added extension ’55′ priority 1 to home
— Added extension ’55′ priority 2 to home
— Added extension ’55′ priority 3 to home
athlon*CLI>
Configure the X-Lite phone by adding a SIP account with the following details:

X-Lite Account Details
Save the settings and X-Lite should register with Asterisk. If watching the Asterisk CLI, you should see the following
Connected to Asterisk 1.2.20 currently running on athlon (pid = 3193)
Verbosity is at least 42
— Remote UNIX connection
— Registered SIP ’203′ at 10.10.50.198 port 14126 expires 3600
— Saved useragent “X-Lite release 1011s stamp 41150″ for peer 203
athlon*CLI>

X-Lite SIP account 203 registered
At this point you should be able to dial the echo server. Go ahead and dial “55″ and hit the green send button. You’ll connect with the “Echo Test”, basically just echoes whatever you say to it. It’s simple but a great way to get the basics right without having to deal with the large “sample” configuration files.
If your call to the echo server worked, the rest of the setup is basically the same as before, editing both the sip.conf and extensions.conf files.
Moving on, lets add the other extensions to the mix. We’ll have our own little PBX by the end of this!
Add the rest of the SIP devices to the sip.conf file
[general]
port=5060
bindaddr=0.0.0.0
context=home
tos=0×18
nat=yes
externip=YOUR PUBLIC IP
disallow=all
allow=g729
allow=gsm
allow=ulaw
[200]
type=peer
host=dynamic
context=home
secret=agoodsippasswordgoeshere
callerid= CITY MORGUE
dtmfmode=rfc2833
nat=yes
mailbox=200@home
disallow=all
allow=ulaw
[201]
type=friend
host=dynamic
context=home
secret=agoodsippasswordgoeshere
callerid= CITY MORGUE
dtmfmode=rfc2833
nat=yes
mailbox=200@home
disallow=all
allow=ulaw
[202]
type=friend
host=dynamic
context=home
secret=agoodsippasswordgoeshere
callerid= CITY MORGUE
dtmfmode=rfc2833
nat=yes
mailbox=200@home
disallow=all
allow=ulaw
[203]
type=friend
host=dynamic
context=home
secret=agoodsippasswordgoeshere
callerid=CIA FBI ATF
dtmfmode=rfc2833
nat=yes
mailbox=200@home
disallow=all
allow=ulaw
Now lets add the sip registrations to the extensions.conf file so that calls can be placed amongst the devices.
[general]
static=yes
writeprotect=no
[home]
exten => 55,1,Playback(demo-echotest) ; Let them know what’s going on
exten => 55,2,Echo ; Do the echo test
exten => 55,3,Playback(demo-echodone) ; Let them know it’s over
exten => 200,1,Dial(SIP/200,20)
exten => 201,1,Dial(SIP/201,60)
exten => 202,1,Dial(SIP/202,60)
exten => 203,1,Dial(SIP/203,60)
Reload sip.conf and extensions.conf and you should now be able to place calls between the registered devices and each device should be able to dial the echo server.
This is a very basic Asterisk configuration that should allow you to further explore other Asterisk options. In the next parts of this post, we’ll explore adding “trunking” with a VoIP provider, ZapTel hardware and voice mail with email notification (In no particular order).
Information, Software, Technology
February 4th, 2009 at 6:39 pm
[...] Basic Asterisk Configuration Asterisk , Fedora Core, Telephony I really like the stats package included with WordPress, it provides an excellent source of.Page 2 [...]
April 20th, 2010 at 4:56 pm
Great articles & Nice a site….
April 24th, 2010 at 3:42 pm
Online shopping provides consumers with many benefits. Many people have discovered the advantages of online shopping and hence, prefer to use this mode of shopping to buy their goods. This explains why there is an increasing number of people using online shopping. At times, besides being able to obtain their goods faster through shopping online, they can get their goods at prices lower than those offered by physical retail stores.
May 20th, 2010 at 2:19 pm
Canadian VoIP Providers – Find Out if VOIP Can Save Money For You, Free Comparison and Reviews! – 1800govoip.com
May 20th, 2010 at 2:19 pm
Reliable Fax over IP – True analog-to-analog faxing 100% reliable over ANY connection – 1800govoip.com
May 23rd, 2010 at 12:17 am
PBX Trial – Works with your existing phones. Easy setup, full-featured. Try Free – 1800govoip.com
May 28th, 2010 at 9:41 pm
The amazing little blueberry has emerged as nature’s number one source of antioxidants among fresh fruits and vegetables.
June 13th, 2010 at 10:03 am
One of the benefits of shopping online is that it helps consumer saves time. This suits the current lifestyle of most people who are rather busy and have difficulty finding time doing all their shopping at physical stores. With online shopping, they can cut down on their traveling time. Furthermore, if the product they want is not available in the physical store, they need to go to another store to find it. With shopping online, all these inconvenience can be avoided.
June 15th, 2010 at 2:57 am
Thank you so very much for putting this out here.
June 18th, 2010 at 12:40 pm
In searching for sites related to web hosting and specifically comparison hosting linux plan web, your site came up.
June 25th, 2010 at 10:53 am
Some very good ideas. Reminded me of some things I know and other tips which I could try. Thanks for the post.
July 1st, 2010 at 1:45 pm
Quite a comprehensive list and makes for very interesting reading… Hopefully will be able to do it all though!!!
July 22nd, 2010 at 1:11 pm
If you’re still on the fence: grab your favorite earphones, head down to a Best Buy and ask to plug them into a Zune then an iPod and see which one sounds better to you, and which interface makes you smile more. Then you’ll know which is right for you.
July 22nd, 2010 at 4:58 pm
This is a great web site. Good sparkling user interface and very informative blogs. I will be coming back in a bit, thanks for the good article.
July 22nd, 2010 at 5:08 pm
Wow, I just needed you to know I have added your good site to my Google bookmarks because of your extraordinary blog layout. But seriously, I think your site has one of the freshest theme I’ve came across. It really helps make reading your great blog a lot easier.
August 4th, 2010 at 5:11 am
I love your site.
August 6th, 2010 at 7:16 am
Harrison Pasqua
August 21st, 2010 at 5:56 pm
Nice Information.
August 22nd, 2010 at 2:04 pm
It was a very useful point! Simply would like to thank you for the content you just shared. Just carry on publishing this kind of posts. I will be your faithful subscriber. Thank you.
August 23rd, 2010 at 11:08 am
Thank you very much.
August 24th, 2010 at 1:36 pm
You…are…amazing! This weblog is so good. I truly hope much more individuals understand this and get what youre declaring, due to the fact let me tell you, its critical stuff. I never wouldve believed about this this way unless Id run into your weblog. Thanks for putting it up. I hope you might have great good results.
August 24th, 2010 at 11:23 pm
Hi, really love the look of your site. Would you be able to tell me what theme you are using? I’m new to this and I’d like to get mine looking anywhere near as smart as yours. Thanks a lot.
August 25th, 2010 at 1:35 am
Wonderful web-site, exactly where did you found this info in this article? I am glad I observed it. i am going to be checking out back soon to check what other posts you can have.
August 26th, 2010 at 12:24 pm
Dear admin, thnx for sharing this blog post. I found it wonderful. Finest regards, Victoria…
August 26th, 2010 at 10:52 pm
I am really happy that I have found this blog. Bookmaking it!
August 27th, 2010 at 12:43 am
Hey there I only wanted to let you know, I truly like the written material on your web site. But I’m utilising Chromium on a device running version 9.04 of Ubuntu and the look and feel are not very enjoyable. Not a powerful deal, I can still essentially look over the articles and look for data, but just wanted to inform you concerning that. The navigation bar is kind of tough to use while using config I am operating. Keep up the superb job!
August 29th, 2010 at 11:24 am
Uhh are you making this up? This post is some f-ed up sh*t kid. Ive met braindead chimpanzees who were smarter than you.
August 29th, 2010 at 9:09 pm
Very Good.
August 30th, 2010 at 6:57 pm
I’m very happy to encounter this information which I had been trying to find for some time. It made me truly glad… This web site has provided all of us very practical info. Thank you