From b85ca359574f2f68662ba32035056169acb0bcdb Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 26 Dec 2007 16:27:08 +0000 Subject: [PATCH] added hard-code option to kick all calls from conference in vicidial.php in trunk changed how closer call logging works to test in trunk git-svn-id: svn://192.168.202.10@753 3d104415-ff17-0410-8863-d5cf3c621b8a --- agi/agi-VDAD_ALL_inbound.agi | 16 +- docs/conf_examples/extensions.conf.sample | 2 + docs/conf_examples/extensions.conf.sample-1.4 | 2 + www/agc/vdc_db_query.php | 158 ++++++++++-------- www/agc/vicidial.php | 10 +- 5 files changed, 110 insertions(+), 78 deletions(-) diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 9df97e68..16239ce4 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -627,13 +627,25 @@ if ($call_handle_method =~ /DIGITID$/) if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD : |$insert_lead_id|$fronter|insert to vicidial_log: $uniqueid"; &agi_output;} - } + } if ($call_handle_method =~ /CLOSER|DIGITID$/) { $stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$insert_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL')"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rows = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- VDXL : |$insert_lead_id|insert to vicidial_xfer_log"; &agi_output;} + $stmtB = "select LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $insert_xfer_id = "$aryA[0]"; + $cbc++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "-- VDXL : |$insert_lead_id|$insert_xfer_id|insert to vicidial_xfer_log"; &agi_output;} } ### insert a LIVE record to the vicidial_auto_calls table diff --git a/docs/conf_examples/extensions.conf.sample b/docs/conf_examples/extensions.conf.sample index 3902f7b0..a8890c64 100644 --- a/docs/conf_examples/extensions.conf.sample +++ b/docs/conf_examples/extensions.conf.sample @@ -324,6 +324,7 @@ exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) ; - CID - CID received, add record with phone number ; - CIDLOOKUP - Lookup CID to find record in whole system ; - CIDLOOKUPRL - Restrict lookup to one list +; - CIDLOOKUPRC - Restrict lookup to one campaign's lists ; - CLOSER - Closer calls from VICIDIAL fronters ; - ANI - ANI received, add record with phone number ; - ANILOOKUP - Lookup ANI to find record in whole system @@ -343,6 +344,7 @@ exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) ; 7. the status of the call initially(usually not used) ; 8. the list_id to insert the new lead under if it is new (and CID/ANI available) ; 9. the phone dialing code to insert with the new lead if new (and CID/ANI available) +; 10. the campaign_id to search within lists if CIDLOOKUPRC ; inbound VICIDIAL call with CID delivery through T1 PRI exten => 1234,1,Answer ; Answer the line exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) diff --git a/docs/conf_examples/extensions.conf.sample-1.4 b/docs/conf_examples/extensions.conf.sample-1.4 index 7cc5b008..9fa08fd5 100644 --- a/docs/conf_examples/extensions.conf.sample-1.4 +++ b/docs/conf_examples/extensions.conf.sample-1.4 @@ -323,6 +323,7 @@ exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) ; - CID - CID received, add record with phone number ; - CIDLOOKUP - Lookup CID to find record in whole system ; - CIDLOOKUPRL - Restrict lookup to one list +; - CIDLOOKUPRC - Restrict lookup to one campaign's lists ; - CLOSER - Closer calls from VICIDIAL fronters ; - ANI - ANI received, add record with phone number ; - ANILOOKUP - Lookup ANI to find record in whole system @@ -342,6 +343,7 @@ exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) ; 7. the status of the call initially(usually not used) ; 8. the list_id to insert the new lead under if it is new (and CID/ANI available) ; 9. the phone dialing code to insert with the new lead if new (and CID/ANI available) +; 10. the campaign_id to search within lists if CIDLOOKUPRC ; inbound VICIDIAL call with CID delivery through T1 PRI exten => 1234,1,Answer ; Answer the line exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 9c15f395..ab93a9ba 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -69,6 +69,7 @@ # - $use_internal_dnc - ('Y','N') # - $omit_phone_code - ('Y','N') # - $no_delete_sessions - ('0','1') +# - $LogouTKicKAlL - ('0','1'); # CHANGELOG: # 50629-1044 - First build of script @@ -138,10 +139,12 @@ # 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login # 71125-1751 - Added inbound-group default inbound group sending to vicidial.php # 71129-2025 - restricted callbacks count and list to campaign only +# 71223-0318 - changed logging of closer calls +# 71226-1117 - added option to kick all calls from conference upon logout # -$version = '2.0.4-65'; -$build = '71129-2025'; +$version = '2.0.5-67'; +$build = '71226-1117'; require("dbconnect.php"); @@ -274,6 +277,8 @@ if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["e elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} if (isset($_GET["status"])) {$status=$_GET["status"];} elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["LogouTKicKAlL"])) {$LogouTKicKAlL=$_GET["LogouTKicKAlL"];} + elseif (isset($_POST["LogouTKicKAlL"])) {$LogouTKicKAlL=$_POST["LogouTKicKAlL"];} $user=ereg_replace("[^0-9a-zA-Z]","",$user); @@ -1049,7 +1054,8 @@ if ($stage == "end") if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); - if ($row[0] > 0) + $check_inbound = $row[0]; + if ($check_inbound > 0) { ##### look for the start epoch in the vicidial_closer_log table $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; @@ -1072,11 +1078,8 @@ if ($stage == "end") { $length_in_sec = 0; } - $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - if ( ($length_in_sec < 1) and ($row[0] > 0) ) + + if ( ($length_in_sec < 1) and ($check_inbound > 0) ) { ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; @@ -1097,11 +1100,7 @@ if ($stage == "end") } else {$length_in_sec = ($StarTtime - $start_epoch);} - $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - if ($row[0] > 0) + if ($check_inbound > 0) { $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where lead_id='$lead_id' order by start_epoch desc limit 1;"; if ($DB) {echo "$stmt\n";} @@ -1642,41 +1641,69 @@ if ($ACTION == 'VDADcheckINCOMING') $row=mysql_fetch_row($rslt); $user_group = trim("$row[0]"); } - $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + + + $stmt = "select campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - - $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - if ($row[0] > 0) + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) { - ### update the vicidial_closer_log user to INCALL - $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + $call_type =$row[3]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + if ( ($call_type=='OUT') or ($call_type=='OUTBALANCE') ) + { + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $VDAC_cid_ct = mysql_num_rows($rslt); if ($VDAC_cid_ct > 0) { $row=mysql_fetch_row($rslt); - $VDADchannel_group =$row[0]; - $dialed_number =$row[1]; - $dialed_label =$row[2]; - } - else - { - if ($WeBRooTWritablE > 0) - { - $fp = fopen ("./vicidial_debug.txt", "a"); - fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); - fclose($fp); - } + $dialed_number =$row[0]; + $dialed_label =$row[1]; } + } + else + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} @@ -1748,35 +1775,6 @@ if ($ACTION == 'VDADcheckINCOMING') } else {echo '|' . $tsr . "\n";} } - else - { - $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $VDIG_cid_ct = mysql_num_rows($rslt); - if ($VDIG_cid_ct > 0) - { - $row=mysql_fetch_row($rslt); - $VDCL_campaign_script = $row[0]; - $VDCL_get_call_launch = $row[1]; - $VDCL_xferconf_a_dtmf = $row[2]; - $VDCL_xferconf_a_number = $row[3]; - $VDCL_xferconf_b_dtmf = $row[4]; - $VDCL_xferconf_b_number = $row[5]; - } - echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; - - $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $VDAC_cid_ct = mysql_num_rows($rslt); - if ($VDAC_cid_ct > 0) - { - $row=mysql_fetch_row($rslt); - $dialed_number =$row[0]; - $dialed_label =$row[1]; - } - } $comments = eregi_replace("\r",'',$comments); $comments = eregi_replace("\n",'!N',$comments); @@ -1934,19 +1932,33 @@ else $rslt=mysql_query($stmt, $link); $wcs_delete = mysql_affected_rows($link); - ##### Hangup the client phone - $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($rslt) + if ($LogouTKicKAlL > 0) { - $row=mysql_fetch_row($rslt); - $agent_channel = "$row[0]"; - if ($format=='debug') {echo "\n";} - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + $local_DEF = 'Local/5555'; + $local_AMP = '@'; + $kick_local_channel = "$local_DEF$conf_exten$local_AMP$ext_context"; + $queryCID = "ULGH3458$StarTtime"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $kick_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); } + else + { + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } $pause_sec=0; $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 8558b0d1..e68943da 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -171,10 +171,12 @@ # 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to # 71127-0408 - Added height and width settings for easier modification of screen size # 71129-2025 - restricted callbacks count and list to campaign only +# 71223-0318 - changed logging of closer calls +# 71226-1117 - added option to kick all calls from conference upon logout # -$version = '2.0.4-142'; -$build = '71129-2025'; +$version = '2.0.5-144'; +$build = '71226-1117'; require("dbconnect.php"); @@ -261,6 +263,7 @@ $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of chann $PreseT_DiaL_LinKs = '1'; # set to 1 to show a DIAL link for Dial Presets $LogiNAJAX = '1'; # set to 1 to do lookups $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" +$LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen @@ -1828,6 +1831,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var enable_sipsak_messages = ''; var allow_sipsak_messages = ''; var HidEMonitoRSessionS = ''; + var LogouTKicKAlL = ''; var flag_channels = ''; var flag_string = ''; var DiaLControl_auto_HTML = "\"Pause\"\"Resume\""; @@ -5254,7 +5258,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - VDlogout_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=userLOGout&format=text&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&agent_log_id=" + agent_log_id + "&no_delete_sessions=" + no_delete_sessions + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages; + VDlogout_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=userLOGout&format=text&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&agent_log_id=" + agent_log_id + "&no_delete_sessions=" + no_delete_sessions + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages + "&LogouTKicKAlL=" + LogouTKicKAlL + "&ext_context=" + ext_context; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(VDlogout_query);