Zphone sipstatus.agi: Unterschied zwischen den Versionen
Aus metasec wiki
Admin (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<pre> #!/usr/bin/php4 -q <?php include("/var/www/zphone/etc/config.inc.php"); include($CCBOX["INC"]."func_manager.inc.php"); include($CCBOX["INC"]."ccbox.inc.php…“) |
(kein Unterschied)
|
Aktuelle Version vom 30. September 2010, 22:28 Uhr
#!/usr/bin/php4 -q <?php include("/var/www/zphone/etc/config.inc.php"); include($CCBOX["INC"]."func_manager.inc.php"); include($CCBOX["INC"]."ccbox.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); $EXTEN = array(); foreach ( $argv as $key => $val ) if ( $key > 0 ) $EXTEN[] = $val; if ( count($EXTEN) == 0 ) { fclose($in); fclose($err); return 0; } $CALL = array(); foreach ( zphone_manager_get_user_status($EXTEN, $default ) as $ext => $val ) { if ( $val == 0 ) $CALL[] = "SIP/".$ext; } if ( count($CALL) == 0 ) { print("set variable DIAL_STR SIP/20\n"); } else { print("set variable DIAL_STR ".implode("&", $CALL)."\n"); } fclose($in); fclose($err); return 0; ?>