Updates (Sticky)

December 27 2008

I tried upgrading to the latest GUI:

ipkg remove asterisk14-gui
ipkg install asterisk-gui

but had some problems with the CDR reader. While the
interface seems a little nicer, i would stay with
asterisk14-gui for now.

August 27 2008

I reinstalled asterisk on the slug today using
my instructions. It all seemed to work OK!

I did make a couple of minor changes: I added some
code under the Platform step to automatically start
asterisk on reboot; I also updated the version numbers
of the asterisk software for the ipkg install step.

FWD is no linger free. It can still be used
as an example of SIP trunking.

May 13 2008

I added a bit of an explanation to Step 3 on how
to allow all calls to go out. The original dialplan
blocks long distance calls by default (other than
to toll free numbers).

Friday, December 28, 2007

Introduction

Using two very inexpensive Linksys devices and some sort of USB storage device you can create a full featured home PBX using Asterisk, a Linux based open source PBX system.

We'll need to get an analog terminal adaptor called the Linksys SPA3102:

The SPA3102 acts as a gateway from the PSTN to your home VoIP system.

Next we'll need to get the Linksys NSLU2 which is a home NAS device:

This little box can be flashed with a version of Linux called Unslung to create a small server that will run Asterisk, an open souce PBX system. Finally, you'll need either a USB pen or external drive.

Our intention here is to create a system that can use the Asterisk GUI to set up our users, configure voicemail and add VoIP trunks. The GUI can also be used to monitor call logs and system performance. The GUI cannot be used to configure the SPA3102.

At the end of the process you should be able to dial out using a SIP phone and receive calls that will got to a SIP extension. If no one answers the extension, the call will go to voicemail.

We'll also be able to block unwanted callers using blacklists, phone numbers that can be added directly from the phone.

There are currently 7 setup sections on the blog. Follow them in order and you should have a functional home PBX. I will not bore you with how many hours it took me to figure this out! Steps 3-7 should also work with an Asterisk Now implementation as those steps are hardware independent.

If you see some glaring errors I would very much appreciate comments. I'm new at this home PBX stuff, although I have quite a bit of UNIX/Linux experience and some knowledge of the Alcatel OmniPCX 4400.

Disclaimer!!!!

These instructions are extremely bare bones, assume you have basic Linux knowledge, and are probably incorrect in many places!!!!

First Step (Platform)

Many instructions on the Internet are for Asterisk 1.2. Asterisk 1.4 has a slightly different configuration syntax and when you use the GUI interface you must follow the convention of using the users.conf file rather than the sip.conf file. Do not manually modify modules.conf, sip.conf, or extensions.conf at this time. Once again, and finally:

USE AT YOUR OWN RISK!!!


Setup the NSLU2

Follow http://www.nslu2-linux.org/ and install the latest Unlung version of Linux. I am using Unslung 6.8 Beta. Note that when it's done and you login the console will say:

Welcome to Unslung V2.3R63-uNSLUng-6.8-beta

---------- NOTE: THIS SYSTEM IS CURRENTLY UNSLUNG ----------


BusyBox v0.60.4 (2005.03.22-06:52+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.


Threw me for a loop as I thought "UNSLUNG" meant it didn't work, but it just means the system is good to go.

Setup ssh



ipkg install openssh



and turn telnet off from the NSLU2 web interface. All these instructions are on the NSLU2's excellent web page. Once your NSLU2 is unslung you can install the Asterisk packages using the ipkg installer.

Installing Software Packages

Step 1

Install the following ipkgs:


asterisk14 - 1.4.21.2-2 - Asterisk is an Open Source PBX and telephony toolkit.
asterisk14-core-sounds-en-alaw - 1.4.8-1 - asterisk-core-sounds-en-alaw
asterisk14-core-sounds-en-g729 - 1.4.8-1 - asterisk-core-sounds-en-g729
asterisk14-core-sounds-en-gsm - 1.4.8-1 - asterisk-core-sounds-en-gsm
asterisk14-core-sounds-en-ulaw - 1.4.8-1 - asterisk-core-sounds-en-ulaw
asterisk14-extra-sounds-en-alaw - 1.4.7-1 - asterisk-extra-sounds-en-alaw
asterisk14-extra-sounds-en-g729 - 1.4.7-1 - asterisk-extra-sounds-en-g729
asterisk14-extra-sounds-en-gsm - 1.4.7-1 - asterisk-extra-sounds-en-gsm
asterisk14-extra-sounds-en-ulaw - 1.4.7-1 - asterisk-extra-sounds-en-ulaw
asterisk14-gui - 0.0.0svn-r2036-3 - Asterisk-GUI is a framework for the creation of graphical interfaces for configuring Asterisk.

sendmail - 8.14.2-1 - The most classic SMTP server.


Optional, to make your life easier:

man - 1.5p-4 - unix manual page reader
bash - 3.2.17-1 - A bourne style shell
diffutils - 2.8.1-6 - contains gnu diff, cmp, sdiff and diff3 to display differences between and among text files



Note
: Additional packages other than the above will be automatically installed if needed.

Step 2

Check to see if Asterisk is installed correctly by typing:
# /opt/sbin/asterisk -vvvc
If it starts up OK give a Ctrl-C and continue on.

Step 3

Backup the following files:

# cd /opt/etc/asterisk
# cp -p extensions.conf extensions.conf.org
# cp -p users.conf users.conf.org
# cp -p http.conf http.conf.org
# cp -p manager.conf manager.conf.org
# cp -p voicemail.conf voicemail.conf.org

Step 4

You can add this code to a file called
/opt/etc/init.d/S99asterisk
to have asterisk start up automatically at reboot:


#!/bin/sh

if [ -f /opt/var/run/asterisk.pid ] ; then
kill `cat /opt/var/run/asterisk.pid`
else
killall asterisk
fi

rm -f /opt/var/run/asterisk.pid

umask 077

/opt/sbin/asterisk


Setting up the Linksys 3102 ATA

Update: I recommend flashing your SPA3102 with the latest Linksys firmware. I was having some problems with only the Caller ID number being passed to Asterisk (not the Caller ID name). Moving to the 5.1.7 firmware appears to have solved the problem.

Check the SPA3102 Linksys 3102 for Dummies guide from the blog roll links. It is the best on the Internet IMHO.

Step 1

Connect the ATA to your Ethernet jack on your PC or Mac, set the interface for DHCP and connect the other end of the cable to the Internet port of the SPA3102.

Plug the 3102 in and navigate to:
192.168.0.1
Under Subscriber Information

Step 2


Click on Admin login in the upper right hand side. You won't be prompted for a password as the SPA3102 has not had one set yet.

Now click on the advanced config button on the lower left hand side. Linksys/Cisco need to do some work on their human interface design!


Step 3

Click on the Wan Setup tab

For network type choose either DHCP or Static depending on your preferences.

Enter a couple of ntp time servers under optional settings:


Primary NTP Server: 0.pool.ntp.org
Secondary NTP Server: 1.pool.ntp.org

Click yes for Remote Management. You will need this to access the SPA3102 from your LAN.

That's all we will do here. Click Submit all Changes.

Step 4

Click on the Lan Setup tab

Network Service: Select Bridge

This will turn the SPA3102 into a single port switch and there is no need to enter any other settings.

Click Submit all Changes.

NOTE: When you save the setting here the SPA3102 will not be available from your computer. You will need to plug it into your LAN, and browse to the DHCP assigned or static address you entered in the Wan tab.

Step 5

Let's configure the Voice side of things by logging in as you did in Step 2.

Click on the Voice/Regional tab and set your time zone and make sure Daylight Savings is OK for you. I found the default gain settings to be too low. I adjusted them to:

FXS Port Input Gain: -3
FXS Port Output Gain: -6
from the default -3 and -3 You can experiment. I'm still unclear about these settings, however!

The rest of the settings in the Regional tab should be OK.

Step 6

Click on the Voice/PSTN Line tab

Proxy and Registration

Proxy: Enter IP of your NSLU2 Asterisk server.

Subscriber Information


Display Name: LinksysFXO
User ID: LinksysFXO
Password: whateveryouwant

Dial Plans

Dial Plan 1: (S0<:s>)

PSTN-To-VoIP Gateway Setup

PSTN Ring Thru Line 1: no
PSTN CID for VoIP CID: yes
Off Hook While Calling VoIP: no
PSTN Caller Default DP: 1
The last entry corresponds to the dial plan you selected above.

FXO Timer Values (sec)

PSTN Answer Delay: 5

The Answer Delay value is important to enable the SPA3102 to capture the Caller ID information from the PSTN. I needed to tweak this setting a few times and YMMV!

International Control

SPA To PSTN Gain: 0
PSTN To SPA Gain: 10

There has been some discussion about voicemail audio levels for incoming calls from the PSTN on Asterisk (VOIP to VOIP callers leaving voicemail are always OK) and the PSTN to SPA Gain setting allows you to tweak this. You might find that maxing out this setting at 12 will cause some annoying echo. Experiment!

Optional Step

If you want an analog phone attached to the Line 1 port and have it act as a VoIP phone follow these steps. If you are just going to have the SPA3102 act as a VoIP gateway you can ignore this.

Click on the Voice/Line 1 tab

Under Proxy and Registration

Enter IP of your NSLU2 Asterisk server.


Display Name: LinksysFXS
User ID: 6001
Password: whateveryouwant

Click Submit all Changes. The SPA3102 is now set up.

Step 7

Edit users.conf and add the following entry.

[LinksysFXO]
type=friend
secret=whateveryouwant
qualify=yes ; Qualify peer is no more than 2000 ms away
nat=no ; This phone is not natted
host=dynamic ; This device registers with us
canreinvite=no ; Asterisk by default tries to redirect

If you followed the optional step you must also add a similar entry.

Step 8

Start Asterisk and if thing are going OK you should be able to navigate to the SPA3102 Info tab and see that the PSTN Line Status is registered and if you followed the optional step you'll see that Line1 is registered.

Second Step (GUI)

Next we must make some edits to allow the GUI to work. A good general guide is located here:

http://www.asteriskguru.com/tutorials/asterisk_gui.html

Some elements of the GUI will not work on the NSLU2. You will only be able to use the basic configuration.

Step 1

Plop this code at the end of the extensons.conf file. This will tell the GUI that we've already configured a dialplan. This is necessary to avoid the setup page which automatically pops up when you type the URL in Step 2. We don't want the setup page to activate as the step by step GUI is primarily directed at PC users and not NSLU2 users.

[asterisk_guitools]
exten = executecommand,1,System(${command})
exten = executecommand,n,Hangup()
exten = record_vmenu,1,Answer
exten = record_vmenu,n,Playback(vm-intro)
exten = record_vmenu,n,Record(${var1})
exten = record_vmenu,n,Playback(vm-saved)
exten = record_vmenu,n,Playback(vm-goodbye)
exten = record_vmenu,n,Hangup
exten = play_file,1,Answer
exten = play_file,n,Playback(${var1})
exten = play_file,n,Hangup
hasbeensetup = Y

Note: I'm not altogether sure if this whole block is necessary. You might just try with:

[asterisk_guitools]
hasbeensetup = Y
If that does work OK, could someone leave a comment? Thanks!

Step 2

cd to /opt/etc/asterisk and edit `manager.conf` and add the following code snippets:

[general]
displaysystemname = yes
enabled = yes
webenabled = yes
port = 5038



[administrator]
secret = 1234
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config




Edit `http.conf` and change the following:

enabled=yes
enablestatic=yes
bindaddr=0.0.0.0


Start the Asterisk server on the NSLU2
# asterisk -vvvc
Open your web browser and navigate to:
http://IP.OF.YOUR.NSLU2:8088/asterisk/static/config/cfgbasic.html
Login as administrator with the password wrxiur

Browse around. As I mentioned some functionality is limited, but you will be able to add users, check call logs, monitor the CPU use, etc.

Note: You might have to quit your browser to see the Users tab. Seems to be a bit of a hack job here!

Step 3

Click on the Users tab and create one extension (6002). You can accept the default values for now.

Note: You will see the LinksysFXO extension already created since you manually added it to users.conf in the previous setup section.

Step 4

Plug the Line jack of the SPA3102 into the phone jack. and configure a SIP phone with the extension 6002 pointing to your Asterisk server's IP. Use the SIP phone to call 500. It will play a demo file and make an attempt to connect to Digium's IAX server.

Call your home telephone number from an external line and Asterisk should answer. It will play the demo files telling you that Asterisk is set up correctly.

Step 5

Unplug the the SPA3102 from the wall jack. No need to confuse incoming callers!

Third Step (Dialplan)

Now we're going to hack extensions.conf to get rid of the demo message that plays after voicemail and incoming calls.

Step 1

cd /opt/etc/asterisk
cp -p extensions.conf extensions.conf.hold

Step 2

Comment out the following two lines in [demo]:

;exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory
;exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions

Now if you dial your home phone number Asterisk will answer with no messages. When prompted enter 6002 and it will ring your SIP phone.

Step 3

Now let's create a real dialplan that will allow the SPA3102 to answer the phone, ring a single SIP extension and go to voicemail. You will also be able to dial out, but note the example here is for the 604 and 778 area codes which require 10 digit dialing. Adjust for your local scenario.

You will need to create a new extensions.conf file so make double sure you backed up the original one.

Part of this script was borrowed from the slug samples and from
http://swik.net/AsteriskDialplan
Here's the new extensions.conf file:


;!
;! Automatically generated configuration file
;! Filename: extensions.conf (/opt/etc/asterisk/extensions.conf)
;! Generator: Manager
;! Creation Date: Mon Dec 17 21:40:38 2007
;!
[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static = yes
;
;
; if stati=yes and writeprotect=no, you can save dialplan by
; CLI command 'save dialplan' too
;
writeprotect = yes

[globals]
PHONE1 = SIP/2203
; These variables are to avoid the irritating problem
; with inability to use regexp's on strings that have
; not been defined.
;
CALLFILENAME = foo
FOO = foo

[macro-stdexten];
;
; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
;

exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHAN
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user in

[macro-failann]
; Failure announcement playback macro:
; ${ARG1} - Status of the call, one of:
; (CHANUNAVAIL | CONGESTION | BUSY | NOANSWER |
; ANSWER | CANCEL | DONTCALL | TORTURE)
;
exten => s,1,Goto(s-${ARG1},1)
exten => s-CHANUNAVAIL,1,Playback(all-circuits-busy-now)
exten => s-CHANUNAVAIL,2,Playback(pls-try-call-later)
exten => s-CHANUNAVAIL,3,Hangup
exten => s-CONGESTION,1,Playback(cannot-complete-temp-error)
exten => s-CONGESTION,2,Playback(pls-try-call-later)
exten => s-BUSY,1,Playback(the-party-you-are-calling)
exten => s-BUSY,2,Playback(is-curntly-busy)
exten => s-BUSY,3,Hangup
exten => s-NOANSWER,1,Playback(the-party-you-are-calling)
exten => s-NOANSWER,2,Playback(is-curntly-unavail)
exten => s-NOANSWER,3,Hangup
exten => s-ANSWER,1,Hangup
exten => _s-.,1,Playback(cannot-complete-network-error)
exten => _s-.,2,Playback(pls-try-call-later)
exten => _s-.,3,Hangup

[pstn-outgoing]

exten => 911,1,Dial(SIP/${EXTEN}@LinksysFXO,,T)
exten => 911,2,Macro(failann,${DIALSTATUS})
exten => _604NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _604NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _778NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _778NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _18XXNXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _18XXNXXXXXX,2,Macro(failann,${DIALSTATUS})

[default]

; We start with what to do when a call first comes in.
;
exten => s,1,Wait(1) ; Wait a second, just for fun
exten => s,n,NoOp(CURRENT CALLER ID= ${CALLERID(num)})
exten => s,n,Answer ; Answer the line
exten => s,n,Macro(stdexten,6001,SIP/6001)
exten => 6000,1,VoiceMailMain

include => pstn-outgoing

[asterisk_guitools]
exten = executecommand,1,System(${command})
exten = executecommand,n,Hangup()
exten = record_vmenu,1,Answer
exten = record_vmenu,n,Playback(vm-intro)
exten = record_vmenu,n,Record(${var1})
exten = record_vmenu,n,Playback(vm-saved)
exten = record_vmenu,n,Playback(vm-goodbye)
exten = record_vmenu,n,Hangup
exten = play_file,1,Answer
exten = play_file,n,Playback(${var1})
exten = play_file,n,Hangup
hasbeensetup = Y



Also, please note that this dialplan blocks long distance calls (other than to the 18XX toll free numbers). If you want to have everything go through replace
[pstn-outgoing]
with this code:

[pstn-outgoing]
exten => 911,1,Dial(SIP/${EXTEN}@LinksysFXO,,T)
exten => 911,2,Macro(failann,${DIALSTATUS})
exten => _XXXXXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _XXXXXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _XXXXXXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _XXXXXXXXXXX,2,Macro(failann,${DIALSTATUS})

Fourth Step (Voicemail)

This took me a while to figure out!

Step 1

If you are using the extensions.conf script from the previous step you can skip to Step 2, if not make a voicemail extension in the Asterisk GUI. Easily done by navigating to the voicemail tab. For the record Asterisk will add the following entry to [default] in extensions.conf (using 6000 as an example extension):

exten => 6000,1,VoiceMailMain

The default password for checking voicemail is 1234 and is set in users.conf. You can set that to whatever you want by editing:


vmsecret = 1234

Step 2

Now we have to make some sendmail edits:
cd /opt/etc/mail
and edit
sendmail.cf
and modify the following:
# "Smart" relay host (may be null)
DSfqdn.smtp.adddress.of.your.ISP

Step 3

Modify the mailcmd line in voicemail.conf:


; You can override the default program to send e-mail if you wish, too
mailcmd = /opt/sbin/sendmail -t -f asterisk@the.fqdn.of.site

Step 4

You'll need to use wav49 as the format for writing voicemail files as the NSLU2 doesn't really have the horsepower to support the other formats. Edit voicemail.conf and modify the format line:

;format=g723sf|wav49|wav
format = wav49
;

Step 5

Go to the GUI and enter the email address of extension 6002. When they recieve a voicemail it will be sent to their email account as a wav file.

I have found that the Asterisk GUI does not directly modify the voicemail.conf when you add a new extension. I'm not sure if this is correct or not, but voicemail becomes activated nonetheless. The GUI only adds an entry to extensions.conf.

The voicemail.conf file should look like this:

;!
;! Automatically generated configuration file
;! Filename: voicemail.conf (/opt/etc/asterisk/voicemail.conf)
;! Generator: Manager
;! Creation Date: Sat Dec 15 17:08:56 2007
;!
[general]
; Default formats for writing Voicemail
;format=g723sf|wav49|wav
format = wav49
;
; WARNING:
; If you change the list of formats that you record voicemail in
; when you have mailboxes that contain messages, you _MUST_ absolutely
; manually go through those mailboxes and convert/delete/add the
; the message files so that they appear to have been stored using
; your new format list. If you don't do this, very unpleasant
; things may happen to your users while they are retrieving and
; manipulating their voicemail.
;
; In other words: don't change the format list on a production system
; unless you are _VERY_ sure that you know what you are doing and are
; prepared for the consequences.
;
; Who the e-mail notification should appear to come from
serveremail = asterisk
;serveremail=asterisk@linux-support.net
; Should the email contain the voicemail as an attachment
attach = yes
; Maximum length of greetings in seconds
;maxgreet=60
; How many miliseconds to skip forward/back when rew/ff in message playback
skipms = 3000
; How many seconds of silence before we end the recording
maxsilence = 6
; Silence threshold (what we consider silence, the lower, the more sensitive)
silencethreshold = 128
; Max number of failed login attempts
maxlogins = 3
; If you need to have an external program, i.e. /usr/bin/myapp called when a
; voicemail is left, delivered, or your voicemailbox is checked, uncomment
; this:
;externnotify=/usr/bin/myapp
; If you need to have an external program, i.e. /usr/bin/myapp called when a
; voicemail password is changed, uncomment this:
;externpass=/usr/bin/myapp
; For the directory, you can override the intro file if you want
;directoryintro=dir-intro
; The character set for voicemail messages can be specified here
;charset=ISO-8859-1
; The ADSI feature descriptor number to download to
;adsifdn=0000000F
; The ADSI security lock code
;adsisec=9BDBF7AC
; The ADSI voicemail application version number.
;adsiver=1
; Skip the "[PBX]:" string from the message title
;pbxskip=yes
; Change the From: string
;fromstring=The Asterisk PBX
; Permit finding entries for forward/compose from the directory
;usedirectory=yes
;
; Change the from, body and/or subject, variables:
; VM_NAME, VM_DUR, VM_MSGNUM, VM_MAILBOX, VM_CALLERID, VM_CIDNUM,
; VM_CIDNAME, VM_DATE
;
; Note: The emailbody config row can only be up to 512 characters due to a
; limitation in the Asterisk configuration subsystem.
;emailsubject=[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}
; The following definition is very close to the default, but the default shows
; just the CIDNAME, if it is not null, otherise just the CIDNUM, or "an unknown
; caller", if they are both null.
;emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\nwant to check it when you get a chance. Thanks!\n\n\t\t\t\t--Asterisk\n
;
; You can also change the Pager From: string, the pager body and/or subject.
; The above defined variables also can be used here
;pagerfromstring=The Asterisk PBX
;pagersubject=New VM
;pagerbody=New ${VM_DUR} long msg in box ${VM_MAILBOX}\nfrom ${VM_CALLERID}, on ${VM_DATE}
;
; Set the date format on outgoing mails. Valid arguments can be found on the
; strftime(3) man page
;
; Default
emaildateformat = %A, %B %d, %Y at %r
; 24h date format
;emaildateformat=%A, %d %B %Y at %H:%M:%S
;
; You can override the default program to send e-mail if you wish, too
;
mailcmd = /opt/sbin/sendmail -t -f asterisk@the.fqdn.of.site
;servermail=
;
; Users may be located in different timezones, or may have different
; message announcements for their introductory message when they enter
; the voicemail system. Set the message and the timezone each user
; hears here. Set the user into one of these zones with the tz= attribute
; in the options field of the mailbox. Of course, language substitution
; still applies here so you may have several directory trees that have
; alternate language choices.
;
; Look in /usr/share/zoneinfo/ for names of timezones.
; Look at the manual page for strftime for a quick tutorial on how the
; variable substitution is done on the values below.
;
; Supported values:
; 'filename' filename of a soundfile (single ticks around the filename
; required)
; ${VAR} variable substitution
; A or a Day of week (Saturday, Sunday, ...)
; B or b or h Month name (January, February, ...)
; d or e numeric day of month (first, second, ..., thirty-first)
; Y Year
; I or l Hour, 12 hour clock
; H Hour, 24 hour clock (single digit hours preceded by "oh")
; k Hour, 24 hour clock (single digit hours NOT preceded by "oh")
; M Minute, with 00 pronounced as "o'clock"
; N Minute, with 00 pronounced as "hundred" (US military time)
; P or p AM or PM
; Q "today", "yesterday" or ABdY
; (*note: not standard strftime value)
; q "" (for today), "yesterday", weekday, or ABdY
; (*note: not standard strftime value)
; R 24 hour time, including minute
;
;
;
; Each mailbox is listed in the form <mailbox>=<password>,<name>,<email>,<pager_email>,<options>
; if the e-mail is specified, a message will be sent when a message is
; received, to the given mailbox. If pager is specified, a message will be
; sent there as well. If the password is prefixed by '-', then it is
; considered to be unchangable.
;
; Advanced options example is extension 4069
; NOTE: All options can be expressed globally in the general section, and
; overriden in the per-mailbox settings, unless listed otherwise.
;
; tz=central ; Timezone from zonemessages above. Irrelevant if envelope=no.
; attach=yes ; Attach the voicemail to the notification email *NOT* the pager email
; saycid=yes ; Say the caller id information before the message. If not described,
; or set to no, it will be in the envelope
; cidinternalcontexts=intern ; Internal Context for Name Playback instead of extension digits when saying caller id.
; sayduration=no ; Turn on/off the duration information before the message. [ON by default]
; saydurationm=2 ; Specify the minimum duration to say. Default is 2 minutes
dialout = from-vm ; Context to dial out from [option 4 from the advanced menu]
; if not listed, dialing out will not be permitted
sendvoicemail = yes ; Context to Send voicemail from [option 5 from the advanced menu]
; if not listed, sending messages from inside voicemail will not be
; permitted
; searchcontexts=yes ; Current default behavior is to search only the default context
; if one is not specified. The older behavior was to search all contexts.
; This option restores the old behavior [DEFAULT=no]
callback = from-vm ; Context to call back from
; if not listed, calling the sender back will not be permitted
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default
; operator=yes ; Allow sender to hit 0 before/after/during leaving a voicemail to
; reach an operator [OFF by default]
; envelope=no ; Turn on/off envelope playback before message playback. [ON by default]
; This does NOT affect option 3,3 from the advanced options menu
; delete=yes ; After notification, the voicemail is deleted from the server. [per-mailbox only]
; This is intended for use with users who wish to receive their voicemail ONLY by email.
; Note: deletevoicemail is provided as an equivalent option for Realtime configuration.
nextaftercmd = yes ; Skips to the next message after hitting 7 or 9 to delete/save current message.
deletevoicemail = yes
envelope = no
operator = no
review = no
saycid = yes
sayduration = no
maxgreet = 60
attachfmt = wav49
maxmessage = 60
maxmsg = 25
minmessage = 1
; [global option only at this time]
; forcename=yes ; Forces a new user to record their name. A new user is
; determined by the password being the same as
; the mailbox number. The default is "no".
; forcegreetings=no ; This is the same as forcename, except for recording
; greetings. The default is "no".
; hidefromdir=yes ; Hide this mailbox from the directory produced by app_directory
; The default is "no".
[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'
[default]

Fifth Step (Outbound SIP Trunks)

So far we have incoming and outgoing calls traversing the PSTN. What we are now going to do is set up a digital VoIP trunk so that we can use Asterisk to bypass the PSTN entirely.

There are two protocols in Asterisk that can accomplish this. We've already encountered SIP so we'll stay with that for now. We'll talk about IAX2 in a later post.

In order for our test you might want to get a Free World Dialup account. If you have a FWD account great, if not you have to sign up and give some personal information (like your snail mail address). I guess nothing is free, but they have to eat too. The process is fairly straightforward. Pop over there and grab yourself an account.

Step 1

As always backup your files:

# cd /opt/etc/asterisk
# cp -p users.conf users.conf.hold
# cp -p sip.conf sip.conf.hold
# cp -p extensions.conf extensions.conf.hold

We are going to have to cut a paste a macro from extensions.conf.org into our hacked extensions.conf (you did make a backup right!?!). Take a look at the original extensons.conf file and find the macro:

[macro-trunkdial]
;
; Standard trunk dial macro (hangs up on a dialstatus that should
; terminate call)
; ${ARG1} - What to dial
;
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp

Copy and paste this into your working extensions.conf file.

Step 2

Fire up the GUI:

http://IP.ADDRESS.OF.ASTERISK:8088/asterisk/static/config/cfgbasic.html

Step 3

Click on Service Providers, Add Service Provider, and select Custom VoIP under Provider Type. Fill in the fields selecting:

Comment FWD_SIP
SIP as the protocol
Check Register
Host fwd.pulver.com
Username: Your 6 digit FWD number
Password: Your FWD password

Click Save and Activate Changes. Your users.conf file will be appended like this:


[trunk_1]
allow = all
context = DID_trunk_1
dialformat = ${EXTEN:1}
hasexten = no
hasiax = no
hassip = yes
host = fwd.pulver.com
port = 5060
registeriax = no
registersip = yes
secret = XXXXXX
trunkname = Custom - FWD_SIP
trunkstyle = customvoip
username = XXXXXX


Where XXXXXX are your 6 digit FWD account number and password.

Step 4

Click on Calling Rules.

You'll see that a "A default DialPlan is not found !!"

Click on "click here to create a default DialPlan."

Click on Add a Calling Rule

and fill in the fileds like this:

Rule Name: FWD_SIP_Rule
Place this call through: Custom - FWD_SIP
Dialing Rules : If the number begins with 8
followed by 3 digits x or more
Strip 01 digits from the front and prepend 0 before dialing

This allows us to dial the FWD number by pressing 8 on our SIP phone.

Click on Save and Activate Changes.

If you look at extensions.conf you'll see that the GUI added the following:


trunk_1 = SIP/trunk_1

and at the bottom:


[DID_trunk_1]
include = default

[numberplan-custom-1]
include = default
plancomment = FWD
parked = no
exten = _8XXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:01})
comment = _8XXX!,1,FWD_SIP_RULE,standard

The GUI also adds an inbound context:
[DID_trunk_1]

You can configure this under Incoming Calls in the GUI. We'll put aside that step for now.

Step 5


Now take the context
[numberplan-custom-1]
and include it in
[default]


include => numberplan-custom-1

This will enable Asterisk to understand that when you dial 8 it will pull your SIP trunk and send the calls to FWD.

Step 6 (For NAT'd Networks)

In order for this to work behind a NAT'd firewall you must add the following to the users.conf entry for
[trunk_1]


canreinvite = no

This allows Asterisk to pass all the voice data (RTP media stream) through the Asterisk server rather than directly between calling stations. It's necessary to avoid NAT issues.

You must also edit sip.conf and configure the NAT section. Edit the externip, externhost (one or the other) and localnet settings and add the values that correspond to your network. The final thing is to forward the appropriate ports to you Asterisk box. 5084 seems to be specific to FWD:

5060 For SIP both UDP and TCP
5084 For SIP both UDP and TCP
10000-20000 For RTP UDP

That's it. Configure a softphone with your FWD account information. Pick up your regular SIP phone (or another softphone that terminates on your Asterisk server) and dial 8 plus your FWD number. Your softphone should ring! Dial 8613 and check out the echo test form your Asterisk terminated SIP phone. If you have access to a computer outside your network you can do further tests to see how well this works. The acid test is phoning 8613 from your Asterisk terminated SIP phone. If you get the echo test to work you should be good to go.

I've tidied up extensions.conf a bit so here's the complete file as it stands at this point:


;!
;! Automatically generated configuration file
;! Filename: extensions.conf (/opt/etc/asterisk/extensions.conf)
;! Generator: Manager
;! Creation Date: Mon Dec 24 21:02:51 2007
;!
[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static = yes
;
;
; if stati=yes and writeprotect=no, you can save dialplan by
; CLI command 'save dialplan' too
;
writeprotect = yes

[globals]
PHONE1 = SIP/2203
; These variables are to avoid the irritating problem
; with inability to use regexp's on strings that have
; not been defined.
;
CALLFILENAME = foo
FOO = foo
trunk_1 = SIP/trunk_1

[macro-trunkdial]
;
; Standard trunk dial macro (hangs up on a dialstatus that should
; terminate call)
; ${ARG1} - What to dial
;
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp

[macro-stdexten];
;
; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
;
exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHAN
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user in

[macro-failann]
; Failure announcement playback macro:
; ${ARG1} - Status of the call, one of:
; (CHANUNAVAIL | CONGESTION | BUSY | NOANSWER |
; ANSWER | CANCEL | DONTCALL | TORTURE)
;
exten => s,1,Goto(s-${ARG1},1)
exten => s-CHANUNAVAIL,1,Playback(all-circuits-busy-now)
exten => s-CHANUNAVAIL,2,Playback(pls-try-call-later)
exten => s-CHANUNAVAIL,3,Hangup
exten => s-CONGESTION,1,Playback(cannot-complete-temp-error)
exten => s-CONGESTION,2,Playback(pls-try-call-later)
exten => s-BUSY,1,Playback(the-party-you-are-calling)
exten => s-BUSY,2,Playback(is-curntly-busy)
exten => s-BUSY,3,Hangup
exten => s-NOANSWER,1,Playback(the-party-you-are-calling)
exten => s-NOANSWER,2,Playback(is-curntly-unavail)
exten => s-NOANSWER,3,Hangup
exten => s-ANSWER,1,Hangup
exten => _s-.,1,Playback(cannot-complete-network-error)
exten => _s-.,2,Playback(pls-try-call-later)
exten => _s-.,3,Hangup

[pstn-outgoing]
exten => 911,1,Dial(SIP/${EXTEN}@LinksysFXO,,T)
exten => 911,2,Macro(failann,${DIALSTATUS})
exten => _604NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _604NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _778NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _778NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _18XXNXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _18XXNXXXXXX,2,Macro(failann,${DIALSTATUS})

[answer]
exten => s,1,Wait(1) ; Wait a second, just for fun
exten => s,n,NoOp(CURRENT CALLER ID= ${CALLERID(num)})
exten => s,n,Answer ; Answer the line

[dial]
exten => s,n,Macro(stdexten,6002,SIP/6002)
exten => 6000,1,VoiceMailMain

[default]
include => answer
include = dial
include => pstn-outgoing
include => numberplan-custom-1

[asterisk_guitools]
exten = executecommand,1,System(${command})
exten = executecommand,n,Hangup()
exten = record_vmenu,1,Answer
exten = record_vmenu,n,Playback(vm-intro)
exten = record_vmenu,n,Record(${var1})
exten = record_vmenu,n,Playback(vm-saved)
exten = record_vmenu,n,Playback(vm-goodbye)
exten = record_vmenu,n,Hangup
exten = play_file,1,Answer
exten = play_file,n,Playback(${var1})
exten = play_file,n,Hangup
hasbeensetup = Y

[DID_trunk_1]
include = default

[numberplan-custom-1]
plancomment = DialPlan1
include = default
include = parkedcalls
exten = _8XXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:1})
comment = _8XXX!,1,FWD_SIP_Rule,standard

Sixth Step (Inbound SIP Trunks)

If we want to receive calls from FWD we have to make a few modifications to sip.conf. If you've already added your externhost and localnet information in sip.conf half the battle is won. If you have an opportunity to call a SIP phone outside your local network, you will see that Caller ID information was detected by the receiving station. That call can actually be returned by simply redialing the number that was detected i.e. 6003@your.local.net.

However, in order for a foreign station to call your local station without any knowledge of your network you must configure the SIP equivalent of a traditional PSTN trunk.

Step 1

Many instructions on the Internet have you adding a register entry in sip.conf to allow incoming calls. However, using the GUI in version 1.4 this is done in users.conf (registersip). We did this when we first set up our SIP trunk in Step 5 so there is no need to modify the
register =>
line in sip.conf.

Step 2

We must make a context to handle incoming calls. If you recall from step 5 in the previous post there was an entry added to extensions.conf
[DID_trunk_1]
Let's complete the entry by launching the GUI and navigating to Incoming Calls.

Click on Add an Incoming Rule and fill in the following fields:

Route: All unmathed incoming calls
from Provider: Custom FWD_SIP
to exentions: whatever_local_extension_you_want

Click Save and Activate Changes

extensions.conf will have the following entry added:


[DID_trunk_1]
include = default
exten = _X.,1,Goto(default|6003|1)
exten = s,1,Goto(default|6003|1)

I chose extension 6003 to receive my FWD calls.

Step 3

The final step is to edit sip.conf. Look for the
[sip_proxy]
entry and edit the following lines:


[sip_proxy]
; For incoming calls only. Example: FWD (Free World Dialup)
; We match on IP address of the proxy for incoming calls
; since we can not match on username (caller id)
type=peer
context=DID_trunk_1
host=fwd.pulver.com

If you use the Call Me feature of FWD you can check to see if the extension you assigned rings.

Note: I'm a little confused why I couldn't designate trunk_1 in users.conf to accept incoming calls. Perhaps a kind reader would leave a comment about that! It seems that if I can configure outgoing calls in users.conf, I should be able to receive these calls without having to edit sip_proxy.

Seventh Step (Blacklists)

One reason why I wanted to deploy my own home PBX was that I get incredibly annoyed by telemarketers. The other day I was having a nice afternoon snooze when I was woken up by one. But I have an Asterisk system, so let's block these guys!

I'll provide the complete new extensions.conf below (for the impatient, like me).

Step 1

Backup extensions.conf and add replace the [answer] context with this new [answer] context:


[answer]
exten => s,1,GotoIf(${BLACKLIST()}?blacklisted,s,1)
exten => s,n,NoOp(CURRENT CALLER ID= ${CALLERID(num)})
exten => s,n,Macro(stdexten,6002,SIP/6002)

Now in extensions.conf add the following context:


[blacklisted]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup

And finally add the [blacklisted] context to [default]:


[default]
include => answer
include => blacklisted
include => app-system-blacklist
include => pstn-outgoing
include => numberplan-custom-1
exten => 6000,1,VoiceMailMain

Step 2

To add a caller to the blacklist fire up the Asterisk CLI and type:

database put blacklist XXXXXXXXXX 1

The trailing 1 after the phone number is necessary. To remove the number type:

database del blacklist XXXXXXXXXX

A few points:

Zapateller plays a Session Information Tone (SIT) that apparently will help remove you from the nasty telemarketer's database.

This code:

GotoIf(${BLACKLIST()}?blacklisted,s,1)

Replaces the older Asterisk 1.2 LookupBlacklist function. There's some interesting discussion about this over at voip-info.org, but I couldn't get any of the examples offered to work!

Step 3

Having to go to the CLI to add a blacklist number is a bit of a drag, so let's do this right from the phone. I couldn't find too many script examples in my Internet searching, but it was surprisingly easier than trying to get Step 2 done. The best example I found was here:
How to blacklist unwanted callerid
We have to modify this because we don't have perl and we want to use Asterisk 1.4 database calls. Here's what I did:


[app-system-blacklist]
; 33 1 - Add to blacklist
; 33 - Delete from blacklist
exten => _33XXXXXXXXXX.,1,Answer
exten => _33XXXXXXXXXX.,n,Set(DB(blacklist/${EXTEN:2:10})=${EXTEN:13})
exten => _33XXXXXXXXXX.,n,Wait(2)
exten => _33XXXXXXXXXX.,n,SayDigits(${EXTEN:2:10})
exten => _33XXXXXXXXXX.,n,Playback(added)
exten => _33XXXXXXXXXX.,n,Hangup
exten => _33XXXXXXXXXX,1,Answer
exten => _33XXXXXXXXXX,n,DBdel(blacklist/${EXTEN:2:10})
exten => _33XXXXXXXXXX,n,Wait(2)
exten => _33XXXXXXXXXX,n,SayDigits(digits/${EXTEN:2:10})
exten => _33XXXXXXXXXX,n,Playback(removed)
exten => _33XXXXXXXXXX,n,Hangup

Add [app-system-blacklist] to your [default] context and you should be good to go.

I had to remove * from my example (the above link has *96 as the prefix) because one of my Linksys phones got cranky and I'm too lazy to figure out why. I believe it has something to do with the phone's vertical service activation codes. (Don't you just love telco speak!). My other Linksys phone was happy with * so your YMMV!

To add a blacklisted number pickup the phone and dial:
33XXXXXXXXXX1
To remove the number dial:
33XXXXXXXXXX

Note: This is good for 10 digit local calls. If you get an 11 digit long distance call (prefixed by "1" for example) make a new blacklist app and include it in your default context. Alternatively, if you receive 7 digit calls make the appropriate changes by removing Xs and adjusting {EXTEN} for the new values.

Finally

Here's the latest incarnation of extensions.conf. I've cleaned it up a bit as I'm learning more:


;!
;! Automatically generated configuration file
;! Filename: extensions.conf (/opt/etc/asterisk/extensions.conf)
;! Generator: Manager
;! Creation Date: Fri Dec 28 02:25:23 2007
;!
[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static = yes
;
;
; if stati=yes and writeprotect=no, you can save dialplan by
; CLI command 'save dialplan' too
;
writeprotect = yes

[globals]
PHONE1 = SIP/2203
; These variables are to avoid the irritating problem
; with inability to use regexp's on strings that have
; not been defined.
;
CALLFILENAME = foo
FOO = foo
trunk_1 = SIP/trunk_1
trunk_2 = IAX2/trunk_2

[macro-trunkdial]
;
; Standard trunk dial macro (hangs up on a dialstatus that should
; terminate call)
; ${ARG1} - What to dial
;
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp

[macro-stdexten];
;
; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
;
exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHAN
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user in

[macro-failann]
; Failure announcement playback macro:
; ${ARG1} - Status of the call, one of:
; (CHANUNAVAIL | CONGESTION | BUSY | NOANSWER |
; ANSWER | CANCEL | DONTCALL | TORTURE)
;
exten => s,1,Goto(s-${ARG1},1)
exten => s-CHANUNAVAIL,1,Playback(all-circuits-busy-now)
exten => s-CHANUNAVAIL,2,Playback(pls-try-call-later)
exten => s-CHANUNAVAIL,3,Hangup
exten => s-CONGESTION,1,Playback(cannot-complete-temp-error)
exten => s-CONGESTION,2,Playback(pls-try-call-later)
exten => s-BUSY,1,Playback(the-party-you-are-calling)
exten => s-BUSY,2,Playback(is-curntly-busy)
exten => s-BUSY,3,Hangup
exten => s-NOANSWER,1,Playback(the-party-you-are-calling)
exten => s-NOANSWER,2,Playback(is-curntly-unavail)
exten => s-NOANSWER,3,Hangup
exten => s-ANSWER,1,Hangup
exten => _s-.,1,Playback(cannot-complete-network-error)
exten => _s-.,2,Playback(pls-try-call-later)
exten => _s-.,3,Hangup

[pstn-outgoing]
exten => 911,1,Dial(SIP/${EXTEN}@LinksysFXO,,T)
exten => 911,2,Macro(failann,${DIALSTATUS})
exten => _604NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _604NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _1250NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _1250NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _778NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _778NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _18XXNXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _18XXNXXXXXX,2,Macro(failann,${DIALSTATUS})

[answer]
exten => s,1,GotoIf(${BLACKLIST()}?blacklisted,s,1)
exten => s,n,NoOp(CURRENT CALLER ID= ${CALLERID(num)})
exten => s,n,Macro(stdexten,6002,SIP/6002)

[blacklisted]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup

[app-system-blacklist]
; 33 1 - Add to blacklist
; 33 - Delete from blacklist
exten => _33XXXXXXXXXX.,1,Answer
exten => _33XXXXXXXXXX.,n,Set(DB(blacklist/${EXTEN:2:10})=${EXTEN:13})
exten => _33XXXXXXXXXX.,n,Wait(2)
exten => _33XXXXXXXXXX.,n,SayDigits(${EXTEN:2:10})
exten => _33XXXXXXXXXX.,n,Playback(added)
exten => _33XXXXXXXXXX.,n,Hangup
exten => _33XXXXXXXXXX,1,Answer
exten => _33XXXXXXXXXX,n,DBdel(blacklist/${EXTEN:2:10})
exten => _33XXXXXXXXXX,n,Wait(2)
exten => _33XXXXXXXXXX,n,SayDigits(digits/${EXTEN:2:10})
exten => _33XXXXXXXXXX,n,Playback(removed)
exten => _33XXXXXXXXXX,n,Hangup

[default]
include => answer
include => blacklisted
include => app-system-blacklist
include => pstn-outgoing
include => numberplan-custom-1
exten => 6000,1,VoiceMailMain

[asterisk_guitools]
exten = executecommand,1,System(${command})
exten = executecommand,n,Hangup()
exten = record_vmenu,1,Answer
exten = record_vmenu,n,Playback(vm-intro)
exten = record_vmenu,n,Record(${var1})
exten = record_vmenu,n,Playback(vm-saved)
exten = record_vmenu,n,Playback(vm-goodbye)
exten = record_vmenu,n,Hangup
exten = play_file,1,Answer
exten = play_file,n,Playback(${var1})
exten = play_file,n,Hangup
hasbeensetup = Y

[DID_trunk_1]
include = default
exten = _X.,1,Goto(default|6003|1)
exten = s,1,Goto(default|6003|1)

[numberplan-custom-1]
plancomment = DialPlan1
include = default
include = parkedcalls
exten = _8XXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:1})
comment = _8XXX!,1,FWD_SIP_Rule,standard

Saturday, December 1, 2007

Sticky Archive

April 13 2008

Noticed a bad thing that happens when your local DSL or
cable connection dies. All traffic to the ATA stops
because Asterisk is too stupid to realize it doesn't
need DNS to resolve localnet stuff.

Solution:

1) Disable your SIP trunks that rely on DNS
(such as FWD). This corrects the issue as Asterisk is
not being called upon to resolve DNS.

2) Install a caching only nameserver.

I haven't tried that and don't even think it is possible
on the Slug. My recommendation would be not to use
outgoing SIP trunks, such as FWD with the Slug.

April 12 2008

Moved to an Airport extreme wireless solution and toasted
my NAT traversal setting. Turned out I was setting the
5060 SIP port mapping to use only TCP. Adding UDP solved
my problem.


March 1 2008

Under PSTN-To-VoIP Gateway Setup/International Control
I've reduced the PSTN to SPA Gain to 10. It was
previously set at 12 and seemed to cause a degree of
echo on my Snom 300 phone.


January 17 2008

Well only 7 votes but they were 100% in favour!
I will have to consider this!

January 10 2008

Over the course of setting the Asterisk server up I
have been fortunate to have had access to a number of
SIP hard and soft phones. If there's interest I can
do a review of my experience. I've added a poll to
gauge interest!


January 4 2008

Some minor typographical fixes. Imagine, even with spell
checkers they slip through!

January 2 2008

There's an elaboration on the blacklist step. The example
provided is for 10 digit incoming numbers.
You can add or delete numbers for your local situation.


January 1 2008

I added a recommendation to update the firmware on
the Linksys SPA3102.

December 31 2007

I added a bit of clarification to the voicemail
setup, namely where the GUI edits files and where
the main voicemail password is kept.

December 28 2007

I added a step on how to do blacklists and
also provided a newer extensions.conf.

In Voicemail the mailcmd was chagned to:
asterisk@fqnd.of.site meaning the domainname
that your ISP gives you. i.e.:
asterisk@dsluser.pacbell.net

December 26 2007

I added incoming SIP instructions using
FreeWorldDialup as an example.

I modified Step 5 steps so it will work OK
with NAT'd firewalls.

December 25 2007

I've added a FreeWorldDialup SIP trunk.
It works! I'll assume IAX will work too.

There's a neater extensions.conf on Step 5 as well
December 24 2007

I made a little sticky archive so this doesn't
clutter things up. It appears as the last post.

I'm still struggling with using the GUI to setup
an IAX2 trunk. It doesn't help that FreeWorldDialup is
down. I might have to sign up for something cheap.
December 22 2007
You should frequently check if there are new builds
available for Asterisk. Upgrading is good:

# ipkg list
# ipkg list_installed

If there is a new version:

# ipkg upgrade

Added diff to the Platform setup. I think you need to
have diff:

# ipkg install diffutils

The next section will be on setting up IAX. I had
almost completed using FWD as an example.
However, FWDs IAX2 server seems to be down
so I'm looking for an alternative IAX2 service
to use as an example. Stay tuned.

December 23 2007
Anonymous comments allowed. I forgot to turn that
feature on!

December 18 2007
In Asterisk configuration:

extensions.conf modified to remove:
exten => s-CONGESTION,3,Hangup

Which was causing a fast busy when a caller pressed # in voicemail.

In SPA3102 configuration:

SPA To PSTN Gain: 0
Modified PSTN To SPA Gain: 12

to increase the volume when a caller left a voicemail.
It seems to make a big difference.