Home > Linux > Home phone by Asterisk

Home phone by Asterisk

September 1st, 2009 Leave a comment Go to comments

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
Categories: Linux Tags: ,
  1. theo
    August 2nd, 2011 at 17:49 | #1

    Leuk, ik ben ook aan de slap met asterisk & een kx-tgp500 panasonic sip telefoon.

    Ik probeer je trouwens al de hele tijd te bellen op dat nummer, maar ik krijg geen gehoor.

    • Dirk-Jan
      August 2nd, 2011 at 23:39 | #2

      Theo, how you doing?
      Asterisk al aan de praat gekregen? Op welk nummer probeer je me te bereiken dan? Het nummer op mijn blog pagina (31123456789) gaat niet werken hoor :-)
      Greetz

  2. theo
    August 4th, 2011 at 11:59 | #3

    @Dirk-Jan

    Zo ben jij, he? Dat je er op in gaat ;)

    Ik heb ook net mijn budget phone gegevens via de normale post binnengekregen, dus ik ga es verder vogelen. Ik zit momenteel met het oreilly book erbij, maar jouw configuratie heeft mij ook geholpen. Heb jij ook CDR logging voor jezelf aan de praat?

    Ik wilde eerst 12connect.nl proberen, maar ik kreeg geen account aangemeld. Maar deze is geloof ik weder wat goedkoper dan budgetphone. Volgende keer maar verder naar kijken.

  3. Dirk-Jan
    August 6th, 2011 at 21:25 | #4

    Hey Theo, je kent me toch? Heb geen CDR logging geactiveerd, denk niet dat ik het zal gebruiken. De standaard asterisk log file is altijd voldoende geweest. Over Budgetphone ben ik goed te spreken, ben een tevreden klant! Als je nog tips hebt, let me know. Handig zo’n HP TouchPad, kan vanuit de luie stoel nu ook mijn blog bijwerken.

  4. theo
    August 30th, 2011 at 11:48 | #5

    @Dirk-Jan
    Leuk, wat kostte die en wat kan je ermee?

    En gebruiktie hem nu nog?

  5. Dirk-Jan
    August 30th, 2011 at 16:48 | #6

    Hij koste 99 dollar en je kunt er voornamelijk heel goed mee multitasken. Niks voor jou?

  6. theo
    September 6th, 2011 at 12:02 | #7

    @Dirk-Jan

    Hmmm. ja, ik heb wel wat tips. Welke versie van asterisk gebruikt U? Ik heb nl. uiteindelijk een iets andere configuratie gebruikt. Die van jou doet het half bij mijn. Ff bij jou checkoe, momentje ……. Dat insecure=very in de sip.conf, da’s depricated en werkte niet bij mijn. ‘k Kent anders wel ff die van mijn plaatsen hier, maar niet stiekem mijn wachtwoord gebruiken en mijn weer midden in de nacht opbellen om dan weer te zingen: “Heb je even voor mijn? Maak wat tijd voor mij vrij”. Tsjonge jonge, zeg. Maar ja, zo ben jij.

  1. September 3rd, 2009 at 09:57 | #1