47 lines
837 B
PHP
47 lines
837 B
PHP
|
<?php
|
||
|
|
||
|
include('../config.php');
|
||
|
|
||
|
// Read GET data
|
||
|
|
||
|
$section = $_GET['s'];
|
||
|
$value = $_GET['v'];
|
||
|
|
||
|
// Open socket to ami server
|
||
|
|
||
|
$socket = fsockopen($ami_host, $ami_port);
|
||
|
|
||
|
// Login
|
||
|
|
||
|
fputs($socket, "Action: Login\r\n");
|
||
|
fputs($socket, 'UserName: ' . $ami_user . "\r\n");
|
||
|
fputs($socket, 'Secret: ' . $ami_pass . "\r\n\r\n");
|
||
|
|
||
|
//
|
||
|
// Section: sippeers
|
||
|
//
|
||
|
|
||
|
if($section == 'sippeers') {
|
||
|
fputs($socket, "Action: QueueAdd\r\n");
|
||
|
fputs($socket, 'Interface: SIP/' . $value . "\r\n");
|
||
|
fputs($socket, "Queue: warteschlange\r\n\r\n");
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Section: queuemembers
|
||
|
//
|
||
|
|
||
|
if($section == 'queuemembers') {
|
||
|
fputs($socket, "Action: QueueRemove\r\n");
|
||
|
fputs($socket, 'Interface: SIP/' . $value . "\r\n");
|
||
|
fputs($socket, "Queue: warteschlange\r\n\r\n");
|
||
|
}
|
||
|
|
||
|
// It seems that it needs some time to execute
|
||
|
sleep(1);
|
||
|
|
||
|
// Close socket
|
||
|
fclose($socket);
|
||
|
|
||
|
?>
|