Added API function to allow for the changing of agent selected in-groups while logged-in to the agent screen.

git-svn-id: svn://192.168.202.10@1269 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-12-01 06:39:15 +00:00
parent 86202b04cf
commit 31eedf49ce
11 changed files with 729 additions and 324 deletions
+6
View File
@@ -300,6 +300,12 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
database table field order less important, allowing for more
customizations by the user without causing problems.
73. Added an API function(change_ingroups) which allows the selected in-groups
for an agent to be changed while they are active in the ViciDial Agent
screen. Once changed in this way, the agent would need to log out and
back in to be able to select in-groups themselves. Blended can also be
changed using this function. For more information see the AGENT_API.txt
document in the docs directory.
+33 -2
View File
@@ -15,7 +15,7 @@ external_hangup - sends command to hangup the current phone call for one specifi
external_status - sends command to set the disposition for one specific agent and move on to next call
external_pause - sends command to pause/resume an agent now if not on a call, or pause after their next call if on call
external_dial - sends command to manually dial a number on the agent's screen
change_ingroups - changes the selected in-groups for a logged-in agent
New scripts:
@@ -146,8 +146,8 @@ vtiger_callback -
RESPONSES:
ERROR: external_dial not valid - 7275551212|1|YES|6666
ERROR: agent_user is not allowed to place manual dial calls - 6666
ERROR: agent_user is not logged in - 6666
ERROR: agent_user is not allowed to place manual dial calls - 6666
ERROR: caller_id_number from group_alias is not valid - 6666|TESTING|123
ERROR: group_alias is not valid - 6666|TESTING
ERROR: vtiger callback activity does not exist in vtiger system - 12345
@@ -155,7 +155,38 @@ SUCCESS: external_dial function set - 7275551212|1|YES|1232020456|6666
change_ingroups -
DESCRIPTION:
This function will change the selected in-groups for an agent that is logged into a campaign that allows for inbound calls to be handled. Allows the selected in-groups for an agent to be changed while they are logged-in to the ViciDial Agent screen only. Once changed in this way, the agent would need to log out and back in to be able to select in-groups themselves(If Agent Choose In-Groups is enabled for that user). The blended checkbox can also be changed using this function. The API user performing this function must have vicidial_users.change_agent_campaign = 1.
VALUES:
value -
CHANGE - will change all in-groups to those defined in ingroup_choices
REMOVE - will only remove the listed in-groups
ADD - will only add the listed in-groups
blended -
YES - set the agent to take outbound auto-dialed calls (not applicable in MANUAL and INBOUND_MAN dial method campaigns)
NO - set the agent to only take inbound calls
ingroup_choices -
OPTIONAL, a space-delimited(use plusses + in the URL) list of in-groups to allow the agent to take calls from, example: " TEST_IN2 SALESLINE TRAINING_IN -"
set_as_default -
OPTIONAL, YES or NO - overwrites the settings for the agent in the user modification screen, default is NO
EXAMPLE URL:
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+-
RESPONSES:
ERROR: change_ingroups not valid - N| TEST_IN SALESLINE -
ERROR: agent_user is not logged in - 6666
ERROR: campaign does not allow inbound calls - 6666
ERROR: user is not allowed to change agent in-groups - 6666|TESTING|123
ERROR: campaign dial_method does not allow outbound autodial - 6666|TESTING
ERROR: ingroup does not exist - FAKE_IN| TEST_IN FAKE_IN SALESLINE -
ERROR: ingroup_choices are required for ADD and REMOVE values - ADD|
SUCCESS: change_ingroups function set - YES| TEST_IN SALESLINE -|6666
@@ -351,11 +351,14 @@ external_hangup VARCHAR(1) default '',
external_status VARCHAR(6) default '',
external_pause VARCHAR(20) default '',
external_dial VARCHAR(100) default '',
external_ingroups TEXT,
external_blended ENUM('0','1') default '0',
external_igb_set_user VARCHAR(20) default '',
agent_log_id INT(9) UNSIGNED default '0',
last_state_change DATETIME,
agent_territories TEXT,
outbound_autodial ENUM('Y','N') default 'N',
manager_ingroup_set ENUM('Y','N') default 'N',
manager_ingroup_set ENUM('Y','N','SET') default 'N',
index (random_id),
index (last_call_time),
index (last_update_time),
@@ -1276,6 +1279,7 @@ campaign_id VARCHAR(20),
event_date DATETIME,
blended ENUM('1','0') default '0',
closer_campaigns TEXT,
manager_change VARCHAR(20) default '',
index (user),
index (event_date)
);
@@ -1957,7 +1961,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number);
CREATE INDEX date_user on vicidial_closer_log (call_date,user);
CREATE INDEX comment_a on live_inbound_log (comment_a);
UPDATE system_settings SET db_schema_version='1182',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1183',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+9
View File
@@ -617,3 +617,12 @@ UPDATE system_settings SET db_schema_version='1181',db_schema_update_date=NOW();
ALTER TABLE servers ADD conf_secret VARCHAR(20) default 'test';
UPDATE system_settings SET db_schema_version='1182',db_schema_update_date=NOW();
ALTER TABLE vicidial_live_agents MODIFY manager_ingroup_set ENUM('Y','N','SET') default 'N';
ALTER TABLE vicidial_live_agents ADD external_ingroups TEXT AFTER external_dial;
ALTER TABLE vicidial_live_agents ADD external_blended ENUM('0','1') default '0' AFTER external_ingroups;
ALTER TABLE vicidial_live_agents ADD external_igb_set_user VARCHAR(20) default '' AFTER external_blended;
ALTER TABLE vicidial_user_closer_log ADD manager_change VARCHAR(20) default '';
UPDATE system_settings SET db_schema_version='1183',db_schema_update_date=NOW();
@@ -364,6 +364,8 @@ Calls In Queue||
Hide Calls In Queue||
Calls in Queue View Disabled for this campaign||
YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE||
Manager ||
has selected your in-group choices||
add-file: vdc_script_display.php
+530 -279
View File
@@ -10,7 +10,7 @@
# - $user
# - $pass
# - $agent_user
# - $function - ('external_hangup','external_status','external_pause')
# - $function - ('external_hangup','external_status','external_pause','external_dial','change_ingroups')
# - $value
# - $vendor_id
# - $focus
@@ -23,6 +23,9 @@
# - $source - ('vtiger','webform','adminweb')
# - $format - ('text','debug')
# - $vtiger_callback - ('YES','NO')
# - $blended - ('YES','NO')
# - $ingroup_choices - (' TEST_IN SALESLINE -')
# - $set_as_default - ('YES','NO')
# CHANGELOG:
# 80703-2225 - First build of script
@@ -33,10 +36,11 @@
# 90407-1920 - Added vtiger_callback option for external_dial function
# 90508-0727 - Changed to PHP long tags
# 90522-0506 - Security fix
# 91130-1307 - Added change_ingroups(Manager InGroup change feature)
#
$version = '2.2.0-8';
$build = '90522-0506';
$version = '2.2.0-9';
$build = '91130-1307';
require("dbconnect.php");
@@ -73,6 +77,12 @@ if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["vtiger_callback"])) {$vtiger_callback=$_GET["vtiger_callback"];}
elseif (isset($_POST["vtiger_callback"])) {$vtiger_callback=$_POST["vtiger_callback"];}
if (isset($_GET["blended"])) {$blended=$_GET["blended"];}
elseif (isset($_POST["blended"])) {$blended=$_POST["blended"];}
if (isset($_GET["ingroup_choices"])) {$ingroup_choices=$_GET["ingroup_choices"];}
elseif (isset($_POST["ingroup_choices"])) {$ingroup_choices=$_POST["ingroup_choices"];}
if (isset($_GET["set_as_default"])) {$set_as_default=$_GET["set_as_default"];}
elseif (isset($_POST["set_as_default"])) {$set_as_default=$_POST["set_as_default"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -84,16 +94,16 @@ $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++;
}
##### END SETTINGS LOOKUP #####
###########################################
$ingroup_choices = ereg_replace("\+"," ",$ingroup_choices);
if ($non_latin < 1)
{
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
@@ -113,6 +123,9 @@ if ($non_latin < 1)
$source = ereg_replace("[^0-9a-zA-Z]","",$source);
$format = ereg_replace("[^0-9a-zA-Z]","",$format);
$vtiger_callback = ereg_replace("[^A-Z]","",$vtiger_callback);
$blended = ereg_replace("[^A-Z]","",$blended);
$ingroup_choices = ereg_replace("[^ -\_0-9a-zA-Z]","",$ingroup_choices);
$set_as_default = ereg_replace("[^A-Z]","",$set_as_default);
}
else
{
@@ -196,7 +209,7 @@ else
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
if($SNauth==0)
{
$result = 'ERROR';
$result_reason = "System API NOT ACTIVE";
@@ -204,7 +217,7 @@ else
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
else
{
# do nothing for now
}
@@ -213,15 +226,15 @@ else
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build USER: $user\n";
echo "<title>VICIDiaL Agent API";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build USER: $user\n";
echo "<title>VICIDiaL Agent API";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
################################################################################
### END - user validation section
################################################################################
@@ -234,40 +247,40 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
### BEGIN - external_hangup - hang up the active agent call
################################################################################
if ($function == 'external_hangup')
{
{
if ( (strlen($value)<1) || (strlen($agent_user)<1) )
{
$result = 'ERROR';
$result_reason = "external_hangup not valid";
echo "$result: $result_reason - $value|$agent_user\n";
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);
if ($row[0] > 0)
{
$stmt="UPDATE vicidial_live_agents set external_hangup='$value' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_hangup function set";
echo "$result: $result_reason - $value|$agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
$result_reason = "external_hangup not valid";
echo "$result: $result_reason - $value|$agent_user\n";
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);
if ($row[0] > 0)
{
$stmt="UPDATE vicidial_live_agents set external_hangup='$value' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_hangup function set";
echo "$result: $result_reason - $value|$agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
}
################################################################################
### END - external_hangup
################################################################################
@@ -280,40 +293,40 @@ if ($function == 'external_hangup')
### BEGIN - external_status - set the dispo code or status for a call and move on
################################################################################
if ($function == 'external_status')
{
{
if ( (strlen($value)<1) || (strlen($agent_user)<1) )
{
$result = 'ERROR';
$result_reason = "external_status not valid";
echo "$result: $result_reason - $value|$agent_user\n";
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);
if ($row[0] > 0)
{
$stmt="UPDATE vicidial_live_agents set external_status='$value' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_status function set";
echo "$result: $result_reason - $value|$agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
$result_reason = "external_status not valid";
echo "$result: $result_reason - $value|$agent_user\n";
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);
if ($row[0] > 0)
{
$stmt="UPDATE vicidial_live_agents set external_status='$value' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_status function set";
echo "$result: $result_reason - $value|$agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
}
################################################################################
### END - external_status
################################################################################
@@ -326,56 +339,56 @@ if ($function == 'external_status')
### BEGIN - external_pause - pause or resume the agent
################################################################################
if ($function == 'external_pause')
{
{
if ( (strlen($value)<1) || (strlen($agent_user)<1) || (!ereg("PAUSE|RESUME",$value)) )
{
$result = 'ERROR';
$result_reason = "external_pause not valid";
echo "$result: $result_reason - $value|$agent_user\n";
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);
if ($row[0] > 0)
{
if (ereg("RESUME",$value))
{
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status IN('READY','QUEUE','INCALL','CLOSER');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$result = 'ERROR';
$result_reason = "external_pause agent is not paused";
echo "$result: $result_reason - $value|$agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
$stmt="UPDATE vicidial_live_agents set external_pause='$value!$epoch' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_pause function set";
echo "$result: $result_reason - $value|$epoch|$agent_user\n";
$data = "$epoch";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
$result_reason = "external_pause not valid";
echo "$result: $result_reason - $value|$agent_user\n";
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);
if ($row[0] > 0)
{
if (ereg("RESUME",$value))
{
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status IN('READY','QUEUE','INCALL','CLOSER');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$result = 'ERROR';
$result_reason = "external_pause agent is not paused";
echo "$result: $result_reason - $value|$agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
$stmt="UPDATE vicidial_live_agents set external_pause='$value!$epoch' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_pause function set";
echo "$result: $result_reason - $value|$epoch|$agent_user\n";
$data = "$epoch";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
}
################################################################################
### END - external_pause
################################################################################
@@ -388,179 +401,187 @@ if ($function == 'external_pause')
### BEGIN - external_dial - place a manual dial phone call
################################################################################
if ($function == 'external_dial')
{
{
$value = ereg_replace("[^0-9]","",$value);
if ( (strlen($value)<2) || (strlen($agent_user)<2) || (strlen($search)<2) || (strlen($preview)<2) || (strlen($focus)<2) )
{
$result = 'ERROR';
$result_reason = "external_dial not valid";
$data = "$phone_code|$search|$preview|$focus";
echo "$result: $result_reason - $value|$data|$agent_user\n";
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);
if ($row[0] > 0)
{
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status='PAUSED' and lead_id < 1;";
$result = 'ERROR';
$result_reason = "external_dial not valid";
$data = "$phone_code|$search|$preview|$focus";
echo "$result: $result_reason - $value|$data|$agent_user\n";
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);
if ($row[0] > 0)
{
$stmt = "select count(*) from vicidial_users where user='$agent_user' and agentcall_manual='1';";
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status='PAUSED' and lead_id < 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
if (strlen($group_alias)>1)
$stmt = "select count(*) from vicidial_users where user='$agent_user' and agentcall_manual='1';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "select caller_id_number from groups_alias where group_alias_id='$group_alias';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$VDIG_cidnum_ct = mysql_num_rows($rslt);
if ($VDIG_cidnum_ct > 0)
if (strlen($group_alias)>1)
{
$row=mysql_fetch_row($rslt);
$caller_id_number = $row[0];
if ($caller_id_number < 4)
{
$result = 'ERROR';
$result_reason = "caller_id_number from group_alias is not valid";
$data = "$group_alias|$caller_id_number";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
else
{
$result = 'ERROR';
$result_reason = "group_alias is not valid";
$data = "$group_alias";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
####### Begin Vtiger CallBack Launching #######
$vtiger_callback_id='';
if ( (eregi("YES",$vtiger_callback)) and (preg_match("/^99/",$value)) )
{
$value = preg_replace("/^99/",'',$value);
$value = ($value + 0);
$stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;";
$rslt=mysql_query($stmt, $link);
$ss_conf_ct = mysql_num_rows($rslt);
if ($ss_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$enable_vtiger_integration = $row[0];
$vtiger_server_ip = $row[1];
$vtiger_dbname = $row[2];
$vtiger_login = $row[3];
$vtiger_pass = $row[4];
$vtiger_url = $row[5];
}
if ($enable_vtiger_integration > 0)
{
$stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';";
$rslt=mysql_query($stmt, $link);
$vtc_camp_ct = mysql_num_rows($rslt);
if ($vtc_camp_ct > 0)
{
$row=mysql_fetch_row($rslt);
$campaign_id = $row[0];
}
$stmt = "SELECT vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_search_dead,vtiger_status_call FROM vicidial_campaigns where campaign_id='$campaign_id';";
$rslt=mysql_query($stmt, $link);
$vtc_conf_ct = mysql_num_rows($rslt);
if ($vtc_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$vtiger_search_category = $row[0];
$vtiger_create_call_record = $row[1];
$vtiger_create_lead_record = $row[2];
$vtiger_search_dead = $row[3];
$vtiger_status_call = $row[4];
}
### connect to your vtiger database
$linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass");
if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());}
mysql_select_db("$vtiger_dbname", $linkV);
# make sure the ID is present in Vtiger database as an account
$stmt="SELECT count(*) from vtiger_seactivityrel where activityid='$value';";
$stmt = "select caller_id_number from groups_alias where group_alias_id='$group_alias';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
$vt_act_ct = mysql_num_rows($rslt);
if ($vt_act_ct > 0)
$rslt=mysql_query($stmt, $link);
$VDIG_cidnum_ct = mysql_num_rows($rslt);
if ($VDIG_cidnum_ct > 0)
{
$row=mysql_fetch_row($rslt);
$activity_check = $row[0];
}
if ($activity_check > 0)
{
$stmt="SELECT crmid from vtiger_seactivityrel where activityid='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
$vt_actsel_ct = mysql_num_rows($rslt);
if ($vt_actsel_ct > 0)
$caller_id_number = $row[0];
if ($caller_id_number < 4)
{
$row=mysql_fetch_row($rslt);
$vendor_id = $row[0];
}
if (strlen($vendor_id) > 0)
{
$stmt="SELECT phone from vtiger_account where accountid='$vendor_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
$vt_acct_ct = mysql_num_rows($rslt);
if ($vt_acct_ct > 0)
{
$row=mysql_fetch_row($rslt);
$vtiger_callback_id="$value";
$value = $row[0];
}
$result = 'ERROR';
$result_reason = "caller_id_number from group_alias is not valid";
$data = "$group_alias|$caller_id_number";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
else
{
$result = 'ERROR';
$result_reason = "vtiger callback activity does not exist in vtiger system";
echo "$result: $result_reason - $value\n";
$result_reason = "group_alias is not valid";
$data = "$group_alias";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
}
####### End Vtiger CallBack Launching #######
### If no errors, run the update to place the call ###
$stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id' 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|$dial_prefix|$group_alias|$caller_id_number";
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);
####### Begin Vtiger CallBack Launching #######
$vtiger_callback_id='';
if ( (eregi("YES",$vtiger_callback)) and (preg_match("/^99/",$value)) )
{
$value = preg_replace("/^99/",'',$value);
$value = ($value + 0);
$stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;";
$rslt=mysql_query($stmt, $link);
$ss_conf_ct = mysql_num_rows($rslt);
if ($ss_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$enable_vtiger_integration = $row[0];
$vtiger_server_ip = $row[1];
$vtiger_dbname = $row[2];
$vtiger_login = $row[3];
$vtiger_pass = $row[4];
$vtiger_url = $row[5];
}
if ($enable_vtiger_integration > 0)
{
$stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';";
$rslt=mysql_query($stmt, $link);
$vtc_camp_ct = mysql_num_rows($rslt);
if ($vtc_camp_ct > 0)
{
$row=mysql_fetch_row($rslt);
$campaign_id = $row[0];
}
$stmt = "SELECT vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_search_dead,vtiger_status_call FROM vicidial_campaigns where campaign_id='$campaign_id';";
$rslt=mysql_query($stmt, $link);
$vtc_conf_ct = mysql_num_rows($rslt);
if ($vtc_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$vtiger_search_category = $row[0];
$vtiger_create_call_record = $row[1];
$vtiger_create_lead_record = $row[2];
$vtiger_search_dead = $row[3];
$vtiger_status_call = $row[4];
}
### connect to your vtiger database
$linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass");
if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());}
mysql_select_db("$vtiger_dbname", $linkV);
# make sure the ID is present in Vtiger database as an account
$stmt="SELECT count(*) from vtiger_seactivityrel where activityid='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
$vt_act_ct = mysql_num_rows($rslt);
if ($vt_act_ct > 0)
{
$row=mysql_fetch_row($rslt);
$activity_check = $row[0];
}
if ($activity_check > 0)
{
$stmt="SELECT crmid from vtiger_seactivityrel where activityid='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
$vt_actsel_ct = mysql_num_rows($rslt);
if ($vt_actsel_ct > 0)
{
$row=mysql_fetch_row($rslt);
$vendor_id = $row[0];
}
if (strlen($vendor_id) > 0)
{
$stmt="SELECT phone from vtiger_account where accountid='$vendor_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
$vt_acct_ct = mysql_num_rows($rslt);
if ($vt_acct_ct > 0)
{
$row=mysql_fetch_row($rslt);
$vtiger_callback_id="$value";
$value = $row[0];
}
}
}
else
{
$result = 'ERROR';
$result_reason = "vtiger callback activity does not exist in vtiger system";
echo "$result: $result_reason - $value\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
}
####### End Vtiger CallBack Launching #######
### If no errors, run the update to place the call ###
$stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id' 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|$dial_prefix|$group_alias|$caller_id_number";
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);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not allowed to place manual dial calls";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not allowed to place manual dial calls";
$result_reason = "agent_user is not paused";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
@@ -568,20 +589,12 @@ if ($function == 'external_dial')
else
{
$result = 'ERROR';
$result_reason = "agent_user is not paused";
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
################################################################################
### END - external_dial
################################################################################
@@ -590,13 +603,251 @@ if ($function == 'external_dial')
################################################################################
### BEGIN - change_ingroups - change selected in-groups for logged-in agent
################################################################################
if ($function == 'change_ingroups')
{
$value = ereg_replace("[^A-Z]","",$value);
if ( (strlen($blended)<2) or (strlen($agent_user)<2) or (strlen($value)<3) )
{
$result = 'ERROR';
$result_reason = "change_ingroups not valid";
$data = "$value|$blended|$ingroup_choices";
echo "$result: $result_reason - $data|$agent_user\n";
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);
if ($row[0] > 0)
{
$stmt = "select count(*) from vicidial_live_agents vla, vicidial_campaigns vc where user='$agent_user' and campaign_allow_inbound='Y' and vla.campaign_id=vc.campaign_id;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "select count(*) from vicidial_users where user='$user' and change_agent_campaign='1';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
if ($blended == 'YES')
{
$stmt = "select count(*) from vicidial_live_agents vla, vicidial_campaigns vc where user='$agent_user' and dial_method IN('MANUAL','INBOUND_MAN') and vla.campaign_id=vc.campaign_id;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$result = 'ERROR';
$result_reason = "campaign dial_method does not allow outbound autodial";
$data = "$blended";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
if (strlen($ingroup_choices)>0)
{
$in_groups_pre = preg_replace('/-$/','',$ingroup_choices);
$in_groups = explode(" ",$in_groups_pre);
$in_groups_ct = count($in_groups);
$k=1;
while ($k < $in_groups_ct)
{
if (strlen($in_groups[$k])>1)
{
$stmt="SELECT count(*) FROM vicidial_inbound_groups where group_id='$in_groups[$k]';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
if ($row[0] < 1)
{
$result = 'ERROR';
$result_reason = "ingroup does not exist";
$data = "$in_groups[$k]|$ingroup_choices";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
$k++;
}
}
if ( (strlen($ingroup_choices) < 1) and ( ($value == 'ADD') or ($value == 'REMOVE') ) )
{
$result = 'ERROR';
$result_reason = "ingroup_choices are required for ADD and REMOVE values";
$data = "$value|$ingroup_choices";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
if ($value == 'ADD')
{
$stmt = "select closer_campaigns from vicidial_live_agents where user='$agent_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_groups_pre = preg_replace('/-$/','',$row[0]);
$closer_groups = explode(" ",$closer_groups_pre);
$closer_groups_ct = count($closer_groups);
$in_groups_pre = preg_replace('/-$/','',$ingroup_choices);
$in_groups = explode(" ",$in_groups_pre);
$in_groups_ct = count($in_groups);
$k=1;
while ($k < $in_groups_ct)
{
$duplicate_group=0;
if (strlen($in_groups[$k])>1)
{
$m=0;
while ($m < $closer_groups_ct)
{
if (strlen($closer_groups[$m])>1)
{
if ($closer_groups[$m] == $in_groups[$k])
{$duplicate_group++;}
}
$m++;
}
if ($duplicate_group < 1)
{
$closer_groups[$closer_groups_ct] = $in_groups[$k];
$closer_groups_ct++;
}
}
$k++;
}
$m=0;
$NEWcloser_groups=' ';
while ($m < $closer_groups_ct)
{
if (strlen($closer_groups[$m])>1)
{
$NEWcloser_groups .= "$closer_groups[$m] ";
}
$m++;
}
$NEWcloser_groups .= '-';
$ingroup_choices = $NEWcloser_groups;
}
if ($value == 'REMOVE')
{
$stmt = "select closer_campaigns from vicidial_live_agents where user='$agent_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_groups_list = $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('/-$/','',$ingroup_choices);
$in_groups = explode(" ",$in_groups_pre);
$in_groups_ct = count($in_groups);
$k=1;
while ($k < $in_groups_ct)
{
$duplicate_group=0;
if (strlen($in_groups[$k])>1)
{
$m=0;
while ($m < $closer_groups_ct)
{
if (strlen($closer_groups[$m])>1)
{
if ($closer_groups[$m] == $in_groups[$k])
{$duplicate_group++;}
}
$m++;
}
if ($duplicate_group > 0)
{
$closer_groups_list = preg_replace("/ $in_groups[$k] /",' ',$closer_groups_list);
}
}
$k++;
}
$ingroup_choices = $closer_groups_list;
}
### If no errors, run the update to change selected ingroups ###
$external_blended=0;
if ($blended == 'YES')
{$external_blended=1;}
$stmt="UPDATE vicidial_live_agents set external_ingroups='$ingroup_choices',external_blended='$external_blended',external_igb_set_user='$user',manager_ingroup_set='SET' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$default_data = "";
if ($set_as_default == 'YES')
{
$stmt="UPDATE vicidial_users set closer_campaigns='$ingroup_choices',closer_default_blended='$external_blended' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$default_data = "User settings set as default";
}
$result = 'SUCCESS';
$result_reason = "change_ingroups function set";
$data = "$ingroup_choices|$blended|$default_data";
echo "$result: $result_reason - $user|$agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "user is not allowed to change agent in-groups";
echo "$result: $result_reason - $user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "campaign does not allow inbound calls";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
################################################################################
### END - change_ingroups
################################################################################
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;
@@ -609,15 +860,15 @@ exit;
##### 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;
}
?>
+72 -4
View File
@@ -47,10 +47,11 @@
# 90508-0727 - Changed to PHP long tags
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
# 90908-1037 - Added DEAD call logging
# 91130-2022 - Added code for manager override of in-group selection
#
$version = '2.2.0-22';
$build = '90908-1037';
$version = '2.2.0-23';
$build = '91130-2022';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=17;
$one_mysql_log=0;
@@ -210,7 +211,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
if ($Acount > 0)
{
$stmt="SELECT status,callerid,agent_log_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -218,6 +219,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
$Astatus = $row[0];
$Acallerid = $row[1];
$Aagent_log_id = $row[2];
$Acampaign_id = $row[3];
}
# ### find out if external table shows agent should be disabled
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
@@ -371,6 +373,72 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
$time_diff = ($server_epoch - $db_epoch);
$web_diff = ($db_epoch - $web_epoch);
##### check for in-group change details
$InGroupChangeDetails = '0|||';
$manager_ingroup_set=0;
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$mis_record_ct = mysql_num_rows($rslt);
if ($mis_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$manager_ingroup_set = $row[0];
}
if ($manager_ingroup_set > 0)
{
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$VLAMISaffected_rows_update = mysql_affected_rows($link);
if ($VLAMISaffected_rows_update > 0)
{
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$migs_record_ct = mysql_num_rows($rslt);
if ($migs_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$external_ingroups = $row[0];
$external_blended = $row[1];
$external_igb_set_user = $row[2];
$outbound_autodial = $row[3];
$dial_method = $row[4];
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$mign_record_ct = mysql_num_rows($rslt);
if ($mign_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$external_igb_set_name = $row[0];
}
$NEWoutbound_autodial='N';
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
{$NEWoutbound_autodial='Y';}
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
}
##### grab the shift information the agent
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
@@ -460,7 +528,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
if ($Ashift_logout > 0)
{$Alogin='SHIFT_LOGOUT';}
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . "\n";
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . "\n";
}
$total_conf=0;
+11 -12
View File
@@ -4930,7 +4930,6 @@ if ($ACTION == 'updateDISPO')
mysql_close($linkB);
}
echo 'Lead ' . $lead_id . ' has been changed to ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n";
}
@@ -5075,16 +5074,16 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') )
$stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00166',$user,$server_ip,$session_name,$one_mysql_log);}
$retry_count=0;
while ( ($errno > 0) and ($retry_count < 9) )
{
$rslt=mysql_query($stmt, $link);
$one_mysql_log=1;
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9166$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
$one_mysql_log=0;
$retry_count++;
}
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00166',$user,$server_ip,$session_name,$one_mysql_log);}
$retry_count=0;
while ( ($errno > 0) and ($retry_count < 9) )
{
$rslt=mysql_query($stmt, $link);
$one_mysql_log=1;
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9166$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
$one_mysql_log=0;
$retry_count++;
}
$affected_rows = mysql_affected_rows($link);
}
if ( ($affected_rows > 0) or ($comments == 'NO_STATUS_CHANGE') )
@@ -5228,7 +5227,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') )
$VLAaffected_rows_update = mysql_affected_rows($link);
}
}
echo 'Agent ' . $user . ' is now in status ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n";
echo 'Agent ' . $user . ' is now in status ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n";
}
+38 -10
View File
@@ -260,10 +260,11 @@
# 91108-2118 - Added QM pause code entry
# 91111-1433 - Fixed Gender pulldown list display for IE, remove links for recording channels in SHOW CHANNELS
# 91123-1801 - Added code for outbound_autodial field
# 91130-2021 - Added code for manager override of in-group selection
#
$version = '2.2.0-238';
$build = '91123-1801';
$version = '2.2.0-239';
$build = '91130-2021';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=61;
$one_mysql_log=0;
@@ -1920,7 +1921,7 @@ else
$closer_chooser_string='';
$stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y');";
$stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y','N');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01044',$VD_login,$server_ip,$session_name,$one_mysql_log);}
@@ -1960,7 +1961,7 @@ else
{
print "<!-- campaign is set to manual dial: $auto_dial_level -->\n";
$stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level', '$campaign_weight', '$calls_today','$NOW_TIME','N');";
$stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level', '$campaign_weight', '$calls_today','$NOW_TIME','N','N');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01047',$VD_login,$server_ip,$session_name,$one_mysql_log);}
@@ -2594,6 +2595,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var script_height = '<?php echo $SSheight ?>';
var enable_second_webform = '<?php echo $enable_second_webform ?>';
var no_delete_VDAC=0;
var manager_ingroups_set=0;
var external_igb_set_name='';
var DiaLControl_auto_HTML = "<IMG SRC=\"./images/vdc_LB_pause_OFF.gif\" border=0 alt=\" Pause \"><a href=\"#\" onclick=\"AutoDial_ReSume_PauSe('VDADready');\"><IMG SRC=\"./images/vdc_LB_resume.gif\" border=0 alt=\"Resume\"></a>";
var DiaLControl_auto_HTML_ready = "<a href=\"#\" onclick=\"AutoDial_ReSume_PauSe('VDADpause');\"><IMG SRC=\"./images/vdc_LB_pause.gif\" border=0 alt=\" Pause \"></a><IMG SRC=\"./images/vdc_LB_resume_OFF.gif\" border=0 alt=\"Resume\">";
var DiaLControl_auto_HTML_OFF = "<IMG SRC=\"./images/vdc_LB_pause_OFF.gif\" border=0 alt=\" Pause \"><IMG SRC=\"./images/vdc_LB_resume_OFF.gif\" border=0 alt=\"Resume\">";
@@ -3231,6 +3234,11 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var APIDiaL = APIDiaL_array[1];
var CheckDEADcall_array = check_time_array[10].split("DEADcall: ");
var CheckDEADcall = CheckDEADcall_array[1];
var InGroupChange_array = check_time_array[11].split("InGroupChange: ");
var InGroupChange = InGroupChange_array[1];
var InGroupChangeBlend = check_time_array[12];
var InGroupChangeUser = check_time_array[13];
var InGroupChangeName = check_time_array[14];
if ( (APIHanguP==1) && (VD_live_customer_call==1) )
{
hideDiv('CustomerGoneBox');
@@ -3323,6 +3331,20 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
CheckDEADcallON=1;
}
}
if (InGroupChange > 0)
{
var external_blended = InGroupChangeBlend;
var external_igb_set_user = InGroupChangeUser;
external_igb_set_name = InGroupChangeName;
manager_ingroups_set=1;
if ( (external_blended == '1') && (dial_method != 'INBOUND_MAN') )
{VICIDiaL_closer_blended = '1';}
if (external_blended == '0')
{VICIDiaL_closer_blended = '0';}
}
// ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ above section working on API functions
var check_conf_array=check_ALL_array[1].split("|");
@@ -5437,9 +5459,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var check_DS_array=check_dispo.split("\n");
// alert(xmlhttp.responseText + "\n|" + check_DS_array[1] + "\n|" + check_DS_array[2] + "|");
if (check_DS_array[1] == 'Next agent_log_id:')
{
agent_log_id = check_DS_array[2];
}
{agent_log_id = check_DS_array[2];}
}
}
delete xmlhttp;
@@ -7439,7 +7459,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
function CloserSelectContent_create()
{
HidEGenDerPulldown();
if (VU_agent_choose_ingroups == '1')
if ( (VU_agent_choose_ingroups == '1') && (manager_ingroups_set < 1) )
{
var live_CSC_HTML = "<table cellpadding=5 cellspacing=5 width=500><tr><td><B>GROUPS NOT SELECTED</B></td><td><B>SELECTED GROUPS</B></td></tr><tr><td bgcolor=\"#99FF99\" height=300 width=240 valign=top><font class=\"log_text\"><span id=CloserSelectAdd> &nbsp; <a href=\"#\" onclick=\"CloserSelect_change('-----ADD-ALL-----','ADD');return false;\"><B>--- ADD ALL ---</B><BR>";
var loop_ct = 0;
@@ -8549,8 +8569,15 @@ function phone_number_format(formatphone) {
}
else
{
HidEGenDerPulldown();
showDiv('CloserSelectBox')
if (manager_ingroups_set > 0)
{
alert("Manager " + external_igb_set_name + " has selected your in-group choices");
}
else
{
HidEGenDerPulldown();
showDiv('CloserSelectBox')
}
}
}
@@ -8797,6 +8824,7 @@ else
{
if (VU_closer_default_blended == 1)
{document.vicidial_form.CloserSelectBlended.checked=true}
CloserSelectContent_create();
showDiv('CloserSelectBox');
var CloserSelecting = 1;
CloserSelectContent_create();
+4 -2
View File
@@ -19,6 +19,7 @@
# 90310-0734 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 90524-2009 - Changed time display to use functions.php
# 91130-2037 - Added user closer log manager flag display
#
header ("Content-type: text/html; charset=utf-8");
@@ -435,9 +436,9 @@ echo "<center>\n";
echo "<B>CLOSER IN-GROUP SELECTION LOGS:</B>\n";
echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2> CAMPAIGN</td><td align=left><font size=2>BLEND</td><td align=left><font size=2> GROUPS</td></tr>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2> CAMPAIGN</td><td align=left><font size=2>BLEND</td><td align=left><font size=2> GROUPS</td><td align=left><font size=2> MANAGER</td></tr>\n";
$stmt="select user,campaign_id,event_date,blended,closer_campaigns from vicidial_user_closer_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by event_date desc limit 1000;";
$stmt="select user,campaign_id,event_date,blended,closer_campaigns,manager_change from vicidial_user_closer_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by event_date desc limit 1000;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
@@ -457,6 +458,7 @@ while ($logs_to_print > $u)
echo "<td align=left><font size=2> $row[1]</td>\n";
echo "<td align=left><font size=2> $row[3]</td>\n";
echo "<td align=left><font size=2> $row[4] </td>\n";
echo "<td align=left><font size=2> $row[5]</td>\n";
echo "</tr>\n";
}
+18 -13
View File
@@ -12,6 +12,7 @@
# 90310-0741 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 91012-0536 - Added selected territories display
# 91130-2039 - Added user closer log manager flag display
#
header ("Content-type: text/html; charset=utf-8");
@@ -120,7 +121,7 @@ else
$full_name = $row[0];
$user_group = $row[1];
$stmt="SELECT live_agent_id,user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,call_server_ip,user_level,comments,campaign_weight,calls_today,external_hangup,external_status,external_pause,external_dial,agent_log_id,last_state_change,agent_territories from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';";
$stmt="SELECT live_agent_id,user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,call_server_ip,user_level,comments,campaign_weight,calls_today,external_hangup,external_status,external_pause,external_dial,agent_log_id,last_state_change,agent_territories,outbound_autodial,manager_ingroup_set,external_igb_set_user from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$agents_to_print = mysql_num_rows($rslt);
@@ -128,14 +129,17 @@ else
while ($i < $agents_to_print)
{
$row=mysql_fetch_row($rslt);
$Aserver_ip = $row[2];
$Asession_id = $row[3];
$Aextension = $row[4];
$Astatus = $row[5];
$Acampaign = $row[7];
$Alast_call = $row[14];
$Acl_campaigns = $row[15];
$agent_territories = $row[27];
$Aserver_ip = $row[2];
$Asession_id = $row[3];
$Aextension = $row[4];
$Astatus = $row[5];
$Acampaign = $row[7];
$Alast_call = $row[14];
$Acl_campaigns = $row[15];
$agent_territories = $row[27];
$outbound_autodial = $row[28];
$manager_ingroup_set = $row[29];
$external_igb_set_user = $row[30];
$i++;
}
@@ -411,13 +415,14 @@ if ($agents_to_print > 0)
echo "<TR><TD ALIGN=RIGHT>status:</TD><TD ALIGN=LEFT> &nbsp; $Astatus</TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>hungup last call at:</TD><TD ALIGN=LEFT> &nbsp; $Alast_call</TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>Closer groups:</TD><TD ALIGN=LEFT> &nbsp; $Acl_campaigns</TD></TR>\n";
if ($manager_ingroup_set != 'N')
{echo "<TR><TD ALIGN=RIGHT>Manager InGroup Select:</TD><TD ALIGN=LEFT> &nbsp; YES, by $external_igb_set_user</TD></TR>\n";}
if ($outbound_autodial == 'Y')
{echo "<TR><TD ALIGN=RIGHT>Outbound Auto-Dial:</TD><TD ALIGN=LEFT> &nbsp; YES</TD></TR>\n";}
if ($user_territories_active > 0)
{
echo "<TR><TD ALIGN=RIGHT>Selected Territories:</TD><TD ALIGN=LEFT> &nbsp; $agent_territories</TD></TR>\n";
}
{echo "<TR><TD ALIGN=RIGHT>Selected Territories:</TD><TD ALIGN=LEFT> &nbsp; $agent_territories</TD></TR>\n";}
echo "</TABLE>\n<BR>\n";
if ($change_agent_campaign > 0)
{
echo "<form action=$PHP_SELF method=POST>\n";