diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 54a19ad1..e573d667 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -841,6 +841,8 @@ OTHER CHANGES: 238. Added "LAGGED Agent Log Summary Report". +239. Added a Multi-call option to the agent 3-way press-1 calls feature. + diff --git a/agc_2-X/trunk/agi/agi-3way_press_agent.agi b/agc_2-X/trunk/agi/agi-3way_press_agent.agi index be2913f8..35b169e9 100644 --- a/agc_2-X/trunk/agi/agi-3way_press_agent.agi +++ b/agc_2-X/trunk/agi/agi-3way_press_agent.agi @@ -28,9 +28,11 @@ # changes: # 231113-2016 - First Build # 231118-1600 - Added endings for HUNGUP and TIMEOUT +# 231227-1428 - Added multi-phone ability # $script = 'agi-3way_press_agent.agi'; +$build = '231227-1428'; $at='@'; $S='*'; @@ -50,6 +52,7 @@ if ($hour < 10) {$hour = "0$hour";} if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} $CIDdate = "$mon$mday$hour$min$sec"; +$CIDdateD = "$mon$mday$hour$min$sec"; $tsSQLdate = "$year$mon$mday$hour$min$sec"; $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; $SQLdateBEGIN = $SQLdate; @@ -242,7 +245,7 @@ foreach $i (sort keys %AGI) if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} } -if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$stage|"; &agi_output;} +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$stage|$build|"; &agi_output;} $CALLvendor_lead_code = $AGI->get_variable('vendor_lead_code'); $CALLlead_id = $AGI->get_variable('lead_id'); @@ -311,6 +314,8 @@ $AGI->stream_file('sip-silence'); $CALLserver_ip=''; $CALLsession_id=''; $CALLuser=''; +$CALLphone_numbers=''; +$CALLphone_numbers_ct=0; $stmtA = "SELECT server_ip,cmd_line_d FROM vicidial_manager where callerid='$calleridname' order by entry_date desc limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -345,34 +350,118 @@ if ( (length($CALLuser) < 1) || (length($CALLserver_ip) < 5) || (length($CALLses if ($AGILOG) {$agi_string = "3-WAY DEBUG: user/server/session found: |$CALLuser|$CALLserver_ip|$CALLsession_id|$calleridname|"; &agi_output;} +# Check to see if multiple calls should be sent out to outside users +$stmtA = "SELECT phone_numbers,phone_numbers_ct FROM vicidial_3way_press_multi where user='$CALLuser' and status='NEW' limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLphone_numbers = $aryA[0]; + $CALLphone_numbers_ct = $aryA[1]; + } +$sthA->finish(); $PADlead_id = sprintf("%010s", $lead_id); while (length($PADlead_id) > 10) {chop($PADlead_id);} -$VIDqueryCID = "T$CIDdate$PADlead_id"; -$newcallerid = "\"$VIDqueryCID <$original_cid>\""; -$CALLcontext = '@default'; +$allCIDs=''; +if ( ($CALLphone_numbers_ct > 0) && (length($CALLphone_numbers) > 4) ) + { + ##### Get maximum calls per second that this process can send out + $stmtA = "SELECT outbound_calls_per_second,vicidial_recording_limit FROM servers where server_ip='$server_ip';"; + $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; + $outbound_calls_per_second = $aryA[0]; + $DBvicidial_recording_limit = $aryA[1]; + } + $sthA->finish(); -### Insert the call to vicidial_3way_press_live -$stmtA="INSERT INTO vicidial_3way_press_live SET call_date=NOW(),caller_code='$calleridname',call_3way_id='$VIDqueryCID',lead_id='$lead_id',phone_number='$phone_number',dialstring='$dialstring',outbound_cid='$original_cid',user='$CALLuser',session_id='$CALLsession_id',server_ip='$CALLserver_ip',session_id_3way='',status='NEW';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} -$affected_rowsA = $dbhA->do($stmtA); -if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live INSERT: |$affected_rowsA|$stmtA|"; &agi_output;} + ### Update status of the vicidial_3way_press_multi record for this user + $stmtA="UPDATE vicidial_3way_press_multi SET status='PROCESSING' where user='$CALLuser';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_multi UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} -### Log the call to vicidial_3way_press_log -$stmtA="INSERT INTO vicidial_3way_press_log SET call_date=NOW(),caller_code='$calleridname',call_3way_id='$VIDqueryCID',lead_id='$lead_id',phone_number='$phone_number',dialstring='$dialstring',outbound_cid='$original_cid',user='$CALLuser',session_id='$CALLsession_id',server_ip='$CALLserver_ip',session_id_3way='',result='Started: $SQLdate';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} -$affected_rowsB = $dbhA->do($stmtA); -if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log LOG INSERT: |$affected_rowsB|$stmtA|"; &agi_output;} + if ( ($outbound_calls_per_second > 0) && ($outbound_calls_per_second < 201) ) + {$per_call_delay = (1000 / $outbound_calls_per_second);} + else + {$per_call_delay = '25';} -### Insert the outside-agent call into vicidial_manager -$stmtA="INSERT INTO vicidial_manager values('','',NOW(),'NEW','N','$CALLserver_ip','','Originate','$VIDqueryCID','Channel: Local/$dialstring$CALLcontext','Context: xfer_press_dialplan','Exten: s','Priority: 1','Callerid: $newcallerid','Variable: __lead_id=$lead_id','','','','');"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} -$affected_rowsG = $dbhA->do($stmtA); -if ($AGILOG) {$agi_string = "-- vicidial_manager INSERT: |$affected_rowsG|$stmtA|"; &agi_output;} + # Loop through every phone number sent to place a call to an outside user, up to 10 + @CALLphone_numbers_ARY = split(/,/,$CALLphone_numbers); + $vp=0; + $temp_phone_length = (length($CALLphone_numbers_ARY[$vp]) * -1); + $temp_prefix_code = substr($dialstring,0,$temp_phone_length); + while ($vp < $CALLphone_numbers_ct) + { + $VIDqueryCID = "T$CIDdateD$vp$PADlead_id"; + $newcallerid = "\"$VIDqueryCID <$original_cid>\""; + $CALLcontext = '@default'; + $allCIDs .= "$VIDqueryCID|"; + ### Insert the call to vicidial_3way_press_live + $stmtA="INSERT INTO vicidial_3way_press_live SET call_date=\"$SQLdate\",caller_code='$calleridname',call_3way_id='$VIDqueryCID',lead_id='$lead_id',phone_number='$CALLphone_numbers_ARY[$vp]',dialstring='$temp_prefix_code$CALLphone_numbers_ARY[$vp]',outbound_cid='$original_cid',user='$CALLuser',session_id='$CALLsession_id',server_ip='$CALLserver_ip',session_id_3way='',status='NEW';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live INSERT: |$affected_rowsA|$stmtA|"; &agi_output;} + + ### Log the call to vicidial_3way_press_log + $stmtA="INSERT INTO vicidial_3way_press_log SET call_date=\"$SQLdate\",caller_code='$calleridname',call_3way_id='$VIDqueryCID',lead_id='$lead_id',phone_number='$CALLphone_numbers_ARY[$vp]',dialstring='$temp_prefix_code$CALLphone_numbers_ARY[$vp]',outbound_cid='$original_cid',user='$CALLuser',session_id='$CALLsession_id',server_ip='$CALLserver_ip',session_id_3way='',result='Started: $SQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsB = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log LOG INSERT: |$affected_rowsB|$stmtA|"; &agi_output;} + + ### Insert the outside-agent call into vicidial_manager + $stmtA="INSERT INTO vicidial_manager values('','',NOW(),'NEW','N','$CALLserver_ip','','Originate','$VIDqueryCID','Channel: Local/$temp_prefix_code$CALLphone_numbers_ARY[$vp]$CALLcontext','Context: xfer_press_dialplan','Exten: s','Priority: 1','Callerid: $newcallerid','Variable: __lead_id=$lead_id','','','','');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsG = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_manager INSERT: |$affected_rowsG|$stmtA|"; &agi_output;} + + usleep(1*$per_call_delay*1000); + $vp++; + } + } +else + { + # Place call to only phone number sent to outside user + $VIDqueryCID = "T$CIDdate$PADlead_id"; + $newcallerid = "\"$VIDqueryCID <$original_cid>\""; + $CALLcontext = '@default'; + $allCIDs .= "$VIDqueryCID|"; + + ### Insert the call to vicidial_3way_press_live + $stmtA="INSERT INTO vicidial_3way_press_live SET call_date=\"$SQLdate\",caller_code='$calleridname',call_3way_id='$VIDqueryCID',lead_id='$lead_id',phone_number='$phone_number',dialstring='$dialstring',outbound_cid='$original_cid',user='$CALLuser',session_id='$CALLsession_id',server_ip='$CALLserver_ip',session_id_3way='',status='NEW';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live INSERT: |$affected_rowsA|$stmtA|"; &agi_output;} + + ### Log the call to vicidial_3way_press_log + $stmtA="INSERT INTO vicidial_3way_press_log SET call_date=\"$SQLdate\",caller_code='$calleridname',call_3way_id='$VIDqueryCID',lead_id='$lead_id',phone_number='$phone_number',dialstring='$dialstring',outbound_cid='$original_cid',user='$CALLuser',session_id='$CALLsession_id',server_ip='$CALLserver_ip',session_id_3way='',result='Started: $SQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsB = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log LOG INSERT: |$affected_rowsB|$stmtA|"; &agi_output;} + + ### Insert the outside-agent call into vicidial_manager + $stmtA="INSERT INTO vicidial_manager values('','',NOW(),'NEW','N','$CALLserver_ip','','Originate','$VIDqueryCID','Channel: Local/$dialstring$CALLcontext','Context: xfer_press_dialplan','Exten: s','Priority: 1','Callerid: $newcallerid','Variable: __lead_id=$lead_id','','','','');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsG = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_manager INSERT: |$affected_rowsG|$stmtA|"; &agi_output;} + } # loop every second until vicidial_3way_press_live record changes to status='ACCEPTED', then grab an unused session, update record and go into it $CALLstatus=''; +$CALLcall_3way_id=''; +$CALLstatusARY[0]=''; +$CALLcall_3way_idARY[0]=''; +$allCIDs =~ s/\|$//gi; +$allCIDs =~ s/\|/','/gi; + $wait_loop=0; while ($wait_loop < 100) { @@ -382,49 +471,35 @@ while ($wait_loop < 100) $AGI->stream_file('hold_tone'); } - $stmtA = "SELECT status FROM vicidial_3way_press_live where call_3way_id='$VIDqueryCID' order by call_date desc limit 1;"; + $stmtA = "SELECT status,call_3way_id FROM vicidial_3way_press_live where call_3way_id IN('$allCIDs') order by status desc limit 11;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; - if ($sthArows > 0) + $sthArowsMP=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArowsMP; &mysql_error_logging; + $mp=0; + while ($mp < $sthArowsMP) { @aryA = $sthA->fetchrow_array; - $CALLstatus = $aryA[0]; + $CALLstatusARY[$mp] = $aryA[0]; + $CALLcall_3way_idARY[$mp] = $aryA[1]; + $mp++; } $sthA->finish(); - if ($CALLstatus =~ /ACCEPTED/) + + ### loop through each outside user call and check for acceptance or declined or hungup + $mp=0; + while ($mp < $sthArowsMP) { - #grab open session - $free_session_count=0; - $stmtA="SELECT count(*) FROM vicidial_conferences where server_ip='$CALLserver_ip' and ((extension='') or (extension is null)) and conf_exten != '$CALLsession_id';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $free_session_count = $aryA[0]; - } - $sthA->finish(); + $CALLstatus = $CALLstatusARY[$mp]; + $VIDqueryCID = $CALLcall_3way_idARY[$mp]; + if ($AGILOG) {$agi_string = "-- DEBUG CALL CHECK: |$mp|$CALLstatus|$VIDqueryCID|$lead_id|"; &agi_output;} - if ($free_session_count < 1) + if ($CALLstatus =~ /ACCEPTED/) { - if ($AGILOG) {$agi_string = "-- ERROR: no sessions available! |$CALLserver_ip|$stmtA|"; &agi_output;} - } - else - { - ### Update vicidial_conferences to grab available session - $stmtA="UPDATE vicidial_conferences set extension='Local/8300$CALLuser$tsSQLdate', leave_3way='0' where server_ip='$CALLserver_ip' and ((extension='') or (extension is null)) and conf_exten != '$CALLsession_id' limit 1;"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsC = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsC|$stmtA|"; &agi_output;} - - # Grab the session_id that was reserved - $CALLconf_exten=''; - $stmtA="SELECT conf_exten from vicidial_conferences where server_ip='$CALLserver_ip' and extension='Local/8300$CALLuser$tsSQLdate' and conf_exten != '$CALLsession_id';"; + #grab open session + $free_session_count=0; + $stmtA="SELECT count(*) FROM vicidial_conferences where server_ip='$CALLserver_ip' and ((extension='') or (extension is null)) and conf_exten != '$CALLsession_id';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -432,101 +507,176 @@ while ($wait_loop < 100) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $CALLconf_exten = $aryA[0]; + $free_session_count = $aryA[0]; } $sthA->finish(); - if (length($CALLconf_exten) < 1) + if ($free_session_count < 1) { - if ($AGILOG) {$agi_string = "-- ERROR: no valid session available! |$CALLserver_ip|$stmtA|"; &agi_output;} + if ($AGILOG) {$agi_string = "-- ERROR: no sessions available! |$CALLserver_ip|$stmtA|"; &agi_output;} } else { - ### Update the call in vicidial_3way_press_live - $stmtA="UPDATE vicidial_3way_press_live SET status='RESERVED',session_id_3way='$CALLconf_exten' where call_3way_id='$VIDqueryCID';"; + ### Update vicidial_conferences to grab available session + $stmtA="UPDATE vicidial_conferences set extension='Local/8300$CALLuser$tsSQLdate', leave_3way='0' where server_ip='$CALLserver_ip' and ((extension='') or (extension is null)) and conf_exten != '$CALLsession_id' limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsA = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live reserved UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + $affected_rowsC = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsC|$stmtA|"; &agi_output;} - ### Update the call in vicidial_3way_press_log - $stmtA="UPDATE vicidial_3way_press_log SET session_id_3way='$CALLconf_exten', result=CONCAT(result,'|Reserved: ',NOW()) where call_3way_id='$VIDqueryCID';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsA = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log reserved UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + # Grab the session_id that was reserved + $CALLconf_exten=''; + $stmtA="SELECT conf_exten from vicidial_conferences where server_ip='$CALLserver_ip' and extension='Local/8300$CALLuser$tsSQLdate' and conf_exten != '$CALLsession_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLconf_exten = $aryA[0]; + } + $sthA->finish(); - ### Update vicidial_conferences to leave_3way - # $Ttimeout='Xtimeout9'; - # $stmtA="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime=NOW(), extension='3WAY_$CALLuser$Ttimeout' where server_ip='$CALLserver_ip' and conf_exten='$CALLconf_exten';"; - # if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - # $affected_rowsD = $dbhA->do($stmtA); - # if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsD|$stmtA|"; &agi_output;} + if (length($CALLconf_exten) < 1) + { + if ($AGILOG) {$agi_string = "-- ERROR: no valid session available! |$CALLserver_ip|$stmtA|"; &agi_output;} + } + else + { + ### Update the call in vicidial_3way_press_live + $stmtA="UPDATE vicidial_3way_press_live SET status='RESERVED',session_id_3way='$CALLconf_exten' where call_3way_id='$VIDqueryCID';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live reserved UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} - if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} - print "SET CONTEXT $ext_context\n"; - $result = ; - checkresult($result); - print "SET EXTENSION 7$CALLconf_exten\n"; - $result = ; - checkresult($result); - print "SET PRIORITY 1\n"; - $result = ; - checkresult($result); + ### Update the call in vicidial_3way_press_log + $stmtA="UPDATE vicidial_3way_press_log SET session_id_3way='$CALLconf_exten', result=CONCAT(result,'|Reserved: ',NOW()) where call_3way_id='$VIDqueryCID';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log reserved UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} - $wait_loop=1000; - exit; + ### Update vicidial_conferences to leave_3way + # $Ttimeout='Xtimeout9'; + # $stmtA="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime=NOW(), extension='3WAY_$CALLuser$Ttimeout' where server_ip='$CALLserver_ip' and conf_exten='$CALLconf_exten';"; + # if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + # $affected_rowsD = $dbhA->do($stmtA); + # if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsD|$stmtA|"; &agi_output;} + + if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + $result = ; + checkresult($result); + print "SET EXTENSION 7$CALLconf_exten\n"; + $result = ; + checkresult($result); + print "SET PRIORITY 1\n"; + $result = ; + checkresult($result); + + $wait_loop=1000; + exit; + } } } + + if ($CALLstatus =~ /DEFEATED/) + { + ### Update the call in vicidial_3way_press_log + $stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Defeated: ',NOW()) where call_3way_id='$VIDqueryCID';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log defeated UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + + ### Find the channel this call is on and send it to extension 8300@default for Hangup + $CALLchannel=''; + $CHANNELserver_ip=''; + $stmtA="SELECT channel,server_ip from live_channels where channel_group='$VIDqueryCID' limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLchannel = $aryA[0]; + $CHANNELserver_ip = $aryA[1]; + } + $sthA->finish(); + + if ( (length($CALLchannel) > 0) && (length($CHANNELserver_ip) > 0) ) + { + $HIDqueryCID = $VIDqueryCID; + $HIDqueryCID =~ s/^T/H/gi; + $stmtA = "INSERT INTO vicidial_manager values('','',NOW(),'NEW','N','$CHANNELserver_ip','','Redirect','$HIDqueryCID','Channel: $CALLchannel','Context: default','Exten: 8300','Priority: 1','','','','','','')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log defeated HANGUP: |$affected_rowsA|$stmtA|"; &agi_output;} + } + else + { + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log defeated HANGUP: no channel found |$VIDqueryCID|"; &agi_output;} + } + + ### Delete the call in vicidial_3way_press_live + $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$VIDqueryCID';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsE = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live defeated DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} + + if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER DEFEATED: |$CALLuser|$CALLserver_ip|$CALLchannel|$calleridname|$VIDqueryCID|"; &agi_output;} + } + + if ($CALLstatus =~ /DECLINED/) + { + ### Delete the call in vicidial_3way_press_live + $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$VIDqueryCID';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsE = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live declined DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} + + if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER DECLINED: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} + } + + if ($CALLstatus =~ /HUNGUP/) + { + ### Delete the call in vicidial_3way_press_live + $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$VIDqueryCID';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsE = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live hungup DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} + + if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER HUNGUP: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} + } + + $mp++; } - - if ($CALLstatus =~ /DECLINED/) + if ($sthArowsMP < 1) { - ### Delete the call in vicidial_3way_press_live - $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$VIDqueryCID';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsE = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live declined DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} - - if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER DECLINED: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} + if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER NO OUTSIDE AGENTS FOUND, HANGING UP..."; &agi_output;} $AGI->stream_file('buzz'); - usleep(1*490*1000); - - exit; - } - - if ($CALLstatus =~ /HUNGUP/) - { - ### Delete the call in vicidial_3way_press_live - $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$VIDqueryCID';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsE = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live hungup DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} - - if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER HUNGUP: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} - $AGI->stream_file('buzz'); - usleep(1*490*1000); - exit; } + usleep(1*490*1000); $wait_loop++; } if ($wait_loop >= 100) { ### Update the call in vicidial_3way_press_log - $stmtA="UPDATE vicidial_3way_press_log SET session_id_3way='$CALLconf_exten', result=CONCAT(result,'|Timeout: ',NOW()) where call_3way_id='$VIDqueryCID';"; + $stmtA="UPDATE vicidial_3way_press_log SET session_id_3way='$CALLconf_exten', result=CONCAT(result,'|Timeout: ',NOW()) where call_3way_id IN('$allCIDs');"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rowsA = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log timeout UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} ### Delete the call in vicidial_3way_press_live - $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$VIDqueryCID';"; + $stmtA="DELETE from vicidial_3way_press_live where call_3way_id IN('$allCIDs');"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rowsE = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live timeout DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} - if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER TIMEOUT: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} + if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER TIMEOUT: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|'$allCIDs'|"; &agi_output;} $AGI->stream_file('buzz'); usleep(1*490*1000); diff --git a/agc_2-X/trunk/agi/agi-3way_press_outside.agi b/agc_2-X/trunk/agi/agi-3way_press_outside.agi index 2083e95c..a7492f2f 100644 --- a/agc_2-X/trunk/agi/agi-3way_press_outside.agi +++ b/agc_2-X/trunk/agi/agi-3way_press_outside.agi @@ -51,9 +51,11 @@ # # changes: # 231113-2041 - First Build +# 231227-1427 - Added multi-phone ability # $script = 'agi-3way_press_outside.agi'; +$build = '231227-1427'; $at='@'; $S='*'; @@ -265,7 +267,7 @@ foreach $i (sort keys %AGI) if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} } -if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$stage|"; &agi_output;} +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$stage|$build|"; &agi_output;} $CALLvendor_lead_code = $AGI->get_variable('vendor_lead_code'); @@ -377,7 +379,7 @@ if ($AGILOG) {$agi_string = "3-WAY DEBUG: user/server/session found: |$CALLuser| if ($stage =~ /answered/i) { ### Update the call in vicidial_3way_press_live - $stmtA="UPDATE vicidial_3way_press_live SET status='ANSWERED' where call_3way_id='$calleridname';"; + $stmtA="UPDATE vicidial_3way_press_live SET status='ANSWERED' where call_3way_id='$calleridname' and status!='DEFEATED';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rowsA = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live answered UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} @@ -391,97 +393,147 @@ if ($stage =~ /answered/i) if ($stage =~ /accepted/i) { - ### Update the call in vicidial_3way_press_live - $stmtA="UPDATE vicidial_3way_press_live SET status='ACCEPTED' where call_3way_id='$calleridname';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsA = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live accepted UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + $accepted_ct=0; - ### Update the call in vicidial_3way_press_log - $stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Accepted: $SQLdate') where call_3way_id='$calleridname';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsA = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log accepted UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + $stmtA = "LOCK TABLES vicidial_3way_press_live WRITE;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02057'; $MEL_aff_rows=$LOCKaffected_rows; &mysql_error_logging; - - # loop until session_id_3way is populated - $CALLstatus=''; - $CALLconf_exten=''; - $wait_loop=0; - while ($wait_loop < 100) + if (length($qp_groupWAIT_aco)<2) + {$qp_groupWAIT_aco="''";} + ### Get list of users that should take higher priority inbound calls first + $stmtA = "SELECT count(*) from vicidial_3way_press_live where lead_id='$CALLlead_id' and status IN('ACCEPTED','RESERVED','TRANSFER') and call_3way_id!='$calleridname';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) { - usleep(1*990*1000); - if ($wait_loop =~ /0$|5$/) - { - $AGI->stream_file('hold_tone'); - } - - $stmtA = "SELECT status,session_id_3way FROM vicidial_3way_press_live where call_3way_id='$calleridname' order by call_date desc limit 1;"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $CALLstatus = $aryA[0]; - $CALLconf_exten = $aryA[1]; - } - $sthA->finish(); - - if ( ($CALLstatus =~ /RESERVED/) && (length($CALLconf_exten) > 0) ) - { - ### Update the call in vicidial_3way_press_live - $stmtA="UPDATE vicidial_3way_press_live SET status='TRANSFER' where call_3way_id='$calleridname';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsA = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live transfer UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} - - ### Update the call in vicidial_3way_press_log - $stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Transfer: ',NOW()) where call_3way_id='$calleridname';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsA = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log transfer UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} - - ### Update vicidial_conferences to leave_3way=1 - # $Ttimeout='Xtimeout9'; - # $stmtA="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime=NOW(), extension='3WAY_$CALLuser$Ttimeout' where server_ip='$CALLserver_ip' and conf_exten='$CALLconf_exten';"; - $stmtA="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime=NOW(), extension='3WAY_$CALLuser' where server_ip='$CALLserver_ip' and conf_exten='$CALLconf_exten';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsD = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsD|$stmtA|"; &agi_output;} - - ### Delete the call in vicidial_3way_press_live - $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$calleridname';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} - $affected_rowsE = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live transfer DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} - - if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|"; &agi_output;} - print "SET CONTEXT $ext_context\n"; - $result = ; - checkresult($result); - print "SET EXTENSION 7$CALLconf_exten\n"; - $result = ; - checkresult($result); - print "SET PRIORITY 1\n"; - $result = ; - checkresult($result); - - $wait_loop=1000; - exit; - } - - $wait_loop++; + @aryA = $sthA->fetchrow_array; + $accepted_ct = $aryA[0]; } + if ($accepted_ct < 1) + { + ### Update the call in vicidial_3way_press_live + $stmtA = "UPDATE vicidial_3way_press_live SET status='ACCEPTED' where call_3way_id='$calleridname';"; + my $UPDATEaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$UPDATEaffected_rows; &mysql_error_logging; + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live accepted UPDATE: |$UPDATEaffected_rows|$stmtA|"; &agi_output;} + + ### Update all other calls for this lead in vicidial_3way_press_live to DEFEATED status + $stmtA = "UPDATE vicidial_3way_press_live SET status='DEFEATED' where lead_id='$CALLlead_id' and call_3way_id!='$calleridname';"; + my $UPDATEaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$UPDATEaffected_rows; &mysql_error_logging; + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live defeated UPDATE: |$UPDATEaffected_rows|$stmtA|"; &agi_output;} + + $stmtA = "UNLOCK TABLES;"; + my $UNLOCKaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$UNLOCKaffected_rows; &mysql_error_logging; + + ### Update the call in vicidial_3way_press_log + $stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Accepted: $SQLdate') where call_3way_id='$calleridname';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log accepted UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + + + # loop until session_id_3way is populated + $CALLstatus=''; + $CALLconf_exten=''; + $wait_loop=0; + while ($wait_loop < 100) + { + usleep(1*990*1000); + if ($wait_loop =~ /0$|5$/) + { + $AGI->stream_file('hold_tone'); + } + + $stmtA = "SELECT status,session_id_3way FROM vicidial_3way_press_live where call_3way_id='$calleridname' order by call_date desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLstatus = $aryA[0]; + $CALLconf_exten = $aryA[1]; + } + $sthA->finish(); + + if ( ($CALLstatus =~ /RESERVED/) && (length($CALLconf_exten) > 0) ) + { + ### Update the call in vicidial_3way_press_live + $stmtA="UPDATE vicidial_3way_press_live SET status='TRANSFER' where call_3way_id='$calleridname';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live transfer UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + + ### Update the call in vicidial_3way_press_log + $stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Transfer: ',NOW()) where call_3way_id='$calleridname';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log transfer UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + + ### Update vicidial_conferences to leave_3way=1 + # $Ttimeout='Xtimeout9'; + # $stmtA="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime=NOW(), extension='3WAY_$CALLuser$Ttimeout' where server_ip='$CALLserver_ip' and conf_exten='$CALLconf_exten';"; + $stmtA="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime=NOW(), extension='3WAY_$CALLuser' where server_ip='$CALLserver_ip' and conf_exten='$CALLconf_exten';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsD = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsD|$stmtA|"; &agi_output;} + + ### Delete the call in vicidial_3way_press_live + $stmtA="DELETE from vicidial_3way_press_live where call_3way_id='$calleridname';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsE = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live transfer DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} + + if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + $result = ; + checkresult($result); + print "SET EXTENSION 7$CALLconf_exten\n"; + $result = ; + checkresult($result); + print "SET PRIORITY 1\n"; + $result = ; + checkresult($result); + + $wait_loop=1000; + exit; + } + $wait_loop++; + } + } + else + { + # already accepted + $stmtA = "UNLOCK TABLES;"; + my $UNLOCKaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$UNLOCKaffected_rows; &mysql_error_logging; + + ### Update the call in vicidial_3way_press_live + $stmtA="UPDATE vicidial_3way_press_live SET status='TOOSLOW' where call_3way_id='$calleridname';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live too slow UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + + ### Update the call in vicidial_3way_press_log + $stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Too Slow: $SQLdate') where call_3way_id='$calleridname';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsA = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log too slow UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} + } } if ($stage =~ /declined/i) { ### Update the call in vicidial_3way_press_live - $stmtA="UPDATE vicidial_3way_press_live SET status='DECLINED' where call_3way_id='$calleridname';"; + $stmtA="UPDATE vicidial_3way_press_live SET status='DECLINED' where call_3way_id='$calleridname' and status!='DEFEATED';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rowsA = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live declined UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/bin/AST_flush_DBqueue.pl b/agc_2-X/trunk/bin/AST_flush_DBqueue.pl index a9867799..efcd96c1 100644 --- a/agc_2-X/trunk/bin/AST_flush_DBqueue.pl +++ b/agc_2-X/trunk/bin/AST_flush_DBqueue.pl @@ -33,6 +33,7 @@ # 220921-1148 - Added optimize of vicidial_users table # 230414-1622 - Added --reset-stuck-leads option # 231118-1256 - Added clearing of old vicidial_3way_press_live records +# 231228-1901 - Added optimizing of vicidial_3way_press_multi records # $session_flush=0; @@ -611,6 +612,20 @@ if (!$T) if (!$Q) {print " - OPTIMIZE vicidial_3way_press_live \n";} +$stmtA = "OPTIMIZE table vicidial_3way_press_multi;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - OPTIMIZE vicidial_3way_press_multi \n";} + + if ($session_flush > 0) { $stmtA = "DELETE from vicidial_sessions_recent where call_date < '$SQLdate_NEG_1hour';"; diff --git a/agc_2-X/trunk/docs/AGENT_3WAY_PRESS-1_CALLS.txt b/agc_2-X/trunk/docs/AGENT_3WAY_PRESS-1_CALLS.txt index a27c7b7b..7736786d 100644 --- a/agc_2-X/trunk/docs/AGENT_3WAY_PRESS-1_CALLS.txt +++ b/agc_2-X/trunk/docs/AGENT_3WAY_PRESS-1_CALLS.txt @@ -1,4 +1,4 @@ -Agent 3-way Press-1 Calls DOC Started: 2023-11-13 Updated: 2023-11-18 +Agent 3-way Press-1 Calls DOC Started: 2023-11-13 Updated: 2023-12-28 This document will go over how to set up Agent Screen 3-way calls with outside @@ -8,6 +8,7 @@ customer. NOTE: This requires svn/trunk revision 3778 or higher!!! + What is an Agent Screen 3-way calls with an outside user that has to press-1? The purpose of this feature is to allow agents using the Agent Screen the ability to call an outside number as part of a 3-way call and require that the outside called party press 1 on their phone before they will be bridged to the agent and their customer. To make this work, instead of just sending the "phone_number" you want to call by itself, you will need to send a dial-string that has a reserved prefix for this feature (this is "49907"), then you will need to add the dial_prefix you want to use for the call to the outside-agent(for example: '9'), then the phone_code of '1' then the "phone_number" (for this example: '7275551212'), so the resulting dialstring you would want to use would be "49907917275551212", you will also must check the DIAL OVERRIDE checkbox before clicking on the "DIAL WITH CUSTOMER" button for this to work properly. Alternatively, you can use the Agent API's "transfer_conference" function with the phone_number field set to "49907917275551212" and the "dial_override" variable to "YES". @@ -17,6 +18,13 @@ On the agent side, after placing the 3-way call while waiting for the called-par All activity for these calls are logged, with the logs being visible in the Admin Modify Lead page, in the "3-WAY PRESS LOGS FOR THIS LEAD" section. +Outside User Multi-Call: + +A newer option(included in svn/trunk rev 3792) added to this feature allows the agent to place multiple(up to 10) concurrent phone calls to outside users at the same time and the outside user that presses 1 first will get sent to the user and customer session. This feature only works with the Agent API "transfer_conference" function initiating the 3-way call, and the multiple phone numbers are to be sent through the "multi_dial_phones" variable as a list of comma-separated phone numbers. Here is an example URL for this: + +https://server/agc/api.php?source=outsidexfer&user=6666&pass=XXXXXXXXXXXXXXX&function=transfer_conference&value=DIAL_WITH_CUSTOMER&cid_choice=CUSTOMER&agent_user=7777&phone_number=49907819991991999&dial_override=YES&multi_dial_phones=7275551212,7275551213,7275551214 + + How do I configure this on my system? @@ -24,6 +32,23 @@ All that is required is the lines below be added to the System Settings "Custom +Is there any reporting available for this feature? + +Yes, the "3-Way Press Log Report" is available on the "Reports -> Admin Utilities" page. This report will display the logs of the 3-way phone calls that are placed to outside-users from the agent screen as detailed in this document. You can search by date range and filter by agent user and/or outside-user-phone_number. The outside-user call records shown in black are successful transfer calls, while the records shown in red are unsuccessful outside-agent calls. These records include both single 3-way phone calls and multi-3-way phone calls. As for the events shown in the Results column, here is what they mean: + +Started = All calls will have this event, it simply means the outside-user call was launched. +Answered = The outside-user call was answered. +Accepted = The outside-user pressed '1' to accept the call. +Reserved = The agent screen approves of the outside-user call and prepares for the transfer. +Transfer = The outside-user call is transferred to the agent and customer. +Declined = The outside-user call did not press '1' to accept the call. +Too Slow = Multi-Call Only, The outside-user did press '1' to accept the call, but another outside-user pressed '1' before them. +Defeated = Multi-Call Only, another outside-user pressed '1' before them, so this call was hung up. +Hungup = Either the call timed out or another outside-user pressed '1' before them, so this call was hung up. + + + + SYSTEM SETTINGS DIALPLAN ENTRIES, PUT AT THE BOTTOM OF THE ENTRY!!! : ------------------------------------------------------------------------- @@ -110,8 +135,18 @@ result TEXT, index(call_date), index(caller_code), index(call_3way_id), -index(lead_id) +index(lead_id), +index(phone_number) ) ENGINE=MyISAM; CREATE TABLE vicidial_3way_press_log_archive LIKE vicidial_3way_press_log; CREATE UNIQUE INDEX vdpla on vicidial_3way_press_log_archive (call_date,caller_code,user); + +CREATE TABLE vicidial_3way_press_multi ( +user VARCHAR(20) PRIMARY KEY, +call_date DATETIME, +phone_numbers VARCHAR(255) default '', +phone_numbers_ct TINYINT(3) default '0', +status VARCHAR(40) default '', +index(call_date) +) ENGINE=MyISAM; diff --git a/agc_2-X/trunk/docs/AGENT_API.txt b/agc_2-X/trunk/docs/AGENT_API.txt index f467006e..ea16380e 100644 --- a/agc_2-X/trunk/docs/AGENT_API.txt +++ b/agc_2-X/trunk/docs/AGENT_API.txt @@ -1,4 +1,4 @@ -AGENT API DOCUMENT Started: 2008-07-03 Updated: 2023-04-13 +AGENT API DOCUMENT Started: 2008-07-03 Updated: 2023-12-22 This document describes the functions of an API(Application Programming Interface) for the VICIDIAL Agent screen. This functionality will be rather limited at first @@ -715,6 +715,8 @@ VALUES: OPTIONAL, defines what caller ID number to use when doing DIAL_WITH_CUSTOMER or PARK_CUSTOMER_DIAL cid_choice - OPTIONAL, alternate method for caller ID number to use when doing DIAL_WITH_CUSTOMER or PARK_CUSTOMER_DIAL: 'CAMPAIGN','AGENT_PHONE','CUSTOMER','CUSTOM_CID' + multi_dial_phones - + OPTIONAL, for use only with "Agent 3-way Press-1 Calls", contains up to 10 phone numbers separated by commas: "2125551212,4075551212,3125551212" (duplicates will be removed) EXAMPLE URLS: http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=HANGUP_XFER diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index 362307b6..874dc235 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -4944,7 +4944,7 @@ CREATE TABLE vicidial_agent_notifications ( notification_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, entry_date DATETIME DEFAULT current_timestamp(), recipient VARCHAR(20) DEFAULT NULL, -recipient_type ENUM('USER','USER_GROUP','CAMPAIGN') DEFAULT NULL, +recipient_type ENUM('USER','USER_GROUP','CAMPAIGN','ALT_DISPLAY') DEFAULT NULL, notification_date DATETIME DEFAULT current_timestamp(), notification_retry ENUM('Y','N') DEFAULT 'N', notification_text TEXT DEFAULT NULL, @@ -5086,7 +5086,8 @@ result TEXT, index(call_date), index(caller_code), index(call_3way_id), -index(lead_id) +index(lead_id), +index(phone_number) ) ENGINE=MyISAM; CREATE TABLE vicidial_hci_live_agents ( @@ -5161,6 +5162,15 @@ modify_date DATETIME, unique index vpncdc_phone_number (phone_number) ) ENGINE=MyISAM; +CREATE TABLE vicidial_3way_press_multi ( +user VARCHAR(20) PRIMARY KEY, +call_date DATETIME, +phone_numbers VARCHAR(255) default '', +phone_numbers_ct TINYINT(3) default '0', +status VARCHAR(40) default '', +index(call_date) +) ENGINE=MyISAM; + ALTER TABLE vicidial_email_list MODIFY message text character set utf8; @@ -5560,4 +5570,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues', UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1702',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1703',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/agc_2-X/trunk/extras/upgrade_2.14.sql b/agc_2-X/trunk/extras/upgrade_2.14.sql index dfe099ae..e8416682 100644 --- a/agc_2-X/trunk/extras/upgrade_2.14.sql +++ b/agc_2-X/trunk/extras/upgrade_2.14.sql @@ -2178,7 +2178,7 @@ CREATE TABLE vicidial_agent_notifications ( notification_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, entry_date DATETIME DEFAULT current_timestamp(), recipient VARCHAR(20) DEFAULT NULL, -recipient_type ENUM('USER','USER_GROUP','CAMPAIGN') DEFAULT NULL, +recipient_type ENUM('USER','USER_GROUP','CAMPAIGN','ALT_DISPLAY') DEFAULT NULL, notification_date DATETIME DEFAULT current_timestamp(), notification_retry ENUM('Y','N') DEFAULT 'N', notification_text TEXT DEFAULT NULL, @@ -2564,3 +2564,18 @@ unique index vpncdc_phone_number (phone_number) ) ENGINE=MyISAM; UPDATE system_settings SET db_schema_version='1702',db_schema_update_date=NOW() where db_schema_version < 1702; + +ALTER TABLE vicidial_agent_notifications MODIFY recipient_type ENUM('USER','USER_GROUP','CAMPAIGN','ALT_DISPLAY') DEFAULT NULL; + +CREATE TABLE vicidial_3way_press_multi ( +user VARCHAR(20) PRIMARY KEY, +call_date DATETIME, +phone_numbers VARCHAR(255) default '', +phone_numbers_ct TINYINT(3) default '0', +status VARCHAR(40) default '', +index(call_date) +) ENGINE=MyISAM; + +CREATE INDEX vdplpn on vicidial_3way_press_log (phone_number); + +UPDATE system_settings SET db_schema_version='1703',db_schema_update_date=NOW() where db_schema_version < 1703; diff --git a/agc_2-X/trunk/www/agc/api.php b/agc_2-X/trunk/www/agc/api.php index e5567daa..e39261da 100644 --- a/agc_2-X/trunk/www/agc/api.php +++ b/agc_2-X/trunk/www/agc/api.php @@ -111,10 +111,11 @@ # 230413-1957 - Fix for send_notification user group permissions # 230519-0731 - Fix for input variable filtering # 231129-1457 - Added refresh_panel function +# 231222-2105 - Added multi_dial_phones option to the transfer_conference function # -$version = '2.14-76'; -$build = '231129-1457'; +$version = '2.14-77'; +$build = '231222-2105'; $php_script = 'api.php'; $startMS = microtime(); @@ -288,6 +289,8 @@ if (isset($_GET["text_weight"])) {$text_weight=$_GET["text_weight"];} elseif (isset($_POST["text_weight"])) {$text_weight=$_POST["text_weight"];} if (isset($_GET["text_color"])) {$text_color=$_GET["text_color"];} elseif (isset($_POST["text_color"])) {$text_color=$_POST["text_color"];} +if (isset($_GET["multi_dial_phones"])) {$multi_dial_phones=$_GET["multi_dial_phones"];} + elseif (isset($_POST["multi_dial_phones"])) {$multi_dial_phones=$_POST["multi_dial_phones"];} $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); @@ -349,6 +352,7 @@ $close_window_link=preg_replace("/[^-_0-9a-zA-Z]/","",$close_window_link); $dnc_check=preg_replace("/[^-_0-9a-zA-Z]/","",$dnc_check); $campaign_dnc_check=preg_replace("/[^-_0-9a-zA-Z]/","",$campaign_dnc_check); $notification_date = preg_replace('/[^- \:0-9]/','',$notification_date); +$multi_dial_phones = preg_replace('/[^\,0-9]/','',$multi_dial_phones); if ($non_latin < 1) { @@ -4208,13 +4212,53 @@ if ($function == 'transfer_conference') { if ($SUCCESS > 0) { + $stmtVP=''; + $multi_dial_phones_OUTPUT=''; + $multi_dial_phones_STRING=''; + if (strlen($multi_dial_phones) > 4) + { + $multi_dial_phonesARY=array(); + $multi_dial_phones_ct=0; + if (preg_match("/,/",$multi_dial_phones)) + { + $multi_dial_phonesARY = explode(',',$multi_dial_phones); + $multi_dial_phones_ct = count($multi_dial_phonesARY); + } + else + { + $multi_dial_phonesARY[0] = $multi_dial_phones; + $multi_dial_phones_ct = 1; + } + $mp=0; + $vp=0; + while ($mp < $multi_dial_phones_ct) + { + $temp_phone = $multi_dial_phonesARY[$mp]; + if ( (strlen($temp_phone) > 4) and (strlen($temp_phone) < 19) and (!preg_match("/$temp_phone/",$multi_dial_phones_STRING)) ) + { + if ($vp > 0) {$multi_dial_phones_STRING .= ",";} + $multi_dial_phones_STRING .= "$temp_phone"; + $vp++; + } + $mp++; + } + $affected_rowsVP=0; + if ($vp > 0) + { + $stmtVP = "INSERT IGNORE INTO vicidial_3way_press_multi SET user='$agent_user',call_date=NOW(),phone_numbers='$multi_dial_phones_STRING',phone_numbers_ct='$vp',status='NEW' ON DUPLICATE KEY UPDATE call_date=NOW(),phone_numbers='$multi_dial_phones_STRING',phone_numbers_ct='$vp',status='NEW';"; + $rslt=mysql_to_mysqli($stmtVP, $link); + $affected_rowsVP = mysqli_affected_rows($link); + } + $multi_dial_phones_OUTPUT = "|Multi-phones: $vp $mp $affected_rowsVP"; + } + $stmt="UPDATE vicidial_live_agents set external_transferconf='$external_transferconf' where user='$agent_user';"; if ($format=='debug') {echo "\n";} if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $result = _QXZ("SUCCESS"); $result_reason = _QXZ("transfer_conference function set"); - $data = "$callerid"; + $data = "$callerid$multi_dial_phones_OUTPUT"; echo "$result: $result_reason - $value|$ingroup_choices|$phone_number|$consultative|$agent_user|$data|\n"; api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); } diff --git a/agc_2-X/trunk/www/agc/conf_exten_check.php b/agc_2-X/trunk/www/agc/conf_exten_check.php index 4102698e..5503c70d 100644 --- a/agc_2-X/trunk/www/agc/conf_exten_check.php +++ b/agc_2-X/trunk/www/agc/conf_exten_check.php @@ -1508,11 +1508,11 @@ if ($ACTION == 'refresh') { // Check for alerts // Activate notifications that are ready to be sent systemwide - $upd_stmt="update vicidial_agent_notifications set notification_status='READY' where notification_date<=now() and notification_status='QUEUED'"; + $upd_stmt="update vicidial_agent_notifications set notification_status='READY' where notification_date<=now() and notification_status='QUEUED';"; $upd_rslt=mysql_to_mysqli($upd_stmt, $link); # gather all READY notifications to be triggered, limit with $user, $VU_user_group, $campaign - $alert_stmt="select * from vicidial_agent_notifications where notification_status='READY' and ( (recipient_type='USER' and recipient='$user') or (recipient_type='USER_GROUP' and recipient='$VU_user_group') or (recipient_type='CAMPAIGN' and recipient='$campaign') ) order by notification_date asc limit 1"; + $alert_stmt="select * from vicidial_agent_notifications where notification_status='READY' and ( (recipient_type='USER' and recipient='$user') or (recipient_type='USER_GROUP' and recipient='$VU_user_group') or (recipient_type='CAMPAIGN' and recipient='$campaign') ) order by notification_date asc limit 1;"; $alert_rslt=mysql_to_mysqli($alert_stmt, $link); while ($alert_row=mysqli_fetch_array($alert_rslt)) { diff --git a/agc_2-X/trunk/www/vicidial/AST_3way_press_log_report.php b/agc_2-X/trunk/www/vicidial/AST_3way_press_log_report.php new file mode 100644 index 00000000..9d530674 --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/AST_3way_press_log_report.php @@ -0,0 +1,744 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 231228-2204 - First build +# + +$startMS = microtime(); + +require("dbconnect_mysqli.php"); +require("functions.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} + elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search_archived_data"];} + elseif (isset($_POST["search_archived_data"])) {$search_archived_data=$_POST["search_archived_data"];} + +$MT=array(); +$MT[0]=''; +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$start_screen=0; +if (!isset($group)) {$group = array();} +if (!isset($query_date)) {$query_date = $NOW_DATE; $start_screen=1;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); + +$report_name = '3-Way Press Log Report'; +$db_source = 'M'; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,report_default_format,allow_web_debug FROM system_settings;"; +$rslt=mysql_to_mysqli($stmt, $link); +#if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysqli_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $SSenable_languages = $row[4]; + $SSlanguage_method = $row[5]; + $SSreport_default_format = $row[6]; + $SSallow_web_debug = $row[7]; + } +if ($SSallow_web_debug < 1) {$DB=0;} +##### END SETTINGS LOOKUP ##### +########################################### + +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$log_tables_array=array("vicidial_3way_press_log"); +for ($t=0; $t 0) + { + $row=mysqli_fetch_row($rslt); + $VUselected_language = $row[0]; + } + +$auth=0; +$reports_auth=0; +$admin_auth=0; +$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',1,0); +if ($auth_message == 'GOOD') + {$auth=1;} + +if ($auth > 0) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $admin_auth=$row[0]; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $reports_auth=$row[0]; + + if ($reports_auth < 1) + { + $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + if ( ($reports_auth > 0) and ($admin_auth < 1) ) + { + $ADD=999999; + $reports_only_user=1; + } + } +else + { + $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); + if ($auth_message == 'LOCK') + { + $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + if ($auth_message == 'IPBLOCK') + { + $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; + exit; + } + +##### BEGIN log visit to the vicidial_report_log table ##### +$LOGip = getenv("REMOTE_ADDR"); +$LOGbrowser = getenv("HTTP_USER_AGENT"); +$LOGscript_name = getenv("SCRIPT_NAME"); +$LOGserver_name = getenv("SERVER_NAME"); +$LOGserver_port = getenv("SERVER_PORT"); +$LOGrequest_uri = getenv("REQUEST_URI"); +$LOGhttp_referer = getenv("HTTP_REFERER"); +$LOGbrowser=preg_replace("/\'|\"|\\\\/","",$LOGbrowser); +$LOGrequest_uri=preg_replace("/\'|\"|\\\\/","",$LOGrequest_uri); +$LOGhttp_referer=preg_replace("/\'|\"|\\\\/","",$LOGhttp_referer); +if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';} +else {$LOGserver_port = ":$LOGserver_port";} +$LOGfull_url = "$HTTPprotocol$LOGserver_name$LOGserver_port$LOGrequest_uri"; + +$LOGhostname = php_uname('n'); +if (strlen($LOGhostname)<1) {$LOGhostname='X';} +if (strlen($LOGserver_name)<1) {$LOGserver_name='X';} + +$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$webserver_id_ct = mysqli_num_rows($rslt); +if ($webserver_id_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $webserver_id = $row[0]; + } +else + { + ##### insert webserver entry + $stmt="INSERT INTO vicidial_webservers (webserver,hostname) values('$LOGserver_name','$LOGhostname');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $affected_rows = mysqli_affected_rows($link); + $webserver_id = mysqli_insert_id($link); + } + +$stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name |$query_date, $end_date, $phone_number, $file_download|', url='$LOGfull_url', webserver='$webserver_id';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$report_log_id = mysqli_insert_id($link); +##### END log visit to the vicidial_report_log table ##### + +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysqli_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect_mysqli.php"); + echo "\n"; + } + +$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$row=mysqli_fetch_row($rslt); +$LOGuser_group = $row[0]; + +$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$row=mysqli_fetch_row($rslt); +$LOGallowed_campaigns = $row[0]; +$LOGallowed_reports = $row[1]; +$LOGadmin_viewable_groups = $row[2]; +$LOGadmin_viewable_call_times = $row[3]; + +if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) + { + Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); + Header("HTTP/1.0 401 Unauthorized"); + echo _QXZ("You are not allowed to view this report").": |$PHP_AUTH_USER|$report_name|\n"; + exit; + } + +$LOGallowed_campaignsSQL=''; +$whereLOGallowed_campaignsSQL=''; +if ( (!preg_match('/\-ALL/i', $LOGallowed_campaigns)) ) + { + $rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns); + $rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL); + $LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')"; + $whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')"; + } +$regexLOGallowed_campaigns = " $LOGallowed_campaigns "; + +$LOGadmin_viewable_groupsSQL=''; +$vuLOGadmin_viewable_groupsSQL=''; +$whereLOGadmin_viewable_groupsSQL=''; +if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) ) + { + $rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups); + $rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL); + $LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; + $whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; + $vuLOGadmin_viewable_groupsSQL = "and vicidial_users.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; + } + +$LOGadmin_viewable_call_timesSQL=''; +$whereLOGadmin_viewable_call_timesSQL=''; +if ( (!preg_match('/\-\-ALL\-\-/i', $LOGadmin_viewable_call_times)) and (strlen($LOGadmin_viewable_call_times) > 3) ) + { + $rawLOGadmin_viewable_call_timesSQL = preg_replace("/ -/",'',$LOGadmin_viewable_call_times); + $rawLOGadmin_viewable_call_timesSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_call_timesSQL); + $LOGadmin_viewable_call_timesSQL = "and call_time_id IN('---ALL---','$rawLOGadmin_viewable_call_timesSQL')"; + $whereLOGadmin_viewable_call_timesSQL = "where call_time_id IN('---ALL---','$rawLOGadmin_viewable_call_timesSQL')"; + } + +$stmt="select user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$user_groups_to_print = mysqli_num_rows($rslt); +$i=0; +$user_groups=array(); +while ($i < $user_groups_to_print) + { + $row=mysqli_fetch_row($rslt); + $user_groups[$i] =$row[0]; + $i++; + } +$user_group_SQL = "and user_group IN('".implode("', '", $user_groups)."')"; +if (preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) {$user_group_SQL='';} + +$stmt="SELECT user,full_name,user_group from vicidial_users where active IN('Y','N') $user_group_SQL order by user;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$users_to_print = mysqli_num_rows($rslt); +$i=0; +$USERusers=array(); +$USERfull_names=array(); +$USERuser_groups=array(); +while ($i < $users_to_print) + { + $row=mysqli_fetch_row($rslt); + $USERusers[$i] = $row[0]; + $USERfull_names[$i] = $row[1]; + $USERuser_groups[$i] = $row[2]; + $i++; + } + + +$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date&phone_number=$phone_number&DB=$DB&user=$user$groupQS&search_archived_data=$search_archived_data"; + +$NWB = "\"HELP\""; + +if ($file_download < 1) + { + ?> + + + + + + \n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo ""._QXZ("$report_name")."\n"; + echo ""; + echo ""; + + $short_header=1; + + require("admin_header.php"); + + echo "\n"; + echo "\n"; + echo ""._QXZ("$report_name")." $NWB#3way_press_log$NWE\n"; + echo "
";
+	}
+
+if ($start_screen > 0)
+	{
+	echo "";
+	echo _QXZ("PLEASE SELECT A DATE RANGE BELOW AND CLICK SUBMIT")."\n";
+	echo " "._QXZ("NOTE: user and phone number are optional")."\n";
+	}
+
+else
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+
+	$query_date_BEGIN = "$query_date $time_BEGIN";   
+	$query_date_END = "$end_date $time_END";
+
+	if ($file_download < 1)
+		{
+		$ASCII_text.=_QXZ("3-Way Press Agent Report",24).": $user                     $NOW_TIME ($db_source)\n";
+		$ASCII_text.=_QXZ("Time range").": $query_date_BEGIN "._QXZ("to")." $query_date_END\n\n";
+		}
+	else
+		{
+		$file_output .= _QXZ("3-Way Press Agent Report",24).": $user                     $NOW_TIME ($db_source)\n";
+		$file_output .= _QXZ("Time range").": $query_date_BEGIN "._QXZ("to")." $query_date_END\n\n";
+		}
+
+	$statuses='-';
+	$statusesTXT='';
+	$statusesHEAD='';
+	$statusesHTML='';
+	$statusesFILE='';
+	$statusesARY=array();
+	$statusesARY[0]='';
+	$j=0;
+	$dates='-';
+	$date=array();
+	$calls=array();
+	$status=array();
+	$datesARY=array();
+	$datesARY[0]='';
+	$date_namesARY=array();
+	$date_namesARY[0]='';
+	$k=0;
+
+	$user_SQL='';
+	if (strlen($user) > 0) {$user_SQL = "and user='$user'";}
+	$phone_number_SQL='';
+	if (strlen($phone_number) > 0) {$phone_number_SQL = "and phone_number='$phone_number'";}
+
+	$Rcall_date=array();
+	$Ruser=array();
+	$Rfull_name=array();
+	$Rlead_id=array();
+	$Rphone_number=array();
+	$Routbound_cid=array();
+	$Rresult=array();
+	$Rtransfer=array();
+
+	$TOTtotal=0;
+	$TOTanswered=0;
+	$TOTaccepted=0;
+	$TOTdeclined=0;
+	$TOTtooslow=0;
+	$TOTdefeated=0;
+	$TOTtransfer=0;
+
+	$stmt = "SELECT date_format(call_date, '%Y-%m-%d %H:%i:%s') as date,user,lead_id,phone_number,outbound_cid,result from ".$vicidial_3way_press_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' $user_SQL $phone_number_SQL order by call_date desc limit 100000";
+	$rslt=mysql_to_mysqli($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysqli_num_rows($rslt);
+	$i=0;
+	while ($i < $rows_to_print)
+		{
+		$row=mysqli_fetch_row($rslt);
+		$Rcall_date[$i] =		$row[0];
+		$Ruser[$i] =			$row[1];
+		$Rfull_name[$i] =		_QXZ("-- NOT FOUND --");
+		$Rlead_id[$i] =			$row[2];
+		$Rphone_number[$i] =	$row[3];
+		$Routbound_cid[$i] =	$row[4];
+		$Rresult[$i] =			$row[5];
+		$Rtransfer[$i] =		0;
+		$i++;
+		}
+
+	$ASCII_text_data='';
+	$file_output_data='';
+	$i=0;
+	while ($i < $rows_to_print)
+		{
+		$h=0;   $name_found=0;
+		while ( ($h < $users_to_print) and ($name_found < 1) )
+			{
+			if ($Ruser[$i] == $USERusers[$h])
+				{$Rfull_name[$i] = $USERfull_names[$h];   $name_found++;}
+			$h++;
+			}
+		if ( ($name_found > 0) or (preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) )
+			{
+			# print record
+			$BD='';   $ED='';
+			$TOTtotal++;
+			if (preg_match("/Answered/",$Rresult[$i])) {$TOTanswered++;}
+			if (preg_match("/Accepted/",$Rresult[$i])) {$TOTaccepted++;}
+			if (preg_match("/Declined/",$Rresult[$i])) {$TOTdeclined++;}
+			if (preg_match("/Too Slow/",$Rresult[$i])) {$TOTtooslow++;}
+			if (preg_match("/Defeated/",$Rresult[$i])) {$TOTdefeated++;}
+			if (preg_match("/Transfer/",$Rresult[$i])) {$TOTtransfer++;   $Rtransfer[$i]++;}
+			else
+				{$BD='';   $ED='';}
+			$file_output_data .= "\"".trim($Rcall_date[$i])."\",\"".trim($Rfull_name[$i])."\",\"".trim($Rlead_id[$i])."\",\"".trim($Rphone_number[$i])."\",\"".trim($Routbound_cid[$i])."\",\"".trim($Rtransfer[$i])."\",\"".trim($Rresult[$i])."\"\n";
+			$Rcall_date[$i] =		$BD.sprintf("%19s", $Rcall_date[$i]).$ED;
+			$Rfull_name[$i] =		"$Ruser[$i] - $Rfull_name[$i]";
+			if (mb_strlen($Rfull_name[$i],'utf-8')>40)
+							{$Rfull_name[$i] = mb_substr($Rfull_name[$i],0,40,'utf-8') . '...';}
+			$Rfull_name[$i] =		$BD.sprintf("%-43s", "$Rfull_name[$i]").$ED;
+			$Rlead_id[$i] =			$BD.sprintf("%-9s", $Rlead_id[$i]).$ED;
+			$Rphone_number[$i] =	$BD.sprintf("%-10s", $Rphone_number[$i]).$ED;
+			$Routbound_cid[$i] =	$BD.sprintf("%-10s", $Routbound_cid[$i]).$ED;
+			$Rresult[$i] =			$BD.sprintf("%-200s", $Rresult[$i]).$ED;
+			$ASCII_text_data.="| $Rcall_date[$i] | $Rfull_name[$i] | $Rlead_id[$i] | $Rphone_number[$i] | $Routbound_cid[$i] | $Rresult[$i]\n";
+			}
+		$i++;
+		}
+
+	if (strlen($ASCII_text_data) > 8)
+		{
+		$TOTtotal = sprintf("%10s", $TOTtotal);
+		$TOTanswered = sprintf("%10s", $TOTanswered);
+		$TOTaccepted = sprintf("%10s", $TOTaccepted);
+		$TOTdeclined = sprintf("%10s", $TOTdeclined);
+		$TOTtooslow = sprintf("%10s", $TOTtooslow);
+		$TOTdefeated = sprintf("%10s", $TOTdefeated);
+		$TOTtransfer = sprintf("%10s", $TOTtransfer);
+
+		$ASCII_text.=""._QXZ("Results Summary").":\n";
+		$ASCII_text.="+------------+------------+\n";
+		$ASCII_text.="|    "._QXZ("TOTAL",7)." | $TOTtotal |\n";
+		$ASCII_text.="| "._QXZ("Answered",10)." | $TOTanswered |\n";
+		$ASCII_text.="| "._QXZ("Accepted",10)." | $TOTaccepted |\n";
+		$ASCII_text.="| "._QXZ("Declined",10)." | $TOTdeclined |\n";
+		$ASCII_text.="| "._QXZ("Too Slow",10)." | $TOTtooslow |\n";
+		$ASCII_text.="| "._QXZ("Defeated",10)." | $TOTdefeated |\n";
+		$ASCII_text.="| "._QXZ("Transfer",10)." | $TOTtransfer |\n";
+		$ASCII_text.="+------------+------------+\n";
+
+		$ASCII_text.="\n"._QXZ("Results Detail").":\n";
+		$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+------------\n";
+		$ASCII_text.="| "._QXZ("Date Time",19)." | "._QXZ("User Agent",43)." | "._QXZ("Lead",9)." | "._QXZ("Phone",10)." | "._QXZ("CID",10)." | "._QXZ("Results",20)."\n";
+		$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+------------\n";
+		$ASCII_text.=$ASCII_text_data;
+		$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+------------\n";
+
+		$file_output .= "\""._QXZ("Results Summary").":\"\n";
+		$file_output .= "\""._QXZ("TOTAL")."\",\"".trim($TOTtotal)."\"\n";
+		$file_output .= "\""._QXZ("Answered")."\",\"".trim($TOTanswered)."\"\n";
+		$file_output .= "\""._QXZ("Accepted")."\",\"".trim($TOTaccepted)."\"\n";
+		$file_output .= "\""._QXZ("Declined")."\",\"".trim($TOTdeclined)."\"\n";
+		$file_output .= "\""._QXZ("Too Slow")."\",\"".trim($TOTtooslow)."\"\n";
+		$file_output .= "\""._QXZ("Defeated")."\",\"".trim($TOTdefeated)."\"\n";
+		$file_output .= "\""._QXZ("Transfer")."\",\"".trim($TOTtransfer)."\"\n";
+		$file_output .= "\n";
+		$file_output .= "\""._QXZ("Results Detail").":\"\n";
+		$file_output .= "\""._QXZ("Date Time")."\",\""._QXZ("User Agent")."\",\""._QXZ("Lead")."\",\""._QXZ("Phone")."\",\""._QXZ("CID")."\",\""._QXZ("Transfer")."\",\""._QXZ("Results")."\"\n";
+		$file_output .= $file_output_data;
+		}
+	else
+		{
+		$ASCII_text.=_QXZ("No Results Found",29)."\n";
+		$file_output .= _QXZ("No Results Found")."\n";
+		}
+
+
+
+
+/*
+
+	$TOTcalls = sprintf("%7s", $TOTcalls);
+	$CIScountTOT = sprintf("%7s", $CIScountTOT);
+	$DNCcountPCT = ( MathZDC($DNCcountTOT, $CIScountTOT) * 100);
+	#$DNCcountPCT = round($DNCcountPCT,2);
+	$DNCcountPCT = round($DNCcountPCT);
+	#$DNCcountPCT = sprintf("%3.2f", $DNCcountPCT);
+	$DNCcountPCT = sprintf("%6s", $DNCcountPCT);
+
+
+	if ($file_download < 1)
+		{
+		$ASCII_text.="+------------+--------+--------+--------+$statusesHEAD\n";
+		$ASCII_text.="| "._QXZ("TOTALS",10)." | $TOTcalls| $CIScountTOT| $DNCcountPCT%|$SUMstatusesHTML\n";
+		$ASCII_text.="+------------+--------+--------+--------+$statusesHEAD\n";
+
+		$ASCII_text.="\n\n
"; + } + else + { + $file_output .= _QXZ("TOTALS").",".trim($TOTcalls).",".trim($CIScountTOT).",".trim($DNCcountPCT)."%,".trim($SUMstatusesFILE)."\n"; + } + } +*/ + + } // END USER CHECK + +if ($file_download > 0) + { + $US='_'; + $FILE_TIME = date("Ymd-His"); + $CSVfilename = "3WAY_PRESS_$FILE_TIME.csv"; + + // We'll be outputting a TXT file + header('Content-type: application/octet-stream'); + + // It will be called 3WAY_PRESS_20090209-121212.txt + header("Content-Disposition: attachment; filename=\"$CSVfilename\""); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + ob_clean(); + flush(); + + echo "$file_output"; + + if ($db_source == 'S') + { + mysqli_close($link); + $use_slave_server=0; + $db_source = 'M'; + require("dbconnect_mysqli.php"); + } + + $endMS = microtime(); + $startMSary = explode(" ",$startMS); + $endMSary = explode(" ",$endMS); + $runS = ($endMSary[0] - $startMSary[0]); + $runM = ($endMSary[1] - $startMSary[1]); + $TOTALrun = ($runS + $runM); + + $stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + + exit; + } + + +echo "
"; +echo "
"._QXZ("Dates").":
"; +echo "\n"; +echo ""; + +?> + + "._QXZ("to")."
"; + +?> + +
"._QXZ("User").":
"; +echo "\n"; +echo "
"._QXZ("Phone Number").":
"; +echo "\n"; + +if ($archives_available=="Y") + { + echo ""._QXZ("Search archived data")."\n"; + } + +echo "

\n"; +echo "
        "; +echo ""; +echo " "._QXZ("DOWNLOAD")." | \n"; +if (strlen($user) > 1) + { + echo " "._QXZ("USER")." | \n"; + echo " "._QXZ("USER STATS")." | \n"; + } +else + {echo " "._QXZ("USERS")." | \n";} +echo ""._QXZ("REPORTS")." \n"; +echo "
"; + +echo "
"; + +# print the page +echo $ASCII_text; + + +echo "
\n"; + +echo "\n"; +echo "
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
+
+$m=0;
+$sort_order=array();
+while ($m < $k)
+	{
+	$sort_split = explode("-----",$TOPsort[$m]);
+	$i = $sort_split[1];
+	$sort_order[$m] = "$i";
+
+	if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
+		{echo "              \n";}
+	else
+		{
+		echo "              ";
+		$TOPsortPLOT = ( MathZDC($TOPsortTALLY[$i], $TOPsortMAX) * 120 );
+		$h=0;
+		while ($h <= $TOPsortPLOT)
+			{
+			echo " ";
+			$h++;
+			}
+		echo "\n";
+		}
+	$m++;
+	}
+
+echo "\n";
+
+if ($db_source == 'S')
+	{
+	mysqli_close($link);
+	$use_slave_server=0;
+	$db_source = 'M';
+	require("dbconnect_mysqli.php");
+	}
+
+$endMS = microtime();
+$startMSary = explode(" ",$startMS);
+$endMSary = explode(" ",$endMS);
+$runS = ($endMSary[0] - $startMSary[0]);
+$runM = ($endMSary[1] - $startMSary[1]);
+$TOTALrun = ($runS + $runM);
+
+$stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+
+
+?>
+
+
diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php
index d260cf80..dc3d9279 100644
--- a/agc_2-X/trunk/www/vicidial/admin.php
+++ b/agc_2-X/trunk/www/vicidial/admin.php
@@ -125,9 +125,9 @@ $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF);
 $QUERY_STRING = getenv("QUERY_STRING");
 $groups=array();
 
-$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report';
+$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, 3-Way Press Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report';
 
-$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report, VERM QA Links';
+$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, 3-Way Press Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report, VERM QA Links';
 
 $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information';
 
@@ -6123,12 +6123,13 @@ if ($SSscript_remove_js > 0)
 # 231129-0936 - Added daily_phone_number_call_limit campaign setting
 # 231129-1541 - Added refresh_panel Agent API function
 # 231204-0858 - Added Agent LAGGED Summary Report
+# 231227-2217 - Added 3-Way Press Log Report
 #
 
 # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
 
-$admin_version = '2.14-904a';
-$build = '231204-0858';
+$admin_version = '2.14-905a';
+$build = '231227-2217';
 
 $STARTtime = date("U");
 $SQLdate = date("Y-m-d H:i:s");
@@ -50548,6 +50549,7 @@ if ($ADD==999994)
 		echo "
  • "._QXZ("Hangup Cause Report")."\n"; echo "
  • "._QXZ("SIP Event Report")."\n"; echo "
  • "._QXZ("AMD Log Report")."\n"; + echo "
  • "._QXZ("3-Way Press Log Report")."\n"; echo "
  • "._QXZ("Inbound DID Detail Report")." | "._QXZ("User Inbound Calls Today")."\n"; if ($KHOMP_enabled > 0) {echo "
  • "._QXZ("Dialer KHOMP Admin Tool")."\n";} diff --git a/agc_2-X/trunk/www/vicidial/help_documentation.txt b/agc_2-X/trunk/www/vicidial/help_documentation.txt index b128a823..62e7dbf2 100644 --- a/agc_2-X/trunk/www/vicidial/help_documentation.txt +++ b/agc_2-X/trunk/www/vicidial/help_documentation.txt @@ -1,4 +1,4 @@ -# version: 20231129094101 +# version: 20231228184301 users-user User ID This field is where you put the users ID number, can be up to 20 digits in length, Must be at least 2 characters in length. We strongly recommend not reusing user accounts for different users, for reporting accuracy. To disable a user account, set the Active option to -N-. users-pass Password This field is where you put the users password. Must be at least 2 characters in length, unless the User Password Minimum Length system setting is enabled, which will require a longer password. Only letters and numbers are allowed in user passwords. 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. users-force_change_password Force Change Password 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. @@ -1576,3 +1576,4 @@ user_stats-lead_searches Lead Searches for this Time Period This section wi user_stats-preview_skips Preview Lead Skips for this Time Period This section will show the previewed leads that were skipped by the agent during this time period, most recent skips first.
    DATE TIME = The date-time-stamp when the previewed lead was skipped by the agent.
    LEAD = The Lead ID of the lead that was skipped. You can click on this link to see more details about this lead, including past calls and the ability to modify lead information.
    STATUS = The status of the lead that was skipped.
    COUNT = The called count of the lead that was skipped.
    CAMPAIGN = The campaign the agent was logged into when this previewed lead was skipped. user_stats-switch_leads Agent Lead Switches for this Time Period This section will show the Agent Lead Switches that happened during the selected time period, a lead switch is when an inbound call goes to the agent, the agent searches for a lead in the system and they select another lead to tie their current call to. Most recent lead switch is shown first.
    DATE TIME = The date-time-stamp when the lead was switched by the agent.
    FROM LEAD ID = The Lead ID of the lead that the agent started the call with. You can click on this link to see more details about this lead, including past calls and the ability to modify lead information.
    TO LEAD ID = The Lead ID of the lead that the agent switched the call to during the call. You can click on this link to see more details about this lead, including past calls and the ability to modify lead information.
    CALL ID = The original Call ID in the system before the Lead ID was switched.
    UNIQUEID = The phone system uniqieid of the call that had its lead switched.
    PHONE = The phone number of the lead that was switched.
    CAMPAIGN = The campaign the agent was logged into when they switched the lead. user_stats-pause_code_approvals Manager Pause Code Approvals for this Time Period This section will show the agent pause code approvals that this Manager User approved during the selected time period, only for pause codes that require manager approval, most recent approvals first.
    DATE TIME = The date-time-stamp when the agent pause code was approved by this user.
    AGENT = The User ID of the agent that had their pause code approved.
    AGENT USER GROUP = The User Group of the agent at the time that they had their pause code approved.
    CAMPAIGN = The campaign the agent was logged into when they had their pause code approved.
    PAUSE CODE = The pause code that was approved. +3way_press_log 3-Way Press Log Report This report will display the logs of the 3-way phone calls that are placed to outside-users from the agent screen as detailed in the AGENT_3WAY_PRESS-1_CALLS.txt document. These calls require the outside-agent to press -1- on their phone to accept the transfer before they can speak to the agent and customer. You can search by date range and filter by agent user and-or outside-user-phone_number. The outside-user call records shown in black are successful transfer calls, while the records shown in red are unsuccessful outside-agent calls. These records include both single 3-way phone calls and multi-3-way phone calls. As for the events shown in the Results column, here is what they mean:
    Started = All calls will have this event, it simply means the outside-user call was launched.
    Answered = The outside-user call was answered.
    Accepted = The outside-user pressed -1- to accept the call.
    Reserved = The agent screen approves of the outside-user call and prepares for the transfer.
    Transfer = The outside-user call is transferred to the agent and customer.
    Declined = The outside-user call did not press -1- to accept the call.
    Too Slow = Multi-Call Only, The outside-user did press -1- to accept the call, but another outside-user pressed -1- before them.
    Defeated = Multi-Call Only, another outside-user pressed -1- before them, so this call was hung up.
    Hungup = Either the call timed out or another outside-user pressed -1- before them, so this call was hung up.