commit eb95be64ecdfed2b8d8431ed2681fe231e560170 Author: Alan Oliveira Date: Thu Dec 12 11:00:09 2024 -0300 First commit diff --git a/AGIEntrada.php b/AGIEntrada.php new file mode 100644 index 0000000..abe9bba --- /dev/null +++ b/AGIEntrada.php @@ -0,0 +1,34 @@ +globais = array(); + $this->injection = $injection; + } + + public function agiRunCmd($command) + { + return $this->injection['agiRunCmd']($command); + } + + public function agiLog($texto) + { + return $this->injection['agiLog']($texto); + } + + function tocarFila($queueId, $timeout) + { + return $this->agiRunCmd('EXEC Queue Q' . $queueId . ',ctT,,,' . $timeout); + } + + public function run() + { + $this->globais['nomeFila'] = '10'; + $response = $this->tocarFila($this->globais['nomeFila'], 1); + echo "\n" . $response . "\n"; + } +} diff --git a/hitagi-entrada.php b/hitagi-entrada.php new file mode 100644 index 0000000..7348b5c --- /dev/null +++ b/hitagi-entrada.php @@ -0,0 +1,51 @@ + EXECUTAR COMANDO $command"; + return $texto; + }; +} + +function agiLogWrapper($logEnabled) +{ + return function ($texto) use ($logEnabled) { + if ($logEnabled) { + $filename = str_replace('.php', '-log.html', __FILE__); + $fp = fopen($filename, 'a'); + fwrite($fp, $texto); + fclose($fp); + } + }; +} + +// -------------------------------------------------------------------------------------------------------------------------------- + +$stdin = fopen('php://stdin', 'r'); +$stdout = fopen('php://stdout', 'w'); + +$isXampp = (file_exists('C:\xampp')); +$logEnabled = false; + +$appdir = dirname(__FILE__); +chdir($appdir); + +date_default_timezone_set('America/Bahia'); + +$agientrada = new AGIEntrada( + array( + 'agiRunCmd' => agiRunCmdWrapper($stdin, $stdout), + 'agiLog' => agiLogWrapper($logEnabled) + ), + array( + 'isxampp' => $isXampp, + 'logEnabled' => $logEnabled + ) +); +$agientrada->run(); + +fclose($stdin); +fclose($stdout); +exit();