Page 1 of 1

ONE OF THE TODO'S DONE!!

PostPosted: Sun Sep 23, 2007 4:06 am
by bobbymc
THIS WILL CHECK EVERY CONFRECNE ROOM BY VICIDIAL AND SEE IF THE CONFRECNE IS USED BY ANYONE LIVE IN THE SYSTEM.. IF SO DO NOHTING.. IF ITS NOT OCCUPIDE BY ANYONE BASED ON THE LIVE AGENTS TABE KICK EVERYONE OUT OF THE CONFENCE ROOM AND MAKE IT AVALIABLE..

LET ME KNOW IF YOU NEED ANYMORE HELP.. TO RUN THIS ADD THIS TO YOUR CRONTAB ADDITIONS

* * * * * root /usr/bin/php4 /PATH_TO_FILE/fix_meetme.php &>/dev/null



$res = $astman->connect("$row[server_ip]", "admin" , "amp111") MODIFY THIS LIEN TO LOG INTO UR ASTERISK MANAGER

TURN ON DEBUG=1 TO PRINT DEBUG INFO

CODE:


<?

set_time_limit(120);

foreach (split("\n", `ps auxw|grep fix_meetme.php | grep -v grep`) as $pair) {
if(stristr($pair, 'fix_meetme.php') !== FALSE)$cronphp++;
}
if($cronphp>1){exit;}

//PHP CONNECT CODE TO CONNECT TO THE DATABASE

mysql_select_db ("asterisk"); // OR WHATEVER DATABASE U USE FOR VICIDIAL

$DEBUG=0;

require_once("php-asmanager.php");
$astman = new AGI_AsteriskManager();

$result = mysql_query("SELECT server_ip from servers order by server_ip");
while ($row = mysql_fetch_array($result))
{

if($DEBUG)print "Server $row[server_ip]\n";
if ($res = $astman->connect("$row[server_ip]", "admin" , "amp111")) {
$response = $astman->send_request('Command', array('Command'=>'meetme'));
$verinfo = $response['data'];
foreach (split("\n", $verinfo) as $indexparse) {
preg_match('/(.*) (.*)/i', $indexparse, $matches);
list($meetme_room,$right) = split("[\t ]+", $matches[1]);
if($meetme_room && $meetme_room!='Conf'){
$sql = "select extension,conf_exten from vicidial_conferences where server_ip='$row[server_ip]' and conf_exten = '$meetme_room'";
list($extension,$conf_exten) = mysql_fetch_array(mysql_query($sql));
if(!$extension && $conf_exten){
if($DEBUG)print "Kill confrence $meetme_room on server $row[server_ip]\n";
mysql_query("update vicidial_conferences set extension='' where server_ip='$row[server_ip]' and conf_exten='$meetme_room'");
for ($i = 1; $i < 11; $i++)
{

$response = $astman->send_request('Command', array('Command'=>"meetme kick $meetme_room $i"));
if($DEBUG)print "meetme kick $meetme_room $i\n";
}
}
else if($extension && $conf_exten){
list($check_phone_status_time) = mysql_fetch_array(mysql_query("SELECT count(*) FROM `vicidial_live_agents` where last_update_time <= now() - interval 2 minute and extension='$extension'"));
if($check_phone_status_time){
mysql_query("update vicidial_conferences set extension='' where server_ip='$row[server_ip]' and conf_exten='$meetme_room'");
if($DEBUG)print "Kill confrence $meetme_room even tho its already assigned to a user but user is not alive\n";
for ($i = 1; $i < 11; $i++)
{
$response = $astman->send_request('Command', array('Command'=>"meetme kick $meetme_room $i"));
if($DEBUG)print "meetme kick $meetme_room $i\n";
}
}
else{
if($DEBUG)print "Confence $meetme_room is ok! on server $row[server_ip]\n";
}
}
}
}
$astman->disconnect();
}
if($DEBUG)print "-------------------\n";


}



?>

PostPosted: Sun Sep 23, 2007 4:08 am
by bobbymc
OH BTW IT NEEDS php-asmanager.php

PostPosted: Sun Sep 23, 2007 7:40 am
by Op3r
Oh my GOD!!!!

Please upload this on the VICIDIAL Issue Tracker! ...

Thanks...

PostPosted: Mon Sep 24, 2007 1:43 pm
by bobbymc
im new to contributing code how would i do that.. i got alot of other bug fixes i can add =)

PostPosted: Tue Sep 25, 2007 4:31 am
by ramindia
Hi

thats good script

its very usefull also

ram

PostPosted: Tue Sep 25, 2007 6:31 am
by Op3r
via here

http://www.eflo.net/VICIDIALmantis

its an bug/issue tracker.

PostPosted: Thu Sep 27, 2007 12:30 am
by gardo
put it in the tracker please. by the way, where do you get php-asmanger.php?

PostPosted: Thu Sep 27, 2007 9:12 am
by mflorell
Thank you very much for posting this. This is good functionality that does need to be in VICIDIAL, but I would prefer not bringing a PHP-shell script into the mix that both uses another external package and does not follow the settings in VICIDIAL for manager connections.

Adding this functionality to the AST_VDauto_dial.pl script makes more sense for the project and will be more efficient while following the settings properly.

PostPosted: Fri Sep 28, 2007 11:37 pm
by bobbymc
well the idea is there.. feel free to implement it into that script.. let me know if you guys need any help on doing so

Re: ONE OF THE TODO'S DONE!!

PostPosted: Thu Aug 23, 2012 11:01 pm
by bobbymc
matt would you like me to implement this into the AST_VDauto_dial.pl script?

Re: ONE OF THE TODO'S DONE!!

PostPosted: Fri Aug 24, 2012 9:16 am
by mflorell
The conf update perl script already does this.