Compare commits

...
10 Commits
Author SHA1 Message Date
mattf 928b8d84a9 Added link to beta 6th gen lead loader
git-svn-id: svn://192.168.202.10@4027 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-12 14:04:04 +00:00
mattf d61d46c4b3 Added CID SIP 603 Report
git-svn-id: svn://192.168.202.10@4026 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-11 00:42:03 +00:00
mattf 6861b0d850 Fix for added users without user_group
Small fix for PJSIP

git-svn-id: svn://192.168.202.10@4025 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-10 05:22:35 +00:00
mattf 12a518040a Added copy_phone API function
git-svn-id: svn://192.168.202.10@4024 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-07 22:19:06 +00:00
mattf bd5f94ae68 Added PJSIP option for add_phone & update_phone in Non-Agent API
git-svn-id: svn://192.168.202.10@4023 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-07 21:05:04 +00:00
mattf 13f49f8c92 Changed default logger.conf to do millisecond logging
Several updates to Remote Agent back-end script
Added -ra-delay=X flag to keepalive script

git-svn-id: svn://192.168.202.10@4022 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-04 19:22:59 +00:00
mattf 4a50c46387 Fix for Issue #1560
git-svn-id: svn://192.168.202.10@4021 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-04 18:20:19 +00:00
mattf 1f2f7d29a7 Fix for areacode duplicates in multiple countries in admin bulk tools
Several fxes for PJSIP compatibility

git-svn-id: svn://192.168.202.10@4020 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-03 00:49:45 +00:00
mattf d5a90e49f3 Fixes for systems with overloaded Khomp servers on outbound auto-dialing
git-svn-id: svn://192.168.202.10@4019 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-02 20:09:25 +00:00
mattf f33a3dca7f Added check for mariadb-admin, mariadb-dump and mariadb to scripts
git-svn-id: svn://192.168.202.10@4018 3d104415-ff17-0410-8863-d5cf3c621b8a
2026-09-02 04:37:29 +00:00
21 changed files with 3781 additions and 112 deletions
+2 -1
View File
@@ -32,6 +32,7 @@
#
# changes:
# 260509-1847 - First build
# 260902-1619 - Added PJSIP
#
$script = 'CID_change.agi';
@@ -203,7 +204,7 @@ $sthA->finish();
$phone_extension = $channel;
$phone_extension =~ s/^SIP\/|^IAX\/|^IAX2\///gi;
$phone_extension =~ s/^SIP\/|^PJSIP\/|^IAX\/|^IAX2\///gi;
$phone_extension =~ s/-.*//gi;
if ($AGILOG) {$agi_string = "Phone Account: ($phone_extension)"; &agi_output;}
+10 -1
View File
@@ -45,7 +45,7 @@
#exten => 8366,4,AGI(agi-VDAD_ALL_outbound.agi,SURVEY-----LB-----US_pol_survey_hello-----1238-----8-----US_pol_survey_transfer-----US_thanks_no_contact-----OPTOUT-----DNC)
#exten => 8366,5,Hangup
#
# Copyright (C) 2025 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80218-2027 - First Build
@@ -136,6 +136,7 @@
# 250924-2150 - Added code for deprecation of "Monitor" application after Asterisk 20
# 251001-1837 - Fix for rare Stereo recording filename issue
# 251020-0835 - Added code for recording_dtmf_muting, fix for stereo call recording
# 260902-1607 - Fix for systems with overloaded Khomp servers
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -7216,6 +7217,14 @@ sub khomp_json_api
$agi_string = "-- KHOMP RESPONSE JSON: |$message|"; &agi_output;
}
$test503 = $message;
$test503 =~ s/\n|\r|\t//gi;
if ($test503 =~ /503 Service Not Available/)
{
$agi_string = "-- KHOMP API REJECTED OUR REQUEST!!! forcing fake timeout response"; &agi_output;
$message = '{"id":0,"jsonrpc":"2.0","result":{"calls":[{"disconnected":false,"fields":{"analyzer_action":"Connect","analyzer_conclusion":"Khomp Reject","analyzer_pattern":"","analyzer_stamp":"9999999999","answer_stamp":"9999999999","audio_stamp":"9999999999","end_stamp":"","hangup_cause":"","hangup_cause_sent":"","hangup_origin":"","sip_header:call-id":"","start_stamp":"1788358771462"}}]}}';
}
#UC# $json = JSON::PP->new->ascii->pretty->allow_nonref;
#UC# $result = $json->decode($message);
+17 -1
View File
@@ -12,7 +12,7 @@
# exten => _8331*.,n,AGI(agi-VDAD_RINGALL.agi,${EXTEN})
# exten => _8331*.,n,Hangup
#
# Copyright (C) 2025 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 110303-2325 - First build
@@ -26,6 +26,7 @@
# 240415-1702 - Fix for ConfBridge code
# 250924-2157 - Added code for deprecation of "Monitor" application after Asterisk 20
# 251006-0902 - If recording_dtmf_muting enabled, force use of MixMonitor for recording
# 260902-1622 - Added PJSIP
#
$script = 'agi-VDAD_RINGALL.agi';
@@ -552,6 +553,21 @@ if ($NAGcount > 0)
}
$sthA->finish();
}
if ($orVLA_exten[$orct] =~ /^PJSIP/i)
{
$orVLA_exten[$orct] =~ s/^PJSIP\///gi;
$stmtA = "SELECT dialplan_number FROM phones where extension='$orVLA_exten[$orct]' and server_ip='$orVLA_server_ip[$orct]' and protocol='PJSIP';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$Pcount=$sthA->rows;
if ($Pcount > 0)
{
@aryA = $sthA->fetchrow_array;
$Pdialplan_number = $aryA[0];
$exten_match = "STARSYM" . $Pdialplan_number . "ATSYM";
}
$sthA->finish();
}
if ($orVLA_exten[$orct] =~ /^IAX/i)
{
$orVLA_exten[$orct] =~ s/^IAX2\/|^IAX\///gi;
+4 -3
View File
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# getAGENTchannel.agi by Omar Rodriguez www.ItContinental.com
# Copyright (C) 2025 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# This script is able to return the name of the channel that belongs to the agent,
# to allow administrators to whisper to the agents
# Has been made using Vicidial code as Base
@@ -11,6 +11,7 @@
# 150804-0944 - Rewritten to work on multi-server systems and with different dialplan
# 160523-2352 - Fixed issue with local channels in session
# 250103-1608 - Added processing of monitorsession channel variable
# 260902-1610 - Fix for PJSIP
#
$script = 'getAGENTchannel.agi';
@@ -146,8 +147,8 @@ $s=0;
while ($sthArows > $s)
{
@aryA = $sthA->fetchrow_array;
# channel priority(highest to lowest): SIP, IAX, Local
if ($aryA[0] =~ /^SIP/i)
# channel priority(highest to lowest): SIP, PJSIP, IAX, Local
if ( ($aryA[0] =~ /^SIP/i) || ($aryA[0] =~ /^PJSIP/i) )
{$agent_zap_channel = $aryA[0];}
if ( ($aryA[0] =~ /^IAX/i) && ( (length($agent_zap_channel) < 4) || ($agent_zap_channel =~ /^Local/i) ) )
{$agent_zap_channel = $aryA[0];}
+3 -2
View File
@@ -15,10 +15,11 @@
# then put the above Custom Dialplan into it, then set the Phone's
# 'phone context' to the call menu ID that you just created.
#
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 160527-1415 - First build
# 260902-1624 - Added PJSIP
#
$script = 'phone_alt_CID.agi';
@@ -176,7 +177,7 @@ $sthA->finish();
$phone_extension = $channel;
$phone_extension =~ s/^SIP\/|^IAX\/|^IAX2\///gi;
$phone_extension =~ s/^SIP\/|^PJSIP\/|^IAX\/|^IAX2\///gi;
$phone_extension =~ s/-.*//gi;
if ($AGILOG) {$agi_string = "Phone Account: ($phone_extension)"; &agi_output;}
+11 -2
View File
@@ -5,7 +5,7 @@
# DESCRIPTION:
# Backs-up the asterisk database, conf/agi/sounds/bin files
#
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
#
@@ -28,6 +28,7 @@
# 191119-1658 - Added --db-remote option to specify '--host' parameter for mysqldumpdump
# 210817-1956 - Added --db-leads-only option to dump only the vicidial_list table
# 230215-1456 - update of table categories
# 260901-1012 - Added check for mariadb-dump and mariadb first
#
$secT = time();
@@ -345,6 +346,9 @@ if ( ($without_db < 1) && ($conf_only < 1) )
### find mysqldump binary to do the database dump
print "\n----- Mysql dump -----\n\n";
$mysqldumpbin = '';
if ( -e ('/usr/bin/mariadb-dump')) {$mysqldumpbin = '/usr/bin/mariadb-dump';}
else
{
if ( -e ('/usr/bin/mysqldump')) {$mysqldumpbin = '/usr/bin/mysqldump';}
else
{
@@ -358,7 +362,11 @@ if ( ($without_db < 1) && ($conf_only < 1) )
}
}
}
}
$mysqlbin = '';
if ( -e ('/usr/bin/mariadb')) {$mysqlbin = '/usr/bin/mariadb';}
else
{
if ( -e ('/usr/bin/mysql')) {$mysqlbin = '/usr/bin/mysql';}
else
{
@@ -372,6 +380,7 @@ if ( ($without_db < 1) && ($conf_only < 1) )
}
}
}
}
use DBI;
@@ -455,7 +464,7 @@ if ( ($without_db < 1) && ($conf_only < 1) )
{
$archive_tables .= " $aryA[0]";
}
elsif ($aryA[0] =~ /_log|server_performance|vicidial_ivr|vicidial_hopper|vicidial_manager|web_client_sessions|imm_outcomes|_counts|_sip$|_recent|_queue$|_urls$/)
elsif ($aryA[0] =~ /_log|server_performance|vicidial_ivr|vicidial_hopper|vicidial_manager|web_client_sessions|imm_outcomes|_counts|_sip$|_recent|_queue$|_urls$|_overrides|_messages|_drops|_auth|_calls|_caller_codes|_daily|_extensions|_gaps|_reserve/)
{
$log_tables .= " $aryA[0]";
}
+30 -3
View File
@@ -186,9 +186,12 @@
# 260527-0142 - Added dialplan filtering
# 260605-1002 - Added end-of-day log processing log entry for the vicidial_internal_log
# 260826-1814 - Added FastAGIServer code
# 260902-1718 - Fix for PJSIP monitoring
# 260903-1914 - Added -ra-delay=X flag
# 260910-0116 - Small fix for PJSIP
#
$build = '260826-1814';
$build = '260910-0116';
$DB=0; # Debug flag
$teodDB=0; # flag to log Timeclock End of Day processes to log file
@@ -201,6 +204,7 @@ $cu3way_delay='';
$autodial_delay='';
$adfill_delay='';
$fill_staggered='';
$ra_delay='';
$recmon=0;
$reserved_exten_skip=0;
$reserved_exten_message='';
@@ -311,6 +315,7 @@ if (length($ARGV[0])>1)
print " [-autodial-delay=X] = setting delay seconds on local auto-dial process\n";
print " [-adfill-delay=X] = setting delay seconds on auto-dial FILL process\n";
print " [-fill-staggered] = enable experimental staggered auto-dial FILL process\n";
print " [-ra-delay=X] = setting delay seconds on Remote Agent process\n";
print " [-cu3way] = keepalive for the optional 3way conference checker\n";
print " [-lstn-buffer] = use special enhanced telnet buffer listen process(depricated)\n";
print " [-cu3way-delay=X] = setting delay seconds on 3way conference checker\n";
@@ -431,6 +436,21 @@ if (length($ARGV[0])>1)
}
@CLIvarARY=@MT; @CLIvarARY=@MT;
}
if ($args =~ /-ra-delay=/i) # CLI defined delay for Remote Agent script
{
@CLIvarRADLY = split(/-ra-delay=/,$args);
@CLIvarRADLX = split(/ /,$CLIvarRADLY[1]);
if (length($CLIvarRADLX[0])>0)
{
$CLIradelay = $CLIvarRADLX[0];
$CLIradelay =~ s/\/$| |\r|\n|\t//gi;
$CLIradelay =~ s/\D//gi;
if ( ($CLIradelay > 0) && (length($CLIradelay)> 0) )
{$ra_delay = "--delay=$CLIradelay";}
if ($DB > 0) {print "Remote Agent Delay set to $CLIradelay $ra_delay \n";}
}
@CLIvarRADLY=@MT; @CLIvarRADLY=@MT;
}
if ($args =~ /-test/i)
{
$TEST=1;
@@ -1114,7 +1134,7 @@ else
{
if ($DB) {print "starting AST_VDremote_agents...\n";}
# add a '-L' to the command below to activate logging
`/usr/bin/screen -d -m -S ASTVDremote $PATHhome/AST_VDremote_agents.pl --debug $debug_string`;
`/usr/bin/screen -d -m -S ASTVDremote $PATHhome/AST_VDremote_agents.pl --debug $ra_delay $debug_string`;
if ($megaDB)
{
`/usr/bin/screen -S ASTVDremote -X logfile $PATHlogs/ASTVDremote-screenlog.0`;
@@ -3304,6 +3324,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Lext .= "exten => 473782138521111,n,Hangup()\n";
$Lext .= "; Whisper to agent meetme entry\n";
$Lext .= "exten => _473782188600XXX,1,Answer\n";
$Lext .= "exten => _473782188600XXX,n,Set(CALLERID(name)=\${MONITORCG})\n";
$Lext .= "exten => _473782188600XXX,n,Wait(1)\n";
$Lext .= "exten => _473782188600XXX,n,AGI(getAGENTchannel.agi)\n";
$Lext .= "exten => _473782188600XXX,n,NoOp(\${agent_zap_channel})\n";
@@ -3340,6 +3361,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Lext .= "exten => 473782138521111,n,Hangup()\n";
$Lext .= "; Whisper to agent meetme entry\n";
$Lext .= "exten => _473782188600XXX,1,Answer\n";
$Lext .= "exten => _473782188600XXX,n,Set(CALLERID(name)=\${MONITORCG})\n";
$Lext .= "exten => _473782188600XXX,n,Wait(1)\n";
$Lext .= "exten => _473782188600XXX,n,AGI(getAGENTchannel.agi)\n";
$Lext .= "exten => _473782188600XXX,n,NoOp(\${agent_zap_channel})\n";
@@ -3348,6 +3370,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Lext .= "exten => _473782188600XXX,n(fin),Hangup()\n";
$Lext .= "; Whisper to agent ConfBridge entry\n";
$Lext .= "exten => _473782189600XXX,1,Answer\n";
$Lext .= "exten => _473782189600XXX,n,Set(CALLERID(name)=\${MONITORCG})\n";
$Lext .= "exten => _473782189600XXX,n,Wait(1)\n";
$Lext .= "exten => _473782189600XXX,n,AGI(getAGENTchannel.agi)\n";
$Lext .= "exten => _473782189600XXX,n,NoOp(\${agent_zap_channel})\n";
@@ -3356,6 +3379,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Lext .= "exten => _473782189600XXX,n(fin),Hangup()\n";
$Lext .= "; Enhanced Agent Monitoring ConfBridge entry: MONITOR\n";
$Lext .= "exten => _473782199600XXX,1,Answer()\n";
$Lext .= "exten => _473782199600XXX,n,Set(CALLERID(name)=\${MONITORCG})\n";
$Lext .= "exten => _473782199600XXX,n,Wait(1)\n";
$Lext .= "exten => _473782199600XXX,n,AGI(getAGENTchannel.agi)\n";
$Lext .= "exten => _473782199600XXX,n,NoOp(\${monitorsession})\n";
@@ -3366,6 +3390,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Lext .= "exten => _473782199600XXX,n,Hangup()\n";
$Lext .= "; Enhanced Agent Monitoring ConfBridge entry: BARGE\n";
$Lext .= "exten => _473782209600XXX,1,Answer()\n";
$Lext .= "exten => _473782209600XXX,n,Set(CALLERID(name)=\${MONITORCG})\n";
$Lext .= "exten => _473782209600XXX,n,Wait(1)\n";
$Lext .= "exten => _473782209600XXX,n,AGI(getAGENTchannel.agi)\n";
$Lext .= "exten => _473782209600XXX,n,NoOp(\${monitorsession})\n";
@@ -3395,6 +3420,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$confbridge_enhanced_monitoring .= "; Enhanced Agent Monitoring Whisper to agent channel entry\n";
$confbridge_enhanced_monitoring .= "exten => _473782219600XXX,1,Answer\n";
$confbridge_enhanced_monitoring .= "exten => _473782219600XXX,n,Set(CALLERID(name)=\${MONITORCG})\n";
$confbridge_enhanced_monitoring .= "exten => _473782219600XXX,n,Wait(1)\n";
$confbridge_enhanced_monitoring .= "exten => _473782219600XXX,n,AGI(getAGENTchannel.agi)\n";
$confbridge_enhanced_monitoring .= "exten => _473782219600XXX,n,NoOp(\${monitorsession})\n";
@@ -4383,10 +4409,10 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Ppjsipw .= "endpoint/callerid=\"$fullname[$i]\" <$outbound_cid[$i]>\n";
}
$Ppjsipw .= "endpoint/mailboxes=$voicemail[$i]\n";
$Ppjsipw .= "endpoint/accountcode=$extension[$i]\n";
if (($codecs_with_template[$i] > 0) || (!($template_contents[$i] =~ /allow=/i)))
{$Ppjsipw .= "$Pcodec";}
$Ppjsipw .= "$template_contents[$i]\n";
$conf_entry_written++;
}
$sthA->finish();
@@ -4421,6 +4447,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Ppjsipw .= "endpoint/callerid=\"$fullname[$i]\" <$outbound_cid[$i]>\n";
}
$Ppjsipw .= "endpoint/mailboxes=$voicemail[$i]\n";
$Ppjsipw .= "endpoint/accountcode=$extension[$i]\n";
$Ppjsipw .= "$Pcodec";
$Ppjsipw .= "endpoint/dtmf_mode = rfc4733\n";
$Ppjsipw .= "endpoint/trust_id_inbound = no\n";
+101 -19
View File
@@ -60,9 +60,10 @@
# 240516-2149 - Allow for ALT start_call_url, added --version flag
# 260403-2253 - Added vicidial_max_inbound_cache logging
# 260515-1935 - Added internal logging
# 260903-1936 - Changed inactive agent and queue-status agents processing to run more often if short --delay is used, added INCALL/QUEUE status no-call check
#
$build = '260515-1933';
$build = '260903-1936';
$script_name = 'AST_VDremote_agents.pl';
### begin parsing run-time options ###
@@ -266,7 +267,9 @@ while($one_day_interval > 0)
$VDRLOGfile = "$PATHlogs/remoteagent.$year-$mon-$mday";
if ($endless_loop =~ /0$|5$/)
### Remove inactive remote agents and process QUEUE agents into INCALL status
### By default, every 5 loops(10 seconds), or if delay override to 1 second, run this section every 2 seconds
if ( ( ($endless_loop =~ /0$|5$/) && ($loop_delay >= 2000) ) || ( ($endless_loop =~ /0$|2$|4$|6$|8$/) && ($loop_delay < 2000) ) )
{
### Grab Server values from the database
$stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';";
@@ -563,7 +566,7 @@ while($one_day_interval > 0)
$concurrent_calls=0;
$incalls_count=0;
### Get count of concurrent calls for this in-group
### Get count of concurrent calls for this user
$stmtA = "SELECT count(*) FROM vicidial_live_agents where ra_user='$QHra_user[$w]' and extension LIKE \"R/%\" and status IN('QUEUE','INCALL','DONE');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -682,6 +685,11 @@ while($one_day_interval > 0)
@VD_uniqueid=@MT;
@VD_callerid=@MT;
@VD_random=@MT;
@dVD_user=@MT;
@dVD_extension=@MT;
@dVD_status=@MT;
@dVD_campaign_id=@MT;
@dVD_random=@MT;
@autocallexists=@MT;
@calllogfinished=@MT;
@@ -1011,8 +1019,8 @@ while($one_day_interval > 0)
###############################################################################
###### fourth, validate that the calls that the vicidial_live_agents are on and not dead
###### and if they are wipe out the values and set the agent record back to READY
###### fourth, validate that the calls that the vicidial_live_agents are on are not dead
###### and if they are, wipe out the values and set the agent record back to READY
###############################################################################
$stmtA = "SELECT user,extension,status,uniqueid,callerid,lead_id,campaign_id,call_server_ip FROM vicidial_live_agents where extension LIKE \"R/%\" and server_ip='$server_ip' and uniqueid > 10;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -1064,6 +1072,8 @@ while($one_day_interval > 0)
}
$sthA->finish();
if ($enable_queuemetrics_logging > 0)
{
$stmtA = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$VD_campaign_id[$z]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1074,6 +1084,7 @@ while($one_day_interval > 0)
$USER_queuemetrics_phone_environment[$z] = $aryA[0];
}
$sthA->finish();
}
if ($autocallexists[$z] < 1)
{
@@ -1083,10 +1094,12 @@ while($one_day_interval > 0)
if ($DELusers =~ /R\/$VD_user[$z]\|/)
{
$stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='PAUSED', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$VD_user[$z]' and server_ip='$server_ip';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {print STDERR "$VD_user[$z] CALL WIPE DELETE UPDATE: $affected_rows|PAUSED|$VD_uniqueid[$z]|$VD_user[$z]|\n";}
if ($affected_rows>0)
$newRAstatus='PAUSED';
$stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='$newRAstatus', last_call_finish='$SQLdate',lead_id=0,uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$VD_user[$z]' and server_ip='$server_ip';";
$affected_rowsA = $dbhA->do($stmtA);
$affected_rowsB=0;
if ($DB) {print STDERR "SQLdate - $VD_user[$z] CALL WIPE DELETE UPDATE: $affected_rowsA|$newRAstatus|$VD_uniqueid[$z]| \n";}
if ($affected_rowsA>0)
{
if ($enable_queuemetrics_logging > 0)
{
@@ -1187,14 +1200,15 @@ while($one_day_interval > 0)
}
else
{
$stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$VD_user[$z]' and server_ip='$server_ip';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {print STDERR "$VD_user[$z] CALL WIPE UPDATE: $affected_rows|READY|$VD_uniqueid[$z]|$VD_user[$z]|\n";}
$newRAstatus='READY';
$stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]', last_call_finish='$SQLdate',lead_id=0,uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$VD_user[$z]' and server_ip='$server_ip';";
$affected_rowsA = $dbhA->do($stmtA);
if ($DB) {print STDERR "$SQLdate - $VD_user[$z] CALL WIPE UPDATE: $affected_rowsA|$VD_uniqueid[$z]| \n";}
$stmtA = "UPDATE vicidial_live_agents set status='READY' where user='$VD_user[$z]' and server_ip='$server_ip';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {print STDERR "$VD_user[$z] CALL WIPE UPDATE: $affected_rows|READY|$VD_uniqueid[$z]|$VD_user[$z]|\n";}
if ($affected_rows>0)
$stmtA = "UPDATE vicidial_live_agents set status='$newRAstatus' where user='$VD_user[$z]' and server_ip='$server_ip';";
$affected_rowsB = $dbhA->do($stmtA);
if ($DB) {print STDERR "$SQLdate - $VD_user[$z] CALL WIPE STATUS UPDATE: $affected_rowsB|$newRAstatus|$VD_uniqueid[$z]| \n";}
if ($affected_rowsB > 0)
{
if ($enable_queuemetrics_logging > 0)
{
@@ -1216,6 +1230,11 @@ while($one_day_interval > 0)
}
}
}
if ( ($affected_rowsA > 0) || ($affected_rowsB > 0) )
{
$event_string = "| CALL WIPE AGENT UPDATE: |$affected_rowsA|$affected_rowsB| |$VD_user[$z]|$VD_callerid[$z]|$VD_uniqueid[$z]|$newRAstatus|";
&event_logger;
}
}
### possible future active call checker
# else
@@ -1234,7 +1253,7 @@ while($one_day_interval > 0)
# $sthA->finish();
# if ($calllogfinished[$z] > 1)
# {
# $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='READY', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='' where user='$VD_user[$z]' and server_ip='$server_ip';";
# $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='READY', last_call_finish='$SQLdate',lead_id=0,uniqueid='',callerid='',channel='' where user='$VD_user[$z]' and server_ip='$server_ip';";
# $affected_rows = $dbhA->do($stmtA);
# if ($DB) {print STDERR "$VD_user[$z] AGENT READY UPDATE: $affected_rows|READY|$VD_uniqueid[$z]|$VD_callerid[$z]|$VD_user[$z]|\n";}
@@ -1249,6 +1268,69 @@ while($one_day_interval > 0)
###############################################################################
###### fifth, look for vicidial_live_agents remote agents that are INCALL but with no call
###### if found, wipe out the values and set the agent record back to READY
###############################################################################
$stmtA = "SELECT user,extension,status,campaign_id FROM vicidial_live_agents where extension LIKE \"R/%\" and server_ip='$server_ip' and uniqueid='' and callerid='' and lead_id=0 and status IN('INCALL','QUEUE');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
$z=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$VDuser = $aryA[0];
$VDextension = $aryA[1];
$VDstatus = $aryA[2];
$VDcampaign_id = $aryA[3];
$VDrandom = int( rand(9999999)) + 10000000;
$dVD_user[$z] = $VDuser;
$dVD_extension[$z] = $VDextension;
$dVD_status[$z] = $VDstatus;
$dVD_campaign_id[$z] = $VDcampaign_id;
$dVD_random[$z] = $VDrandom;
$z++;
$rec_count++;
}
$sthA->finish();
if ($DB) {print STDERR "$z remote agents INCALL/QUEUE with no call \n";}
$z=0;
foreach(@dVD_user)
{
if ($DELusers =~ /R\/$dVD_user[$z]\|/)
{
$newRAstatus='PAUSED';
$stmtA = "UPDATE vicidial_live_agents set random_id='$dVD_random[$z]',status='$newRAstatus', last_call_finish='$SQLdate',lead_id=0,uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$dVD_user[$z]' and server_ip='$server_ip';";
$affected_rowsA = $dbhA->do($stmtA);
if ($DB) {print STDERR "$SQLdate - $dVD_user[$z] RA user NO-CALL WIPE DELETE UPDATE: $affected_rowsA|$newRAstatus|$dVD_extension[$z]|$dVD_user[$z]|\n";}
$affected_rowsB=0;
}
else
{
$newRAstatus='READY';
$stmtA = "UPDATE vicidial_live_agents set random_id='$dVD_random[$z]', last_call_finish='$SQLdate',lead_id=0,uniqueid='',callerid='',channel='',last_state_change='$SQLdate' where user='$dVD_user[$z]' and server_ip='$server_ip';";
$affected_rowsA = $dbhA->do($stmtA);
if ($DB) {print STDERR "$SQLdate - $dVD_user[$z] RA user NO-CALL WIPE UPDATE: $affected_rowsA|$SQLdate|$dVD_extension[$z]| \n";}
$stmtA = "UPDATE vicidial_live_agents set status='$newRAstatus' where user='$dVD_user[$z]' and server_ip='$server_ip';";
$affected_rowsB = $dbhA->do($stmtA);
if ($DB) {print STDERR "$SQLdate - $dVD_user[$z] RA user NO-CALL WIPE STATUS UPDATE: $affected_rowsB|$newRAstatus|$dVD_extension[$z]| \n";}
}
if ( ($affected_rowsA > 0) || ($affected_rowsB > 0) )
{
$event_string = "| NO-CALL WIPE AGENT UPDATE: |$affected_rowsA|$affected_rowsB| |$VD_user[$z]|$dVD_extension[$z]|$newRAstatus|";
&event_logger;
}
$z++;
}
###############################################################################
###### last, wait for a little bit and repeat the loop
###############################################################################
@@ -1325,8 +1407,6 @@ sub get_time_now #get the current date and time and epoch for logging call lengt
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";}
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
@@ -1344,6 +1424,8 @@ sub get_time_now #get the current date and time and epoch for logging call lengt
$filedate = "$year-$mon-$mday";
$YMD = "$year-$mon-$mday";
if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min $SQLdate \n";}
$FDtarget = ($secX + 10);
($Fsec,$Fmin,$Fhour,$Fmday,$Fmon,$Fyear,$Fwday,$Fyday,$Fisdst) = localtime($FDtarget);
$Fyear = ($Fyear + 1900);
+8
View File
@@ -107,6 +107,7 @@
# 260327-0824 - Fixes for PJSIP compatibility
# 260424-1644 - Fix for rare Auto-Alt Dial issue
# 260515-1936 - Added internal logging
# 260902-1608 - Fix for systems with overloaded Khomp servers
#
# defaults for PreFork
@@ -3847,6 +3848,13 @@ sub khomp_json_api
$agi_string = "-- KHOMP JSON : |$khomp_json|"; &agi_output;
$agi_string = "-- KHOMP RESPONSE JSON: |$message|"; &agi_output;
}
$test503 = $message;
$test503 =~ s/\n|\r|\t//gi;
if ($test503 =~ /503 Service Not Available/)
{
$agi_string = "-- KHOMP API REJECTED OUR REQUEST!!! forcing fake timeout response"; &agi_output;
$message = '{"id":0,"jsonrpc":"2.0","result":{"calls":[{"disconnected":false,"fields":{"analyzer_action":"Connect","analyzer_conclusion":"Khomp Reject","analyzer_pattern":"","analyzer_stamp":"9999999999","answer_stamp":"9999999999","audio_stamp":"9999999999","end_stamp":"","hangup_cause":"","hangup_cause_sent":"","hangup_origin":"","sip_header:call-id":"","start_stamp":"1788358771462"}}]}}';
}
#UC# $json = JSON::PP->new->ascii->pretty->allow_nonref;
#UC# $result = $json->decode($message);
+12 -3
View File
@@ -4,10 +4,11 @@
#
# This script gathers several system metrics and stores them in the MySQL database
#
# Copyright (C) 2024 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 240217-2226 - First build
# 260901-1011 - Look for mariadb-admin first, replacement for mysqladmin
#
$start_epoch = time();
@@ -173,10 +174,16 @@ else
}
}
### find mysqladmin binary (database admin)
### find mysqladmin (or mariadb-admin) binary (database admin)
$mysqladminbin = '';
if ( -e ('/bin/mysqladmin')) {$mysqladminbin = '/bin/mysqladmin';}
if ( -e ('/usr/bin/mariadb-admin')) {$mysqladminbin = '/usr/bin/mariadb-admin';}
else
{
if ( -e ('/bin/mariadb-admin')) {$mysqladminbin = '/bin/mariadb-admin';}
else
{
if ( -e ('/bin/mysqladmin')) {$mysqladminbin = '/bin/mysqladmin';}
else
{
if ( -e ('/usr/bin/mysqladmin')) {$mysqladminbin = '/usr/bin/mysqladmin';}
else
@@ -188,6 +195,8 @@ else
}
}
}
}
}
### find wc binary (line and word count)
$wcbin = '';
+53 -13
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2026-08-22
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2026-09-07
This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -237,6 +237,8 @@ Changes:
260506-1525 - small fix for campaign changes
260519-1647 - Code updates for PHP8 compatibility, and json output format
260822-0841 - Added agent_ingroup_availability function
260907-1702 - Added PJSIP option for add_phone & update_phone
260907-1808 - Added copy_phone function
API Functions use the 'function' variable
@@ -1732,7 +1734,7 @@ SUCCESS: update_remote_agent USER HAS BEEN UPDATED - 6666|7878
--------------------------------------------------------------------------------
add_group_alias - adds group alias to the system
NOTE: api user for this function must have user_level set to 8 or higher and "ast admin access" enabled
NOTE: api user for this function must have user_level set to 8 or higher and "AGC Admin Access" enabled
REQUIRED FIELDS-
caller_id_number - 6-20 characters
@@ -1852,17 +1854,17 @@ SUCCESS: delete_fpg_phone FILTER PHONE GROUP NUMBER HAS BEEN DELETED - 6666|7275
--------------------------------------------------------------------------------
add_phone - adds a phone to the system
NOTE: api user for this function must have user_level set to 8 or higher and "ast admin access" enabled
NOTE: api user for this function must have user_level set to 8 or higher and "AGC Admin Access" enabled
REQUIRED FIELDS-
extension - 2-100 characters
dialplan_number - 1-20 digits
voicemail_id - 1-10 digits
phone_login - 1-20 characters
phone_pass - 1-20 characters
phone_pass - 1-100 characters
server_ip - 7-15 characters, must be a valid server_ip
protocol - Must be one of these: 'IAX2','SIP','Zap','EXTERNAL'
registration_password - 1-20 characters
protocol - Must be one of these: 'IAX2','SIP','PJSIP','Zap','EXTERNAL'
registration_password - 1-100 characters
phone_full_name - 1-50 characters
local_gmt - timezone setting, not adjusting for DST, default: '-5.00'
outbound_cid - 1-20 digits
@@ -1895,10 +1897,48 @@ SUCCESS: add_phone PHONE HAS BEEN ADDED - 6666|cc100|10.0.9.8|SIP|100
--------------------------------------------------------------------------------
copy_phone - copies a phone in the system
NOTE: api user for this function must have user_level set to 8 or higher and "AGC Admin Access" enabled
REQUIRED FIELDS-
extension - 2-100 characters
dialplan_number - 1-20 digits
voicemail_id - 1-10 digits
phone_login - 1-20 characters
server_ip - 7-15 characters, must be a valid server_ip
phone_full_name - 1-50 characters
outbound_cid - 1-20 digits
source_extension - Must be an existing phone extension-server_ip combination in the system
source_server_ip - Must be an existing phone extension-server_ip combination in the system
OPTIONAL FIELDS-
phone_pass - 1-100 characters (if not populated, then default system phone pass is used)
registration_password - 1-100 characters (if not populated, then default system registration pass is used)
Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&function=copy_phone&user=6666&pass=1234&extension=55000&dialplan_number=55000&voicemail_id=55000&phone_login=55000&phone_pass=test&server_ip=192.168.198.5&registration_password=test&phone_full_name=Extension+55000&outbound_cid=7275551212&source_extension=cc100&source_server_ip=10.0.9.8
http://server/vicidial/non_agent_api.php?source=test&function=copy_phone&user=6666&pass=1234&extension=55000&dialplan_number=55000&voicemail_id=55000&phone_login=55000&server_ip=192.168.198.5&phone_full_name=Extension+55000&outbound_cid=7275551212&source_extension=cc100&source_server_ip=10.0.9.8
Example responses:
ERROR: copy_phone USER DOES NOT HAVE PERMISSION TO COPY PHONES - 6666|0
ERROR: copy_phone YOU MUST USE ALL REQUIRED FIELDS - 6666|1000|||||||||||
ERROR: copy_phone SOURCE SERVER DOES NOT EXIST - 6666|10.0.9.8
ERROR: copy_phone SOURCE PHONE DOES NOT EXIST ON THIS SERVER - 6666|10.0.9.8|cc100
ERROR: copy_phone SERVER DOES NOT EXIST - 6666|10.0.9.9
ERROR: copy_phone PHONE ALREADY EXISTS ON THIS SERVER - 6666|10.0.9.8|cc101
ERROR: copy_phone PHONE LOGIN ALREADY EXISTS - 6666|cc100
SUCCESS: copy_phone PHONE HAS BEEN COPIED - 6666|cc100|10.0.9.8|SIP|100
--------------------------------------------------------------------------------
update_phone - updates or deletes a phone entry already in the system
NOTE: api user for this function must have user_level set to 8 or higher and "ast admin access" enabled
NOTE: api user for this function must have user_level set to 8 or higher and "AGC Admin Access" enabled
REQUIRED FIELDS-
extension - 2-100 characters
@@ -1911,9 +1951,9 @@ EDITABLE FIELDS-
dialplan_number - 1-20 digits
voicemail_id - 1-10 digits
phone_login - 1-20 characters
phone_pass - 1-20 characters
protocol - Must be one of these: 'IAX2','SIP','Zap','EXTERNAL'
registration_password - 1-20 characters
phone_pass - 1-100 characters
protocol - Must be one of these: 'IAX2','SIP','PJSIP','Zap','EXTERNAL'
registration_password - 1-100 characters
phone_full_name - 1-50 characters
local_gmt - timezone setting, not adjusting for DST, default: '-5.00'
outbound_cid - 6-18 digits
@@ -1968,7 +2008,7 @@ NOTICE: update_phone USER DOES NOT HAVE PERMISSION TO DELETE PHONES - 6666|7878
--------------------------------------------------------------------------------
add_phone_alias - adds a phone alias entry to the system
NOTE: api user for this function must have user_level set to 8 or higher and "ast admin access" enabled
NOTE: api user for this function must have user_level set to 8 or higher and "AGC Admin Access" enabled
REQUIRED FIELDS-
alias_id - 2-20 characters
@@ -1992,7 +2032,7 @@ SUCCESS: add_phone_alias PHONE ALIAS HAS BEEN ADDED - 6666|x100|testing_x100|cc1
--------------------------------------------------------------------------------
update_phone_alias - updates or deletes a phone alias entry already in the system
NOTE: api user for this function must have user_level set to 8 or higher and "ast admin access" enabled
NOTE: api user for this function must have user_level set to 8 or higher and "AGC Admin Access" enabled
REQUIRED FIELDS-
alias_id - 2-20 characters
@@ -2022,7 +2062,7 @@ SUCCESS: update_phone_alias PHONE ALIAS HAS BEEN DELETED - 6666|x100|
--------------------------------------------------------------------------------
server_refresh - forces a conf file refresh on all telco servers in the cluster
NOTE: api user for this function must have user_level set to 8 or higher and "ast admin access" enabled
NOTE: api user for this function must have user_level set to 8 or higher and "AGC Admin Access" enabled
REQUIRED FIELDS-
stage - "REFRESH"
+3
View File
@@ -1,3 +1,6 @@
[general]
dateformat = %F %T.%3q
[logfiles]
console => notice,warning,error,dtmf
messages => notice,warning,error,debug,verbose,dtmf
@@ -136,7 +136,8 @@ package AGIHandlers::VDAD_ALL_outbound;
# 251001-1837 - Fix for rare Stereo recording filename issue
# 251020-0835 - Added code for recording_dtmf_muting, fix for stereo call recording
# 260805-1057 - Converted to a PM file for the FastAGIServer system
# 260902-1606 - Fix for systems with overloaded Khomp servers
#
our $fagi_channel = '';
our $AGI = '';
@@ -7318,6 +7319,14 @@ sub khomp_json_api
$agi_string = "-- KHOMP RESPONSE JSON: |$message|"; &agi_output;
}
$test503 = $message;
$test503 =~ s/\n|\r|\t//gi;
if ($test503 =~ /503 Service Not Available/)
{
$agi_string = "-- KHOMP API REJECTED OUR REQUEST!!! forcing fake timeout response"; &agi_output;
$message = '{"id":0,"jsonrpc":"2.0","result":{"calls":[{"disconnected":false,"fields":{"analyzer_action":"Connect","analyzer_conclusion":"Khomp Reject","analyzer_pattern":"","analyzer_stamp":"9999999999","answer_stamp":"9999999999","audio_stamp":"9999999999","end_stamp":"","hangup_cause":"","hangup_cause_sent":"","hangup_origin":"","sip_header:call-id":"","start_stamp":"1788358771462"}}]}}';
}
$json = JSON::PP->new->ascii->pretty->allow_nonref;
$result = $json->decode($message);
+4 -3
View File
@@ -139,10 +139,11 @@
# 250523-1730 - Added inbound calls counting capability
# 260420-1445 - Code updates for PHP8 compatibility
# 260501-1447 - Small fix for monitoring issue
# 260902-1708 - Fix for PJSIP
#
$version = '2.14-122';
$build = '260501-1447';
$version = '2.14-123';
$build = '260902-1708';
$php_script='AST_timeonVDADall.php';
require("dbconnect_mysqli.php");
@@ -3854,7 +3855,7 @@ if ($talking_to_print > 0)
$dialplan = preg_replace('/\@.*/i', '',$dialplan);
$exten = "dialplan_number='$dialplan'";
}
if (preg_match('/SIP\//i',$Aextension[$i]))
if (preg_match('/(SIP|PJSIP)\//i',$Aextension[$i]))
{
$protocol = 'SIP';
$dialplan = preg_replace('/SIP\//i', '',$Aextension[$i]);
+17 -12
View File
@@ -124,13 +124,13 @@ $PHP_SELF=$_SERVER['PHP_SELF'];
$PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF);
$QUERY_STRING = getenv("QUERY_STRING");
$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, DB Schema Compare Utility, Khomp Quick Stats 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, DB Schema Compare Utility, Khomp Quick Stats Report, CID SIP 603 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, 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, DB Schema Compare Utility, Khomp Quick Stats 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, 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, DB Schema Compare Utility, Khomp Quick Stats Report, CID SIP 603 Report';
$Vtables = 'NONE,log_noanswer,did_agent_log,contact_information';
$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_ingroup_availability agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number copy_user did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list ingroup_list campaigns_list callmenu_list hopper_list hopper_bulk_insert call_dispo_report agent_campaigns park_call pause_code preview_dial_action ra_call_control recording stereo_recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead batch_update_lead update_list list_info list_custom_fields update_log_entry update_phone update_phone_alias update_user user_group_status vm_list vm_message webphone_url webserver logged_in_agents update_campaign update_alt_url update_presets add_did copy_did update_did lead_field_info lead_all_info lead_callback_info phone_number_log switch_lead ccc_lead_info lead_status_search lead_search lead_dearchive call_status_stats calls_in_queue_count force_fronter_leave_3way force_fronter_audio_stop update_cid_group_entry add_dnc_phone delete_dnc_phone add_fpg_phone send_notification refresh_panel update_remote_agent user_details';
$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_ingroup_availability agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number copy_user copy_phone did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list ingroup_list campaigns_list callmenu_list hopper_list hopper_bulk_insert call_dispo_report agent_campaigns park_call pause_code preview_dial_action ra_call_control recording stereo_recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead batch_update_lead update_list list_info list_custom_fields update_log_entry update_phone update_phone_alias update_user user_group_status vm_list vm_message webphone_url webserver logged_in_agents update_campaign update_alt_url update_presets add_did copy_did update_did lead_field_info lead_all_info lead_callback_info phone_number_log switch_lead ccc_lead_info lead_status_search lead_search lead_dearchive call_status_stats calls_in_queue_count force_fronter_leave_3way force_fronter_audio_stop update_cid_group_entry add_dnc_phone delete_dnc_phone add_fpg_phone send_notification refresh_panel update_remote_agent user_details';
$browser_alert_sounds_list = 'bark_dog,beep_double,beep_five,beep_up,bell_double,bell_school,bird,blaster1,blaster2,buzz1,buzz2,cash_register,chat_alert,click_single,click_double,click_quiet,close_encounter,confirmation,ding,droplet,droplet_double,elephant,email_alert,hold_tone,horn_bike,horn_car,horn_car_triple,horn_clown,horn_double,horn_train,meow_cat,scream_wilhelm,silence_quick,siren,slide_down,slide_up,swish,teleport1,teleport2,ticking_two,ticking_four,ticking_six,whip,whistle_up,whistle_two,whistle_three,whoosh,xylophone1,xylophone2,xylophone3,xylophone4,20Hz_tone';
@@ -6626,8 +6626,7 @@ $survey_camp_record_dir = preg_replace('/;/','',$survey_camp_record_dir);
$conf_override = preg_replace('/;/','',$conf_override);
$template_contents = preg_replace('/;/','',$template_contents);
$registration_string = preg_replace('/;/','',$registration_string);
$account_entry = preg_replace('/;/','',$account_entry);
$account_entry = preg_replace('/\r/', '',$account_entry);
#$account_entry = preg_replace('/\r/', '',$account_entry);
$globals_string = preg_replace('/;/','',$globals_string);
$dialplan_entry = preg_replace('/\\\\/', '',$dialplan_entry);
$dialplan_entry = preg_replace('/\'/', '',$dialplan_entry);
@@ -7776,12 +7775,16 @@ if ($SSscript_remove_js > 0)
# 260529-0918 - Added new AMD features
# 260620-1447 - Added amd_status_map system setting and campaign setting
# 260822-0855 - Added many input variable declarations, added agent_ingroup_availability API function
# 260902-1656 - Fix for PJSIP
# 260907-1810 - Added copy_phone API function
# 260910-0111 - Fix for added users without user_group
# 260910-2040 - Added CID SIP 603 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-962a';
$build = '260822-0855';
$admin_version = '2.14-966a';
$build = '260910-2040';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -13491,7 +13494,7 @@ if ($ADD=="2")
{
$user = 'AUTOGENERA';
}
if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_group) < 2) or ( (mb_strlen($user,'utf-8') > 20) and (!preg_match('/AUTOGENERA/',$user)) ) or ( ($SSrequire_password_length > 0) and ($SSrequire_password_length > strlen($pass)) ) )
if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_group) < 2) or (preg_match('/---ALL---/',$user_group)) or ( (mb_strlen($user,'utf-8') > 20) and (!preg_match('/AUTOGENERA/',$user)) ) or ( ($SSrequire_password_length > 0) and ($SSrequire_password_length > strlen($pass)) ) )
{
echo "<br>"._QXZ("USER NOT ADDED - Please go back and look at the data you entered")."\n";
echo "<br>"._QXZ("user id must be between 2 and 20 characters long")."\n";
@@ -13503,6 +13506,7 @@ if ($ADD=="2")
else
{echo "<br>"._QXZ("full name and password must be at least 2 characters long")."\n";}
echo "<br>"._QXZ("you must select a user group")."\n";
exit;
}
else
{
@@ -13822,6 +13826,7 @@ if ($ADD=="2A")
else
{echo "<br>"._QXZ("full name and password must be at least 2 characters long")."\n";}
echo "<!-- |$user|$pass|$full_name| -->\n";
exit;
}
else
{
@@ -16918,7 +16923,7 @@ if ($ADD==241111111111)
{
echo "<br>"._QXZ("CARRIER ADDED")."\n";
$stmt="INSERT INTO vicidial_server_carriers (carrier_id,carrier_name,registration_string,template_id,account_entry,protocol,globals_string,dialplan_entry,server_ip,active,carrier_description,user_group) values('$carrier_id','$carrier_name','$registration_string','$template_id','$account_entry','$protocol','$globals_string','$dialplan_entry','$server_ip','N','$carrier_description','$user_group');";
$stmt="INSERT INTO vicidial_server_carriers (carrier_id,carrier_name,registration_string,template_id,account_entry,protocol,globals_string,dialplan_entry,server_ip,active,carrier_description,user_group) values('$carrier_id','$carrier_name','$registration_string','$template_id','" . mysqli_real_escape_string($link, $account_entry) . "','$protocol','$globals_string','$dialplan_entry','$server_ip','N','$carrier_description','$user_group');";
$rslt=mysql_to_mysqli($stmt, $link);
$stmtA="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y' and server_ip='$server_ip';";
@@ -22080,7 +22085,7 @@ if ($ADD==441111111111)
{echo "<br>"._QXZ("CARRIER NOT MODIFIED - Please go back and look at the data you entered")."\n";}
else
{
$stmt="UPDATE vicidial_server_carriers set carrier_name='$carrier_name',registration_string='$registration_string',template_id='$template_id',account_entry='$account_entry',protocol='$protocol',globals_string='$globals_string',dialplan_entry='$dialplan_entry',server_ip='$server_ip',active='$active',carrier_description='$carrier_description',user_group='$user_group' where carrier_id='$carrier_id';";
$stmt="UPDATE vicidial_server_carriers set carrier_name='$carrier_name',registration_string='$registration_string',template_id='$template_id',account_entry='" . mysqli_real_escape_string($link, $account_entry) . "',protocol='$protocol',globals_string='$globals_string',dialplan_entry='$dialplan_entry',server_ip='$server_ip',active='$active',carrier_description='$carrier_description',user_group='$user_group' where carrier_id='$carrier_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$stmtA="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y' and server_ip='$server_ip';";
@@ -50505,7 +50510,7 @@ if ($ADD==140000000000)
echo "<tr $bgcolor"; if ($SSadmin_row_click > 0) {echo " onclick=\"window.document.location='$PHP_SELF?ADD=341111111111&carrier_id=$row[0]'\"";} echo "><td><a href=\"$PHP_SELF?ADD=341111111111&carrier_id=$row[0]\"><font size=1 color=black>$row[0]</a></td>";
echo "<td><font size=1>$row[1]</td>";
echo "<td><font size=1>".(preg_match('/[A-Z]/', $row[2]) ? _QXZ("$row[2]") : $row[2])."</td>";
echo "<td><font size=1>".(!preg_match('/^SIP|IAX2/', $row[3]) ? _QXZ("$row[3]") : $row[3])."</td>";
echo "<td><font size=1>".(!preg_match('/^SIP|^PJSIP|IAX2/', $row[3]) ? _QXZ("$row[3]") : $row[3])."</td>";
echo "<td><font size=1>$row[4]</td>";
echo "<td><font size=1>"._QXZ("$row[5]")."</td>";
echo "<td><font size=1>"._QXZ("$row[6]")."</td>";
@@ -53963,7 +53968,7 @@ if ($ADD==999994)
echo "<LI><a href=\"shared_debug.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Shared Debug Page")."</a></FONT> | <a href=\"demographic_quotas_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Demographic Quotas Report")."</a></FONT>\n";
echo "<LI><a href=\"AST_dial_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Dial Log Report")."</a></FONT>\n";
echo "<LI><a href=\"AST_carrier_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Carrier Log Report")."</a></FONT>\n";
echo "<LI><a href=\"callerID_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Caller ID Log Report")."</a></FONT>\n";
echo "<LI><a href=\"callerID_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Caller ID Log Report")."</a></FONT> | <a href=\"cid_603_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("CID SIP 603 Report")."</a></FONT>\n";
echo "<LI><a href=\"AST_hangup_cause_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Hangup Cause Report")."</a></FONT>\n";
echo "<LI><a href=\"AST_SIP_event_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("SIP Event Report")."</a></FONT>\n";
echo "<LI><a href=\"AST_AMD_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("AMD Log Report")."</a></FONT>\n";
+56 -13
View File
@@ -1,7 +1,7 @@
<?php
# admin_bulk_tools.php
#
# Copyright (C) 2024 Mike Coate, Mike Cargile, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Mike Coate, Mike Cargile, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This is the admin screen for various bulk copy/delete tools.
#
@@ -35,6 +35,7 @@
# 230522-1726 - Added missing vicidial_users fields from copy function
# 240217-0908 - Added more missing vicidial_users fields from copy function
# 240801-1130 - Code updates for PHP8 compatibility
# 260902-1713 - Fix for areacode duplicates in multiple countries
#
require("dbconnect_mysqli.php");
@@ -97,7 +98,7 @@ if ($DB) {echo "$form_to_run|";}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$sys_settings_stmt = "SELECT use_non_latin,enable_languages,language_method,campaign_cid_areacodes_enabled,sounds_central_control_active,contacts_enabled,enable_auto_reports,allow_web_debug FROM system_settings;";
$sys_settings_stmt = "SELECT use_non_latin,enable_languages,language_method,campaign_cid_areacodes_enabled,sounds_central_control_active,contacts_enabled,enable_auto_reports,allow_web_debug,default_phone_code FROM system_settings;";
$sys_settings_rslt=mysql_to_mysqli($sys_settings_stmt, $link);
#if ($DB) {echo "$sys_settings_stmt|";}
$num_rows = mysqli_num_rows($sys_settings_rslt);
@@ -112,6 +113,7 @@ if ($num_rows > 0)
$SScontacts_enabled = $sys_settings_row[5];
$SSenable_auto_reports = $sys_settings_row[6];
$SSallow_web_debug = $sys_settings_row[7];
$SSdefault_phone_code = $sys_settings_row[8];
}
else
{
@@ -444,6 +446,8 @@ if ($form_to_run == "ACCID")
}
$areacode = array();
$cid_state = array();
$country = array();
# If using the STATE FILL method, build out the array of ACs and CIDs for each represented state.
if ($ACCIDmethod == "STATEFILL")
{
@@ -454,12 +458,12 @@ if ($form_to_run == "ACCID")
while ($i < count($ACCIDto_insert_raw))
{
$STATEFILLareacode[$i] = substr($ACCIDto_insert_raw[$i], 0, 3);
$SQL = "SELECT state FROM vicidial_phone_codes WHERE country IN('USA','CAN') AND areacode='$STATEFILLareacode[$i]';";
$SQL = "SELECT state FROM vicidial_phone_codes WHERE country_code='$SSdefault_phone_code' AND areacode='$STATEFILLareacode[$i]';";
if ($DB) {echo "$SQL|";}
$SQL_rslt = mysql_to_mysqli($SQL, $link);
$state = mysqli_fetch_row($SQL_rslt);
$SQL = "SELECT areacode FROM vicidial_phone_codes WHERE country IN('USA','CAN') AND state='$state[0]';";
$SQL = "SELECT areacode, country FROM vicidial_phone_codes WHERE country_code='$SSdefault_phone_code' AND state='$state[0]';";
if ($DB) {echo "$SQL|";}
$SQL_rslt = mysql_to_mysqli($SQL, $link);
$areacode_count = mysqli_num_rows($SQL_rslt);
@@ -469,6 +473,8 @@ if ($form_to_run == "ACCID")
{
$row = mysqli_fetch_row($SQL_rslt);
$areacode[$j] = $row[0];
$country[$j] = $row[1];
$cid_state[$j] = $state[0];
$STATEFILLcids[$j] = $ACCIDto_insert_raw[$i];
$j++;
$k++;
@@ -487,6 +493,8 @@ if ($form_to_run == "ACCID")
$ACCIDduplicate = array();
$ACCIDinserted = array();
$ACCIDareacode = array();
$ACCIDstate = array();
$ACCIDcountry = array();
$ACCIDbadlen = array();
$i=0; #loop counter
$j=0; #duplicate counter
@@ -497,17 +505,22 @@ if ($form_to_run == "ACCID")
if ($ACCIDmethod == "CID")
{
$areacode[$i] = substr($ACCIDto_insert_raw[$i], 0, 3);
if ($CGT == 'STATE')
# if ($CGT == 'STATE')
if (preg_match('/STATE|AREACODE/', $CGT))
{
$SQL = "SELECT state FROM vicidial_phone_codes WHERE country IN('USA','CAN') AND areacode='$areacode[$i]';";
$SQL = "SELECT state, country FROM vicidial_phone_codes WHERE country_code='$SSdefault_phone_code' AND areacode='$areacode[$i]';";
if ($DB) {echo "$SQL|";}
$SQL_rslt = mysql_to_mysqli($SQL, $link);
$row=mysqli_fetch_row($SQL_rslt);
$areacode[$i] = $row[0];
$cid_state[$i] = $row[0];
$country[$i] = $row[1];
}
if ($CGT == 'NONE')
{
$areacode[$i] = 'NONE';
$cid_state[$i] = 'NONE';
$country[$i] = 'NONE';
}
}
if ($ACCIDmethod == "CSV") {$areacode[$i] = $ACCIDareacode_raw[$i];}
@@ -529,6 +542,8 @@ if ($form_to_run == "ACCID")
{
$ACCIDto_insert[$k] = $ACCIDto_insert_raw[$i];
$ACCIDareacode[$k] = $areacode[$i];
$ACCIDstate[$k] = $cid_state[$i];
$ACCIDcountry[$k] = $country[$i];
$k++;
}
$i++;
@@ -556,30 +571,46 @@ if ($form_to_run == "ACCID")
}
else
{
echo _QXZ("ATTENTION, You are about to add the following AC-CIDs to this campaign").": $ACCIDcampaign";
echo _QXZ("ATTENTION, You are about to add the following AC-CIDs to this campaign").": $ACCIDcampaign<BR>";
$i = 0;
echo "<ul>";
while ($i < count($ACCIDto_insert))
{
echo "<br> $ACCIDto_insert[$i]";
echo "<li> $ACCIDto_insert[$i]";
if (preg_match('/STATE|AREACODE/', $CGT))
{
echo (isset($ACCIDstate[$i]) && $ACCIDstate[$i]!="NONE" && $ACCIDstate[$i]!="" ? " - areacode found in state $ACCIDstate[$i], country $ACCIDcountry[$i]" : (isset($ACCIDcountry[$i]) ? " - areacode found in country $ACCIDcountry[$i], no state found" : " - <B>**no state/country info found for areacode ".substr($ACCIDto_insert[$i], 0, 3)."***</B>"));
}
echo "</li>";
$i++;
}
echo "</ul>";
echo "<br> "._QXZ("The following AC-CIDs are duplicates and will not be created").": ";
if (empty($ACCIDduplicate[0])) {echo "<br> "._QXZ("NONE");}
echo "<ul>";
if (empty($ACCIDduplicate[0])) {echo "<li> "._QXZ("NONE")."</li>";}
$i = 0;
while ($i < count($ACCIDduplicate))
{
echo "<br> $ACCIDduplicate[$i]";
echo "<li> $ACCIDduplicate[$i]</li>";
$i++;
}
echo "</ul>";
echo "<br> "._QXZ("The following AC-CIDs are of invalid length and will not be created").": ";
if (empty($ACCIDbadlen[0])) {echo "<br> "._QXZ("NONE");}
echo "<ul>";
if (empty($ACCIDbadlen[0])) {echo "<li> "._QXZ("NONE")."</li>";}
$i = 0;
while ($i < count($ACCIDbadlen))
{
echo "<br> $ACCIDbadlen[$i]";
echo "<li> $ACCIDbadlen[$i]</li>";
$i++;
}
}
echo "</ul>";
$ACCIDto_insert = serialize($ACCIDto_insert);
$ACCIDareacode = serialize($ACCIDareacode);
if ($ACCIDmethod=="CSV") {$ACCIDdescription_raw = serialize($ACCIDdescription_raw);}
@@ -631,7 +662,7 @@ elseif ($form_to_run == "ACCIDconfirmed")
$ACCIDareacode[$i] = preg_replace('/[^-_0-9\p{L}]/u', '', $ACCIDareacode[$i]);
if (!preg_match("/[A-Z]/i",$ACCIDareacode[$i]))
{
$SQL="SELECT state FROM vicidial_phone_codes WHERE areacode='$ACCIDareacode[$i]';";
$SQL="SELECT state FROM vicidial_phone_codes WHERE areacode='$ACCIDareacode[$i]' and country_code='$SSdefault_phone_code';";
$SQL_rslt = mysql_to_mysqli($SQL, $link);
$row = mysqli_fetch_row($SQL_rslt);
if ( $row[0] == null ) #Put something in if NULL because areacode.vicidial_campaign_cid_areacodes cannot be NULL
@@ -1903,6 +1934,18 @@ else
echo "<option value='CSV'>"._QXZ("CSV")."</option>\n";
echo "<option value='STATEFILL'>"._QXZ("STATE FILL")."</option>\n";
echo "</select></td></tr>\n";
$country_stmt="select distinct country from vicidial_phone_codes where country_code='$SSdefault_phone_code' order by country";
$country_rslt=mysql_to_mysqli($country_stmt, $link);
$country_str="";
while($country_row=mysqli_fetch_row($country_rslt))
{
$country_str.="$country_row[0], ";
}
$country_str=preg_replace('/, $/', '', $country_str);
echo "<tr bgcolor=#". $SSstd_row1_background ."><td align=right valign='top'>"._QXZ("State Lookup/Fill Filter").": </td><td align=left valign='top' class='standard'>Country code: ".(isset($SSdefault_phone_code) ? "<B>$SSdefault_phone_code</B><BR>Countries: <B>$country_str</B>" : "<B>**NONE DEFINED**</B>") ."</td></tr>\n";
echo "<tr bgcolor=#". $SSstd_row1_background ."><td align=right>"._QXZ("Campaign or CID Group").":</td><td align=left>\n";
$ACCIDcampaigns_to_copy = array();
+4 -3
View File
@@ -87,10 +87,11 @@
# 260203-1600 - Fix for field chooser issue and more code updates for PHP8 compatibility
# 260415-1710 - Added summarized error output, fuzzy field auto-detection for custom layout, Issue #1561 from Acidshock
# 260514-1553 - Added default_phone_code use for Phone Code field on form
# 260912-0956 - Added link to 6th gen lead loader
#
$version = '2.14-84';
$build = '260514-1553';
$version = '2.14-85';
$build = '260912-0956';
require("dbconnect_mysqli.php");
require("functions.php");
@@ -1371,7 +1372,7 @@ if ($SSenable_international_dncs)
<tr>
<td align=center colspan=2><input style='background-color:#<?php echo "$SSbutton_color"; ?>' type=submit value="<?php echo _QXZ("SUBMIT"); ?>" name='submit_file'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input style='background-color:#<?php echo "$SSbutton_color"; ?>' type=button onClick="javascript:document.location='admin_listloader_fifth_gen.php'" value="<?php echo _QXZ("START OVER"); ?>" name='reload_page'></td>
</tr>
<tr><td align=left><font size=1> &nbsp; &nbsp; &nbsp; &nbsp; <a href="admin.php?ADD=100" target="_parent"><?php echo _QXZ("BACK TO ADMIN"); ?></a> &nbsp; &nbsp; </font></td><td align=right><font size=1><?php echo _QXZ("LIST LOADER 5th Gen"); ?> | <a href="admin_listloader_fourth_gen.php"><?php echo _QXZ("4th Gen"); ?></a> &nbsp; &nbsp; <?php echo _QXZ("VERSION"); ?>: <?php echo $version ?> &nbsp; &nbsp; <?php echo _QXZ("BUILD"); ?>: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
<tr><td align=left><font size=1> &nbsp; &nbsp; &nbsp; &nbsp; <a href="admin.php?ADD=100" target="_parent"><?php echo _QXZ("BACK TO ADMIN"); ?></a> &nbsp; &nbsp; </font></td><td align=right><font size=1><a href="admin_listloader_fourth_gen.php"><?php echo _QXZ("4th Gen"); ?></a> | <?php echo _QXZ("LIST LOADER 5th Gen"); ?> | <a href="admin_listloader_sixth_gen.php"><?php echo _QXZ("6th Gen"); ?></a> &nbsp; &nbsp; <?php echo _QXZ("VERSION"); ?>: <?php echo $version ?> &nbsp; &nbsp; <?php echo _QXZ("BUILD"); ?>: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
</table>
<?php
File diff suppressed because it is too large Load Diff
+451
View File
@@ -0,0 +1,451 @@
<?php
# cid_603_report.php
#
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 260910-1726 - First build
#
$startMS = microtime();
require("dbconnect_mysqli.php");
require("functions.php");
$report_name='CID SIP 603 Report';
$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["query_date_D"])) {$query_date_D=$_GET["query_date_D"];}
elseif (isset($_POST["query_date_D"])) {$query_date_D=$_POST["query_date_D"];}
if (isset($_GET["query_date_T"])) {$query_date_T=$_GET["query_date_T"];}
elseif (isset($_POST["query_date_T"])) {$query_date_T=$_POST["query_date_T"];}
if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];}
elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];}
if (isset($_GET["lower_limit"])) {$lower_limit=$_GET["lower_limit"];}
elseif (isset($_POST["lower_limit"])) {$lower_limit=$_POST["lower_limit"];}
if (isset($_GET["upper_limit"])) {$upper_limit=$_GET["upper_limit"];}
elseif (isset($_POST["upper_limit"])) {$upper_limit=$_POST["upper_limit"];}
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["report_display_type"])) {$report_display_type=$_GET["report_display_type"];}
elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];}
$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
$NOW_DATE = date("Y-m-d");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$time_an_hour_ago = date('H:i:s', strtotime('-1 hour'));
if (strlen($query_date_D) < 6) {$query_date_D = $time_an_hour_ago;}
if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,allow_web_debug FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
#if ($DB) {$MAIN.="$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];
$SSallow_web_debug = $row[6];
}
if ($SSallow_web_debug < 1) {$DB=0;}
##### END SETTINGS LOOKUP #####
###########################################
$query_date = preg_replace('/[^- \:\_0-9a-zA-Z]/', '', $query_date);
$query_date_D = preg_replace('/[^- \:\_0-9a-zA-Z]/', '', $query_date_D);
$query_date_T = preg_replace('/[^- \:\_0-9a-zA-Z]/', '', $query_date_T);
$lower_limit = preg_replace('/[^-_0-9a-zA-Z]/', '', $lower_limit);
$upper_limit = preg_replace('/[^-_0-9a-zA-Z]/', '', $upper_limit);
$submit = preg_replace('/[^-_0-9a-zA-Z]/', '', $submit);
$SUBMIT = preg_replace('/[^-_0-9a-zA-Z]/', '', $SUBMIT);
$report_display_type = preg_replace('/[^-_0-9a-zA-Z]/', '', $report_display_type);
$file_download = preg_replace('/[^-_0-9a-zA-Z]/', '', $file_download);
if ($non_latin < 1)
{
$PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW);
}
else
{
$PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW);
}
$stmt="SELECT selected_language,user_group from vicidial_users where user='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$sl_ct = mysqli_num_rows($rslt);
if ($sl_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$VUselected_language = $row[0];
$LOGuser_group = $row[1];
}
$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;
}
$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {$HTML_text.="|$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];
$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 ";
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 "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\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, $lower_limit, $upper_limit, $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");
$MAIN.="<!-- Using slave server $slave_db_server $db_source -->\n";
}
$HEADER.="<HTML>\n";
$HEADER.="<HEAD>\n";
$HEADER.="<STYLE type=\"text/css\">\n";
$HEADER.="<!--\n";
$HEADER.=" .green {color: white; background-color: green}\n";
$HEADER.=" .red {color: white; background-color: red}\n";
$HEADER.=" .blue {color: white; background-color: blue}\n";
$HEADER.=" .purple {color: white; background-color: purple}\n";
$HEADER.=" .small_standard { font-family: Arial, Helvetica, sans-serif; font-size: 8pt}\n";
$HEADER.=" .small_standard_bold { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold}\n";
$HEADER.="-->\n";
$HEADER.=" </STYLE>\n";
$HEADER.="<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
$HEADER.="<link rel=\"stylesheet\" href=\"calendar.css\">\n";
$HEADER.="<link rel=\"stylesheet\" href=\"horizontalbargraph.css\">\n";
$HEADER.="<link rel=\"stylesheet\" href=\"verticalbargraph.css\">\n";
$HEADER.="<script language=\"JavaScript\" src=\"wz_jsgraphics.js\"></script>\n";
$HEADER.="<script language=\"JavaScript\" src=\"line.js\"></script>\n";
$HEADER.="<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
$HEADER.="<TITLE>"._QXZ("$report_name")."</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
### BEGIN figure out where the CID is in the vicidial_dial_log
$CIDbegin=0;
$CIDend=0;
$CIDlength=0;
$stmt = "SELECT outbound_cid FROM vicidial_dial_log where lead_id > 0 and (outbound_cid LIKE '\"M%' or outbound_cid LIKE '\"V%') order by call_date desc limit 1;";
$rslt=mysql_to_mysqli($stmt, $link);
#if ($DB) {$MAIN.="$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$temp_outbound_cid = $row[0];
$temp_outbound_cid_LENGTH = strlen($temp_outbound_cid);
$g=0;
while ($g < $temp_outbound_cid_LENGTH)
{
$temp_char = substr($temp_outbound_cid,$g,1);
if ($temp_char == '<')
{$CIDbegin = $g;}
if ($temp_char == '>')
{$CIDend = $g;}
# echo "DEBUG: $g|$temp_char| CIDbegin: $CIDbegin CIDend: $CIDend CIDlength: $CIDlength CIDraw: $temp_outbound_cid ($temp_outbound_cid_LENGTH) \n";
$g++;
}
if ( ($CIDbegin > 0) and ($CIDend > 0) )
{
$CIDlength = (($CIDend - $CIDbegin) - 1);
$CIDbegin = ($CIDbegin + 2);
}
else
{
echo $HEADER;
require("admin_header.php");
echo "ERROR: No dial logs to analyze \n";
exit;
}
}
# echo "DEBUG: CIDbegin: $CIDbegin CIDlength: $CIDlength CIDraw: $temp_outbound_cid ($temp_outbound_cid_LENGTH) \n";
### END figure out where the CID is in the vicidial_dial_log
$MAIN.="<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$MAIN.="<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
$MAIN.="<TABLE BORDER=0 cellspacing=5 cellpadding=5><TR><TD VALIGN=TOP align=center>\n";
$MAIN.="<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
$MAIN.=_QXZ("Date").":\n";
$MAIN.="<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">";
$MAIN.="<script language=\"JavaScript\">\n";
$MAIN.="var o_cal = new tcal ({\n";
$MAIN.=" // form name\n";
$MAIN.=" 'formname': 'vicidial_report',\n";
$MAIN.=" // input name\n";
$MAIN.=" 'controlname': 'query_date'\n";
$MAIN.="});\n";
$MAIN.="o_cal.a_tpl.yearscroll = false;\n";
$MAIN.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
$MAIN.="</script></tD>\n";
$MAIN.="<TD VALIGN=TOP align=center><INPUT TYPE=TEXT NAME=query_date_D SIZE=9 MAXLENGTH=8 VALUE=\"$query_date_D\">";
$MAIN.=" "._QXZ("to")." <INPUT TYPE=TEXT NAME=query_date_T SIZE=9 MAXLENGTH=8 VALUE=\"$query_date_T\">";
$MAIN.="</TD><TD VALIGN=middle align=center>\n";
$MAIN.=_QXZ("Display as").":";
$MAIN.="<select name='report_display_type'>";
if ($report_display_type) {$MAIN.="<option value='$report_display_type' selected>$report_display_type</option>";}
$MAIN.="<option value='TEXT'>"._QXZ("TEXT")."</option><option value='HTML'>"._QXZ("HTML")."</option></select></TD>";
$MAIN.="<TD VALIGN=TOP align=center><INPUT TYPE=submit NAME=SUBMIT VALUE='"._QXZ("SUBMIT")."'>\n";
$MAIN.="</TD><TD>";
$MAIN.="</TD></TR></TABLE>\n";
if ($SUBMIT && $query_date)
{
# SELECT count(*) as calls,SUM(CASE WHEN sip_hangup_cause='603' THEN 1 ELSE 0 END) AS SOT, round((SUM(CASE WHEN sip_hangup_cause='603' THEN 1 ELSE 0 END) / (count(*)) * 100 ),2) as SOTpct, SUBSTRING(vdl.outbound_cid FROM 25 FOR 10) as CID FROM vicidial_dial_log vdl WHERE (vdl.call_date >= '2026-09-10 15:00:00') and (vdl.call_date <= '2026-09-10 16:00:00') group by CID order by SOTpct desc limit 5000;
$stmt="SELECT SUBSTRING(vdl.outbound_cid FROM $CIDbegin FOR $CIDlength) as CID, count(*) as calls,SUM(CASE WHEN sip_hangup_cause='603' THEN 1 ELSE 0 END) AS SOT, round((SUM(CASE WHEN sip_hangup_cause='603' THEN 1 ELSE 0 END) / (count(*)) * 100 ),2) as SOTpct FROM vicidial_dial_log vdl WHERE (vdl.call_date >= '$query_date $query_date_D') and (vdl.call_date <= '$query_date $query_date_T') group by CID order by SOTpct desc limit 50000;";
$rslt=mysql_to_mysqli($stmt, $link);
$ASCII_text="<PRE><font size=2>\n";
$HTML_text="";
$CIDs_count=0;
if ($DB) {$ASCII_text.=$stmt."\n";}
if (mysqli_num_rows($rslt)>0)
{
$ASCII_text.="--- "._QXZ("OUTBOUND CALLERID NUMBER SIP 603 REPORT")." $query_date, $query_date_D "._QXZ("TO")." $query_date_T &nbsp; &nbsp; ";
$ASCII_text.="<a href=\"$PHP_SELF?SUBMIT=$SUBMIT&DB=$DB&type=$type&query_date=$query_date&query_date_D=$query_date_D&query_date_T=$query_date_T&lower_limit=$lower_limit&upper_limit=$upper_limit&file_download=1\">["._QXZ("DOWNLOAD")."]</a> \n";
$ASCII_text.="+-----------------+---------+---------+----------+\n";
$ASCII_text.="| "._QXZ("CID Number",15)." | "._QXZ("CALLS",7)." | "._QXZ("603s",7)." | "._QXZ("603 pct",8)." |\n";
$ASCII_text.="+-----------------+---------+---------+----------+\n";
$HTML_text.="<table border='0' cellpadding='0' cellspacing='2' width='350'>";
$HTML_text.="<TR><TH colspan='2' class='small_standard_bold grey_graph_cell'>"._QXZ("OUTBOUND CALLERID NUMBER SIP 603 REPORT")." $query_date, $query_date_D "._QXZ("TO")." $query_date_T</TH></TR>";
$HTML_text.="<TR><TH class='small_standard_bold grey_graph_cell'>"._QXZ("CID Number")."</th><TH class='small_standard_bold grey_graph_cell'>"._QXZ("COUNT")."</th><TH class='small_standard_bold grey_graph_cell'>"._QXZ("603s")."</th><TH class='small_standard_bold grey_graph_cell'>"._QXZ("603 pct")."</th></tr>";
$CSV_text="\""._QXZ("CID Number")."\",\""._QXZ("CALLS")."\",\""._QXZ("603s")."\",\""._QXZ("603 pct")."\"\n";
$total_count=0;
$total_countSOT=0;
while ($row=mysqli_fetch_array($rslt))
{
$ASCII_text.="| ".sprintf("%-16s", $row["CID"]);
$ASCII_text.="| ".sprintf("%8s", $row["calls"]);
$ASCII_text.="| ".sprintf("%8s", $row["SOT"]);
$ASCII_text.="| ".sprintf("%8s", $row["SOTpct"])."%";
$ASCII_text.="|\n";
$HTML_text.="<TR><TD class='small_standard'>$row[CID]</td><TD class='small_standard'>$row[calls]</td><TD class='small_standard'>$row[SOT]</td><TD class='small_standard'>$row[SOTpct]</td></tr>";
$CSV_text.="\"$row[CID]\",\"$row[calls]\",\"$row[SOT]\",\"$row[SOTpct]%\"\n";
$total_count+=$row["calls"];
$total_countSOT+=$row["SOT"];
$CIDs_count++;
}
$ASCII_text.="+-----------------+---------+---------+----------+\n";
$ASCII_text.="| "._QXZ("TOTAL",15,"r")." | ".sprintf("%8s", $total_count)."| ".sprintf("%8s", $total_countSOT)."|\n";
$ASCII_text.="+-----------------+---------+---------+\n";
$ASCII_text.=" "._QXZ("CIDs Count",10,"r").": $CIDs_count \n\n\n";
$HTML_text.="<TR><TH class='small_standard_bold grey_graph_cell'>"._QXZ("TOTAL")."</th><TH class='small_standard_bold grey_graph_cell'>$total_count</th><TH class='small_standard_bold grey_graph_cell'>$total_countSOT</th></tr></table>";
}
else
{
$MAIN.="*** "._QXZ("NO RECORDS FOUND")." ***\n";
}
$ASCII_text.="</font></PRE>\n";
if ($report_display_type=="HTML")
{
$MAIN.=$HTML_text;
}
else
{
$MAIN.=$ASCII_text;
}
$MAIN.="</form></BODY></HTML>\n";
}
if ($file_download>0)
{
$FILE_TIME = date("Ymd-His");
$CSVfilename = "AST_url_log_report_$US$FILE_TIME.csv";
$CSV_text=preg_replace('/ +\"/', '"', $CSV_text);
$CSV_text=preg_replace('/\" +/', '"', $CSV_text);
// We'll be outputting a TXT file
header('Content-type: application/octet-stream');
// It will be called LIST_101_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 "$CSV_text";
exit;
}
else
{
echo $HEADER;
require("admin_header.php");
echo $MAIN;
}
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;
?>
+3 -2
View File
@@ -40,6 +40,7 @@
# 210308-0939 - Fix for ALL_DNC_CAMPAIGNS dnc download
# 220224-1041 - Added allow_web_debug system setting
# 260822-0834 - Fix for Issue #1564
# 260904-1419 - Fix for Issue #1560
#
$startMS = microtime();
@@ -771,8 +772,8 @@ if ( ($custom_fields_enabled > 0) and ($event_code_type=='LIST') )
}
if ($columns_ct > 1)
{
if(preg_match("/lead_id,/",$column_list)) {$columns_ct--;} # Lower column count by 1 because we're removing this column
$column_list = preg_replace("/lead_id,/",'',$column_list);
if(preg_match("/^lead_id,/",$column_list)) {$columns_ct--;} # Lower column count by 1 because we're removing this column
$column_list = preg_replace("/^lead_id,/",'',$column_list);
$column_list = preg_replace("/,$/",'',$column_list);
$column_list_array = explode(',',$column_list);
if (preg_match("/cf_encrypt/",$active_modules))
+186 -8
View File
@@ -231,10 +231,13 @@
# 260519-1647 - Code updates for PHP8 compatibility, and json output format
# 260611-2256 - Fix for input variable filtering
# 260822-0841 - Added agent_ingroup_availability function
# 260902-1709 - Fix for PJSIP
# 260907-1702 - Added PJSIP option for add_phone & update_phone
# 260907-1808 - Added copy_phone function
#
$version = '2.14-206';
$build = '260822-0841';
$version = '2.14-209';
$build = '260907-1808';
$php_script='non_agent_api.php';
$api_url_log = 0;
$camp_lead_order_random=1;
@@ -1032,6 +1035,13 @@ if (isset($_GET["ingroup_set_name"])) {$ingroup_set_name=$_GET["ingroup_set_na
else {$ingroup_set_name="";}
if (isset($_GET["DBX"])) {$DBX=$_GET["DBX"];}
elseif (isset($_POST["DBX"])) {$DBX=$_POST["DBX"];}
if (isset($_GET["source_extension"])) {$source_extension=$_GET["source_extension"];}
elseif (isset($_POST["source_extension"])) {$source_extension=$_POST["source_extension"];}
else {$source_extension="";}
if (isset($_GET["source_server_ip"])) {$source_server_ip=$_GET["source_server_ip"];}
elseif (isset($_POST["source_server_ip"])) {$source_server_ip=$_POST["source_server_ip"];}
else {$source_server_ip="";}
if (file_exists('options.php'))
{require('options.php');}
@@ -1042,7 +1052,7 @@ header ("Pragma: no-cache"); // HTTP/1.0
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,custom_fields_enabled,pass_hash_enabled,agent_whisper_enabled,active_modules,auto_dial_limit,enable_languages,language_method,admin_web_directory,sounds_web_server,allow_web_debug,enhanced_agent_monitoring FROM system_settings;";
$stmt = "SELECT use_non_latin,custom_fields_enabled,pass_hash_enabled,agent_whisper_enabled,active_modules,auto_dial_limit,enable_languages,language_method,admin_web_directory,sounds_web_server,allow_web_debug,enhanced_agent_monitoring,default_phone_registration_password,default_phone_login_password FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
@@ -1062,6 +1072,8 @@ if ($qm_conf_ct > 0)
$SSsounds_web_server = $row[9];
$SSallow_web_debug = $row[10];
$SSenhanced_agent_monitoring = $row[11];
$SSdefault_phone_registration_password = $row[12];
$SSdefault_phone_login_password = $row[13];
}
if ($SSallow_web_debug < 1 || !isset($DB)) {$DB=0;}
if ($SSallow_web_debug < 1 || !isset($DBX)) {$DBX=0;}
@@ -1096,6 +1108,7 @@ $function = preg_replace('/[^-_0-9a-zA-Z]/', '',$function);
$format = preg_replace('/[^0-9a-zA-Z]/','',$format);
$session_id = preg_replace('/[^0-9]/','',$session_id);
$server_ip = preg_replace('/[^-\.\:\_0-9a-zA-Z]/','',$server_ip);
$source_server_ip = preg_replace('/[^-\.\:\_0-9a-zA-Z]/','',$source_server_ip);
$stage = preg_replace('/[^-_0-9a-zA-Z]/','',$stage);
$rank = preg_replace('/[^0-9]/','',$rank);
$did_ids=preg_replace('/[^\,\+0-9a-zA-Z]/','',$did_ids);
@@ -1259,6 +1272,7 @@ if ($non_latin < 1)
$custom_four=preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$custom_four);
$custom_five=preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$custom_five);
$extension=preg_replace('/[^-_0-9a-zA-Z]/','',$extension);
$source_extension = preg_replace('/[^-_0-9a-zA-Z]/','',$source_extension);
$dialplan_number=preg_replace('/[^\*\#0-9a-zA-Z]/','',$dialplan_number);
$registration_password=preg_replace('/[^-_0-9a-zA-Z]/','',$registration_password);
$phone_full_name=preg_replace('/[^- \+\.\_0-9a-zA-Z]/','',$phone_full_name);
@@ -1422,6 +1436,7 @@ else
$custom_four=preg_replace('/[^- \+\.\:\/\@\_0-9\p{L}]/u','',$custom_four);
$custom_five=preg_replace('/[^- \+\.\:\/\@\_0-9\p{L}]/u','',$custom_five);
$extension=preg_replace('/[^-_0-9\p{L}]/u','',$extension);
$source_extension=preg_replace('/[^-_0-9\p{L}]/u','',$source_extension);
$dialplan_number=preg_replace('/[^\*\#0-9\p{L}]/u','',$dialplan_number);
$registration_password=preg_replace('/[^-_0-9\p{L}]/u','',$registration_password);
$phone_full_name=preg_replace('/[^- \+\.\_0-9\p{L}]/u','',$phone_full_name);
@@ -4092,13 +4107,16 @@ if ($function == 'blind_monitor')
$AGENTstatus = $row[3];
}
$variable = "Variable: __monitorsession=$session_id";
# $variable = "Variable: __monitorsession=$session_id";
$variable = "Variable: __monitorsession=$session_id,__MONITORCG=$BMquery";
### insert a new lead in the system with this phone number
$stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$monitor_server_ip','','Originate','$BMquery','Channel: Local/$monitor_dialstring$stage$session_id@default','Context: default','Exten: $dialplan_number','Priority: 1','Callerid: \"$BMquery\" <$outbound_cid>','$variable','','','','');";
# $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$monitor_server_ip','','Originate','$BMquery','Channel: Local/$monitor_dialstring$stage$session_id@default','Context: default','Exten: $dialplan_number','Priority: 1','Callerid: \"$BMquery\" <$outbound_cid>','$variable','','','','');";
$stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$monitor_server_ip','','Originate','$BMquery','Channel: Local/$monitor_dialstring$stage$session_id@default/n','Context: default','Exten: $dialplan_number','Priority: 1','Callerid: \"$BMquery\" <$outbound_cid>','$variable','','','','');";
if ($swap_chan > 0)
{
$stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$monitor_server_ip','','Originate','$BMquery','Channel: Local/$dialplan_number@default','Context: default','Exten: $monitor_dialstring$stage$session_id','Priority: 1','Callerid: \"$BMquery\" <$outbound_cid>','$variable','','','','');";
# $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$monitor_server_ip','','Originate','$BMquery','Channel: Local/$dialplan_number@default','Context: default','Exten: $monitor_dialstring$stage$session_id','Priority: 1','Callerid: \"$BMquery\" <$outbound_cid>','$variable','','','','');";
$stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$monitor_server_ip','','Originate','$BMquery','Channel: Local/$dialplan_number@default/n','Context: default','Exten: $monitor_dialstring$stage$session_id','Priority: 1','Callerid: \"$BMquery\" <$outbound_cid>','$variable','','','','');";
}
if ($DB>0) {echo "DEBUG: blind_monitor query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
@@ -6125,7 +6143,7 @@ if ($function == 'add_phone')
}
else
{
if ( (strlen($extension)<2) or (strlen($dialplan_number)<2) or (strlen($voicemail_id)<1) or (strlen($phone_login)<1) or (strlen($phone_pass)<1) or (strlen($server_ip)<1) or (strlen($protocol)<1) or (strlen($registration_password)<1) or (strlen($phone_full_name)<1) or (strlen($local_gmt)<1) or (strlen($outbound_cid)<1) or ( ($protocol != 'IAX2') and ($protocol != 'SIP') and ($protocol != 'Zap') and ($protocol != 'EXTERNAL') ) )
if ( (strlen($extension)<2) or (strlen($dialplan_number)<2) or (strlen($voicemail_id)<1) or (strlen($phone_login)<1) or (strlen($phone_pass)<1) or (strlen($server_ip)<1) or (strlen($protocol)<1) or (strlen($registration_password)<1) or (strlen($phone_full_name)<1) or (strlen($local_gmt)<1) or (strlen($outbound_cid)<1) or ( ($protocol != 'IAX2') and ($protocol != 'SIP') and ($protocol != 'PJSIP') and ($protocol != 'Zap') and ($protocol != 'EXTERNAL') ) )
{
$result = 'ERROR';
$result_reason = "add_phone YOU MUST USE ALL REQUIRED FIELDS";
@@ -6268,6 +6286,166 @@ if ($function == 'add_phone')
################################################################################
### copy_phone - adds phone to the phones table
################################################################################
if ($function == 'copy_phone')
{
if(strlen($source)<2)
{
$result = 'ERROR';
$result_reason = "Invalid Source";
echo "$result: $result_reason: |$source|\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
if ( (!preg_match("/ $function /",$api_allowed_functions)) and (!preg_match("/ALL_FUNCTIONS/",$api_allowed_functions)) )
{
$result = 'ERROR';
$result_reason = "auth USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION";
echo "$result: $result_reason: |$user|$function|\n";
$data = "$allowed_user";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
$stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$allowed_user=$row[0];
if ($allowed_user < 1)
{
$result = 'ERROR';
$result_reason = "copy_phone USER DOES NOT HAVE PERMISSION TO COPY PHONES";
$data = "$allowed_user";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
if ( (strlen($extension)<2) or (strlen($dialplan_number)<2) or (strlen($voicemail_id)<1) or (strlen($phone_login)<1) or (strlen($server_ip)<1) or (strlen($phone_full_name)<1) or (strlen($outbound_cid)<1) or (strlen($source_extension)<1) or (strlen($source_server_ip)<1) )
{
$result = 'ERROR';
$result_reason = "copy_phone YOU MUST USE ALL REQUIRED FIELDS";
$data = "$extension|$dialplan_number|$voicemail_id|$phone_login|$server_ip|$phone_full_name|$outbound_cid";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT count(*) from servers where server_ip='$source_server_ip';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$source_server_exists=$row[0];
if ($source_server_exists < 1)
{
$result = 'ERROR';
$result_reason = "copy_phone SOURCE SERVER DOES NOT EXIST";
$data = "$source_server_ip";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
$stmt="SELECT count(*) from phones where extension='$source_extension' and server_ip='$source_server_ip';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$source_phone_exists=$row[0];
if ($source_phone_exists < 1)
{
$result = 'ERROR';
$result_reason = "copy_phone SOURCE PHONE DOES NOT EXIST ON THIS SERVER";
$data = "$source_server_ip|$source_extension";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
$stmt="SELECT count(*) from servers where server_ip='$server_ip';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$server_exists=$row[0];
if ($server_exists < 1)
{
$result = 'ERROR';
$result_reason = "copy_phone SERVER DOES NOT EXIST";
$data = "$server_ip";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$phone_exists=$row[0];
if ($phone_exists > 0)
{
$result = 'ERROR';
$result_reason = "copy_phone PHONE ALREADY EXISTS ON THIS SERVER";
$data = "$server_ip|$extension";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT count(*) from phones where login='$phone_login';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$phone_exists=$row[0];
if ($phone_exists > 0)
{
$result = 'ERROR';
$result_reason = "copy_phone PHONE LOGIN ALREADY EXISTS";
$data = "$phone_login";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
if (strlen($phone_pass)<1) {$phone_pass = $SSdefault_phone_login_password;}
if (strlen($registration_password)<1) {$registration_password = $SSdefault_phone_registration_password;}
$stmt="INSERT INTO phones(extension, dialplan_number, voicemail_id, phone_ip, computer_ip, server_ip, login, pass, status, active, phone_type, fullname, company, picture, messages, old_messages, protocol, local_gmt, ASTmgrUSERNAME, ASTmgrSECRET, login_user, login_pass, login_campaign, park_on_extension, conf_on_extension, VICIDIAL_park_on_extension, VICIDIAL_park_on_filename, monitor_prefix, recording_exten, voicemail_exten, voicemail_dump_exten, ext_context, dtmf_send_extension, call_out_number_group, client_browser, install_directory, local_web_callerID_URL, VICIDIAL_web_URL, AGI_call_logging_enabled, user_switching_enabled, conferencing_enabled, admin_hangup_enabled, admin_hijack_enabled, admin_monitor_enabled, call_parking_enabled, updater_check_enabled, AFLogging_enabled, QUEUE_ACTION_enabled, CallerID_popup_enabled, voicemail_button_enabled, enable_fast_refresh, fast_refresh_rate, enable_persistant_mysql, auto_dial_next_number, VDstop_rec_after_each_call, DBX_server, DBX_database, DBX_user, DBX_pass, DBX_port, DBY_server, DBY_database, DBY_user, DBY_pass, DBY_port, outbound_cid, enable_sipsak_messages, email, template_id, conf_override, phone_context, phone_ring_timeout, conf_secret, delete_vm_after_email, is_webphone, use_external_server_ip, codecs_list, codecs_with_template, webphone_dialpad, on_hook_agent, webphone_auto_answer, voicemail_timezone, voicemail_options, user_group, voicemail_greeting, voicemail_dump_exten_no_inst, voicemail_instructions, on_login_report, unavail_dialplan_fwd_exten, unavail_dialplan_fwd_context, nva_call_url, nva_search_method, nva_error_filename, nva_new_list_id, nva_new_phone_code, nva_new_status, webphone_dialbox, webphone_mute, webphone_volume, webphone_debug, outbound_alt_cid, conf_qualify, webphone_layout, mohsuggest, webphone_settings) SELECT '$extension', '$dialplan_number', '$voicemail_id', phone_ip, computer_ip, '$server_ip', '$phone_login', '$phone_pass', status, active, phone_type, '$phone_full_name', company, picture, messages, old_messages, protocol, local_gmt, ASTmgrUSERNAME, ASTmgrSECRET, login_user, login_pass, login_campaign, park_on_extension, conf_on_extension, VICIDIAL_park_on_extension, VICIDIAL_park_on_filename, monitor_prefix, recording_exten, voicemail_exten, voicemail_dump_exten, ext_context, dtmf_send_extension, call_out_number_group, client_browser, install_directory, local_web_callerID_URL, VICIDIAL_web_URL, AGI_call_logging_enabled, user_switching_enabled, conferencing_enabled, admin_hangup_enabled, admin_hijack_enabled, admin_monitor_enabled, call_parking_enabled, updater_check_enabled, AFLogging_enabled, QUEUE_ACTION_enabled, CallerID_popup_enabled, voicemail_button_enabled, enable_fast_refresh, fast_refresh_rate, enable_persistant_mysql, auto_dial_next_number, VDstop_rec_after_each_call, DBX_server, DBX_database, DBX_user, DBX_pass, DBX_port, DBY_server, DBY_database, DBY_user, DBY_pass, DBY_port, '$outbound_cid', enable_sipsak_messages, email, template_id, conf_override, phone_context, phone_ring_timeout, '$registration_password', delete_vm_after_email, is_webphone, use_external_server_ip, codecs_list, codecs_with_template, webphone_dialpad, on_hook_agent, webphone_auto_answer, voicemail_timezone, voicemail_options, user_group, voicemail_greeting, voicemail_dump_exten_no_inst, voicemail_instructions, on_login_report, unavail_dialplan_fwd_exten, unavail_dialplan_fwd_context, nva_call_url, nva_search_method, nva_error_filename, nva_new_list_id, nva_new_phone_code, nva_new_status, webphone_dialbox, webphone_mute, webphone_volume, webphone_debug, outbound_alt_cid, conf_qualify, webphone_layout, mohsuggest, webphone_settings from phones where extension='$source_extension' and server_ip='$source_server_ip'";
$rslt=mysql_to_mysqli($stmt, $link);
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/', '', $SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='PHONES', event_type='COPY', record_id='$extension', event_code='ADMIN API COPY PHONE', event_sql=\"$SQL_log\", event_notes='phone: $extension|$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$stmtA="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y' and server_ip='$server_ip';";
$rslt=mysql_to_mysqli($stmtA, $link);
$result = 'SUCCESS';
$result_reason = "copy_phone PHONE HAS BEEN COPIED";
$data = "$extension|$server_ip|$protocol|$dialplan_number";
echo "$result: $result_reason - $user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
}
}
}
exit;
}
################################################################################
### END copy_phone
################################################################################
################################################################################
### update_phone - updates phone entry already in the system
@@ -6522,7 +6700,7 @@ if ($function == 'update_phone')
}
if (strlen($protocol) > 0)
{
if ( ($protocol != 'IAX2') and ($protocol != 'SIP') and ($protocol != 'Zap') and ($protocol != 'EXTERNAL') )
if ( ($protocol != 'IAX2') and ($protocol != 'SIP') and ($protocol != 'PJSIP') and ($protocol != 'Zap') and ($protocol != 'EXTERNAL') )
{
$result = 'ERROR';
$result_reason = "update_phone YOU MUST USE A VALID PROTOCOL";