27 lines
797 B
PHP
27 lines
797 B
PHP
<?php
|
|
global $system_config;
|
|
|
|
$timeout = 30;
|
|
$socket = fsockopen( $system_config->settings['system_asterisk_server'],$system_config->settings['system_asterisk_port'], $errno, $errstr, $timeout);
|
|
if(!$socket){ die("Error Connecting to Asterisk Server"); }
|
|
fputs($socket, "Action: Login\r\n");
|
|
fputs($socket, "UserName: ".$system_config->settings['system_asterisk_username']."\r\n");
|
|
fputs($socket, "Secret: ".$system_config->settings['system_asterisk_secret']."\r\n\r\n");
|
|
|
|
echo"<pre>";
|
|
fwrite($socket, "Action: Status\r\n");
|
|
fwrite($socket, "Command: Lists channel status ".$channel."\r\n\r\n");
|
|
$wrets="";
|
|
|
|
fputs($socket, "Action: Logoff\r\n\r\n");
|
|
|
|
while (!feof($socket)) {
|
|
$wrets .= fread($socket, 8192).'</br>';
|
|
}
|
|
|
|
echo $wrets."<br/></pre>";
|
|
|
|
fclose($socket);
|
|
|
|
|
|
?>
|