hitagi-entrada/hitagi-entrada.php

45 lines
1014 B
PHP

#!/usr/bin/php -q
<?php
require 'vendor/autoload.php';
require 'includes/wrapper-noswoole.php';
use Hitlabs\Hitagi\AGIEntrada;
$stdin = fopen('php://stdin', 'r');
$stdout = fopen('php://stdout', 'w');
$fgId = (isset($argv[1])) ? $argv[1] : null; // Numero do DID
$hostname = (isset($argv[2])) ? $argv[2] : gethostname();
$hostip = (isset($argv[3])) ? $argv[3] : 'localhost';
// $fgId = '8999';
// $hostname = 'hitpbx-050';
// $hostip = '177.107.205.248';
$logEnabled = true;
$isXampp = file_exists('C:\xampp');
$appdir = dirname(__FILE__);
chdir($appdir);
date_default_timezone_set('America/Bahia');
$agientrada = new AGIEntrada(
array(
'agiRunCmd' => agiRunCmdWrapper($stdin, $stdout),
'agiLog' => agiLogWrapper()
),
array(
'fgId' => $fgId,
'hostname' => $hostname,
'hostip' => $hostip,
'logEnabled' => $logEnabled,
'appdir' => $appdir,
'isXampp' => $isXampp
)
);
$agientrada->run();
fclose($stdin);
fclose($stdout);
exit();