From 58be41bc658756a93c7eba19e571484e40459598 Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 11 Dec 2012 14:17:55 +0000 Subject: final testing sesh --- vfg/src/Asterisk.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'vfg/src/Asterisk.cpp') 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! } -- cgit v1.2.3