Saturday, January 2, 2016

Asterisk to control GPIO on Beaglebone

Couldn't figure out Freepbx GUI, so went to /etc/asterisk/extensions_custom.conf and added these extensions:


exten => 3000,1,Playback(one-moment-please)
exten => 3000,2,System(/var/lib/asterisk/myscripts/heatoff.sh)
exten => 3000,n,Hangup

exten => 3001,1,Playback(one-moment-please)
exten => 3001,2,System(/var/lib/asterisk/myscripts/heaton.sh)
exten => 3001,n,Hangup


Executing System(do some stuff to GPIO) but ran into permissions problem.  After changing "direction" to 666 asterisk appears to have access.

root@raspbx:/# ls -l /sys/class/gpio/gpio7/
total 0
-rw-r--r-- 1 root root 4096 Jan  2 18:26 active_low
-rw-r--r-- 1 root root 4096 Jan  2 17:40 direction
-rw-r--r-- 1 root root 4096 Jan  2 18:26 edge
drwxr-xr-x 2 root root    0 Jan  2 18:26 power
lrwxrwxrwx 1 root root    0 Jan  2 18:26 subsystem -> ../../../../class/gpio
-rw-r--r-- 1 root root 4096 Jan  2 18:26 uevent
-rw-r--r-- 1 root root 4096 Jan  2 07:10 value

root@raspbx:/# cd /sys/class/gpio/gpio7/
root@raspbx:/sys/class/gpio/gpio7# ls
active_low  direction  edge  power  subsystem  uevent  value
root@raspbx:/sys/class/gpio/gpio7# chmod 666 direction
root@raspbx:/sys/class/gpio/gpio7# ls -l
total 0
-rw-r--r-- 1 root root 4096 Jan  2 18:26 active_low
-rw-rw-rw- 1 root root 4096 Jan  2 17:40 direction
-rw-r--r-- 1 root root 4096 Jan  2 18:26 edge
drwxr-xr-x 2 root root    0 Jan  2 18:26 power
lrwxrwxrwx 1 root root    0 Jan  2 18:26 subsystem -> ../../../../class/gpio
-rw-r--r-- 1 root root 4096 Jan  2 18:26 uevent
-rw-r--r-- 1 root root 4096 Jan  2 07:10 value


No comments:

Post a Comment