Added non-agent API function and Real-time report feature to allow managers to change agent selected in-groups and blended outbound auto-dial state

git-svn-id: svn://192.168.202.10@1270 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-12-04 21:15:08 +00:00
parent 068c58571e
commit d51b7c6a38
5 changed files with 771 additions and 232 deletions
+8
View File
@@ -307,6 +307,14 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
changed using this function. For more information see the AGENT_API.txt
document in the docs directory.
74. Added a non-agent-API function and a new feature to the Real-Time screen
that allows a manager to change the in-groups selected by an agent in
real time while an agent is logged in. Simply click on the INFO + link
for the agent you want to modify, select the in-groups, select blended
and select if you want to override the agent default settings then
click submit. Manager must have the ability to Change Agent Campaign in
their user settings.
+16 -4
View File
@@ -54,10 +54,10 @@ ERROR: agent_user is not logged in - 6666
DETAIL OF EACH FUNCTION:
--------------------------------------------------------------------------------
version -
DESCRIPTION:
@@ -70,6 +70,7 @@ VERSION: 2.0.5-2|BUILD: 90116-1229|DATE: 2009-01-15 14:59:33|EPOCH: 1222020803
--------------------------------------------------------------------------------
external_hangup -
DESCRIPTION:
@@ -85,6 +86,7 @@ SUCCESS: external_hangup function set - 1|6666
--------------------------------------------------------------------------------
external_status -
DESCRIPTION:
@@ -100,6 +102,7 @@ SUCCESS: external_status function set - A|6666
--------------------------------------------------------------------------------
external_pause -
DESCRIPTION:
@@ -116,6 +119,7 @@ SUCCESS: external_pause function set - PAUSE|1232020456|6666
--------------------------------------------------------------------------------
external_dial -
DESCRIPTION:
@@ -155,6 +159,7 @@ SUCCESS: external_dial function set - 7275551212|1|YES|1232020456|6666
--------------------------------------------------------------------------------
change_ingroups -
DESCRIPTION:
@@ -173,7 +178,7 @@ ingroup_choices -
set_as_default -
OPTIONAL, YES or NO - overwrites the settings for the agent in the user modification screen, default is NO
EXAMPLE URL:
EXAMPLE URLS:
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=change_ingroups&value=CHANGE&set_as_default=YES&blended=YES&ingroup_choices=+TEST_IN+SALESLINE+FAKE_IN+-
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=change_ingroups&value=REMOVE&blended=NO&ingroup_choices=+TEST_IN2+TEST_IN4+-
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=change_ingroups&value=ADD&blended=NO&ingroup_choices=+TEST_IN2+-
@@ -194,6 +199,13 @@ SUCCESS: change_ingroups function set - YES| TEST_IN SALESLINE -|6666
--------------------------------------------------------------------------------
Other information:
Example MySQL query options for executing API functions(not available for all functions):
update vicidial_live_agents set external_hangup=1 where user='1000';
update vicidial_live_agents set external_status='A' where user='1000';
+40 -5
View File
@@ -1,9 +1,9 @@
NON-AGENT API DOCUMENT Started: 2008-07-24
This document describes the functions of an API(Application Programming Interface)
for all functions NOT relating to the VICIDIAL Agent screen. This functionality
will be rather limited at first and will be built upon as critical functions are
identified and programmed into it.
This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
This functionality will be rather limited at first and will be built upon as
critical functions are identified and programmed into it.
There is also a new agent API script, for more information on that, please read
the AGENT_API.txt document.
@@ -11,6 +11,17 @@ the AGENT_API.txt document.
API functions:
version - shows version and build of the API, along with the date/time
sounds_list - outputs a list of audio files from the audio store
moh_list - outputs a list of music on hold classes in the system
vm_list - outputs a list of voicemail boxes in the system
blind_monitor - calls user-defined phone and places them in session as blind monitor
add_lead - adds a new lead to the vicidial_list table with several fields and options
agent_ingroup_info - shows in-group and outbound auto-dial info for logged-in agent
New scripts:
/vicidial/non_agent_api.php - the script that is accessed to execute commands
@@ -22,10 +33,11 @@ Changes:
90721-1432 - Added rank and owner
90904-1535 - Added moh_list musiconhold function
90916-2342 - Added vm_list voicemail list
91203-1140 - Added agent_ingroup_info feature
API Functions: ('function' variable)
API Functions use the 'function' variable
NOTE: Just as with the Agent API, the non-agent API requires the user and pass of a
valid api-enabled vicidial_users account to execute actions.
@@ -149,6 +161,29 @@ ERROR: NO FUNCTION SPECIFIED
--------------------------------------------------------------------------------
agent_ingroup_info - shows in-group and outbound auto-dial info for logged-in agent
REQUIRED FIELDS-
agent_user - 2-20 characters
source - description of what originated the API call (maximum 20 characters)
SETTINGS FIELDS-
stage - info(show information only), change(show options to change), text(standard non-HTML output)
Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&function=agent_ingroup_info&stage=change&user=6666&pass=1234&agent_user=1000
Example responses:
ERROR: agent_ingroup_info USER DOES NOT HAVE PERMISSION TO GET AGENT INFO - 6666|0
ERROR: agent_ingroup_info INVALID USER ID - 1255|6666
--------------------------------------------------------------------------------
add_lead - adds a new lead to the vicidial_list table with several fields and options
+266 -92
View File
@@ -57,10 +57,12 @@
# 90907-0915 - Added PARK status
# 90914-1154 - Added AgentOnly display column to waiting calls section
# 91102-2013 - Changed in-group color styles for incoming calls waiting
# 91204-1548 - Added ability to change agent in-groups and blended
#
$version = '2.2.0-48';
$build = '91102-2013';
$version = '2.2.0-49';
$build = '91204-1548';
header ("Content-type: text/html; charset=utf-8");
@@ -301,14 +303,14 @@ $F=''; $FG=''; $B=''; $BG='';
$select_list = "<TABLE WIDTH=200 CELLPADDING=5 BGCOLOR=\"#D9E6FE\"><TR><TD>Select Campaigns: <BR>";
$select_list .= "<SELECT SIZE=10 NAME=groups[] multiple>";
$o=0;
while ($groups_to_print > $o)
$o=0;
while ($groups_to_print > $o)
{
if (ereg("\|$LISTgroups[$o]\|",$group_string))
{$select_list .= "<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTnames[$o]</option>";}
else
{$select_list .= "<option value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTnames[$o]</option>";}
$o++;
if (ereg("\|$LISTgroups[$o]\|",$group_string))
{$select_list .= "<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTnames[$o]</option>";}
else
{$select_list .= "<option value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTnames[$o]</option>";}
$o++;
}
$select_list .= "</SELECT>";
$select_list .= "<BR><font size=1>(To select more than 1 campaign, hold down the Ctrl key and click)<font>";
@@ -320,12 +322,12 @@ if ($UGdisplay > 0)
$select_list .= "Select User Group:<BR>";
$select_list .= "<SELECT SIZE=1 NAME=usergroup>";
$select_list .= "<option value=\"\">ALL USER GROUPS</option>";
$o=0;
while ($usergroups_to_print > $o)
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
else {$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
$o++;
if ($usergroups[$o] == $usergroup) {$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
else {$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
$o++;
}
$select_list .= "</SELECT><BR><BR>";
}
@@ -379,68 +381,229 @@ $open_list = "<TABLE WIDTH=250 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#D9E6FE\"><
<HEAD>
<script language="Javascript">
var select_list = '<?php echo $select_list ?>';
var open_list = '<?php echo $open_list ?>';
var monitor_phone = '<?php echo $monitor_phone ?>';
var user = '<?php echo $PHP_AUTH_USER ?>';
var pass = '<?php echo $PHP_AUTH_PW ?>';
// functions to hide and show different DIVs
function openDiv(divvar)
window.onload = startup;
// function to detect the XY position on the page of the mouse
function startup()
{
hide_ingroup_info();
if (window.Event)
{
document.getElementById(divvar).innerHTML = select_list;
document.captureEvents(Event.MOUSEMOVE);
}
function closeDiv(divvar)
document.onmousemove = getCursorXY;
}
function getCursorXY(e)
{
document.getElementById('cursorX').value = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
document.getElementById('cursorY').value = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
}
var select_list = '<?php echo $select_list ?>';
var open_list = '<?php echo $open_list ?>';
var monitor_phone = '<?php echo $monitor_phone ?>';
var user = '<?php echo $PHP_AUTH_USER ?>';
var pass = '<?php echo $PHP_AUTH_PW ?>';
// functions to hide and show different DIVs
function openDiv(divvar)
{
document.getElementById(divvar).innerHTML = select_list;
}
function closeDiv(divvar)
{
document.getElementById(divvar).innerHTML = open_list;
}
// function to launch monitoring calls
function send_monitor(session_id,server_ip,stage)
{
// alert(session_id + "|" + server_ip + "|" + monitor_phone + "|" + stage + "|" + user);
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')
{
document.getElementById(divvar).innerHTML = open_list;
xmlhttp = new XMLHttpRequest();
}
// function to launch monitoring calls
function send_monitor(session_id,server_ip,stage)
if (xmlhttp)
{
// alert(session_id + "|" + server_ip + "|" + monitor_phone + "|" + stage + "|" + user);
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();
var monitorQuery = "source=realtime&function=blind_monitor&user=" + user + "&pass=" + pass + "&phone_login=" + monitor_phone + "&session_id=" + session_id + '&server_ip=' + server_ip + '&stage=' + stage;
xmlhttp.open('POST', 'non_agent_api.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(monitorQuery);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
// alert(xmlhttp.responseText);
var Xoutput = null;
Xoutput = xmlhttp.responseText;
var regXFerr = new RegExp("ERROR","g");
var regXFscs = new RegExp("SUCCESS","g");
if (Xoutput.match(regXFerr))
{alert(xmlhttp.responseText);}
if (Xoutput.match(regXFscs))
{alert("SUCCESS: calling " + monitor_phone);}
}
}
if (xmlhttp)
delete xmlhttp;
}
}
// function to change in-groups selected for a specific agent
function submit_ingroup_changes(temp_agent_user)
{
var temp_ingroup_add_remove_changeIndex = document.getElementById("ingroup_add_remove_change").selectedIndex;
var temp_ingroup_add_remove_change = document.getElementById('ingroup_add_remove_change').options[temp_ingroup_add_remove_changeIndex].value;
var temp_set_as_defaultIndex = document.getElementById("set_as_default").selectedIndex;
var temp_set_as_default = document.getElementById('set_as_default').options[temp_set_as_defaultIndex].value;
var temp_blendedIndex = document.getElementById("blended").selectedIndex;
var temp_blended = document.getElementById('blended').options[temp_blendedIndex].value;
var temp_ingroup_choices = '';
var txtSelectedValuesObj = document.getElementById('txtSelectedValues');
var selectedArray = new Array();
var selObj = document.getElementById('ingroup_new_selections');
var i;
var count = 0;
for (i=0; i<selObj.options.length; i++)
{
if (selObj.options[i].selected)
{
var monitorQuery = "source=realtime&function=blind_monitor&user=" + user + "&pass=" + pass + "&phone_login=" + monitor_phone + "&session_id=" + session_id + '&server_ip=' + server_ip + '&stage=' + stage;
xmlhttp.open('POST', 'non_agent_api.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(monitorQuery);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
// selectedArray[count] = selObj.options[i].value;
temp_ingroup_choices = temp_ingroup_choices + '+' + selObj.options[i].value;
count++;
}
}
temp_ingroup_choices = temp_ingroup_choices + '+-';
// alert(session_id + "|" + server_ip + "|" + monitor_phone + "|" + stage + "|" + user);
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 changeQuery = "source=realtime&function=change_ingroups&user=" + user + "&pass=" + pass + "&agent_user=" + temp_agent_user + "&value=" + temp_ingroup_add_remove_change + '&set_as_default=' + temp_set_as_default + '&blended=' + temp_blended + '&ingroup_choices=' + temp_ingroup_choices;
xmlhttp.open('POST', '../agc/api.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(changeQuery);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
// alert(changeQuery);
var Xoutput = null;
Xoutput = xmlhttp.responseText;
var regXFerr = new RegExp("ERROR","g");
if (Xoutput.match(regXFerr))
{alert(xmlhttp.responseText);}
else
{
// alert(xmlhttp.responseText);
var Xoutput = null;
Xoutput = xmlhttp.responseText;
var regXFerr = new RegExp("ERROR","g");
var regXFscs = new RegExp("SUCCESS","g");
if (Xoutput.match(regXFerr))
{alert(xmlhttp.responseText);}
if (Xoutput.match(regXFscs))
{alert("SUCCESS: calling " + monitor_phone);}
alert(xmlhttp.responseText);
hide_ingroup_info();
}
}
delete xmlhttp;
}
delete xmlhttp;
}
}
// function to display in-groups selected for a specific agent
function ingroup_info(agent_user,count)
{
var cursorheight = (document.REALTIMEform.cursorY.value - 0);
var newheight = (cursorheight + 10);
document.getElementById("agent_ingroup_display").style.top = newheight;
// alert(session_id + "|" + server_ip + "|" + monitor_phone + "|" + stage + "|" + user);
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 monitorQuery = "source=realtime&function=agent_ingroup_info&stage=change&user=" + user + "&pass=" + pass + "&agent_user=" + agent_user;
xmlhttp.open('POST', 'non_agent_api.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(monitorQuery);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
// alert(xmlhttp.responseText);
var Xoutput = null;
Xoutput = xmlhttp.responseText;
var regXFerr = new RegExp("ERROR","g");
if (Xoutput.match(regXFerr))
{alert(xmlhttp.responseText);}
else
{
document.getElementById("agent_ingroup_display").visibility = "visible";
document.getElementById("agent_ingroup_display").innerHTML = Xoutput;
}
}
}
delete xmlhttp;
}
}
// function to display in-groups selected for a specific agent
function hide_ingroup_info()
{
document.getElementById("agent_ingroup_display").visibility = "hidden";
document.getElementById("agent_ingroup_display").innerHTML = '';
}
</script>
<STYLE type="text/css">
@@ -504,9 +667,11 @@ echo "<TITLE>Real-Time Report: $group</TITLE></HEAD><BODY BGCOLOR=WHITE marginhe
echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET NAME=REALTIMEform ID=REALTIMEform>\n";
echo "<INPUT TYPE=HIDDEN NAME=RR VALUE=\"$RR\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=cursorX ID=cursorX>\n";
echo "<INPUT TYPE=HIDDEN NAME=cursorY ID=cursorY>\n";
echo "<INPUT TYPE=HIDDEN NAME=adastats VALUE=\"$adastats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=SIPmonitorLINK VALUE=\"$SIPmonitorLINK\">\n";
echo "<INPUT TYPE=HIDDEN NAME=IAXmonitorLINK VALUE=\"$IAXmonitorLINK\">\n";
@@ -519,11 +684,14 @@ echo "<INPUT TYPE=HIDDEN NAME=CALLSdisplay VALUE=\"$CALLSdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=PHONEdisplay VALUE=\"$PHONEdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=CUSTPHONEdisplay VALUE=\"$CUSTPHONEdisplay\">\n";
echo "Real-Time Report &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "<span style=\"position:absolute;left:160px;top:27px;z-index:19;\" id=campaign_select_list>\n";
echo "<span style=\"position:absolute;left:160px;top:27px;z-index:19;\" id=campaign_select_list>\n";
echo "<TABLE WIDTH=250 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#D9E6FE\"><TR><TD ALIGN=CENTER>\n";
echo "<a href=\"#\" onclick=\"openDiv('campaign_select_list');\">Choose Report Display Options</a>";
echo "</TD></TR></TABLE>\n";
echo "</span>\n";
echo "<span style=\"position:absolute;left:10px;top:120px;z-index:18;\" id=agent_ingroup_display>\n";
echo " &nbsp; ";
echo "</span>\n";
echo "<a href=\"$PHP_SELF?RR=4000$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?RR=40$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">SLOW</a> | ";
echo "<a href=\"$PHP_SELF?RR=4$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">GO</a>";
@@ -1319,12 +1487,12 @@ $Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group_string $NO
$HDbegin = "+";
$HTbegin = "|";
$HDstation = "--------------+";
$HTstation = " STATION |";
$HDphone = "------------+";
$HTphone = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$phoneord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">PHONE</a> |";
$HDuser = "--------------------+";
$HTuser = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$userord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">USER</a> |";
$HDstation = "----------------+";
$HTstation = " STATION |";
$HDphone = "-------------+";
$HTphone = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$phoneord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">PHONE</a> |";
$HDuser = "------------------------+";
$HTuser = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$userord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">USER</a> INFO |";
$HDusergroup = "--------------+";
$HTusergroup = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$groupord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone\">USER GROUP</a> |";
$HDsessionid = "------------------+";
@@ -1333,8 +1501,8 @@ $HDbarge = "-------+";
$HTbarge = " BARGE |";
$HDstatus = "----------+";
$HTstatus = " STATUS |";
$HDcustphone = "------------+";
$HTcustphone = " CUST PHONE |";
$HDcustphone = "-------------+";
$HTcustphone = " CUST PHONE |";
$HDserver_ip = "-----------------+";
$HTserver_ip = " SERVER IP |";
$HDcall_server_ip = "-----------------+";
@@ -1510,6 +1678,12 @@ $calls_to_list = mysql_num_rows($rslt);
$dialplan = eregi_replace('Zap/',"",$Aextension[$i]);
$exten = "extension='$dialplan'";
}
if (eregi('DAHDI/',$Aextension[$i]))
{
$protocol = 'Zap';
$dialplan = eregi_replace('DAHDI/',"",$Aextension[$i]);
$exten = "extension='$dialplan'";
}
$stmt="select login from phones where server_ip='$Aserver_ip[$i]' and $exten and protocol='$protocol';";
$rslt=mysql_query($stmt, $link);
@@ -1554,7 +1728,7 @@ $calls_to_list = mysql_num_rows($rslt);
$phone_split = explode("-----",$Alogin[$j]);
$i = $phone_split[1];
if (eregi("READY|PAUSED",$Astatus[$i]))
if (eregi("READY|PAUSED",$Astatus[$i]))
{
$Acall_time[$i]=$Astate_change[$i];
@@ -1565,23 +1739,23 @@ $calls_to_list = mysql_num_rows($rslt);
$status = ' DISPO';
}
}
if ($non_latin < 1)
if ($non_latin < 1)
{
$extension = eregi_replace('Local/',"",$Aextension[$i]);
$extension = sprintf("%-12s", $extension);
while(strlen($extension)>12) {$extension = substr("$extension", 0, -1);}
$extension = sprintf("%-14s", $extension);
while(strlen($extension)>14) {$extension = substr("$extension", 0, -1);}
}
else
else
{
$extension = eregi_replace('Local/',"",$Aextension[$i]);
$extension = sprintf("%-48s", $extension);
while(mb_strlen($extension, 'utf-8')>12) {$extension = mb_substr("$extension", 0, -1,'utf8');}
while(mb_strlen($extension, 'utf-8')>14) {$extension = mb_substr("$extension", 0, -1,'utf8');}
}
$phone = sprintf("%-10s", $phone_split[0]);
$custphone = sprintf("%-10s", $custphone);
$phone = sprintf("%-12s", $phone_split[0]);
$custphone = sprintf("%-11s", $custphone);
$Luser = $Auser[$i];
$user = sprintf("%-18s", $Auser[$i]);
$user = sprintf("%-20s", $Auser[$i]);
$Lsessionid = $Asessionid[$i];
$sessionid = sprintf("%-9s", $Asessionid[$i]);
$Lstatus = $Astatus[$i];
@@ -1637,12 +1811,12 @@ $calls_to_list = mysql_num_rows($rslt);
if ($UGdisplay > 0)
{
if ($non_latin < 1)
if ($non_latin < 1)
{
$user_group = sprintf("%-12s", $Auser_group[$i]);
while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);}
}
else
else
{
$user_group = sprintf("%-40s", $Auser_group[$i]);
while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');}
@@ -1650,15 +1824,15 @@ $calls_to_list = mysql_num_rows($rslt);
}
if ($UidORname > 0)
{
if ($non_latin < 1)
if ($non_latin < 1)
{
$user = sprintf("%-18s", $Afull_name[$i]);
while(strlen($user)>18) {$user = substr("$user", 0, -1);}
$user = sprintf("%-20s", $Afull_name[$i]);
while(strlen($user)>20) {$user = substr("$user", 0, -1);}
}
else
else
{
$user = sprintf("%-40s", $Afull_name[$i]);
while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');}
$user = sprintf("%-60s", $Afull_name[$i]);
while(mb_strlen($user, 'utf-8')>20) {$user = mb_substr("$user", 0, -1,'utf8');}
}
}
if (!eregi("INCALL|QUEUE|PARK",$Astatus[$i]))
@@ -1757,7 +1931,7 @@ $calls_to_list = mysql_num_rows($rslt);
else {$SVD = "";}
if ($PHONEdisplay > 0) {$phoneD = "$G$phone$EG | ";}
else {$phoneD = "";}
else {$phoneD = " ";}
$vac_stage='';
$vac_campaign='';
@@ -1781,7 +1955,7 @@ $calls_to_list = mysql_num_rows($rslt);
$agentcount++;
$Aecho .= "| $G$extension$EG |$phoneD <a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
$Aecho .= "| $G$extension$EG |$phoneD<a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> <a href=\"javascript:ingroup_info('$Luser','$j');\">+</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
$j++;
}
+441 -131
View File
@@ -28,10 +28,11 @@
# 90904-1535 - Added moh_list musiconhold list
# 90916-2342 - Added vm_list voicemail list
# 91026-1059 - Added AREACODE DNC option
# 91203-1140 - Added agent_ingroup_info feature
#
$version = '2.2.0-14';
$build = '91026-1059';
$version = '2.2.0-15';
$build = '91203-1140';
require("dbconnect.php");
@@ -122,6 +123,8 @@ if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
if (isset($_GET["agent_user"])) {$agent_user=$_GET["agent_user"];}
elseif (isset($_POST["agent_user"])) {$agent_user=$_POST["agent_user"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -133,12 +136,10 @@ $stmt = "SELECT use_non_latin FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
$i=0;
while ($i < $qm_conf_ct)
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$i++;
$non_latin = $row[0];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -285,6 +286,9 @@ if ($function == 'version')
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
################################################################################
### END version
################################################################################
@@ -449,6 +453,9 @@ if ($function == 'sounds_list')
}
}
}
################################################################################
### END sounds_list
################################################################################
@@ -590,6 +597,9 @@ if ($function == 'moh_list')
}
}
}
################################################################################
### END moh_list
################################################################################
@@ -706,6 +716,300 @@ if ($function == 'vm_list')
exit;
}
}
################################################################################
### END vm_list
################################################################################
################################################################################
### agent_ingroup_info - displays agent in-group info in an HTML form allowing for changes
################################################################################
if ($function == 'agent_ingroup_info')
{
if(strlen($source)<2)
{
$result = 'ERROR';
$result_reason = "Invalid Source";
echo "$result: $result_reason - $source\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
echo "ERROR: Invalid Source: |$source|\n";
exit;
}
else
{
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and user_level > 6;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$allowed_user=$row[0];
if ( ($allowed_user < 1) and ($source != 'queuemetrics') )
{
$result = 'ERROR';
$result_reason = "agent_ingroup_info USER DOES NOT HAVE PERMISSION TO GET AGENT INFO";
echo "$result: $result_reason: |$user|$allowed_user|\n";
$data = "$allowed_user";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT count(*) from vicidial_live_agents where user='$agent_user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$session_exists=$row[0];
if ($session_exists < 1)
{
$result = 'ERROR';
$result_reason = "agent_ingroup_info INVALID USER ID";
echo "$result: $result_reason - $agent_user|$user\n";
$data = "$session_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT campaign_id,closer_campaigns,outbound_autodial,manager_ingroup_set,external_igb_set_user from vicidial_live_agents where user='$agent_user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$campaign_id = $row[0];
$closer_campaigns = $row[1];
$blended = $row[2];
$manager_ingroup_set = $row[3];
$external_igb_set_user = $row[4];
$stmt="SELECT full_name from vicidial_users where user='$agent_user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$full_name = $row[0];
$stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign_id' and campaign_allow_inbound='Y' and dial_method NOT IN('MANUAL');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$allowed_campaign_inbound=$row[0];
$stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_method NOT IN('MANUAL','INBOUND_MAN');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$allowed_campaign_autodial=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and change_agent_campaign='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$allowed_user_change_ingroups=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and modify_users='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$allowed_user_modify_user=$row[0];
$result = 'SUCCESS';
$result_reason = "";
$data = "$agent_user|$stage";
if ($stage == 'text')
{
$output .= "SELECTED INGROUPS: $closer_campaigns\n";
$output .= "OUTBOUND AUTODIAL: $blended\n";
$output .= "MANAGER OVERRIDE: $manager_ingroup_set\n";
$output .= "MANAGER: $external_igb_set_user\n";
echo "$result: $result_reason - $data\n$output\n";
}
else
{
$output = '';
$output .= "<TABLE WIDTH=680 CELLPADDING=0 CELLSPACING=5 BGCOLOR=\"#D9E6FE\"><TR><TD ALIGN=LEFT>\n";
$output .= "Agent: $agent_user - $full_name </TD><TD>\n";
$output .= " &nbsp; Campaign: $campaign_id</TD><TD>\n";
$output .= "<a href=\"#\" onclick=\"hide_ingroup_info();\">Close</a></TD></TR><TR><TD COLSPAN=3 BGCOLOR=\"#CCCCFF\">\n";
$stmt="SELECT closer_campaigns from vicidial_campaigns where campaign_id='$campaign_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($allowed_campaign_inbound < 1)
{$row[0]='';}
$closer_groups_pre = preg_replace('/-$/','',$row[0]);
$closer_groups = explode(" ",$closer_groups_pre);
$closer_groups_ct = count($closer_groups);
$in_groups_pre = preg_replace('/-$/','',$closer_campaigns);
$in_groups = explode(" ",$in_groups_pre);
$in_groups_ct = count($in_groups);
$k=1;
while ($k < $closer_groups_ct)
{
$closer_select[$k]=0;
if (strlen($closer_groups[$k])>1)
{
$m=0;
while ($m < $in_groups_ct)
{
if (strlen($in_groups[$m])>1)
{
if ($closer_groups[$k] == $in_groups[$m])
{$closer_select[$k]++;}
}
$m++;
}
}
$k++;
}
if ( ($allowed_user_change_ingroups > 0) and ($stage == 'change') )
{
$output .= "<TABLE CELLPADDING=0 CELLSPACING=3 BORDER=0>\n";
$output .= "<TR><TD ALIGN=RIGHT VALIGN=TOP>Selected In-Groups: </TD><TD ALIGN=LEFT>\n";
$output .= "<INPUT TYPE=HIDDEN NAME=agent_user ID=agent_user value=\"$agent_user\">\n";
$output .= "<SELECT SIZE=10 NAME=ingroup_new_selections ID=ingroup_new_selections multiple>\n";
$m=0;
$m_printed=0;
while ($m < $closer_groups_ct)
{
if (strlen($closer_groups[$m])>1)
{
$stmt="SELECT group_name from vicidial_inbound_groups where group_id='$closer_groups[$m]';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$output .= "<option value=\"$closer_groups[$m]\"";
if ($closer_select[$m] > 0)
{$output .= " SELECTED";}
$output .= ">$closer_groups[$m] - $row[0]</option>\n";
$m_printed++;
}
$m++;
}
if ($m_printed < 1)
{$output .= "<option value=\"\">No In-Groups Allowed</option>\n";}
$output .= "</SELECT><BR></TD></TR>\n";
$output .= "<TR><TD ALIGN=RIGHT>Change, Add, Remove:\n";
$output .= "</TD><TD ALIGN=LEFT>\n";
$output .= "<SELECT SIZE=1 NAME=ingroup_add_remove_change ID=ingroup_add_remove_change>\n";
$output .= "<option value=\"CHANGE\">CHANGE - Set in-groups to those selected above</option>\n";
$output .= "<option value=\"ADD\">ADD - Add in-groups selected above to agent selected</option>\n";
$output .= "<option value=\"REMOVE\">REMOVE - Remove in-groups selected above from agent selected</option>\n";
$output .= "</SELECT>\n";
$output .= "</TD></TR>\n";
$output .= "<TR><TD ALIGN=RIGHT>Blended Outbound Autodial:\n";
$output .= "</TD><TD ALIGN=LEFT>\n";
$output .= "<SELECT SIZE=1 NAME=blended ID=blended";
if ($allowed_campaign_autodial < 1)
{
$output .= " DISABLED";
$blended = 'N';
}
$output .= ">\n";
$output .= "<option value=\"YES\"";
if ($blended == 'Y')
{$output .= " SELECTED";}
$output .= ">Yes</option>\n";
$output .= "<option value=\"NO\"";
if ($blended == 'N')
{$output .= " SELECTED";}
$output .= ">No</option>\n";
$output .= "</SELECT>\n";
$output .= "</TD></TR>\n";
$output .= "<TR><TD ALIGN=RIGHT>Set As User Default:\n";
$output .= "</TD><TD ALIGN=LEFT>\n";
$output .= "<SELECT SIZE=1 NAME=set_as_default ID=set_as_default";
if ($allowed_user_modify_user < 1)
{$output .= " DISABLED";}
$output .= ">\n";
$output .= "<option value=\"YES\">Yes</option>\n";
$output .= "<option value=\"NO\" SELECTED>No</option>\n";
$output .= "</SELECT>\n";
$output .= "</TD></TR>\n";
if ( ($manager_ingroup_set == 'SET') or ($manager_ingroup_set == 'Y') )
{
$stmt="SELECT full_name from vicidial_users where user='$external_igb_set_user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$Mfull_name = $row[0];
$output .= "<TR><TD ALIGN=RIGHT>Manager In-Group Override:\n";
$output .= "</TD><TD ALIGN=LEFT>\n";
$output .= "$manager_ingroup_set - $external_igb_set_user - $Mfull_name\n";
$output .= "</TD></TR>\n";
}
$output .= "<TR><TD ALIGN=CENTER COLSPAN=2>\n";
$output .= "<INPUT TYPE=BUTTON NAME=SUBMIT ID=SUBMIT VALUE=\"Submit Changes\" onclick=\"submit_ingroup_changes('$agent_user')\">\n";
$output .= "</TD></TR>\n";
$output .= "</TABLE>\n";
$output .= "</TD></TR></TABLE>\n";
}
else
{
$output .= "<TABLE CELLPADDING=0 CELLSPACING=3 BORDER=0>\n";
$m=0;
$m_printed=0;
while ($m < $closer_groups_ct)
{
if (strlen($closer_groups[$m])>1)
{
$stmt="SELECT group_name from vicidial_inbound_groups where group_id='$closer_groups[$m]';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$output .= "<TR><TD>$closer_groups[$m]";
if ($closer_select[$m] > 0)
{$output .= " *";}
$output .= "</TD><TD>$row[0]</TD></TR>\n";
$m_printed++;
}
$m++;
}
if ($m_printed < 1)
{$output .= "<TR><TD>No In-Groups Allowed</TD></TR>\n";}
$output .= "</TABLE><BR>\n";
$output .= "SELECTED INGROUPS: $closer_campaigns<BR>\n";
$output .= "OUTBOUND AUTODIAL: $blended<BR>\n";
$output .= "MANAGER OVERRIDE: $manager_ingroup_set<BR>\n";
$output .= "MANAGER: $external_igb_set_user<BR>\n";
$output .= "\n";
$output .= "</TD></TR></TABLE>\n";
}
echo "$output";
}
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
exit;
}
################################################################################
### END agent_ingroup_info
################################################################################
@@ -840,6 +1144,9 @@ if ($function == 'blind_monitor')
}
exit;
}
################################################################################
### END blind_monitor
################################################################################
@@ -1063,6 +1370,9 @@ if ($function == 'add_lead')
exit;
}
}
################################################################################
### END add_lead
################################################################################
@@ -1080,13 +1390,13 @@ api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$resul
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
@@ -1724,134 +2034,134 @@ return $gmt_offset;
##### DETERMINE IF LEAD IS DIALABLE #####
function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state)
{
$dialable=0;
{
$dialable=0;
$pzone=3600 * $gmt_offset;
$pmin=(gmdate("i", time() + $pzone));
$phour=( (gmdate("G", time() + $pzone)) * 100);
$pday=gmdate("w", time() + $pzone);
$tz = sprintf("%.2f", $p);
$GMT_gmt = "$tz";
$GMT_day = "$pday";
$GMT_hour = ($phour + $pmin);
$pzone=3600 * $gmt_offset;
$pmin=(gmdate("i", time() + $pzone));
$phour=( (gmdate("G", time() + $pzone)) * 100);
$pday=gmdate("w", time() + $pzone);
$tz = sprintf("%.2f", $p);
$GMT_gmt = "$tz";
$GMT_day = "$pday";
$GMT_hour = ($phour + $pmin);
$stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$rowx=mysql_fetch_row($rslt);
$Gct_default_start = "$rowx[3]";
$Gct_default_stop = "$rowx[4]";
$Gct_sunday_start = "$rowx[5]";
$Gct_sunday_stop = "$rowx[6]";
$Gct_monday_start = "$rowx[7]";
$Gct_monday_stop = "$rowx[8]";
$Gct_tuesday_start = "$rowx[9]";
$Gct_tuesday_stop = "$rowx[10]";
$Gct_wednesday_start = "$rowx[11]";
$Gct_wednesday_stop = "$rowx[12]";
$Gct_thursday_start = "$rowx[13]";
$Gct_thursday_stop = "$rowx[14]";
$Gct_friday_start = "$rowx[15]";
$Gct_friday_stop = "$rowx[16]";
$Gct_saturday_start = "$rowx[17]";
$Gct_saturday_stop = "$rowx[18]";
$Gct_state_call_times = "$rowx[19]";
$stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$rowx=mysql_fetch_row($rslt);
$Gct_default_start = "$rowx[3]";
$Gct_default_stop = "$rowx[4]";
$Gct_sunday_start = "$rowx[5]";
$Gct_sunday_stop = "$rowx[6]";
$Gct_monday_start = "$rowx[7]";
$Gct_monday_stop = "$rowx[8]";
$Gct_tuesday_start = "$rowx[9]";
$Gct_tuesday_stop = "$rowx[10]";
$Gct_wednesday_start = "$rowx[11]";
$Gct_wednesday_stop = "$rowx[12]";
$Gct_thursday_start = "$rowx[13]";
$Gct_thursday_stop = "$rowx[14]";
$Gct_friday_start = "$rowx[15]";
$Gct_friday_stop = "$rowx[16]";
$Gct_saturday_start = "$rowx[17]";
$Gct_saturday_stop = "$rowx[18]";
$Gct_state_call_times = "$rowx[19]";
if ($GMT_day==0) #### Sunday local time
{
if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0))
if ($GMT_day==0) #### Sunday local time
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) )
{$dialable=1;}
}
}
else
if ($GMT_day==1) #### Monday local time
{
if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) )
{$dialable=1;}
if (($Gct_monday_start==0) and ($Gct_monday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) )
{$dialable=1;}
}
}
}
if ($GMT_day==1) #### Monday local time
{
if (($Gct_monday_start==0) and ($Gct_monday_stop==0))
if ($GMT_day==2) #### Tuesday local time
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) )
{$dialable=1;}
}
}
else
if ($GMT_day==3) #### Wednesday local time
{
if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) )
{$dialable=1;}
if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) )
{$dialable=1;}
}
}
}
if ($GMT_day==2) #### Tuesday local time
{
if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0))
if ($GMT_day==4) #### Thursday local time
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) )
{$dialable=1;}
}
}
else
if ($GMT_day==5) #### Friday local time
{
if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) )
{$dialable=1;}
if (($Gct_friday_start==0) and ($Gct_friday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) )
{$dialable=1;}
}
}
}
if ($GMT_day==3) #### Wednesday local time
{
if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0))
if ($GMT_day==6) #### Saturday local time
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) )
{$dialable=1;}
}
}
else
{
if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) )
{$dialable=1;}
}
}
if ($GMT_day==4) #### Thursday local time
{
if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) )
{$dialable=1;}
}
}
if ($GMT_day==5) #### Friday local time
{
if (($Gct_friday_start==0) and ($Gct_friday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) )
{$dialable=1;}
}
}
if ($GMT_day==6) #### Saturday local time
{
if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0))
{
if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) )
{$dialable=1;}
}
else
{
if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) )
{$dialable=1;}
}
}
return $dialable;
}
return $dialable;
}
/*
$ct_states = '';
@@ -2011,15 +2321,15 @@ return $dialable;
##### Logging #####
function api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data)
{
if ($api_logging > 0)
{
$NOW_TIME = date("Y-m-d H:i:s");
# api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
$stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$agent_user',function='$function',value='$value',result='$result',result_reason='$result_reason',source='$source',data='$data',api_date='$NOW_TIME',api_script='$api_script';";
$rslt=mysql_query($stmt, $link);
if ($api_logging > 0)
{
$NOW_TIME = date("Y-m-d H:i:s");
# api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
$stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$agent_user',function='$function',value='$value',result='$result',result_reason='$result_reason',source='$source',data='$data',api_date='$NOW_TIME',api_script='$api_script';";
$rslt=mysql_query($stmt, $link);
}
return 1;
}
return 1;
}
?>