AGI Vorlage zum starten: Unterschied zwischen den Versionen

Aus metasec wiki
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „<pre> #!/usr/bin/php4 -q <?php some zphone specific includes: // main config file //include_once("/var/www/zphone/etc/config.inc.php"); // main file fo…“)
(kein Unterschied)

Version vom 17. Oktober 2009, 13:04 Uhr


#!/usr/bin/php4 -q
<?php

/*
 some zphone specific includes
 */

// main config file
//include_once("/var/www/zphone/etc/config.inc.php");

// main file for doing any sql lookups
//include($CCBOX["INC"]."func_sql.inc.php");

// some other zAPI files
//include($CCBOX["INC"]."func_voip.inc.php");


$in = fopen("php://stdin", "r" );
$err = fopen("php://stderr", "r" );


/*

 asterisk pass some values via stdin to the agi
 script. format is key: vale
 just get the values and extact them into an
 array named $agivars with key value index

*/

$agivars = array();
while (!feof($in)) {
    $agivar = trim(fgets($in));

    if ($agivar === '')
        break;

    $agivar = explode(':', $agivar);
    $agivars[$agivar[0]] = trim($agivar[1]);
}


/*
 this is needed if executing via DeadAGI dialplan app
 */
pcntl_signal(SIGHUP, SIG_IGN);

/*
 hier kommt der code hin, den man verwenden will
 wenn man die richtigen includes im kopf definiert,
 stehen einem alle zphone internen funktionen zur
 verfuegung


 paste here your code you want to use
 if you include the needed/right files in the
 header of this file, you are able to user all
 of the internal zphone functions form the zAPI
 */

/*

print("noop just an info...\n");
print("set varialble Z_AGI_TEST hallo\n");

*/

fclose($in);
fclose($err);
return 0;


?>