by bobbymc » Wed Oct 10, 2007 1:32 am
i recently published a code that cleans out confrence rooms.. here is some code that can check if the confrence room is really avaliable or not based on asterisk telling us and not the database
this should be added after the first if statment to check for exsisting confrence rooms
(replace manager_login_here and manager_pass_here with valid info)
#### check astertisk to see which confrence rooms are taken jsut to make sure it wont reassing it to someone
#### else due to lack of updates on db
require_once("php-asmanager.php");
$astman = new AGI_AsteriskManager();
if (! $res = $astman->connect("$server_ip", "manager_login_here" , "manager_pass_here")) {
unset( $astman );
}
$response = $astman->send_request('Command', array('Command'=>'meetme'));
$verinfo = $response['data'];
$astman->disconnect();
foreach (split("\n", $verinfo) as $indexparse) {
preg_match('/(.*) (.*)/i', $indexparse, $matches);
list($left,$right) = split("[\t ]+", $matches[1]);
if($left)$extension_disclude.= "and conf_exten != '$left' ";
}
##### grab the next available vicidial_conference room and reserve it
$stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and (((extension='' or extension is null) $extension_disclude)) LIMIT 1;";
hope this helps