Tag Archives: extensions.conf

How to configure BLF with a Linksys SPA942 and Asterisk 1.4

Here is my guide for setting up BLF (Busy Lamp Field) on asterisk 1.4 using a linksys SPA-942 voip phone. I must say that trying to find the right information took a little bit of time…In fact it took me about 2 hours to successfully set up the unused lines on my SPA942 to be used as indicators because I could not find enough detailed information in one location. Hence this post.

Linksys SPA-942

Linksys SPA-942

Asterisk does not easily work with shared line appearances unless the phones are made specifically for it. However, you should be able to get BLF working instead of SLA and have almost the same functionality. Below is what you will need to do to enable BLF on asterisk 1.4 using a linksys spa942 (this should also work on any Linksys/Sipura Phone that supports BLF and extended functions).

Edit your SIP.CONF file and enable these features (these MUST be enabled for hints to work correctly):

allowsubscribe=yes
limitonpeers=yes
notifyringing=yes
notifyhold=yes

In your SIP.CONF/USERS.CONF file, edit your users to contain the following code:

qualify=yes (im not sure this is necessary as I tested it without this setting and BLF still functioned correctly)
call-limit=100 (this can be anything, but 100 will keep you from denying any new calls)

In your EXTENSIONS.CONF file, you just have to enable hints by putting this in your default context (change the extension numbers with your extension numbers):

exten => 1000,hint,SIP/1000
exten => 2000,hint,SIP/2000
exten => 3000,hint,SIP/3000
exten => 4000,hint,SIP/4000

This enables BLF on your asterisk server. In order to configure your linksys spa-942, all you have to do is enter a few settings on the phone itself. But you must be sure you are currently running the newest version of the phones firmware (it is currently at 6.1.5(a)), BLF will not work without first running the newest firmware release! After you have confirmed this, use your web browser and enter the ip adrress of your phone. Click on admin login and then on advanced.

Under the Phone tab type the following:

Short Name: Anything you want to show up next to the LED to remind you which line it is you are monitoring.
Extended Function: fnc=blf+sd+cp;sub=5000@$PROXY;ext=5000@$PROXY

SPA942 settings for blf

Just enter the line under extended function

Above, I have two extensions; 5000 and 6000 which I am monitoring which show up on my phone line buttons 2 and 3. After these settings are entered, scroll down to Line Key Extended Function and enter these settings:

Line key extended functions

Line Key Extended Functions

Server Type: Asterisk (*this is important!).

You do not have to enable line keys in the Ext. tabs  for this to work. Just click ‘submit all’ and wait for the phone to reboot. Youre done! Hopefully this will save someone lots of time searching google for consolidated information! If youre looking for more SPA-942’s you can get them for a decent price on ebay or here.

Post to Twitter

How to send an email alert using sendmail from Asterisk 1.4 when a call is made through Ooma

I have been using asterisk in conjunction with my Ooma voip device for some time now. My current configuration allows my family and I to place a call from anywhere there is an internet connection out through my ooma device. My family and extended family travel often and this is a great way to be able to still make local calls for free while being away.

While my family uses this setup, I often wondered the details of the calls made out through my Ooma device. Sure I could log into my.ooma.com or even check the asterisk call logs, but it wasnt as neat/tidy or as automated as I would have liked. I snooped around and discovered that Asterisk can run system commands when they are specified in the extensions.conf file!

I scoured the internet for instructions and realized the lack of a good guide for asterisk 1.4 when using sendmail (this guide should work for msmtp as well), so I thought i would share.

Below is my dialplan for sending an email alert when a call is placed through to my ooma device. This can be placed in any dialplan where you would like an email alert to be made to you, so the possibilities are endless!

Asterisk email alert

While many guides are written for use with the linux mail application which can allow for the subject and body to be specified by the command line, I was using sendmail which does not allow for the subject or body to be specified by command line (except using echo statements in a way which asterisk could not duplicate while running from a dialplan ig. (cat > text | echo xxx ; echo xxx ; | sendmail) etc.). Sendmail needs certain variables to be specified in a file, or by running the application and specifying it while it is running.

I found that asterisk would need to create the file dynamically and add the To:, Subject:, and Body text variables before Asterisk/Sendmail would send the customized email that I wanted sent.

*Note: For this to work, you must have sendmail already configured and able to send emails.

[ooma-out]
;make outgoing calls to ooma pstn
exten => _XXXX.,1,System(echo “To: putdestinationemail@here.com” > /opt/etc/init.d/calls)
exten => _XXXX.,n(done),NoOp()
exten => _XXXX.,n,System(echo “Subject: [PBX]: Outgoing call through Ooma” >> /opt/etc/init.d/calls)
exten => _XXXX.,n(done),NoOp()
exten => _XXXX.,n,System(echo “” >> /opt/etc/init.d/calls)
exten => _XXXX.,n(done),NoOp()
exten => _XXXX.,n,System(echo “User ${CALLERID(NUM)} has made an outgoing call through ooma to phone number ${EXTEN} on ${STRFTIME(%C%m%d%y%H%M)}” >> /opt/etc/init.d/calls)
exten => _XXXX.,n(done),NoOp()
exten => _XXXX.,n,System(sendmail -t -f putsendingemail@here.com < /opt/etc/init.d/calls)
exten => _XXXX.,n(done),NoOp()
exten => _XXXX.,n,Dial(SIP/${EXTEN}@pstn,20)
exten => _XXXX.,n,Hangup
exten => _XXXX.,n,Congestion

exten => _XXXX., is used instead of exten => s,n, because I wanted to have any number larger than 4 digits routed out through ooma, since my internal extensions are 4 digits long.
exten => _XXXX.,n,Dial(SIP/${EXTEN}@pstn,20) is my command to send the call out through ooma.

This configuration makes a file located in /opt/etc/init.d called “calls” containing:

To: putdestinationemail@here.com
Subject: [PBX]: Outgoing call through Ooma
User EXTENTIONCALLING has made an outgoing call through ooma to phone number NUMBERCALLED on DATE

The email is sent to the email specified in “putdestinationemail@here.com” from email address specified in putsendingemail@here.com

This dialplan can be customized to suit any email alert you may need to send when placed into any dialplan in the extensions.conf file, so have fun!

Post to Twitter