From cf8bff335470ae6ef182f52ba371474defedc7ae Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 25 Mar 2011 18:41:08 +0000 Subject: [PATCH] Added user recording override settings checking, for remote agent recording git-svn-id: svn://192.168.202.10@1631 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 4 ++- agi/agi-VDAD_ALL_inbound.agi | 29 +++++++++++++++++--- agi/agi-VDAD_ALL_outbound.agi | 51 +++++++++++++++++++++++++++++++---- agi/agi-VDAD_RINGALL.agi | 20 ++++++++++++++ 4 files changed, 94 insertions(+), 10 deletions(-) diff --git a/UPGRADE b/UPGRADE index 5d1510ff..3098f22c 100644 --- a/UPGRADE +++ b/UPGRADE @@ -523,7 +523,9 @@ OTHER CHANGES: 120. Added recording of Remote Agents calls per recording settings in campaigns. If recording is set to ALLCALLS or ALLFORCE then a recording will be initiated for the call upon routing to the Remote Agent and will be tied - to the R/ user and the lead_id. Also works with on-hook enabled. + to the R/ user and the lead_id. Also works with on-hook enabled. User- + level recording settings for the start user of the remote agent will + also be followed. diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 2eedc6e5..145a4225 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -147,6 +147,7 @@ # 110224-1735 - Added compatibility with QM phone environment logging # 110303-2338 - Added on-hook agent compatibility and rewrote a few sections # 110324-2330 - Added recording of remote agent calls, per in-group and campaign recording settings +# 110325-1409 - Added user recording override settings checking for remote agent recording # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -158,7 +159,7 @@ $wait_prompt_runs=0; $at='@'; $S='*'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=169; +$mysql_log_count=173; $one_mysql_log=0; @@ -2471,13 +2472,15 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $dbhP=$dbhA; $mysql_count='01138'; $MEL_aff_rows=$RALaffected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- REMOTE EXTEN LOG : |$RALaffected_rows|CID changed: \"$callerid\" \<$phone_number\>\n|$stmtA|"; &agi_output;} + + ### get the recording settings for the campaign that this remote agent is logged into if ( (length($extension_campaign_id) > 0) && ($ingroup_recording_override =~ /DISABLED/) ) { $stmtA = "SELECT campaign_recording,campaign_rec_filename FROM vicidial_campaigns where campaign_id='$extension_campaign_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='01134'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='01170'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -2486,6 +2489,24 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) } $sthA->finish(); } + ### look for the recording settings for the start user of this remote agent + if (length($ra_user) > 0) + { + $stmtA = "SELECT vicidial_recording_override,vicidial_recording FROM vicidial_users where user='$ra_user';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsVUrec=$sthA->rows; + $dbhP=$dbhA; $mysql_count='01171'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging; + if ($sthArowsVUrec > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] !~ /DISABLED/) + {$ingroup_recording_override = $aryA[0];} + if ($aryA[1] < 1) + {$ingroup_recording_override = 'NONE';} + } + $sthA->finish(); + } ### if recording is enabled then start recording on this call before sending to a remote agent if ($ingroup_recording_override =~ /ALLCALLS|ALLFORCE/) @@ -2494,7 +2515,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='01172'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -2533,7 +2554,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) ### insert record into recording_log table ### $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$phone_number','$now_date','$now_date_epoch','0','$campaign_rec_filename','$insert_lead_id','$VDADuser','$campaign_rec_filename','$uniqueid');"; $RLRAaffected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='01173'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;} } } diff --git a/agi/agi-VDAD_ALL_outbound.agi b/agi/agi-VDAD_ALL_outbound.agi index 8c4488d4..93d6f54a 100644 --- a/agi/agi-VDAD_ALL_outbound.agi +++ b/agi/agi-VDAD_ALL_outbound.agi @@ -83,12 +83,13 @@ # 110224-1733 - Added compatibility with QM phone environment logging # 110303-2316 - Added condition that would not allow calls to be sent to agent with ringing inbound call # 110324-2326 - Added recording of remote agent calls, per in-group and campaign recording settings +# 110325-1410 - Added user recording override settings checking for remote agent recording # $script = 'agi-VDAD_ALL_outbound.agi'; $AGILOG = '0'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=71; +$mysql_log_count=76; $one_mysql_log=0; @@ -1758,6 +1759,26 @@ while ($drop_timer <= $DROP_TIME) $dbhP=$dbhA; $mysql_count='01064'; $MEL_aff_rows=$RALaffected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- REMOTE EXTEN LOG : |$RALaffected_rows|CID changed: \"$callerid\" \<$VDADphone\>\n|$stmtA|"; &agi_output;} + + ### look for the recording settings for the start user of this remote agent + if (length($ra_user) > 0) + { + $stmtA = "SELECT vicidial_recording_override,vicidial_recording FROM vicidial_users where user='$ra_user';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsVUrec=$sthA->rows; + $dbhP=$dbhA; $mysql_count='01072'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging; + if ($sthArowsVUrec > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] !~ /DISABLED/) + {$campaign_recording = $aryA[0];} + if ($aryA[1] < 1) + {$campaign_recording = 'NONE';} + } + $sthA->finish(); + } + ### if recording is enabled then start recording on this call before sending to a remote agent if ($campaign_recording =~ /ALLCALLS|ALLFORCE/) { @@ -1765,7 +1786,7 @@ while ($drop_timer <= $DROP_TIME) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='01073'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -1804,7 +1825,7 @@ while ($drop_timer <= $DROP_TIME) ### insert record into recording_log table ### $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','$VDADuser','$campaign_rec_filename','$uniqueid');"; $RLRAaffected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='01074'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;} } } @@ -2197,6 +2218,26 @@ while ($drop_timer <= $DROP_TIME) $dbhP=$dbhA; $mysql_count='01065'; $MEL_aff_rows=$RALaffected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- REMOTE EXTEN LOG : |$RALaffected_rows|CID changed: \"$callerid\" \<$VDADphone\>\n|$stmtA|"; &agi_output;} + + ### look for the recording settings for the start user of this remote agent + if (length($ra_user) > 0) + { + $stmtA = "SELECT vicidial_recording_override,vicidial_recording FROM vicidial_users where user='$ra_user';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsVUrec=$sthA->rows; + $dbhP=$dbhA; $mysql_count='01072'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging; + if ($sthArowsVUrec > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] !~ /DISABLED/) + {$campaign_recording = $aryA[0];} + if ($aryA[1] < 1) + {$campaign_recording = 'NONE';} + } + $sthA->finish(); + } + ### if recording is enabled then start recording on this call before sending to a remote agent if ($campaign_recording =~ /ALLCALLS|ALLFORCE/) { @@ -2204,7 +2245,7 @@ while ($drop_timer <= $DROP_TIME) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='01075'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -2243,7 +2284,7 @@ while ($drop_timer <= $DROP_TIME) ### insert record into recording_log table ### $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','$VDADuser','$campaign_rec_filename','$uniqueid');"; $RLRAaffected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='01076'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;} } } diff --git a/agi/agi-VDAD_RINGALL.agi b/agi/agi-VDAD_RINGALL.agi index 69d14eed..80e6655e 100644 --- a/agi/agi-VDAD_RINGALL.agi +++ b/agi/agi-VDAD_RINGALL.agi @@ -17,6 +17,7 @@ # changes: # 110303-2325 - First build # 110324-2328 - Added recording of remote agent calls, per in-group and campaign recording settings +# 110325-1411 - Added user recording override settings checking for remote agent recording # $script = 'agi-VDAD_RINGALL.agi'; @@ -259,6 +260,7 @@ if ($NAGcount > 0) $sthA->finish(); if ($AGILOG) {$agi_string = "-- AVC Session Reserved: |$callerid|$auto_call_id|$dial_user|3WAY_$dial_user|$now_date|$VLAconf_exten|"; &agi_output;} + ### get the recording settings for the campaign that this remote agent is logged into if (length($VLAcampaign_id) > 0) { $stmtA = "SELECT campaign_recording,campaign_rec_filename FROM vicidial_campaigns where campaign_id='$VLAcampaign_id';"; @@ -274,6 +276,24 @@ if ($NAGcount > 0) $sthA->finish(); } + ### look for the recording settings for the start user of this remote agent + if (length($VLAra_user) > 0) + { + $stmtA = "SELECT vicidial_recording_override,vicidial_recording FROM vicidial_users where user='$VLAra_user';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsVUrec=$sthA->rows; + if ($sthArowsVUrec > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] !~ /DISABLED/) + {$campaign_recording = $aryA[0];} + if ($aryA[1] < 1) + {$campaign_recording = 'NONE';} + } + $sthA->finish(); + } + ### if recording is enabled then start recording on this call before sending to a remote agent if ($campaign_recording =~ /ALLCALLS|ALLFORCE/) {