Index of /log/Interweb/asterisk-xs4all

Me

Categories

Archives

2008-Apr
2007-Dec
2007-Nov
2007-Oct
2007-Sep
2007-Jul
2007-Jun
2007-May
2007-Apr
2007-Feb
2007-Jan
2006-Dec
2006-Nov
2006-Oct
2006-Sep
2006-Aug
2006-Jul
2006-Jun
2006-May
2006-Apr
2006-Mar
2006-Feb
2006-Jan
2005-Dec
2005-Nov
2005-Oct
2005-Sep
2005-Aug

Sat, 05 Apr 2008

Asterisk + XS4ALL Bellen

After lots of trying and giving up, I've finally configured an asterisk server on my Ubuntu server. I got it to accept connections from my SIP client, and to connect to XS4ALL's "Bellen" SIP service.

First, the easy bit: installing asterisk. You can do this with the following command: apt-get install asterisk (note: as Joe Terranova points out, you should pay attention to the security side of this. Installing on a machine inside your LAN isn't too much of a risk, but if you install it on a machine with a public IP address, make sure you have all security fixes installed, and set up iptables.)

Then you have to configure the beast. This can look hard, because there are almost 80 config files in /etc/asterisk. Furtunately, you can ignore most of them for now.

SIP accounts

First, add a SIP account to sip.conf. An entry for a SIP account look like this:

[connection_nickname]
type=peer
nat=yes        ; Or "no", if your client has a public IP
username=the_username
secret=password123
canreinvite=no ; Ekiga needs this
context=default

Once you've configured this, restart asterisk, and tell your favorite SIP client it to connect to your server using the username you just added. Then use it to call 1000, and you should get a test system.

Now you have a working SIP server with one client, you can add more clients… and there's the first problem: there's no way to make a call to the SIP clients. To make this possible, you have to add entries to the dialplan in extensions.conf.

Find the [default] section, and for every SIP client, add lines like these to the section. You may want to remove the include => demo line: it provides the "test" you called earlier.

exten => 2001,1,Dial(SIP/connection_nickname,30)

Give all your clients unique extensions (you can even use names!). Restart asterisk when you've added all extensions, and try calling other logged-in extensions. Congratulations! You now have a basic, working SIP PBX (without a connection to anywhere else, though).

The sections in extensions.conf are called contexts, and you can use them for access control. Every connection to/from the Asterisk server has a context, and can only call extensions in that context. You can use this to make sure that only some people can make expensive calls.

The Outside World

To connect to the "normal" phone system, you can use a SIP account. I have an account at XS4ALL, so I created a SIP account in their service centre. Then I added this to the [general] section in sip.conf (replace the xxxxxx bit with the phone number you got):

register => xxxxxxxxxx:[email protected]/xs4all-in

This makes asterisk register with the XS4ALL SIP server, with incoming calls going to extension "xs4all-in". All you have to do to accept these calls, is define the extension in extensions.conf:

[incoming]
exten => xs4all-in,1,Dial(SIP/2001) ; When there's an incoming call from the
                                       ; SIP provider, step 1 is: forward to 
                                       ; SIP/2001 

Note that it's in its own context, so it can't call your extensions (or other SIP accounts!) directly.

You probably also want to use this SIP account to call other people. For that, you'll need another change in both sip.conf and extensions.conf:

sip.conf:
[xs4all]
type=friend
context=incoming
nat=no
username=xxxxxxxxxx
fromuser=xxxxxxxxxx
host=sip.xs4all.nl
fromdomain=sip.xs4all.nl
secret=password123
canreinvite=no
dtmfmode=inband
insecure=very ; Don't worry
disallow=all
allow=gsm
allow=alaw
allow=ulaw
qualify=yes
extensions.conf:
[outgoing]
exten =" _X.,1,Dial(SIP/xs4all/${EXTEN},60,r)

This adds an outgoing SIP line to Asterisk, and adds an extension for "all numbers with one or more digits 0-9", that calls that number on the outgoing SIP line. Make sure you include the "outgoing" context in the context your SIP client is in, so this extension is found when you dial a number.

More information

Lots of information on configuring asterisk and related programs can be found at the VOIP Wiki.

Your avatar scared me the first time I saw it! O.O

Posted by http://vadi.myopenid.com/ at Sun Apr 6 00:49:13 2008 from

Thanks, your post helped me a lot to get Asterisk working. It just took me a while to figure out how to include the outgoing context.

For anybody else puzzled by this: in extensions.conf section [default] add a line 'include => outgoing'

Posted by http://mans-manik.com/ivo/ at Wed Apr 23 09:24:00 2008 from

Leave a comment



foodfight.org index


Creative Commons Licentie Op dit werk is een Creative Commons Licentie van toepassing.