Fix: file encode

main
Alan Oliveira 2024-12-12 16:27:10 -03:00
parent b64dbec5cb
commit 0df56d1f77
3 changed files with 24 additions and 7 deletions

View File

@ -3,14 +3,14 @@
"id": "1",
"idmaster": "0",
"cmd": "start",
"value": "7999"
"value": "8999"
},
{
"id": "2",
"idmaster": "1",
"cmd": "playaudio",
"value": "welcome.wav",
"value2": "2",
"value": "32021341DIGITEOCPF.mp3",
"value2": "5",
"value3": "1",
"value4": "false"
},
@ -24,7 +24,7 @@
"id": "4",
"idmaster": "3",
"cmd": "playaudio",
"value": "timeout.wav",
"value": "Agradecimento.wav",
"value2": "2",
"value3": "1",
"value4": "false"

View File

@ -1,3 +1,4 @@
#!/usr/bin/php -q
<?php
require 'vendor/autoload.php';
require 'includes/wrapper-noswoole.php';
@ -31,4 +32,4 @@ $agientrada->run();
fclose($stdin);
fclose($stdout);
exit();
exit();

View File

@ -2,8 +2,24 @@
function agiRunCmdWrapper($stdin, $stdout)
{
return function ($command) use ($stdin, $stdout) {
$texto = "-----> EXECUTAR COMANDO $command";
return $texto;
// $texto = "-----> EXECUTAR COMANDO $command";
// return $texto;
$return = '';
fwrite($stdout, $command . "\n");
fflush($stdout);
while ($line = fgets($stdin)) {
$return.= $line;
if (strpos($line, 'result=') !== false) {
if (substr($line,0,22) != '100 result=0 Trying...') {
break;
}
}
}
$return = trim($return);
return $return;
};
}