init
This commit is contained in:
27
modules/Accounts/voip_test.php
Normal file
27
modules/Accounts/voip_test.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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);
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user