Fix for AGENT routing, check for availability, issue #1211

git-svn-id: svn://192.168.202.10@3320 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2020-11-12 15:09:16 +00:00
parent 9a04537db3
commit 6d3ef26863
2 changed files with 61 additions and 12 deletions
+58 -9
View File
@@ -46,6 +46,7 @@
# 170923-1355 - Added system filter feature, before any other actions
# 190216-0814 - Fix for user-group, in-group and campaign settings matching issues
# 200623-2258 - Added Answer Signal options
# 201112-0834 - Fix for AGENT routing, check for availability, issue #1211
#
@@ -1251,6 +1252,63 @@ if ( ( ($max_queue_ingroup_calls > 0) || ($max_queue_ingroup_calls < 0) ) && ($n
##### END max queue ingroup calls redirect process #####
### Route AGENT call to a logged-in VICIDIAL agent
if ($did_route =~ /AGENT/)
{
if ($AGILOG) {$agi_string = " did_route AGENT: |$user|$extension|$user_unavailable_action|"; &agi_output;}
$agent_live=0;
$queue_date_epoch = time();
$BDtarget = ($queue_date_epoch - 5);
($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget);
$Byear = ($Byear + 1900);
$Bmon++;
if ($Bmon < 10) {$Bmon = "0$Bmon";}
if ($Bmday < 10) {$Bmday = "0$Bmday";}
if ($Bhour < 10) {$Bhour = "0$Bhour";}
if ($Bmin < 10) {$Bmin = "0$Bmin";}
if ($Bsec < 10) {$Bsec = "0$Bsec";}
$BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec";
# check for agent being logged-in (removed ' and status NOT IN('PAUSED')')
$stmtA = "SELECT count(*) FROM vicidial_live_agents where user='$user' and last_update_time > '$BDtsSQLdate';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$agent_live = $aryA[0];
}
$sthA->finish();
if ($agent_live > 0)
{
$did_ig_prefix='99909';
if ( ($SSinbound_answer_config > 0) && ($inbound_route_answer =~ /N/i) )
{$did_ig_prefix='99809';}
$did_extension = "$did_ig_prefix$S$did_id$S$S$S$route_type";
$exten_context = $ext_context;
$did_route = 'EXTEN';
if ($AGILOG) {$agi_string = "AGENT available, Routing call: $agent_live|$user"; &agi_output;}
}
else
{
$did_route = $user_unavailable_action;
$exten_context = 'default';
$route_type = 'NOAGENT';
if ($AGILOG) {$agi_string = "AGENT unavailable Redirect: |$user|$user_unavailable_action|$user_route_settings_ingroup|$did_extension|$stmtA|"; &agi_output;}
### Update the call in vicidial_did_log
$stmtA = "UPDATE vicidial_did_log SET did_route='NA_$did_route' where uniqueid='$uniqueid' and channel='$channel' and server_ip='$VARserver_ip' and caller_id_number='$callerid' and call_date='$SQLdate';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- DID UPDATE LOG : |$affected_rowsL|$stmtA|"; &agi_output;}
}
}
### Route call to a VICIDIAL-defined phone
if ($did_route =~ /PHONE/)
{
@@ -1314,15 +1372,6 @@ if ($did_route =~ /IN_GROUP/)
}
### Route call to a logged-in VICIDIAL agent
if ($did_route =~ /AGENT/)
{
$did_extension = "$did_ig_prefix$S$did_id$S$S$S$route_type";
$exten_context = $ext_context;
$did_route = 'EXTEN';
}
### QueueMetrics logging if enabled
if ( ($did_route =~ /EXTEN|CALLMENU/) && ($enable_queuemetrics_logging > 0) )
{
@@ -1,4 +1,4 @@
# version: 20201101105301
# version: 20201112100401
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
@@ -630,8 +630,8 @@ inbound_dids-voicemail_ext Voicemail Box <QXZ>If VOICEMAIL is selected as the DI
inbound_dids-phone Phone Extension <QXZ>If PHONE is selected as the DID Route, then this is the phone extension that calls will be sent to.</QXZ>
inbound_dids-server_ip Phone Server IP <QXZ>If PHONE is selected as the DID Route, then this is the server IP for the phone extension that calls will be sent to.</QXZ>
inbound_dids-menu_id Call Menu <QXZ>If CALLMENU is selected as the DID Route, then this is the Call Menu that calls will be sent to.</QXZ>
inbound_dids-user User Agent <QXZ>If AGENT is selected as the DID Route, then this is the Agent that calls will be sent to.</QXZ>
inbound_dids-user_unavailable_action User Unavailable Action <QXZ>If AGENT is selected as the DID Route, and the user is not logged in or available, then this is the route that the calls will take.</QXZ>
inbound_dids-user User Agent <QXZ>If AGENT is selected as the DID Route, then this is the Agent that calls will be sent to if they are logged into the agent screen.</QXZ>
inbound_dids-user_unavailable_action User Unavailable Action <QXZ>If AGENT is selected as the DID Route, and the user is not logged in, then this is the route that the calls will take.</QXZ>
inbound_dids-user_route_settings_ingroup User Route Settings In-Group <QXZ>If AGENT is selected as the DID Route, then this is the In-Group that will be used for the queue settings as the caller is waiting to be sent to the agent. Default is AGENTDIRECT.</QXZ>
inbound_dids-group_id In-Group ID <QXZ>If IN_GROUP is selected as the DID Route, then this is the In-Group that calls will be sent to.</QXZ>
inbound_dids-call_handle_method In-Group Call Handle Method <QXZ>If IN_GROUP is selected as the DID Route, then this is the call handling method used for these calls. CID will add a new lead record with every call using the CallerID as the phone number, CIDLOOKUP will attempt to lookup the phone number by the CallerID in the entire system, CIDLOOKUPRL will attempt to lookup the phone number by the CallerID in only one specified list, CIDLOOKUPRC will attempt to lookup the phone number by the CallerID in all of the lists that belong to the specified campaign, CLOSER is specified for Closer calls, ANI will add a new lead record with every call using the ANI as the phone number, ANILOOKUP will attempt to lookup the phone number by the ANI in the entire system, ANILOOKUPRL will attempt to lookup the phone number by the ANI in only one specified list, XDIGITID will prompt the caller for an X digit code before the call will be put into the queue, VIDPROMPT will prompt the caller for their ID number and will create a new lead record with the CallerID as the phone number and the ID as the Vendor ID, VIDPROMPTLOOKUP will attempt to lookup the ID in the entire system, VIDPROMPTLOOKUPRL will attempt to lookup the vendor ID by the ID in only one specified list, VIDPROMPTLOOKUPRC will attempt to lookup the vendor ID by the ID in all of the lists that belong to the specified campaign. Default is CID. If a CIDLOOKUP method is used with ALT, it will search the alt_phone field for the phone number if no matches are found for the main phone number. If a CIDLOOKUP method is used with ADDR3, it will search the address3 field for the phone number if no matches are found for the main phone number and optionally the alt_phone field.</QXZ>