Today we figured out how to call system tasks using nothing but the asterisk extensions.conf file.
To add an extension executes a script you simply need to add “System(pathtoscript.sh)”
In practice this would look like this:
exten => 607,1,Answer exten => 607,2,Wait(1) exten => 607,3,System(path/to/script.sh) ;make sure to place in writable path for asterisk user exten => 607,4,Hangup()
This opens a plethora of new possibilities that we'll explore in the coming weeks!
Today I've decided to start researching the implications of installing PBX and Asterisk on my Raspberry Pi. My ultimate goal would be initiating a house appliance by literally calling it through asterisk. Smart appliances here I come! =D I'm starting my research here:
UPDATE! FreePBX is loaded and I've setup some extensions. Now I'll be looking into some ip appliances for automation.
Finding direction in Data Com
With everyone moving into their individual projects I'm at as loss with what to do. Hoping we can establish a tangible direction some time soon.
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
Remember that 4 is just the minimum number of entries. Feel free to have more.
Identification of chosen keyword.
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
Identification of chosen keyword.
Arrays are buckets or memory locations that group similar integers or character strings.
Arrays can be manipulated to hold different values of any datatype as long as that datatype is consistant across the entire array. You can even copy the contents of one array to another!
Example:
#include<stdio.h> int main() { int array [5]; int i; short onethroughfive [5]; array[0] = 45; array[1] = 56; array[2] = 34; array[3] = 42; array[4] = 32; for(i=0; i<5; i++){ *(onethroughfive+i)=*(array+i); } for (i=0; i<5; i++){ printf("%d\n", *(onethroughfive+i)); } return (0); }
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
Identification of chosen keyword.
The Raspberry Pi hosts a General Purpose Input Output board for interfacing with low level peripherals. Dragon.net was nice enough to write a detailed C library for the GPIO to make electronics programming super easy! Here's an example of a program that turns on and off an LED:
/* * blink.c: * Simple test program to blink an LED on pin 7 */ #include <wiringPi.h> #include <stdio.h> int main (void) { int pin = 7; printf("Raspberry Pi wiringPi blink test\n"); if (wiringPiSetup() == -1) exit (1); pinMode(pin, OUTPUT); for (;;){ printf("LED On\n"); digitalWrite(pin, 1); delay(250); printf("LED Off\n"); digitalWrite(pin, 0); delay(250); } return 0; }
by way of this reference I hope to setup a simple c application using a solid state relay for my future automated “Dial a Coffee” via Asterisk and Pi ingenuity:http://elinux.org/RPi_Low-level_peripherals#GPIO_Driving_Example_.28C.29
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
Identification of chosen keyword.
A simple program that operates a relay switch that supplies electricity for delicious caffeinated beverages.
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
/* Lair_Brew ~ Caffeine ~ Version 0.2 */ #include <wiringPi.h> #include <stdio.h> void loopback(void) { char ch; ch = getchar(); while( ch != '\n' ) ch = getchar(); } int main (void) { int pin = 7; char ch; int exit_flag = 0; printf("welcome to Lair Brew\n"); if (wiringPiSetup() == -1) return(1); pinMode(pin, OUTPUT); printf("Brew on\n"); digitalWrite(pin, 1); while( exit_flag == 0 ) { printf("Wish to exit? (Y)\n"); scanf(" %c", &ch ); ch = toupper( ch ); if((ch == 'Y')){ printf("\nBrew Off\n"); digitalWrite(pin, 0); delay(250); printf("\nEnjoy Your Coffee, Sir!\n"); } else { printf("\nType (y) to exit.\n"); loopback(); } if( ch == 'Y' ) exit_flag = 1; } return 0; }
The program is loaded into /etc/asterisk/extensions.conf like so:
exten => 607,1,Answer exten => 607,2,Wait(1) exten => 607,3,System(/tmp/Lair_brew_auto) exten => 607,4,Hangup()
Can you include the main() of a program in a header file?
Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.
Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.
State your rationale.
How are you going to test your hypothesis? What is the structure of your experiment?
Perform your experiment, and collect/document the results here.
Based on the data collected:
What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made.