Home phone by Asterisk

Last week I’ve spend some time doing an Asterisk PBX setup at home. Because I like the technique and my girlfriend likes to use the phone I decided to build my own PBX (Private Branch Exchange). In other words a telephone exchange. So doing some research I figured out what the requirements where and came up with the following components:
– a SIP provider
– a SIP compliant phone
– Asterisk PBX software
– an Internet connected Linux server running 24/7

As for the SIP provider I chose the Budgetphone company because they support Asterisk and you get a local area number on which you can be called.

On my search for a suitable phone selected the Siemens Gigaset A580 IP. The main reasons I chose this phone where:
– it’s a hybrid phone so you can use POTS and or VOIP
– it’s energy efficient by using multiple energy-saving technologies
– it’s in a affordable price range

The installation of Asterisk was a piece of cake. Being a very happy user of Debian Linux, I installed the pre-compiled package from the Debian repository by executing the following command:

apt-get install asterisk asterisk-sounds-main

In my case the Asterisk server has a public ip-address, and the phone base station is located in private ip space behind a NAT router.

Below you’ll find the Asterisk configuration. This configuration is known to work on Asterisk version 1.4.21.2~dfsg-3. In my case all configuration files reside in ‘/etc/asterisk/’.

sip.conf:

[general] context=default subscribemwi=yes allowoverlap=no bindport=5060 bindaddr=0.0.0.0 srvlookup=yes disallow=all allow=alaw allow=ulaw allow=g726 allow=ilbc allow=gsm language=us dtmfmode = auto register => 31123456789@sip1.budgetphone.nl::31123456789@sip1.budgetphone.nl/101 [31123456789] type=friend context=from-budgetphone host=sip1.budgetphone.nl fromuser=31123456789 fromdomain=sip1.budgetphone.nl username=31123456789 insecure=very secret= qualify=yes port=5060 [phone] type=friend context=internal host=dynamic nat=yes callerid="Home phone" canreinvite=no qualify=yes secret=password mailbox=1001

extensions.conf:

[general] static=yes writeprotect=no clearglobalvars=no [globals] INT1=SIP/phone OUTBOUNDTRUNK=SIP/31123456789 [from-budgetphone] exten => 101,1,Dial(${INT1},28) exten => 101,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail) exten => 101,n(unavail),VoiceMail(1001@default,u) exten => 101,n,Hangup() exten => 101,n(busy),VoiceMail(1001@default,b) exten => 101,n,Hangup() [internal] ; internal number exten => 1001,1,Dail(${INT1}) ; voicemail number exten => 700,1,VoiceMailMain() ; external numbers exten => _XXXX.,1,Set(CALLERID(all)=31123456789) exten => _XXXX.,2,Dial(${OUTBOUNDTRUNK}/${EXTEN}) exten => _XXXX.,3,Hangup()

voicemail.conf

[general] format=wav49|gsm|wav serveremail=asterisk attach=yes skipms=3000 maxsilence=10 silencethreshold=128 maxlogins=3 emaildateformat=%A, %B %d, %Y at %r sendvoicemail=yes [zonemessages] eastern=America/New_York|'vm-received' Q 'digits/at' IMp central=America/Chicago|'vm-received' Q 'digits/at' IMp central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours' military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p' european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM [default] 1001 => 1234,Your name,user@domain.net,,tz=european

When done editing those files, you need to connect to the Asterisk CLI (Command Line Interface) by using the following command:

asterisk -r

Set the verbosity level to 10:

*CLI> core set verbose 10

To reload the new configuration issue:

*CLI> reload

To see if the SIP services have registered succesfully issue:

*CLI> sip show peers

I needed to configure the next fields in the base station configuration to get the phone registered with Asterisk. Go to ‘settings’ -> ‘telephony’ -> ‘connections’ -> ‘edit’ -> ‘show advanced settings’.
– Authentication Name: phone
– Authentication password: *******
– Username: phone

– Domain: local
– Proxy server address: Asterisk server ip
– Registrar server: Asterisk server ip

To make the MWI (Message Wait Indicator) work on the handset you need to follow the next steps:
Web browse to the Siemens phone web interface, go to ‘settings’ -> ‘telephony’ -> ‘Network Mailbox’. For the connection you want MWI with, enter the voicemail access number into the ‘Call Number’ box, in my case 1001 and tick the ‘Active’ box. This will make the Siemens phone subscribe to the mailbox status.

Have fun!

UPDATE: Since the upgrade of my server system Debian Lenny (asterisk 1.4) to Debian Squeeze (asterisk 1.6) incoming calls were not coming through. After some searches I found out one parameter needed to change at the sip.conf file.

insecure=port,invite

[ad#ad-article-banner1]