Fixed rare bug with manual dial calls and using PRIs where live calls could be hung up

git-svn-id: svn://192.168.202.10@1065 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-03-03 16:38:16 +00:00
parent 41ddd27c91
commit 8bed9a7d76
3 changed files with 41 additions and 7 deletions
+15 -4
View File
@@ -18,6 +18,8 @@
# - $notes
# - $phone_code
# - $search
# - $group_alias
# - $dial_prefix
# - $source - ('vtiger','webform','adminweb')
# - $format - ('text','debug')
@@ -26,10 +28,11 @@
# 90116-1229 - Added external_pause and external_dial functions
# 90118-1051 - Added logging of API functions
# 90128-0229 - Added vendor_id to dial function
# 90303-0723 - Added group alias and dial prefix
#
$version = '2.0.5-4';
$build = '90128-0229';
$version = '2.0.5-5';
$build = '90303-0723';
require("dbconnect.php");
@@ -56,11 +59,17 @@ if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["search"])) {$search=$_GET["search"];}
elseif (isset($_POST["search"])) {$search=$_POST["search"];}
if (isset($_GET["group_alias"])) {$group_alias=$_GET["group_alias"];}
elseif (isset($_POST["group_alias"])) {$group_alias=$_POST["group_alias"];}
if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];}
elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];}
if (isset($_GET["source"])) {$source=$_GET["source"];}
elseif (isset($_POST["source"])) {$source=$_POST["source"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
$group_alias = ereg_replace("[^0-9a-zA-Z]","",$group_alias);
$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix);
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -96,6 +105,8 @@ $preview = ereg_replace("[^-\_0-9a-zA-Z]","",$preview);
$notes = ereg_replace("[^ -\_0-9a-zA-Z]","",$notes);
$phone_code = ereg_replace("[^0-9X]","",$phone_code);
$search = ereg_replace("[^-\_0-9a-zA-Z]","",$search);
$group_alias = ereg_replace("[^0-9a-zA-Z]","",$group_alias);
$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix);
$source = ereg_replace("[^0-9a-zA-Z]","",$source);
$format = ereg_replace("[^0-9a-zA-Z]","",$format);
}
@@ -398,12 +409,12 @@ if ($function == 'external_dial')
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch' where user='$agent_user';";
$stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_dial function set";
$data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch";
$data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch|$dial_prefix|$group_alias";
echo "$result: $result_reason - $value|$agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
+24 -1
View File
@@ -83,7 +83,7 @@
$version = '2.0.5-35';
$build = '81104-0203';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=82;
$mysql_log_count=83;
$one_mysql_log=0;
require("dbconnect.php");
@@ -484,6 +484,29 @@ $rslt=mysql_query($stmt, $link);
}
}
}
if ( ($auto_dial_level < 1) and (strlen($stage)>2) and (strlen($channel)>2) and (strlen($exten)>2) )
{
$stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension NOT LIKE \"%$exten%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02083',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$channel_live=0;
echo "Channel $channel in use by another agent on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n";
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|MDCHU|$user|$channel|$call_server_ip|$exten|\n");
fclose($fp);
}
}
else
{
echo "$stmt\n";
}
}
if ($channel_live==1)
{
+2 -2
View File
@@ -2805,7 +2805,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
}
}
}
if (APIDiaL.length > 8)
if (APIDiaL.length > 9)
{
var APIDiaL_array_detail = APIDiaL.split("!");
if (APIDiaL_ID == APIDiaL_array_detail[6])
@@ -5249,7 +5249,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var queryCID = "HLvdcW" + epoch_sec + user_abb;
var hangupvalue = customer_channel;
// alert(auto_dial_level + "|" + CalLCID + "|" + customer_server_ip + "|" + hangupvalue + "|" + VD_live_call_secondS);
custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id + "campaign" + group;
custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id + "&campaign=" + group + "&stage=CALLHANGUP";
xmlhttp.open('POST', 'manager_send.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(custhangup_query);