IAX and SIP

Source: asteriskblog.com

Here are two protocols that I have played with using Asterisk. They are the most common in my opinion as well, IAX and SIP. Of course you’ve also got H.323 but I’ve never played with that one.

So first of all, I bet you are asking yourself, what the hell am I talking about protocols and geese and tear ducts, oh my! Well, a protocol is simply a way that a call is made. It’s the system that it goes through. SIP is going to be through a standard telephone line. If you connected your Asterisk box to your home phone line, that’s SIP, thus you would have to set it up using SIP specific terms and utilizations. IAX however is a bit more interesting to me. IAX is a protocol that Mark Spencer actually created. It’s in the second version now, so it’s usually referred to as IAX2. Basically, it lets two Asterisk servers communicate with each other. I won’t go into much more detail in this post about it.

Now that we know there is a difference between the two, what are we going to do about it? Well, why not learn how to configure them first? So, let’s write a simple configuration file that will enable us to connect using the protocol and actually make our first call. (If you have asterisk installed already.)

You’re going to need a couple of things to write a config file for SIP. First of all, if you’re using linux for this, which I HIGHLY reccomend, your config files will be located in etc/asterisk/ In there you will find lots and lots of .conf files. Right now we will look at SIP.conf. Right now, there is nothing important in there. It’s all sample stuff that you probably will never use. So if you want, feel free to clear out this file at this time. Everything in there is commented out anyway.

In this file you will need some category’s and a couple of context’s. First of all, you need a [general] category which you will see below. Under the “General” category you need a context. Call it “Line1″ for now. Under [handset1] you will need a type which we will use “friend” which basically issues a link going back and forth in between the two lines. Then we will set the context for this. It’s going to be “phone1″. Secret will be the password that Asterisk uses to talk to the analog/digital phone line converter. The host is the IP address of the computer you’re running asterisk on. (I really reccomend getting a seperate IP from your internet provider for the Asterisk box if you plan on running with SIP behind a network.) Lastly, the DTMF mode, rfc2833 is a standard for this and it works the best out of the other options, so I reccomend just sticking with it.

[general]
context=line1

; handset1 describes the line in * that connects to the handset
[handset1]
type=friend
context=phone1
secret=password
host=192.168.1.8
dtmfmode=rfc2833

; PSTN is the line that connects the PSTN line into the box.
[PSTN]
type=friend
context=line1
secret=password2
host=192.168.1.8
dtmfmode=rfc2833

That is a basic SIP.conf. It will get you in and out of the box pretty well. Now let’s go over an IAX.conf. Firstly, under general, disallow and allow. By using all under disallow, it will disable the use of any and all codecs in compression. But this is a HUGE bandwidth eater. So underneath that, place allow=ulaw. ulaw is probably the best compression out there with the least loss in quality. I would reccomend this highly. DTMF tones come through beautifully with ulaw whereas in others they tend to get kinda garbled.

I reccomend the service Nufone. http://www.Nufone.net For IAX they will charge $0.02 per minute throughout the US, Canada and Puerto Rico I believe it is. You’ll notice the register command above the codec allowances. That sends the user:pass combo to that server. When using Nufone, they will provide you with the server name that they want you to register with.

In the second half of this .conf file, you have 3 context’s. First the type, which is a user in this case. Basically it allows you to send information to them. Next is the secret again, which of course is your password. Lastly is the context in which you will be using it in your dial plan. I chose to use incoming because on my dialplan I named the incoming calls “incoming” obviously. We’ll go over that at a different time though.

[general]
register => chris:password@switch-2.nufone.net
disallow=all
allow=ulaw
; This is how * connects to nufone.
[nufone]
type=user
secret=password
context=incoming

So now that we have gone over the basics of IAX and SIP I know you have some questions. There have been some things that I skipped over because I didn’t think anyone would want to read a 50 page blog post about SIP and IAX. If you have any questions or if I didn’t cover something that needs covering, leave a comment and let me know. Thanks guys!

Published on January 2nd, 2006 under


Last 20 posts tagged "Basics"

911 VOIP Calls Should Be Tested

Source: asteriskblog.com

All Americans know how to call 911 in case of am emergency. The system was first investigated in 1958 and was set in place in 1967. The first 911 call ever to be made was in 1968. The caller…

Published on April 14th, 2008 under , ,

VOIP: The Good and The Bad

Source: asteriskblog.com

In the recent months, VOIP services have gotten more and more attention – both for individual and business purposes. Sometimes, though, we get all caught up in the hype that we may not really…

Published on April 11th, 2008 under ,

Social Networking Benefits From VOIP

Source: asteriskblog.com

I was talking to a younger cousin the other day and I was surprised at how involved she is in social networking. I was asking her about her friends and activities and a large part of the conversation…

Published on February 22nd, 2008 under ,

Installing Asterisk with a GUI on Linux

Source: asteriskblog.com

I don’t know how I missed this, but I just came across an excellent Asterisk How-to guide on howtoforge.com, the excellent site that houses an increasing amount of guides of doing many…

Published on October 8th, 2007 under , , ,

Tips On Maximizing Your PBX

Source: asteriskblog.com

Sure, you know about the basic features that come with your PBX systems.  Features such as call forwarding, voicemail, call accounting, configurability, etc.  But for those who haven’t been…

Published on June 29th, 2007 under , , , ,

Voice 2.0 Anyone? (Part 1)

Source: asteriskblog.com

The coming of “Web 2.0″ has ushered in a whole lot of online services that we could only dream of when the World Wide Web was first conceived and commercialized. There were the blogs, wher…

Published on December 28th, 2006 under , , , , ,

Choosing a VoIP Gateway for Your Company (Part 1)

Source: asteriskblog.com

Gateways are essential aspects of any enterprise VoIP system. These transfer voice (and other traffic) between the Public Switched Telephone Network (PSTN) and the IP (Internet Protocol) network…

Published on December 19th, 2006 under , ,

Back to the Basics - Config Files

Source: asteriskblog.com

The configuration files in Asterisk are all text based. Nothing too complicated. If you installed the sample .conf files, then they will have a default setup and will have everything commented…

Published on November 13th, 2006 under ,

Great comments on ‘Sniffin’ the VOIP Traffic’

Source: asteriskblog.com

My last post has generated some great comments (as I hoped it would) from those who have a lot more experience using Wireshark to view the network traffic from a SIP call. We’re going over…

Published on October 1st, 2006 under ,

Job Postings

Source: asteriskblog.com

If you are a corporate client looking for someone to work on a PBX for you in the cheapest and most efficient manner, you have come to the right place. Take a look at our forum and post a job…

Published on September 29th, 2006 under , , ,

Sniffin’ the VOIP traffic

Source: asteriskblog.com

This time we will install a network protocol analyzer to watch the traffic on our LAN from initiating and connecting a SIP call.

The Wireshark open source project was formerly known as Etherea…

Published on September 16th, 2006 under ,

Chowing on some Nerd Vittles.

Source: asteriskblog.com

To get started on some askerisk hackin’, let’s head on over to nerdvittles for a very nice treat from a fellow Charlestonian asterisk guru (much more than I).

What they are offering is a…

Published on September 11th, 2006 under

Amp is now FreePBX

Source: asteriskblog.com

Those of you who use Asterisk@Home, I’m sure that by now you’re familiar with having a GUI at your fingertips. There are those of us however, who have not had the luxury of a GUI and a…

Published on March 27th, 2006 under , , ,

Using Asterisk In Your Home - The Uses

Source: asteriskblog.com

So now we have Asterisk set up for home use. What can we do with it now? If you happen to have mischevous teenage kids, you can log all your calls! Maybe you want to have a seperate line for…

Published on March 15th, 2006 under

Using Asterisk In Your Home - The Setup

Source: asteriskblog.com

When setting up Asterisk for home use, you’ve got a million and a half ways to do it. If you want to take the easy way, Asterisk@Home is the way to go, thus the name. It provides a GUI that…

Published on February 27th, 2006 under , , ,

Installing Astlinux

Source: asteriskblog.com

I suppose I could reinvent the wheel and copy everything that someone else has said. But honestly, I don’t know squat about Astlinux. I’ve never even heard of it until this morning. So check…

Published on January 16th, 2006 under , , , ,

What distro of Linux should I run?

Source: asteriskblog.com

There are hundreds of distro’s of linux that you could run Asterisk on. There is even a Windows port out now. However I would hesitate running in on Windows as it’s still beyond buggy.

You…

Published on January 12th, 2006 under

What do I need to run Asterisk?

Source: asteriskblog.com

A computer. A clunker. A piece o’ trash! Nothing exciting really. If you’ve got an old dusty computer sitting in your closet, pull it out and throw knoppix on that bad boy!

Currently I am…

Published on January 12th, 2006 under

IAX and SIP

Source: asteriskblog.com

Here are two protocols that I have played with using Asterisk. They are the most common in my opinion as well, IAX and SIP. Of course you’ve also got H.323 but I’ve never played with that…

Published on January 2nd, 2006 under

The Playback() and Background() Functions

Source: asteriskblog.com

These two functions are going to be commonly used in your dial plan. They are virtually the same thing with the exception of one detail, interactivity. First of all, let me share with you a piec…

Published on January 1st, 2006 under ,
Member of "Hype Media! Network"