From 0df56d1f77594ed9582ad67b36ae2f0cdc85ace3 Mon Sep 17 00:00:00 2001 From: Alan Oliveira Date: Thu, 12 Dec 2024 16:27:10 -0300 Subject: [PATCH] Fix: file encode --- dial/{7998.json => 8999.json} | 8 ++++---- hitagi-entrada.php | 3 ++- includes/wrapper-noswoole.php | 20 ++++++++++++++++++-- 3 files changed, 24 insertions(+), 7 deletions(-) rename dial/{7998.json => 8999.json} (78%) diff --git a/dial/7998.json b/dial/8999.json similarity index 78% rename from dial/7998.json rename to dial/8999.json index a2dfe5b..d1f6aaa 100644 --- a/dial/7998.json +++ b/dial/8999.json @@ -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" diff --git a/hitagi-entrada.php b/hitagi-entrada.php index c2f39e5..21d3558 100644 --- a/hitagi-entrada.php +++ b/hitagi-entrada.php @@ -1,3 +1,4 @@ +#!/usr/bin/php -q run(); fclose($stdin); fclose($stdout); -exit(); +exit(); \ No newline at end of file diff --git a/includes/wrapper-noswoole.php b/includes/wrapper-noswoole.php index 73eff0f..4197587 100644 --- a/includes/wrapper-noswoole.php +++ b/includes/wrapper-noswoole.php @@ -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; + }; }