#ifndef ASTERISK_H #define ASTERISK_H #include "ofMain.h" #include "ofxNetwork.h" #define IDLE 0 #define WAITING 1 #define STARTING 2 #define PLAYING 3 // http://stackoverflow.com/questions/1735781/non-blocking-pipe-using-popen /* Commands for game to control PBX Game ready ssh 10.10.10.1 'sudo /usr/sbin/asterisk -rx "devstate change Custom:GAME NOT_INUSE"' change daily access 4 digit code ssh 10.10.10.1 'sudo /usr/sbin/asterisk -rx "database put GAME passcode 1234"' Set status code for current game ssh 10.10.10.1 'sudo /usr/sbin/asterisk -rx "database put GAME statuscode 1234"' Gameover Hangup Call ssh 10.10.10.1 'sudo /usr/sbin/asterisk -rx "hangup request Local/9999@default-00000039;2" Local/9999@default-00000039;2 is a channel identifier and will be send to game when AGI script connects to game controller. The channel ID is unique for each call can we have a message that someone has joined the queue? can we have a message if someone hangs up? */ class Asterisk { public: Asterisk(); virtual ~Asterisk(); void startGame(); void endGame(string score); int update(); void cmd(string s); int state; protected: private: int startTime; FILE *file; int filenum; ofxUDPManager udpConnection; string playerCode; }; #endif // ASTERISK_H