forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
<?php |
|
|
|
require_once("phpagi/phpagi.php"); |
|
/* |
|
* Interage com agi. |
|
*/ |
|
|
|
function GetAgi() { |
|
$optconfig['phpagi']['error_handler'] = false; |
|
$optconfig['asmanager']['server'] = '127.0.0.1'; |
|
$optconfig['asmanager']['port'] = '5038'; |
|
$optconfig['asmanager']['username'] = 'manager'; |
|
$optconfig['asmanager']['secret'] = 'manager007'; |
|
|
|
return new AGI('phpagi.conf', $optconfig); |
|
} |
|
|
|
function GetUra($nomeUra) { |
|
$query = "select id from pbx_ura where nome = '$nomeUra'"; |
|
$result = pg_query($query); |
|
$row = pg_fetch_row($result); |
|
|
|
return 'ura-' . $row[0] . ',s,1'; |
|
} |
|
|
|
function GetAnuncio($nomeAnuncio) { |
|
$query = "select id from pbx_anuncios where nome = '$nomeAnuncio'"; |
|
$result = pg_query($query); |
|
$row = pg_fetch_row($result); |
|
|
|
return sprintf('ext-anuncios,a%s,1', $row[0]); |
|
} |
|
|
|
function GetFila($nomeFila) { |
|
$query = "select numero from pbx_dacs where nome = '$nomeFila'"; |
|
$result = pg_query($query); |
|
$row = pg_fetch_row($result); |
|
|
|
return sprintf('ext-fila,%s,1', $row[0]); |
|
} |
|
|
|
function GetRamal($numRamal){ |
|
$query = "select nome from pbx_ramais where nome = '$numRamal'"; |
|
$result = pg_query($query); |
|
$row = pg_fetch_row($result); |
|
|
|
return sprintf('ext-ramais,%s,1', $row[0]); |
|
}
|
|
|