From 65c366ed0ac00efeb142a1b21b3305f593582934 Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 3 Sep 2026 00:49:45 +0000 Subject: [PATCH] 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 --- agc_2-X/trunk/agi/CID_change.agi | 3 +- agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi | 18 ++++- agc_2-X/trunk/agi/getAGENTchannel.agi | 7 +- agc_2-X/trunk/agi/phone_alt_CID.agi | 5 +- agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl | 9 ++- .../trunk/www/vicidial/AST_timeonVDADall.php | 7 +- agc_2-X/trunk/www/vicidial/admin.php | 14 ++-- .../trunk/www/vicidial/admin_bulk_tools.php | 69 +++++++++++++++---- agc_2-X/trunk/www/vicidial/non_agent_api.php | 14 ++-- 9 files changed, 110 insertions(+), 36 deletions(-) diff --git a/agc_2-X/trunk/agi/CID_change.agi b/agc_2-X/trunk/agi/CID_change.agi index 579771b0..ef01f831 100644 --- a/agc_2-X/trunk/agi/CID_change.agi +++ b/agc_2-X/trunk/agi/CID_change.agi @@ -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;} diff --git a/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi b/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi index 54622831..7a5c8956 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi @@ -12,7 +12,7 @@ # exten => _8331*.,n,AGI(agi-VDAD_RINGALL.agi,${EXTEN}) # exten => _8331*.,n,Hangup # -# Copyright (C) 2025 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2026 Matt Florell 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; diff --git a/agc_2-X/trunk/agi/getAGENTchannel.agi b/agc_2-X/trunk/agi/getAGENTchannel.agi index 164f4725..a4fa476d 100644 --- a/agc_2-X/trunk/agi/getAGENTchannel.agi +++ b/agc_2-X/trunk/agi/getAGENTchannel.agi @@ -1,7 +1,7 @@ #!/usr/bin/perl # getAGENTchannel.agi by Omar Rodriguez www.ItContinental.com -# Copyright (C) 2025 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2026 Matt Florell 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];} diff --git a/agc_2-X/trunk/agi/phone_alt_CID.agi b/agc_2-X/trunk/agi/phone_alt_CID.agi index 0d530798..31410f02 100644 --- a/agc_2-X/trunk/agi/phone_alt_CID.agi +++ b/agc_2-X/trunk/agi/phone_alt_CID.agi @@ -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 LICENSE: AGPLv2 +# Copyright (C) 2026 Matt Florell 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;} diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index ca7e35b0..8d31fabf 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -186,9 +186,10 @@ # 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 # -$build = '260826-1814'; +$build = '260902-1718'; $DB=0; # Debug flag $teodDB=0; # flag to log Timeclock End of Day processes to log file @@ -3304,6 +3305,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 +3342,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 +3351,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 +3360,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 +3371,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 +3401,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"; diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php index 23723a04..a5e2a7ca 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php @@ -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]); diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index ca4e89d9..fec10707 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -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,13 @@ 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 # # 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-963a'; +$build = '260902-1656'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -16918,7 +16918,7 @@ if ($ADD==241111111111) { echo "
"._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 +22080,7 @@ if ($ADD==441111111111) {echo "
"._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 +50505,7 @@ if ($ADD==140000000000) echo " 0) {echo " onclick=\"window.document.location='$PHP_SELF?ADD=341111111111&carrier_id=$row[0]'\"";} echo ">$row[0]"; echo "$row[1]"; echo "".(preg_match('/[A-Z]/', $row[2]) ? _QXZ("$row[2]") : $row[2]).""; - echo "".(!preg_match('/^SIP|IAX2/', $row[3]) ? _QXZ("$row[3]") : $row[3]).""; + echo "".(!preg_match('/^SIP|^PJSIP|IAX2/', $row[3]) ? _QXZ("$row[3]") : $row[3]).""; echo "$row[4]"; echo ""._QXZ("$row[5]").""; echo ""._QXZ("$row[6]").""; diff --git a/agc_2-X/trunk/www/vicidial/admin_bulk_tools.php b/agc_2-X/trunk/www/vicidial/admin_bulk_tools.php index fae1deb5..89cde8a2 100644 --- a/agc_2-X/trunk/www/vicidial/admin_bulk_tools.php +++ b/agc_2-X/trunk/www/vicidial/admin_bulk_tools.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2026 Mike Coate, Mike Cargile, Matt Florell 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
"; $i = 0; + echo "
    "; while ($i < count($ACCIDto_insert)) { - echo "
    $ACCIDto_insert[$i]"; + echo "
  • $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" : " - **no state/country info found for areacode ".substr($ACCIDto_insert[$i], 0, 3)."***")); + } + echo "
  • "; + $i++; } + echo "
"; + echo "
"._QXZ("The following AC-CIDs are duplicates and will not be created").": "; - if (empty($ACCIDduplicate[0])) {echo "
"._QXZ("NONE");} + echo "
    "; + if (empty($ACCIDduplicate[0])) {echo "
  • "._QXZ("NONE")."
  • ";} $i = 0; while ($i < count($ACCIDduplicate)) { - echo "
    $ACCIDduplicate[$i]"; + echo "
  • $ACCIDduplicate[$i]
  • "; $i++; } + echo "
"; + echo "
"._QXZ("The following AC-CIDs are of invalid length and will not be created").": "; - if (empty($ACCIDbadlen[0])) {echo "
"._QXZ("NONE");} + echo "
    "; + if (empty($ACCIDbadlen[0])) {echo "
  • "._QXZ("NONE")."
  • ";} $i = 0; while ($i < count($ACCIDbadlen)) { - echo "
    $ACCIDbadlen[$i]"; + echo "
  • $ACCIDbadlen[$i]
  • "; $i++; } } + echo "
"; + $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 "\n"; echo "\n"; echo "\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 ""._QXZ("State Lookup/Fill Filter").": Country code: ".(isset($SSdefault_phone_code) ? "$SSdefault_phone_code
Countries: $country_str" : "**NONE DEFINED**") ."\n"; + echo ""._QXZ("Campaign or CID Group").":\n"; $ACCIDcampaigns_to_copy = array(); diff --git a/agc_2-X/trunk/www/vicidial/non_agent_api.php b/agc_2-X/trunk/www/vicidial/non_agent_api.php index 6716cdf3..213c1c10 100644 --- a/agc_2-X/trunk/www/vicidial/non_agent_api.php +++ b/agc_2-X/trunk/www/vicidial/non_agent_api.php @@ -231,10 +231,11 @@ # 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 # -$version = '2.14-206'; -$build = '260822-0841'; +$version = '2.14-207'; +$build = '260902-1709'; $php_script='non_agent_api.php'; $api_url_log = 0; $camp_lead_order_random=1; @@ -4092,13 +4093,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);