Home Automation with Asterisk and FreePBX
Posted: February 8th, 2012 | No Comments »To control my house’s lights and AV equipment, I’m using a very simple Asterisk IVR, mine controls my lights and turns on/off my TV and Reciever by quereying a URL on my Mi Casa Verde Vera.
The IVR answers automatically, is completely silent, and hangs up once it recieves a command. This means to launch an action, I simple hit a speed dial button on the phone next to my couch, then hit a number, and my equipment turns on or off.
For creating the IVR and extension for the IVR I’m using FreePBX; if you’re using bare asterisk, check the Asterisk documentation on how to setup a basic IVR.
Log into your FreePBX administration page and add two nessicary extension under Tools -> Module Admin named IVR and Misc Applications.
Next, switch to the Setup tab and open IVR, and lets create a basic IVR. Give it a name, and leave all the other options at their defaults.

Finally, switch to Misc Applications and Add Misc Application, give it a description and a Feature Code (an extension) and set the destination to the IVR you created in the previous step.
Next, we’ll need to log into your Asterisk box over SSH to edit some config files.
Open a terminal or Putty and ssh into your asterisk box, ssh root@asterisk.
We need to search for the name of the IVR that we created in FreePBX, run
cat /etc/asterisk/extensions_additional.conf | grep '\[ivr'
In my case, the IVR is named [ivr-2]
Next, we need to add our own commands,
nano /etc/asterisk/extensions_custom.conf
Copy and paste the below, be sure to change [ivr-2] to the IVR name you discovered earlier.
The above uses wget to launch URLs when you hit 2, 3, 4, 5, or 0 after calling the IVR extension, change the URL to match what you're trying to do. You could, for instance, have it pause your torrent or SABnzbd downloads, set a status on Twitter or Facebook, or set your Google Voice account to Do Not Disturb.








