Basic Asterisk Configuration – Editing sip.conf and extensions.conf

January 27, 2009 29 Comments

Basic 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).

Tags: , , Information, Software, Technology

29 Responses to “Basic Asterisk Configuration – Editing sip.conf and extensions.conf”

  1. 1
    Basic Asterisk Configuration - Editing Sip.Conf and Extensions … Says:

    [...] Basic Asterisk Configuration Asterisk , Fedora Core, Telephony I really like the stats package included with WordPress, it provides an excellent source of.Page 2 [...]

  2. 2
    Stainless Steel Sinks Says:

    Great articles & Nice a site….

  3. 3
    shopping online Says:

    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.

  4. 4
    Burl Beahm Says:

    Canadian VoIP Providers – Find Out if VOIP Can Save Money For You, Free Comparison and Reviews! – 1800govoip.com

  5. 5
    Kathy Dolley Says:

    Reliable Fax over IP – True analog-to-analog faxing 100% reliable over ANY connection – 1800govoip.com

  6. 6
    Charlesetta Duchesne Says:

    PBX Trial – Works with your existing phones. Easy setup, full-featured. Try Free – 1800govoip.com

  7. 7
    Bridgett Pritcher Says:

    The amazing little blueberry has emerged as nature’s number one source of antioxidants among fresh fruits and vegetables.

  8. 8
    shopping outlet Says:

    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.

  9. 9
    on-site computer repair Blog Says:

    Thank you so very much for putting this out here.

  10. 10
    Columbus Macdougal Says:

    In searching for sites related to web hosting and specifically comparison hosting linux plan web, your site came up.

  11. 11
    News on Personal Loans Says:

    Some very good ideas. Reminded me of some things I know and other tips which I could try. Thanks for the post.

  12. 12
    pokerstars deposit Says:

    Quite a comprehensive list and makes for very interesting reading… Hopefully will be able to do it all though!!!

  13. 13
    Stainless Steel Sinks Says:

    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.

  14. 14
    find cheap flights Says:

    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.

  15. 15
    online auctions Says:

    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.

  16. 16
    Atomic Wall Clock Says:

    I love your site.

  17. 17
    Reynaldo Tondre Says:

    Harrison Pasqua

  18. 18
    how do you get rid of yeast infections Says:

    Nice Information.

  19. 19
    Maximo Orison Says:

    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.

  20. 20
    lose stubborn body fat Says:

    Thank you very much.

  21. 21
    Corene Aplington Says:

    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.

  22. 22
    Free Stuff To Get Says:

    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.

  23. 23
    Full Movie Downloads Now Says:

    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.

  24. 24
    Full Movie Downloads Says:

    Dear admin, thnx for sharing this blog post. I found it wonderful. Finest regards, Victoria…

  25. 25
    Amazing Diet To Lose Pounds Says:

    I am really happy that I have found this blog. Bookmaking it!

  26. 26
    Stephaine Lofquist Says:

    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!

  27. 27
    New York city psychiatrists Says:

    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.

  28. 28
    melt body fat Says:

    Very Good.

  29. 29
    Joe Graap Says:

    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

Leave a Reply

Powered by WP Hashcash

World Trade Center Building 7 was NOT hit by an aircraft.

9/11 Controlled Demolitions of September 11, 2001 World Trade Center Building 7 was NOT hit by an aircraft. This...

HAPPY DIWALI AND NEW YEAR, CELEBRATE Diwali

HAPPY DIWALI AND NEW YEAR TO U *. * . * . * . * . * . *...

Dipawali 2009 pooja time, Diwali Muhurats 2009, Auspicious time forLakshmi Puja

Diwali Pooja Muhurats, Auspicious time, Shubh Samay in 2009 Pushya Nakshatra October 12, 2009 is the ‘Pushya Nakshatra’ which...

Diwali sms, Free Diwali sms, Happy Diwali sms, Free Send Diwali sms

Diwali sms Diwali aai, masti chahi, rangi rangoli, Diwali aai, masti chahi, rangi rangoli, deep jalaye, Dhoom Dhadaka, chhoda...

Munna bhai Free SMS, Mobile Text Messages, Tapoti Style Akdom Zakasss

Tera bahot memory aa rela tha,Itna tem ho gela hai,tere ko dekha bhi nai,Akha life mei tere jesa 1...

Find Popular Searches in the web solutions Development Outsourcing

cheap internet marketing web design birmingham website hosting website submission ecommerce web hosting content management systems strategic internet marketing...

Some easy steps you can take to tackle a flu / swine flu virus of any kind

It is essential to remember that all kinds of viruses and bacteria can attack you when your immune system...

Mobile Phone Etiquettes – all good things should be enjoyed responsibly

We all love our mobiles… we talk, we text, we listen to music and we stay in touch.Can we...

Adsense Alternatives – available to webmasters wishing to monetize the web

Here are the Adsense Alternatives that are available to webmasters wishing to monetize the web! Adbrite AdEngage Adgenta Adhearus...

Worldwide Mobile Operator MMSC Settings – For receiving and sending MMS

Worldwide Mobile Operator MMSC Settings Setting For receiving and sending MMS From your mobile phone or GSM Modem [Albania...