May
14
Posted on 14-05-2009
Filed Under (Arduino, Asterisk) by Dan

I’m currently working on a project that works with pachube to post information to the web. It’s really handy to be able to get the sensor information from my Arduino to the web with an ethernet shield and a few lines of code. However, I want to take this functionality a step further and make the pachube feed available from my Asterisk phone system in the rare event that I’m away from civilization and don’t have access to an internet connection. The script I came up with is geared towards my ArduinOil project, but could easily be converted and used in any way with any information. The way it works is this: user calls extension (or could be made available from an AVR), the AGI script requests pachube feed information, flight or cepstral is used to read information to user. Here’s what you’ll need to do to get it up and running:

  1. Download the pachube PHP library, and pachube AGI script.
  2. Unzip the pachube_functions.php file from the PHP library zip and copy it and the AGI script into /var/lib/asterisk/agi-bin/
  3. Unzip pachube.php from the AGI script zip and copy it into /var/lib/asterisk/agi-bin/
  4. chmod +x and chown asterisk:asterisk both files
  5. Make changes to configurable options in pachube.php (ie. api key, feed id, etc.)
  6. Add the following dial plan code to your extensions.conf or extensions_custom.conf (FreePBX)
  7. exten => 750,1,Answer
    exten => 750,n,Wait(2)
    exten => 750,n,AGI(pachube.php)
    exten => 750,n,Hangup

  8. Reload your asterisk dial plan: asterisk -rx dialplan reload

There is more feed information available from the pachube PHP library such as latitude and longitude of the project, multiple datastreams, etc. But this should be enough to get you on your way. Enjoy!

(0) Comments    Read More   
Post a Comment
Name:
Email:
Website:
Comments:

*

Prove you are human by reading this resistor:
0Ω+/- 5%

0
0
1
2
3
4
5
6
7
8
9

0
0
1
2
3
4
5
6
7
8
9

0
0
1
2
3
4
5
6
7
8
9

5
5
10
20

Match the sliders on the left to each color band on the resistor.

Click Here for a new resistor image.

If you'd like to learn more, read about resistor color codes here.