cleanup of extras
git-svn-id: svn://192.168.202.10@17 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -0,0 +1,463 @@
|
||||
<?
|
||||
### active_list_refresh.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
### This script is designed purely to serve updates of the live data to the display scripts
|
||||
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
###
|
||||
### required variables:
|
||||
### - $server_ip
|
||||
### - $session_name
|
||||
### - $user
|
||||
### - $pass
|
||||
### optional variables:
|
||||
### - $ADD - ('1','2','3','4','5')
|
||||
### - $order - ('asc','desc')
|
||||
### - $format - ('text','table','menu','selectlist','textarea')
|
||||
### - $bgcolor - ('#123456','white','black','etc...')
|
||||
### - $txtcolor - ('#654321','black','white','etc...')
|
||||
### - $txtsize - ('1','2','3','etc...')
|
||||
### - $selectsize - ('2','3','4','etc...')
|
||||
### - $selectfontsize - ('8','10','12','etc...')
|
||||
### - $selectedext - ('cc100')
|
||||
### - $selectedtrunk - ('Zap/25-1')
|
||||
### - $selectedlocal - ('SIP/cc100')
|
||||
### - $textareaheight - ('8','10','12','etc...')
|
||||
### - $textareawidth - ('8','10','12','etc...')
|
||||
### - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
###
|
||||
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.7';
|
||||
$build = '60421-1155';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Affichage De Liste: ";
|
||||
if ($ADD==1) {echo "Prolongements De phase";}
|
||||
if ($ADD==2) {echo "Prolongements Occupés";}
|
||||
if ($ADD==3) {echo "Lignes Extérieures";}
|
||||
if ($ADD==4) {echo "Prolongements Locaux";}
|
||||
if ($ADD==5) {echo "Conférences";}
|
||||
if ($ADD==99999) {echo "AIDE";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,192 @@
|
||||
<?
|
||||
### call_log_display.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
### This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
###
|
||||
### required variables:
|
||||
### - $server_ip
|
||||
### - $session_name
|
||||
### - $user
|
||||
### - $pass
|
||||
### optional variables:
|
||||
### - $format - ('text','debug')
|
||||
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
### - $protocol - ('SIP','Zap','IAX2',...)
|
||||
### - $in_limit - ('10','20','50','100',...)
|
||||
### - $out_limit - ('10','20','50','100',...)
|
||||
###
|
||||
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.7';
|
||||
$build = '60421-1401';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Affichage De Notation D'Appel";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten est inadmissible ou protocole $protocol est inadmissible\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,258 @@
|
||||
<?
|
||||
# conf_exten_check.php
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60421-1405';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Contrôle De Prolongation De Conf";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten est inadmissible\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$Astatus='N';
|
||||
$RingCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Astatus='N';
|
||||
$RingCalls='N';
|
||||
}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Statut: ' . $Astatus . '|CampCalls: ' . $RingCalls . "|\n";
|
||||
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LaMancheA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LaMancheA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$LaMancheA[$counter] ~";
|
||||
# echo "$LaMancheA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten est inadmissible or Exten $exten est inadmissible\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
echo "Conférence $conf_exten a été enregistré à $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?
|
||||
|
||||
$link=mysql_connect("localhost", "cron", "1234");
|
||||
mysql_select_db("asterisk");
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
$WeBRooTWritablE = '1';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,348 @@
|
||||
<?
|
||||
### inbound_popup.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
### This script is designed to open up when a live_inbound call comes in giving the user
|
||||
### options of what to do with the call or options to lookup the callerID on various web sites
|
||||
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
###
|
||||
### required variables:
|
||||
### - $server_ip
|
||||
### - $session_name
|
||||
### - $uniqueid - ('1234567890.123456',...)
|
||||
### - $user
|
||||
### - $pass
|
||||
### optional variables:
|
||||
### - $format - ('text','debug')
|
||||
### - $vmail_box - ('101','1234',...)
|
||||
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
### - $ext_context - ('default','demo',...)
|
||||
### - $ext_priority - ('1','2',...)
|
||||
### - $voicemail_dump_exten - ('85026666666666')
|
||||
### - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
###
|
||||
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60421-1043';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<? echo $server_ip ?>';
|
||||
var epoch_sec = '<? echo $StarTtime ?>';
|
||||
var user_abb = '<? echo $user_abb ?>';
|
||||
var vmail_box = '<? echo $vmail_box ?>';
|
||||
var ext_context = '<? echo $ext_context ?>';
|
||||
var ext_priority = '<? echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<? echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<? echo $session_name ?>';
|
||||
var user = '<? echo $user ?>';
|
||||
var pass = '<? echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30 secondes
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?
|
||||
echo "<title>APPEL D'ARRIVÉE DE PHASE";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>APPEL D'ARRIVÉE DE PHASE</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid est inadmissible\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>LaManche: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>CallerID: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Téléphone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Téléphone?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Téléphone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_LaManche=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">COUTUME</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Numéro Composé: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Notes: </td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">DÉCROCHEMENT</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">ENVOYEZ À MON VOICEMAIL</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,273 @@
|
||||
<?
|
||||
### live_exten_check.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
### This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
###
|
||||
### required variables:
|
||||
### - $server_ip
|
||||
### - $session_name
|
||||
### - $user
|
||||
### - $pass
|
||||
### optional variables:
|
||||
### - $format - ('text','debug')
|
||||
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
### - $protocol - ('SIP','Zap','IAX2',...)
|
||||
###
|
||||
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '1.1.11';
|
||||
$build = '60421-1359';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Contrôle De phase De Prolongation";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten est inadmissible ou protocole $protocol est inadmissible\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LaMancheA[$loop_count] = "$row[0]";
|
||||
$LaMancheB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "LaMancheA: $LaMancheA[$counter] ~";
|
||||
echo "LaMancheB: $LaMancheB[$counter] ~";
|
||||
echo "LaMancheBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChannelA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "LaMancheA: $LaMancheA[$counter] ~";
|
||||
echo "LaMancheB: $LaMancheB[$counter] ~";
|
||||
echo "LaMancheBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "LaMancheA: $LaMancheA[$counter] ~";
|
||||
echo "LaMancheB: $LaMancheB[$counter] ~";
|
||||
echo "LaMancheBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChannelB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "LaMancheA: $LaMancheA[$counter] ~";
|
||||
echo "LaMancheB: $LaMancheB[$counter] ~";
|
||||
echo "LaMancheBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "LaMancheA: $LaMancheA[$counter] ~";
|
||||
echo "LaMancheB: $LaMancheB[$counter] ~";
|
||||
echo "LaMancheBtrunk: $LaMancheA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,903 @@
|
||||
<?
|
||||
# manager_send.php
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial')
|
||||
# - $queryCID - ('CN012345678901234567',...)
|
||||
# - $format - ('text','debug')
|
||||
# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...)
|
||||
# - $exten - ('1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $filename - ('20050406-125623_44444',...)
|
||||
# - $extenName - ('phone100',...)
|
||||
# - $parkedby - ('phone100',...)
|
||||
# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...)
|
||||
# - $auto_dial_level - ('0','1','1.1',...)
|
||||
# - $campaign - ('CLOSER','TESTCAMP',...)
|
||||
# - $uniqueid - ('1120232758.2406800',...)
|
||||
# - $lead_id - ('1234',...)
|
||||
# - $seconds - ('32',...)
|
||||
# - $outbound_cid - ('3125551212','0000000000',...)
|
||||
# - $agent_log_id - ('123456',...)
|
||||
# - $call_server_ip - ('10.10.10.15',...)
|
||||
# - $CalLCID - ('VD01234567890123456',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50401-1002 - First build of script, Hangup function only
|
||||
# 50404-1045 - Redirect basic function enabled
|
||||
# 50406-1522 - Monitor basic function enabled
|
||||
# 50407-1647 - Monitor and StopMonitor full functions enabled
|
||||
# 50422-1120 - basic Originate function enabled
|
||||
# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail
|
||||
# 50502-1539 - basic RedirectName and RedirectNameVmail added
|
||||
# 50503-1227 - added session_name checking for extra security
|
||||
# 50523-1341 - added Conference call start/stop recording
|
||||
# 50523-1421 - added OriginateName and OriginateNameVmail for local calls
|
||||
# 50524-1602 - added RedirectToPark and RedirectFromPark
|
||||
# 50531-1203 - added RedirecXtra for dual channel redirection
|
||||
# 50630-1100 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging
|
||||
# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function
|
||||
# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf
|
||||
# 50913-1057 - Added outbound_cid set if present to originate call
|
||||
# 51020-1556 - Added agent_log_id framework for detailed agent activity logging
|
||||
# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode
|
||||
# 51129-1014 - Added ability to accept calls from other VICIDIAL servers
|
||||
# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD
|
||||
# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function
|
||||
# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### These are variable assignments for PHP globals off
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];}
|
||||
elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
|
||||
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["filename"])) {$filename=$_GET["filename"];}
|
||||
elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];}
|
||||
if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];}
|
||||
elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];}
|
||||
if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];}
|
||||
elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];}
|
||||
if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];}
|
||||
elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];}
|
||||
elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];}
|
||||
if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];}
|
||||
elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];}
|
||||
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
|
||||
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
|
||||
if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];}
|
||||
elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];}
|
||||
if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];}
|
||||
elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ACTION)) {$ACTION="Originate";}
|
||||
if (!isset($format)) {$format="alert";}
|
||||
if (!isset($ext_priority)) {$ext_priority="1";}
|
||||
|
||||
$version = '0.0.23';
|
||||
$build = '60421-1413';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build ACTION: $ACTION server_ip: $server_ip-->\n";
|
||||
echo "<title>Le Directeur Envoient: ";
|
||||
if ($ACTION=="Originate") {echo "Originate";}
|
||||
if ($ACTION=="Redirect") {echo "Redirect";}
|
||||
if ($ACTION=="RedirectName") {echo "RedirectName";}
|
||||
if ($ACTION=="Hangup") {echo "Hangup";}
|
||||
if ($ACTION=="Command") {echo "Command";}
|
||||
if ($ACTION==99999) {echo "AIDE";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls
|
||||
######################
|
||||
if ($ACTION=="SysCIDOriginate")
|
||||
{
|
||||
if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) )
|
||||
{
|
||||
echo "Exten $exten est inadmissible or queryCID $queryCID est inadmissible, Originate commande non insérée\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
echo "Originate commande envoyée pour Exten $exten LaManche $channel sur $server_ip\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement
|
||||
######################
|
||||
if ($ACTION=="OriginateName")
|
||||
{
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "extenName $extenName doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "\nOriginateName Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$name_count = mysql_num_rows($rslt);
|
||||
if ($name_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$exten = $row[0];
|
||||
$ACTION="Originate";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ACTION=="OriginateNameVmail")
|
||||
{
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "extenName $extenName doit être placé\n";
|
||||
echo "exten $exten doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "\nOriginateNameVmail Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$name_count = mysql_num_rows($rslt);
|
||||
if ($name_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$exten = "$exten$row[0]";
|
||||
$ACTION="Originate";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ACTION=="Originate")
|
||||
{
|
||||
if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) )
|
||||
{
|
||||
echo "Exten $exten est inadmissible or queryCID $queryCID est inadmissible, Originate commande non insérée\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($outbound_cid)>1)
|
||||
{$outCID = "\"$queryCID\" <$outbound_cid>";}
|
||||
else
|
||||
{$outCID = "$queryCID";}
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
echo "Originate commande envoyée pour Exten $exten LaManche $channel sur $server_ip\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up
|
||||
######################
|
||||
if ($ACTION=="HangupConfDial")
|
||||
{
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "conference $exten est inadmissible or ext_context $ext_context or queryCID $queryCID est inadmissible, Hangup commande non insérée\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$local_DEF = 'Local/';
|
||||
$local_AMP = '@';
|
||||
$hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context";
|
||||
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row > 0)
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$channel=$rowx[0];
|
||||
$ACTION="Hangup";
|
||||
$queryCID = eregi_replace("^.","G",$queryCID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ACTION=Hangup - insert Hangup Manager statement
|
||||
######################
|
||||
if ($ACTION=="Hangup")
|
||||
{
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "LaManche $channel est inadmissible or queryCID $queryCID est inadmissible, Hangup commande non insérée\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;}
|
||||
|
||||
# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';";
|
||||
# if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# if ($row[0]==0)
|
||||
# {
|
||||
# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';";
|
||||
# if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $rowx=mysql_fetch_row($rslt);
|
||||
# if ($rowx[0]==0)
|
||||
# {
|
||||
# $channel_live=0;
|
||||
# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n";
|
||||
# }
|
||||
# }
|
||||
if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4))
|
||||
{
|
||||
$stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
if ($rowx[0]==0)
|
||||
{
|
||||
echo "Call $CalLCID $channel n'est pas de phase sur $call_server_ip, Checking Live LaManche...\n";
|
||||
|
||||
$stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row[0]==0)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "LaManche $channel n'est pas de phase sur $call_server_ip, Hangup commande non insérée $rowx[0]\n$stmt\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "$stmt\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($channel_live==1)
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
echo "Hangup commande envoyée pour LaManche $channel sur $call_server_ip\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD
|
||||
# - insert Redirect Manager statement using extensions name
|
||||
######################
|
||||
if ($ACTION=="RedirectVD")
|
||||
{
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "exten $exten doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "auto_dial_level $auto_dial_level doit être placé\n";
|
||||
echo "campaign $campaign doit être placé\n";
|
||||
echo "uniqueid $uniqueid doit être placé\n";
|
||||
echo "lead_id $lead_id doit être placé\n";
|
||||
echo "\nRedirectVD Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
|
||||
if (eregi("CLOSER",$campaign))
|
||||
{
|
||||
$stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
if ($auto_dial_level < 1)
|
||||
{
|
||||
$stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
|
||||
$ACTION="Redirect";
|
||||
}
|
||||
}
|
||||
|
||||
if ($ACTION=="RedirectToPark")
|
||||
{
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "exten $exten doit être placé\n";
|
||||
echo "extenName $extenName doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "parkedby $parkedby doit être placé\n";
|
||||
echo "\nRedirectToPark Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
|
||||
$stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$ACTION="Redirect";
|
||||
}
|
||||
}
|
||||
|
||||
if ($ACTION=="RedirectFromPark")
|
||||
{
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "exten $exten doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "\nRedirectFromPark Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
|
||||
$stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$ACTION="Redirect";
|
||||
}
|
||||
}
|
||||
|
||||
if ($ACTION=="RedirectName")
|
||||
{
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "extenName $extenName doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "\nRedirectName Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$name_count = mysql_num_rows($rslt);
|
||||
if ($name_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$exten = $row[0];
|
||||
$ACTION="Redirect";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ACTION=="RedirectNameVmail")
|
||||
{
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "extenName $extenName doit être placé\n";
|
||||
echo "exten $exten doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "\nRedirectNameVmail Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$name_count = mysql_num_rows($rslt);
|
||||
if ($name_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$exten = "$exten$row[0]";
|
||||
$ACTION="Redirect";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ACTION=="RedirectXtra")
|
||||
{
|
||||
if ($channel=="$extrachannel")
|
||||
{$ACTION="Redirect";}
|
||||
else
|
||||
{
|
||||
$row=''; $rowx='';
|
||||
$channel_liveX=1;
|
||||
$channel_liveY=1;
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) )
|
||||
{
|
||||
$channel_liveX=0;
|
||||
$channel_liveY=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "ExtraLaManche $extrachannel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "exten $exten doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "\nRedirect Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($exten == "NEXTAVAILABLE")
|
||||
{
|
||||
$stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if (strlen($row[0]) > 3)
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$exten = $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$channel_liveX=0;
|
||||
echo "Ne peut pas trouver la conférence vide sur $server_ip, Redirect commande non insérée\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;}
|
||||
|
||||
$stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row[0]==0)
|
||||
{
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
if ($rowx[0]==0)
|
||||
{
|
||||
$channel_liveX=0;
|
||||
echo "LaManche $channel n'est pas de phase sur $call_server_ip, Redirect commande non insérée\n";
|
||||
}
|
||||
}
|
||||
$stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row[0]==0)
|
||||
{
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
if ($rowx[0]==0)
|
||||
{
|
||||
$channel_liveY=0;
|
||||
echo "LaManche $channel n'est pas de phase sur $server_ip, Redirect commande non insérée\n";
|
||||
}
|
||||
}
|
||||
if ( ($channel_liveX==1) && ($channel_liveY==1) )
|
||||
{
|
||||
if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) )
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
echo "RedirectXtra commande envoyée pour LaManche $channel and \nExtraLaManche $extrachannel\n to $exten sur $server_ip\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$S='*';
|
||||
$D_s_ip = explode('.', $server_ip);
|
||||
if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";}
|
||||
if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";}
|
||||
if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";}
|
||||
if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";}
|
||||
if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";}
|
||||
if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";}
|
||||
if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";}
|
||||
if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";}
|
||||
$dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten";
|
||||
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
echo "RedirectXtra commande envoyée pour LaManche $channel sur $call_server_ip and \nExtraLaManche $extrachannel\n to $exten sur $server_ip\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($channel_liveX==1)
|
||||
{$ACTION="Redirect"; $server_ip = $call_server_ip;}
|
||||
if ($channel_liveY==1)
|
||||
{$ACTION="Redirect"; $channel=$extrachannel;}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($ACTION=="Redirect")
|
||||
{
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Une de ces variables est inadmissible:\n";
|
||||
echo "LaManche $channel doivent être les 2 caractères plus grands que\n";
|
||||
echo "queryCID $queryCID doivent être les 14 caractères plus grands que\n";
|
||||
echo "exten $exten doit être placé\n";
|
||||
echo "ext_context $ext_context doit être placé\n";
|
||||
echo "ext_priority $ext_priority doit être placé\n";
|
||||
echo "\nRedirect Action non envoyé\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
|
||||
$stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row[0]==0)
|
||||
{
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
if ($rowx[0]==0)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "LaManche $channel n'est pas de phase sur $server_ip, Redirect commande non insérée\n";
|
||||
}
|
||||
}
|
||||
if ($channel_live==1)
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
echo "Redirect commande envoyée pour LaManche $channel sur $server_ip\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel
|
||||
######################
|
||||
if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") )
|
||||
{
|
||||
if ($ACTION=="StopMonitor")
|
||||
{$SQLfile = "";}
|
||||
else
|
||||
{$SQLfile = "File: $filename";}
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "LaManche $channel est inadmissible or queryCID $queryCID est inadmissible or filename: $filename est inadmissible, $ACTION commande non insérée\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row[0]==0)
|
||||
{
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
if ($rowx[0]==0)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "LaManche $channel n'est pas de phase sur $server_ip, $ACTION commande non insérée\n";
|
||||
}
|
||||
}
|
||||
if ($channel_live==1)
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
if ($ACTION=="Monitor")
|
||||
{
|
||||
$stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
$stmt="SELECT recording_id FROM recording_log where filename='$filename'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rec_count = mysql_num_rows($rslt);
|
||||
if ($rec_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
$start_time = $row[1];
|
||||
$length_in_sec = ($StarTtime - $start_time);
|
||||
$length_in_min = ($length_in_sec / 60);
|
||||
$length_in_min = sprintf("%8.2f", $length_in_min);
|
||||
|
||||
$stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
|
||||
}
|
||||
echo "$ACTION commande envoyée pour LaManche $channel sur $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference
|
||||
######################
|
||||
if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") )
|
||||
{
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "LaManche $channel est inadmissible or exten $exten est inadmissible or filename: $filename est inadmissible, $ACTION commande non insérée\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($ACTION=="MonitorConf")
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
$stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
$stmt="SELECT recording_id FROM recording_log where filename='$filename'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rec_count = mysql_num_rows($rslt);
|
||||
if ($rec_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
$start_time = $row[1];
|
||||
$length_in_sec = ($StarTtime - $start_time);
|
||||
$length_in_min = ($length_in_sec / 60);
|
||||
$length_in_min = sprintf("%8.2f", $length_in_min);
|
||||
|
||||
$stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
|
||||
# find and hang up all recordings going sur in this conference # and extension = '$exten'
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
# $rec_count = intval(mysql_num_rows($rslt) / 2);
|
||||
$rec_count = mysql_num_rows($rslt);
|
||||
$h=0;
|
||||
while ($rec_count>$h)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$HUchannel[$h] = $rowx[0];
|
||||
$h++;
|
||||
}
|
||||
$i=0;
|
||||
while ($h>$i)
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
echo "$ACTION commande envoyée pour LaManche $channel sur $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n L'ENREGISTREMENT DURERA JUSQU'À 60 MINUTES\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='debug') {echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";}
|
||||
if ($format=='debug') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<?
|
||||
### park_calls_display.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
### This script is designed purely to send the details on the parked calls on the server
|
||||
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
###
|
||||
### required variables:
|
||||
### - $server_ip
|
||||
### - $session_name
|
||||
### - $user
|
||||
### - $pass
|
||||
### optional variables:
|
||||
### - $format - ('text','debug')
|
||||
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
### - $protocol - ('SIP','Zap','IAX2',...)
|
||||
###
|
||||
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.3';
|
||||
$build = '60421-1111';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Affichage Garé D'Appels";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten est inadmissible ou protocole $protocol est inadmissible\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,136 @@
|
||||
<?
|
||||
### voicemail_check.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
### This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
###
|
||||
### required variables:
|
||||
### - $server_ip
|
||||
### - $session_name
|
||||
### - $user
|
||||
### - $pass
|
||||
### optional variables:
|
||||
### - $format - ('text','debug')
|
||||
### - $vmail_box - ('101','1234',...)
|
||||
###
|
||||
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60421-1147';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inadmissible Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inadmissible server_ip: |$server_ip| or Inadmissible session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inadmissible session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version CONSTRUCTION: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Contrôle De Voicemail";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "boîte de voicemail $vmail_box est inadmissible\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- temps d'exécution de manuscrit: $RUNtime secondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user