summaryrefslogtreecommitdiff
path: root/vfg/src/Asterisk.cpp
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2012-12-11 14:17:55 +0000
committerComment <tim@gray.(none)>2012-12-11 14:17:55 +0000
commit58be41bc658756a93c7eba19e571484e40459598 (patch)
treecb58baceffc0a24fddefdce1d0e5e6c868a32e68 /vfg/src/Asterisk.cpp
parentdba01ce870165fd8d8a5fea921cb31f7c4e8c25f (diff)
final testing sesh
Diffstat (limited to 'vfg/src/Asterisk.cpp')
-rwxr-xr-xvfg/src/Asterisk.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/vfg/src/Asterisk.cpp b/vfg/src/Asterisk.cpp
index 55a77e0..9d94138 100755
--- a/vfg/src/Asterisk.cpp
+++ b/vfg/src/Asterisk.cpp
@@ -65,7 +65,6 @@ void Asterisk::setup(string passcode,int millis){
udpConnection.Bind(5000);
udpConnection.SetNonBlocking(true);
cmd("ssh 80.93.22.22 'sudo /usr/sbin/asterisk -rx \"database put GAME passcode "+passcode+"\"'");
- state=ASTERISK_WAITING; //for acknowledge
statusPollMillis=millis;
if (statusPollMillis>0) startThread(false, false); // blocking, verbose
}
@@ -83,9 +82,8 @@ void Asterisk::endGame(string score){
if (state==ASTERISK_PLAYING) {
//cmd("ssh 80.93.22.22 'sudo /usr/sbin/asterisk -rx \"database put GAME statuscode "+score+"\"'");
string emsg="ssh 80.93.22.22 'sudo /usr/sbin/asterisk -rx \"hangup request "+playerCode+"\"'";
- scmd(emsg);
+ cmd(emsg);
printf("Asterisk: hanging up %s\n",playerCode.c_str());
- state=ASTERISK_IDLE;
}
}
void Asterisk::cmd(string s) {
@@ -95,7 +93,7 @@ void Asterisk::cmd(string s) {
file = popen(s.c_str(), "re"); //"e" seems necessary for non blocking but with it getting crash when dequeuing. can't seem to trace it
filenum=fileno(file);
fcntl(filenum, F_SETFL, O_NONBLOCK);
- state=ASTERISK_WAITING;
+ state=ASTERISK_WAITING;
}
void Asterisk::scmd(string s) {
@@ -106,7 +104,7 @@ void Asterisk::scmd(string s) {
filenum=fileno(file);
fcntl(filenum, F_SETFL, O_NONBLOCK);
//printf("close file\n");
- pclose(file);
+ pclose(file); //is blocking!
}