All pastes #36238 Raw Edit

Stuff

public text v1 · immutable
#36238 ·published 2006-01-09 09:00 UTC
rendered paste body
#!/usr/local/bin/php -q 
<?php 
ob_implicit_flush(true); 
set_time_limit(6); 
$in = fopen("php://stdin","r"); 

$stdlog = fopen("/var/log/asterisk/my_agi.log", "w"); 


// Do function definitions before we start the main loop 
function read() { 
  global $in, $debug; 
  $input = str_replace("\n", "", fgets($in, 4096)); 
  return $input; 
} 

function errlog($line) { 
  global $err; 
  echo "VERBOSE \"$line\"\n"; 
} 

function write($line) { 
  global $debug; 
  echo $line."\n"; 
} 

// parse agi headers into array 

while ($env=read()) { 
  $env = str_replace("\"","",$env); 
  $s = split(": ",$env); 
  $agi[str_replace("agi_","",$s[0])] = trim($s[1]); 
     if (($env == "") || ($env == "\n")) { 
     break; 
  } 
}