1 <?php
2 /**
3 * @package phpAGI_examples
4 * @version 2.0
5 */
6
7 require_once('../phpagi-asmanager.php');
8
9 if(!isset($_SERVER['argv'][1]))
10 {
11 echo "Usage:\t{$_SERVER['_']} {$_SERVER['argv'][0]} peer\n\n";
12 exit;
13 }
14
15 $asm = new AGI_AsteriskManager();
16 if($asm->connect())
17 {
18 $peer = $asm->command("sip show peer {$_SERVER['argv'][1]}");
19 if(!strpos($peer['data'], ':'))
20 echo $peer['data'];
21 else
22 {
23 $data = array();
24 foreach(explode("\n", $peer['data']) as $line)
25 {
26 $a = strpos('z'.$line, ':') - 1;
27 if($a >= 0) $data[trim(substr($line, 0, $a))] = trim(substr($line, $a + 1));
28 }
29 print_r($data);
30 }
31
32 $asm->disconnect();
33 }
34 ?>
Documentation generated on Wed, 20 Jul 2005 15:21:22 +0000 by phpDocumentor 1.2.3