hitagi-entrada/includes/wrapper-swoole.php

20 lines
485 B
PHP

<?php
function agiRunCmdSwooleWrapper($fd, $server) {
return function ($command) use ($server, $fd) {
print_r("-----> EXECUTAR COMANDO $command\n");
$server->send($fd, $command . "\n");
$response = '';
while (true) {
$response = $server->table->get($fd);
var_dump($response);
if ($response['data']) break;
sleep(1);
}
$server->table->set($fd, array(
'agi' => 1,
'data' => '',
));
return $response['data'];
};
}
?>