From bd688d8976ea2be462381bfa2c914d24276147aa Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 6 Mar 2009 16:14:14 +0000 Subject: [PATCH] Added group aliases to allow selecting of callerID for manual and 3way calls Added agent-specific in-group and campaign web variables git-svn-id: svn://192.168.202.10@1067 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 6 + agc_2-X/trunk/agi/agi-CANADA_PRI_CIDname.agi | 261 +++ agc_2-X/trunk/agi/agi-DID_route.agi | 2 +- agc_2-X/trunk/docs/AGENT_API.txt | 7 + agc_2-X/trunk/docs/VTIGER.txt | 7 + .../trunk/extras/MySQL_AST_CREATE_tables.sql | 37 +- agc_2-X/trunk/extras/upgrade_2.0.5.sql | 35 + .../TO_BE_TRANSLATED_2.0.5.txt | 40 + agc_2-X/trunk/www/agc/api.php | 34 +- agc_2-X/trunk/www/agc/manager_send.php | 41 +- agc_2-X/trunk/www/agc/vdc_db_query.php | 127 +- agc_2-X/trunk/www/agc/vicidial.php | 348 +++- agc_2-X/trunk/www/vicidial/admin.php | 1702 +++++++++++++++-- agc_2-X/trunk/www/vicidial/user_stats.php | 43 +- .../www/vicidial/vicidial_admin_web_logo.gif | Bin 0 -> 2483 bytes agc_2-X/trunk/www/vicidial/vtiger_user.php | 232 ++- 16 files changed, 2561 insertions(+), 361 deletions(-) create mode 100644 agc_2-X/trunk/agi/agi-CANADA_PRI_CIDname.agi create mode 100644 agc_2-X/trunk/www/vicidial/vicidial_admin_web_logo.gif diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index fd9ef801..7110e92d 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -256,6 +256,12 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom conf files so that you can fully configure them using only the admin.php web interface. See the ASTERISK_CONF-GEN.txt file for more information +60. Added group alias option for selecting callerID on manual and 3rd-party + calls + +61. Added options for custom web variables for each agent per in-group and + camaign. This is definable in the user modification page + diff --git a/agc_2-X/trunk/agi/agi-CANADA_PRI_CIDname.agi b/agc_2-X/trunk/agi/agi-CANADA_PRI_CIDname.agi new file mode 100644 index 00000000..34d3ca77 --- /dev/null +++ b/agc_2-X/trunk/agi/agi-CANADA_PRI_CIDname.agi @@ -0,0 +1,261 @@ +#!/usr/bin/perl +# +# agi-CANADA_PRI_CIDname.agi version 0.1 +# +# Runs after call goes through IAX loop to send out custom CallerIDname on +# Canadian PRIs that allow dynamic setting of CIDname with call initiation +# +# You need to have lines similar to those below in your extensions.conf file: +# +# ;outbound VICIDIAL calls: +#exten => _91NXXNXXXXXX,1,AGI(call_log.agi,${EXTEN}) +#exten => _91NXXNXXXXXX,2,AGI(agi-CANADA_PRI_CIDname.agi,${EXTEN}) +#exten => _91NXXNXXXXXX,3,Dial(${TRUNKX}/${EXTEN:1},55,tTo) +#exten => _91NXXNXXXXXX,4,Hangup +# +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# +# changes: +# 90305-2136 - First build +# + +$script = 'agi-CANADA_PRI_CIDname.agi'; + +$AGILOG=0; +$FD=0; # force debug for testing + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + } + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} +if (!$DIDLOGfile) {$DIDLOGfile = "$PATHlogs/didin.$year-$mon-$mday";} + + +$|=1; +while() + { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + } + +if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; +if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + +if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} +if (length($calleridname)>0) {$VLcomments = $calleridname;} + else {$VLcomments = '';} + +foreach $i (sort keys %AGI) + { + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} + } + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $calleridname =~ s/^\"//gi; + $calleridname =~ s/\".*$//gi; + } + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output,local_gmt FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + $local_gmt = "$aryA[1]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### Grab Server values from the database +$stmtA = "SELECT cmd_line_g,cmd_line_h,cmd_line_i,cmd_line_j FROM vicidial_manager where callerid = '$calleridname' limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $sthA->finish(); + $account_check = "|$aryA[0]|$aryA[1]|$aryA[2]|$aryA[3]"; + if ($account_check =~ /usegroupalias=1/) + { + @data = split(/Account: /,$account_check); + $data[1] =~ s/\|.*//gi; + $account = $data[1]; + + ### Grab callerIDname and number from the database + $stmtA = "SELECT caller_id_name,caller_id_number FROM groups_alias where group_alias_id = '$account' limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $sthA->finish(); + $caller_id_name = "$aryA[0]"; + $caller_id_number = "$aryA[1]"; + + ### set the callerid to the ACQS value(calleridname) + ## use these two lines for Asterisk 1.2 tree + $newcallerid = "\"$caller_id_name <$caller_id_number>\""; + $AGI->set_callerid($newcallerid); + ## use these two lines for Asterisk 1.0 tree + # print "SET CALLERID \"$calleridname\" <0000000000>\n"; + # print "SET CALLERIDNAME \"$calleridname\"\n"; + + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: newcallerid; &agi_output";} + + if ($FD > 0) {print STDERR "callerID changed: newcallerid\n";} + + + if ($AGILOG) {$agi_string = "AGI Variables: |$extension|$areacode|$callerid|$calleridname|newcallerid|"; &agi_output;} + } + } + } + + +exit; + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/trunk/agi/agi-DID_route.agi b/agc_2-X/trunk/agi/agi-DID_route.agi index 94f37a7f..83d58164 100644 --- a/agc_2-X/trunk/agi/agi-DID_route.agi +++ b/agc_2-X/trunk/agi/agi-DID_route.agi @@ -107,7 +107,7 @@ while ($sthArows > $rec_count) $AGILOG = '0'; @aryA = $sthA->fetchrow_array; $DBagi_output = "$aryA[0]"; - $local_gmt = "$aryA[0]"; + $local_gmt = "$aryA[1]"; if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} diff --git a/agc_2-X/trunk/docs/AGENT_API.txt b/agc_2-X/trunk/docs/AGENT_API.txt index e5ffdf7a..98cacc72 100644 --- a/agc_2-X/trunk/docs/AGENT_API.txt +++ b/agc_2-X/trunk/docs/AGENT_API.txt @@ -36,6 +36,7 @@ http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&functi http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_pause&value=PAUSE http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_pause&value=RESUME http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_dial&value=7275551212&phone_code=1&search=YES&preview=NO&focus=YES +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_dial&value=7275551212&phone_code=1&search=YES&preview=NO&focus=YES&dial_prefix=88&group_alias=DEFAULT To hangup the call, disposition it and then pause the agent, do the following in order: @@ -136,11 +137,17 @@ focus - NO - do not change focus vendor_id - Any valid Vendor lead code +dial_prefix - + OPTIONAL, any dial prefix that you want to add to the beginning of the dial string for this call +group_alias - + OPTIONAL, the outbound callerID(from an existing group-alias) that you want to use for this call RESPONSES: ERROR: external_dial not valid - 7275551212|1|YES|6666 ERROR: agent_user is not allowed to place manual dial calls - 6666 ERROR: agent_user is not logged in - 6666 +ERROR: caller_id_number from group_alias is not valid - 6666|TESTING|123 +ERROR: group_alias is not valid - 6666|TESTING SUCCESS: external_dial function set - 7275551212|1|YES|1232020456|6666 diff --git a/agc_2-X/trunk/docs/VTIGER.txt b/agc_2-X/trunk/docs/VTIGER.txt index 9fd4d344..a71a936b 100644 --- a/agc_2-X/trunk/docs/VTIGER.txt +++ b/agc_2-X/trunk/docs/VTIGER.txt @@ -5,6 +5,7 @@ Current VICIDIAL integration with Vtiger is for the 5.0.4 release version of Vti Current integration features: - vicidial.php WEBFORM search for lead/account/vendor - User synchronization of VICIDIAL users to Vtiger user database +- User Group synchronization of VICIDIAL user groups to Vtiger Groups - Added activity event option(call logging in Vtiger) when going from VICIDIAL to Vtiger - Ability to click-to-dial a phone number from a record in Vtiger screen to the vicidial.php screen - Optional script to bulk load leads into Vtiger from a CSV file since Vtiger only seems to want to load 500 at a time: @@ -39,6 +40,12 @@ Here are the procedures to load leads into Vtiger, then output them from Vtiger Then to keep the two systems in sync you would run the last two steps every day or at some other interval. +For VICIDIAL users that are synchronized to Vtiger, the following user_level to roles repationships are used: +- user_level 9 - H2, CEO +- user_level 8 - H3, Vice President +- user_level 7 - H4, Sales Manager +- user_level 6 and lower - H5, Sales Man + Here are the SQL queries used by the vtiger_search.php script to find records in the vtiger system: diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index 49a7b470..275e8c40 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -609,14 +609,16 @@ manual_dial_filter VARCHAR(50) default 'NONE', agent_clipboard_copy VARCHAR(50) default 'NONE', agent_extended_alt_dial ENUM('Y','N') default 'N', use_campaign_dnc ENUM('Y','N') default 'N', -three_way_call_cid ENUM('CAMPAIGN','CUSTOMER','AGENT_PHONE') default 'CAMPAIGN', +three_way_call_cid ENUM('CAMPAIGN','CUSTOMER','AGENT_PHONE','AGENT_CHOOSE') default 'CAMPAIGN', three_way_dial_prefix VARCHAR(20) default '', web_form_target VARCHAR(100) NOT NULL default 'vdcwebform', vtiger_search_category VARCHAR(100) default 'LEAD', vtiger_create_call_record ENUM('Y','N') default 'Y', vtiger_create_lead_record ENUM('Y','N') default 'Y', vtiger_screen_login ENUM('Y','N') default 'Y', -cpd_amd_action ENUM('DISABLED','DISPO','MESSAGE') default 'DISABLED' +cpd_amd_action ENUM('DISABLED','DISPO','MESSAGE') default 'DISABLED', +agent_allow_group_alias ENUM('Y','N') default 'N', +default_group_alias VARCHAR(30) default '' ); CREATE TABLE vicidial_lists ( @@ -732,7 +734,8 @@ hold_recall_xfer_group VARCHAR(20) default '---NONE---', no_delay_call_route ENUM('Y','N') default 'N', play_welcome_message ENUM('ALWAYS','NEVER','IF_WAIT_ONLY','YES_UNLESS_NODELAY') default 'ALWAYS', answer_sec_pct_rt_stat_one SMALLINT(5) UNSIGNED default '20', -answer_sec_pct_rt_stat_two SMALLINT(5) UNSIGNED default '30' +answer_sec_pct_rt_stat_two SMALLINT(5) UNSIGNED default '30', +default_group_alias VARCHAR(30) default '' ); CREATE TABLE vicidial_stations ( @@ -1142,6 +1145,7 @@ group_id VARCHAR(20), group_rank TINYINT(1) default '0', group_weight TINYINT(1) default '0', calls_today SMALLINT(5) UNSIGNED default '0', +group_web_vars VARCHAR(255) default '', index (group_id), index (user) ); @@ -1163,6 +1167,7 @@ campaign_id VARCHAR(20), campaign_rank TINYINT(1) default '0', campaign_weight TINYINT(1) default '0', calls_today SMALLINT(5) UNSIGNED default '0', +group_web_vars VARCHAR(255) default '', index (campaign_id), index (user) ); @@ -1396,6 +1401,30 @@ unique index(carrier_id), index (server_ip) ); +CREATE TABLE groups_alias ( +group_alias_id VARCHAR(30) NOT NULL UNIQUE PRIMARY KEY, +group_alias_name VARCHAR(50), +caller_id_number VARCHAR(20), +caller_id_name VARCHAR(20), +active ENUM('Y','N') default 'N' +); + +CREATE TABLE user_call_log ( +user_call_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +call_date DATETIME, +call_type VARCHAR(20), +server_ip VARCHAR(15) NOT NULL, +phone_number VARCHAR(20), +number_dialed VARCHAR(30), +lead_id INT(9) UNSIGNED, +callerid VARCHAR(20), +group_alias_id VARCHAR(30), +index (user), +index (call_date) +); + + ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP; ALTER TABLE live_channels ENGINE=HEAP; @@ -1491,7 +1520,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); CREATE INDEX comment_a on live_inbound_log (comment_a); -UPDATE system_settings SET db_schema_version='1131'; +UPDATE system_settings SET db_schema_version='1132'; GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.0.5.sql b/agc_2-X/trunk/extras/upgrade_2.0.5.sql index f5a7b726..15425a2c 100644 --- a/agc_2-X/trunk/extras/upgrade_2.0.5.sql +++ b/agc_2-X/trunk/extras/upgrade_2.0.5.sql @@ -728,3 +728,38 @@ UPDATE system_settings SET db_schema_version='1130'; INSERT INTO vicidial_inbound_dids SET did_pattern='default', did_description='Default DID', did_active='Y', did_route='EXTEN', extension='9998811112', exten_context='default'; UPDATE system_settings SET db_schema_version='1131'; + +ALTER TABLE vicidial_campaign_agents ADD group_web_vars VARCHAR(255) default ''; + +ALTER TABLE vicidial_inbound_group_agents ADD group_web_vars VARCHAR(255) default ''; + +CREATE TABLE groups_alias ( +group_alias_id VARCHAR(30) NOT NULL UNIQUE PRIMARY KEY, +group_alias_name VARCHAR(50), +caller_id_number VARCHAR(20), +caller_id_name VARCHAR(20), +active ENUM('Y','N') default 'N' +); + +CREATE TABLE user_call_log ( +user_call_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +call_date DATETIME, +call_type VARCHAR(20), +server_ip VARCHAR(15) NOT NULL, +phone_number VARCHAR(20), +number_dialed VARCHAR(30), +lead_id INT(9) UNSIGNED, +callerid VARCHAR(20), +group_alias_id VARCHAR(30), +index (user), +index (call_date) +); + +ALTER TABLE vicidial_campaigns ADD agent_allow_group_alias ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_campaigns ADD default_group_alias VARCHAR(30) default ''; +ALTER TABLE vicidial_campaigns MODIFY three_way_call_cid ENUM('CAMPAIGN','CUSTOMER','AGENT_PHONE','AGENT_CHOOSE') default 'CAMPAIGN'; + +ALTER TABLE vicidial_inbound_groups ADD default_group_alias VARCHAR(30) default ''; + +UPDATE system_settings SET db_schema_version='1132'; diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index 3d7bc9e3..3bfc8ad6 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -471,6 +471,42 @@ This field allows for a custom VDAD transfer extension. This allows you to use d - 8368 - DEFAULT – Will send the call to the next available agent no matter what server they are on|| - 8369 - Used for Answering Machine Detection after that, same behavior as 8368|| - 8373 - Used for Answering Machine Detection after that same behavior as 8366|| +Also in this section are the WEB VARs for each campaign. These allow each agent to have a different variable string that can be added to the WEB FORM or SCRIPT tab URLs by simply putting --A--web_vars--B-- as you would put any other field.|| +Group Alias List|| +Add A New Group Alias|| +ADD NEW GROUP ALIAS|| +ADDING NEW GROUP ALIAS|| +MODIFY GROUP ALIAS|| +DELETE GROUP ALIAS|| +GROUP ALIAS LIST|| +GROUP ALIAS LISTINGS|| +MODIFY A GROUP ALIAS RECORD|| +Group Alias ID|| +Group Alias Name|| +CallerID Number|| +CallerID Name|| +DELETE THIS GROUP ALIAS|| +GROUP ALIAS NOT MODIFIED|| +GROUP ALIAS MODIFIED|| +ADD A NEW GROUP ALIAS|| +MODIFY A GROUP ALIAS RECORD|| +GROUP ALIAS NOT ADDED|| +GROUP ALIAS ADDED|| +GROUP ALIAS NOT DELETED|| +GROUP ALIAS DELETION CONFIRMATION|| +Click here to delete group alias|| +GROUP ALIAS DELETION COMPLETED|| +Group Alias ID -<\/B> The ID of the group alias used by agents to dial out calls from the VICIDIAL agent interface with different Caller IDs. no spaces or other special characters allowed. Must be between 2 and 20 characters in length|| +Group Alias Name -<\/B> The name used to describe a group alias, Must be between 2 and 50 characters in length|| +Caller ID Number -<\/B> The Caller ID number used in this Group Alias. Must be digits only|| +Caller ID Name -<\/B> The Caller ID name that can be sent out with this Group Alias. As far as we know this will only work in Canada on PRI circuits and using an IAX loop trunk through Asterisk|| +Group Alias Allowed -<\/B> If you want to allow your agents to use group aliases then you need to set this to Y. Group Aliases are explained more in the Admin section, they allow agents to select different callerIDs for outbound manual calls that they may place. Default is N|| +Default Group Alias -<\/B> If you have allowed Group Aliases then this is the group alias that is selected first by default when the agent chooses to use a Group Alias for an outbound manual call. Default is NONE or empty|| +Default Group Alias -<\/B> If you have allowed Group Aliases for the campaign that the agent is logged into then this is the group alias that is selected first by default on a call coming in from this inbound group when the agent chooses to use a Group Alias for an outbound manual call. Default is NONE or empty|| +Group Alias Allowed|| +Default Group Alias|| +AGENT_CHOOSE allows the agent to choose which callerID to use for 3-way calls from a list of choices.|| +you cannot use reserved words in group aliases|| ############################################################ CLIENT @@ -510,6 +546,10 @@ Change this phone number to ACTIVE|| YOU MUST LOG IN TO THE TIMECLOCK FIRST|| There is a time synchronization problem with your system, please tell your system administrator|| Preview Call|| +SELECT A GROUP ALIAS|| +Group Alias Selection|| +Click Here to Choose a Group Alias|| +Group Alias|| ############################################################ MANAGER Manual diff --git a/agc_2-X/trunk/www/agc/api.php b/agc_2-X/trunk/www/agc/api.php index af656447..84e462f5 100644 --- a/agc_2-X/trunk/www/agc/api.php +++ b/agc_2-X/trunk/www/agc/api.php @@ -409,12 +409,42 @@ if ($function == 'external_dial') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { - $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias' where user='$agent_user';"; + if (strlen($group_alias)>1) + { + $stmt = "select caller_id_number from groups_alias where group_alias_id='$group_alias';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cidnum_ct = mysql_num_rows($rslt); + if ($VDIG_cidnum_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_id_number = $row[0]; + if ($caller_id_number < 4) + { + $result = 'ERROR'; + $result_reason = "caller_id_number from group_alias is not valid"; + $data = "$group_alias|$caller_id_number"; + echo "$result: $result_reason - $agent_user|$data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + exit; + } + } + else + { + $result = 'ERROR'; + $result_reason = "group_alias is not valid"; + $data = "$group_alias"; + echo "$result: $result_reason - $agent_user|$data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + exit; + } + } + $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number' where user='$agent_user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); $result = 'SUCCESS'; $result_reason = "external_dial function set"; - $data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch|$dial_prefix|$group_alias"; + $data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch|$dial_prefix|$group_alias|$caller_id_number"; echo "$result: $result_reason - $value|$agent_user|$data\n"; api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); } diff --git a/agc_2-X/trunk/www/agc/manager_send.php b/agc_2-X/trunk/www/agc/manager_send.php index 5078ca47..5a460f95 100644 --- a/agc_2-X/trunk/www/agc/manager_send.php +++ b/agc_2-X/trunk/www/agc/manager_send.php @@ -36,7 +36,11 @@ # - $session_id - ('8600051') # - $FROMvdc - ('YES','NO') # - $agentchannel - ('SIP/cc101-g7yr','Zap/1-1',...) - +# - $usegroupalias - ('0','1') +# - $account - ('DEFAULT',...) +# - $agent_dialed_number - ('1','') +# - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) +# # CHANGELOG: # 50401-1002 - First build of script, Hangup function only # 50404-1045 - Redirect basic function enabled @@ -79,10 +83,12 @@ # 81020-1459 - Fixed bugs in queue_log logging # 81104-0203 - Added mysql error logging capability # 90303-1144 - Fixed manual dial live hangup bug +# 90304-1334 - Added account and usegroupalias and user campaign/in-group specific variables +# 90305-1040 - Added agent_dialed_number and type for user_call_log feature # -$version = '2.0.5-36'; -$build = '90303-1144'; +$version = '2.0.5-38'; +$build = '90305-1040'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=83; $one_mysql_log=0; @@ -160,6 +166,15 @@ if (isset($_GET["FROMvdc"])) {$FROMvdc=$_GET["FROMvdc"];} elseif (isset($_POST["FROMvdc"])) {$FROMvdc=$_POST["FROMvdc"];} if (isset($_GET["agentchannel"])) {$agentchannel=$_GET["agentchannel"];} elseif (isset($_POST["agentchannel"])) {$agentchannel=$_POST["agentchannel"];} +if (isset($_GET["usegroupalias"])) {$usegroupalias=$_GET["usegroupalias"];} + elseif (isset($_POST["usegroupalias"])) {$usegroupalias=$_POST["usegroupalias"];} +if (isset($_GET["account"])) {$account=$_GET["account"];} + elseif (isset($_POST["account"])) {$account=$_POST["account"];} +if (isset($_GET["agent_dialed_number"])) {$agent_dialed_number=$_GET["agent_dialed_number"];} + elseif (isset($_POST["agent_dialed_number"])) {$agent_dialed_number=$_POST["agent_dialed_number"];} +if (isset($_GET["agent_dialed_type"])) {$agent_dialed_type=$_GET["agent_dialed_type"];} + elseif (isset($_POST["agent_dialed_type"])) {$agent_dialed_type=$_POST["agent_dialed_type"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -372,11 +387,27 @@ if ($ACTION=="Originate") {$outCID = "\"$queryCID\" <$outbound_cid>";} else {$outCID = "$queryCID";} - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ( ($usegroupalias > 0) and (strlen($account)>1) ) + { + $RAWaccount = $account; + $account = "Account: $account"; + $variable = "Variable: usegroupalias=1"; + } + else + {$account=''; $variable='';} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02007',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + echo "Originate command sent for Exten $exten Channel $channel on $server_ip |$account|$variable|\n"; + + if ($agent_dialed_number > 0) + { + $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$exten','$channel','0','$outbound_cid','$RAWaccount')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00192',$user,$server_ip,$session_name,$one_mysql_log);} + } } } diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index c0f8570d..c6c21ccd 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -78,6 +78,10 @@ # - $conf_dialed = ('0','1') # - $leaving_threeway = ('0','1') # - $blind_transfer = ('0','1') +# - $usegroupalias - ('0','1') +# - $account - ('DEFAULT',...) +# - $agent_dialed_number - ('1','') +# - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # # CHANGELOG: # 50629-1044 - First build of script @@ -182,13 +186,15 @@ # 81211-0420 - Fixed Manual dial agent_log bug # 90120-1718 - Added external pause and dial option # 90126-1759 - Fixed QM section that wasn't qualified and added agent alert option -# 90128-0231 - Aded vendor_lead_code to manual dial lead lookup +# 90128-0231 - Added vendor_lead_code to manual dial lead lookup +# 90304-1335 - Added support for group aliases and agent-specific variables for campaigns and in-groups +# 90305-1041 - Added agent_dialed_number and type for user_call_log feature # -$version = '2.0.5-100'; -$build = '90128-0231'; +$version = '2.0.5-102'; +$build = '90305-1041'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=186; +$mysql_log_count=192; $one_mysql_log=0; require("dbconnect.php"); @@ -344,6 +350,14 @@ if (isset($_GET["hangup_all_non_reserved"])) {$hangup_all_non_reserved=$_GET[" elseif (isset($_POST["hangup_all_non_reserved"])) {$hangup_all_non_reserved=$_POST["hangup_all_non_reserved"];} if (isset($_GET["blind_transfer"])) {$blind_transfer=$_GET["blind_transfer"];} elseif (isset($_POST["blind_transfer"])) {$blind_transfer=$_POST["blind_transfer"];} +if (isset($_GET["usegroupalias"])) {$usegroupalias=$_GET["usegroupalias"];} + elseif (isset($_POST["usegroupalias"])) {$usegroupalias=$_POST["usegroupalias"];} +if (isset($_GET["account"])) {$account=$_GET["account"];} + elseif (isset($_POST["account"])) {$account=$_POST["account"];} +if (isset($_GET["agent_dialed_number"])) {$agent_dialed_number=$_GET["agent_dialed_number"];} + elseif (isset($_POST["agent_dialed_number"])) {$agent_dialed_number=$_POST["agent_dialed_number"];} +if (isset($_GET["agent_dialed_type"])) {$agent_dialed_type=$_GET["agent_dialed_type"];} + elseif (isset($_POST["agent_dialed_type"])) {$agent_dialed_type=$_POST["agent_dialed_type"];} header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -986,9 +1000,19 @@ if ($ACTION == 'manDiaLnextCaLL') {$Ndialstring = "$Local_out_prefix$phone_number";} else {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + + if ( ($usegroupalias > 0) and (strlen($account)>1) ) + { + $RAWaccount = $account; + $account = "Account: $account"; + $variable = "Variable: usegroupalias=1"; + } + else + {$account=''; $variable='';} + ### insert the call action into the vicidial_manager table to initiate the call # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; - $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','$account','$variable','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00033',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1010,6 +1034,14 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00036',$user,$server_ip,$session_name,$one_mysql_log);} + if ($agent_dialed_number > 0) + { + $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$phone_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00191',$user,$server_ip,$session_name,$one_mysql_log);} + } + ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; @@ -1253,6 +1285,15 @@ if ($ACTION == 'manDiaLonly') if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} else {$CIDstring = "$MqueryCID";} + if ( ($usegroupalias > 0) and (strlen($account)>1) ) + { + $RAWaccount = $account; + $account = "Account: $account"; + $variable = "Variable: usegroupalias=1"; + } + else + {$account=''; $variable='';} + ### whether to omit phone_code or not if (eregi('Y',$omit_phone_code)) {$Ndialstring = "$Local_out_prefix$phone_number";} @@ -1260,7 +1301,7 @@ if ($ACTION == 'manDiaLonly') {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} ### insert the call action into the vicidial_manager table to initiate the call # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; - $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','$account','$variable','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00044',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1292,6 +1333,15 @@ if ($ACTION == 'manDiaLonly') echo "$MqueryCID\n"; + if ($agent_dialed_number > 0) + { + $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$phone_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00192',$user,$server_ip,$session_name,$one_mysql_log);} + } + + ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; @@ -2696,7 +2746,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_front_VDlog =$row[0]; } - $stmt = "select group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + $stmt = "select group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias from vicidial_inbound_groups where group_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00119',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2717,9 +2767,10 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_default_xfer_group = $row[10]; $VDCL_ingroup_recording_override = $row[11]; $VDCL_ingroup_rec_filename = $row[12]; + $VDCL_default_group_alias = $row[13]; - $stmt = "select campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "select campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00181',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2737,6 +2788,33 @@ if ($ACTION == 'VDADcheckINCOMING') {$VDCL_xferconf_b_dtmf = $row[3];} if (strlen($VDCL_xferconf_b_number) < 1) {$VDCL_xferconf_b_number = $row[4];} + if (strlen($VDCL_default_group_alias) < 1) + {$VDCL_default_group_alias = $row[5];} + } + + $stmt = "select group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00188',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidgwv_ct = mysql_num_rows($rslt); + if ($VDIG_cidgwv_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } + + if (strlen($VDCL_group_web_vars) < 1) + { + $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00189',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } } ### update the comments in vicidial_live_agents record @@ -2749,7 +2827,7 @@ if ($ACTION == 'VDADcheckINCOMING') } else { - $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias from vicidial_campaigns where campaign_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00121',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2763,12 +2841,39 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_xferconf_a_number = $row[3]; $VDCL_xferconf_b_dtmf = $row[4]; $VDCL_xferconf_b_number = $row[5]; + $VDCL_default_group_alias = $row[6]; + } + + $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00190',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } + } + + $VDCL_caller_id_number=''; + if (strlen($VDCL_default_group_alias)>1) + { + $stmt = "select caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00187',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidnum_ct = mysql_num_rows($rslt); + if ($VDIG_cidnum_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_caller_id_number = $row[0]; } } ### if web form is set then send on to vicidial.php for override of WEB_FORM address - if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|\n";} - else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|\n";} + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|\n";} + else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|\n";} $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; if ($DB) {echo "$stmt\n";} diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index f9f72594..38d18ac9 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -219,12 +219,14 @@ # 90202-0148 - Added option to disable BLENDED checkbox # 90209-0132 - Changed tab images and color scheme # 90303-1145 - Fixed rare manual dial live hangup bug +# 90304-1333 - Added user-specific web vars option +# 90305-0917 - Added prefix-choice and group-alias options for calls coming from API # -$version = '2.0.5-198'; -$build = '90303-1145'; +$version = '2.0.5-200'; +$build = '90305-0917'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=53; +$mysql_log_count=55; $one_mysql_log=0; require("dbconnect.php"); @@ -899,7 +901,7 @@ $VDloginDISPLAY=0; $HKstatusnames = substr("$HKstatusnames", 0, -1); ##### grab the campaign settings - $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -947,6 +949,34 @@ $VDloginDISPLAY=0; $three_way_dial_prefix = $row[40]; $web_form_target = $row[41]; $vtiger_screen_login = $row[42]; + $agent_allow_group_alias = $row[43]; + $default_group_alias = $row[44]; + + $default_group_alias_cid=''; + if (strlen($default_group_alias)>1) + { + $stmt = "select caller_id_number from groups_alias where group_alias_id='$default_group_alias';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01055',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidnum_ct = mysql_num_rows($rslt); + if ($VDIG_cidnum_ct > 0) + { + $row=mysql_fetch_row($rslt); + $default_group_alias_cid = $row[0]; + } + } + + $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VD_campaign' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $default_web_vars = $row[0]; + } if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) { @@ -1048,6 +1078,33 @@ $VDloginDISPLAY=0; $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); } + if (ereg('Y',$agent_allow_group_alias)) + { + ##### grab the active group aliases + $stmt="SELECT group_alias_id,group_alias_name,caller_id_number FROM groups_alias WHERE active='Y' order by group_alias_id limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01054',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_group_aliases = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_group_aliases) + { + $row=mysql_fetch_row($rslt); + $group_alias_id[$i] = $row[0]; + $group_alias_name[$i] = $row[1]; + $caller_id_number[$i] = $row[2]; + $VARgroup_alias_ids = "$VARgroup_alias_ids'$group_alias_id[$i]',"; + $VARgroup_alias_names = "$VARgroup_alias_names'$group_alias_name[$i]',"; + $VARcaller_id_numbers = "$VARcaller_id_numbers'$caller_id_number[$i]',"; + $i++; + $j++; + } + $VD_group_aliases_ct = ($VD_group_aliases_ct+$VD_group_aliases); + $VARgroup_alias_ids = substr("$VARgroup_alias_ids", 0, -1); + $VARgroup_alias_names = substr("$VARgroup_alias_names", 0, -1); + $VARcaller_id_numbers = substr("$VARcaller_id_numbers", 0, -1); + } + ##### grab the number of leads in the hopper for this campaign $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; $rslt=mysql_query($stmt, $link); @@ -1902,6 +1959,14 @@ $CCAL_OUT .= ""; var scheduled_callbacks = ''; var dispo_check_all_pause = ''; var api_check_all_pause = ''; + VARgroup_alias_ids = new Array(); + VARgroup_alias_names = new Array(); + VARcaller_id_numbers = new Array(); + var VD_group_aliases_ct = ''; + var agent_allow_group_alias = ''; + var default_group_alias = ''; + var default_group_alias_cid = ''; + var active_group_alias = ''; var agent_pause_codes_active = ''; VARpause_codes = new Array(); VARpause_code_names = new Array(); @@ -2028,6 +2093,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var campaign_rec_filename = ''; var LIVE_campaign_recording = ''; var LIVE_campaign_rec_filename = ''; + var LIVE_default_group_alias = ''; + var LIVE_caller_id_number = ''; + var LIVE_web_vars = ''; + var default_web_vars = ''; var campaign_script = ''; var get_call_launch = ''; var campaign_am_message_exten = ''; @@ -2118,6 +2187,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var three_way_call_cid = ''; var outbound_cid = ''; var threeway_cid = ''; + var cid_choice = ''; + var prefix_choice = ''; + var agent_dialed_number=''; + var agent_dialed_type=''; var allcalls_delay = ''; var omit_phone_code = ''; var no_delete_sessions = ''; @@ -2175,7 +2248,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; - var DiaLControl_manual_HTML = "\"Dial"; + var DiaLControl_manual_HTML = "\"Dial"; var image_blank = new Image(); image_blank.src="./images/blank.gif"; var image_livecall_OFF = new Image(); @@ -2426,8 +2499,12 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} function SendManualDial(taskFromConf) { conf_dialed=1; + var sending_group_alias = 0; if (taskFromConf == 'YES') { + agent_dialed_number='1'; + agent_dialed_type='XFER_3WAY'; + document.getElementById("DialWithCustomer").innerHTML ="\"Dial"; document.getElementById("ParkCustomerDial").innerHTML ="\"Park"; @@ -2442,6 +2519,12 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {threeway_cid = outbound_cid;} if (three_way_call_cid == 'CUSTOMER') {threeway_cid = document.vicidial_form.phone_number.value;} + if (three_way_call_cid == 'AGENT_CHOOSE') + { + threeway_cid = cid_choice; + if (active_group_alias.length > 1) + {var sending_group_alias = 1;} + } } else { @@ -2465,19 +2548,22 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (manual_string.length > 7) {manual_string = temp_dial_prefix + "" + temp_phone_code + "" + manual_string;} } + else + {agent_dialed_type='XFER_OVERRIDE';} } if (taskFromConf == 'YES') - {basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid);} + {basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid,sending_group_alias);} else - {basic_originate_call(manual_string,'NO','NO','','','','1');} + {basic_originate_call(manual_string,'NO','NO','','','','1',sending_group_alias);} MD_ring_secondS=0; } // ################################################################################ // Send Originate command to manager to place a phone call - function basic_originate_call(tasknum,taskprefix,taskreverse,taskdialvalue,tasknowait,taskconfxfer,taskcid) + function basic_originate_call(tasknum,taskprefix,taskreverse,taskdialvalue,tasknowait,taskconfxfer,taskcid,taskusegroupalias) { + var usegroupalias=0; var regCXFvars = new RegExp("CXFER","g"); var tasknum_string = tasknum.toString(); if (tasknum_string.match(regCXFvars)) @@ -2528,14 +2614,19 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - if (taskprefix == 'NO') {var orig_prefix = '';} - else {var orig_prefix = agc_dial_prefix;} + if (taskprefix == 'NO') {var call_prefix = '';} + else {var call_prefix = agc_dial_prefix;} + + if (prefix_choice.length > 0) + {var call_prefix = prefix_choice;} + if (taskreverse == 'YES') { if (taskdialvalue.length < 2) {var dialnum = dialplan_number;} else {var dialnum = taskdialvalue;} + var call_prefix = ''; var originatevalue = "Local/" + tasknum + "@" + ext_context; } else @@ -2558,12 +2649,21 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {var queryCID = "DCagcW" + epoch_sec + user_abb;} else {var queryCID = "DVagcW" + epoch_sec + user_abb;} - if (taskcid.length > 3) - {var call_cid = taskcid;} - else - {var call_cid = campaign_cid;} - VMCoriginate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Originate&format=text&channel=" + originatevalue + "&queryCID=" + queryCID + "&exten=" + orig_prefix + "" + dialnum + "&ext_context=" + ext_context + "&ext_priority=1&outbound_cid=" + call_cid; + if (cid_choice.length > 3) + { + var call_cid = cid_choice; + usegroupalias=1; + } + else + { + if (taskcid.length > 3) + {var call_cid = taskcid;} + else + {var call_cid = campaign_cid;} + } + + VMCoriginate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Originate&format=text&channel=" + originatevalue + "&queryCID=" + queryCID + "&exten=" + call_prefix + "" + dialnum + "&ext_context=" + ext_context + "&ext_priority=1&outbound_cid=" + call_cid + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(VMCoriginate_query); @@ -2571,6 +2671,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + // alert(VMCoriginate_query); // alert(xmlhttp.responseText); if ((taskdialvalue.length > 0) && (tasknowait != 'YES')) @@ -2584,6 +2685,11 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } } delete xmlhttp; + active_group_alias=''; + cid_choice=''; + prefix_choice=''; + agent_dialed_number=''; + agent_dialed_type=''; } } @@ -2820,6 +2926,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.vicidial_form.phone_code.value = APIDiaL_array_detail[1]; document.vicidial_form.MDPhonENumbeR.value = APIDiaL_array_detail[0]; document.vicidial_form.vendor_lead_code.value = APIDiaL_array_detail[5]; + prefix_choice = APIDiaL_array_detail[7]; + active_group_alias = APIDiaL_array_detail[8]; + cid_choice = APIDiaL_array_detail[9]; // alert(APIDiaL_array_detail[1] + "-----" + APIDiaL + "-----" + document.vicidial_form.MDDiaLCodE.value + "-----" + document.vicidial_form.phone_code.value); @@ -3626,7 +3735,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.vicidial_form.LeadPreview.checked=true; document.vicidial_form.DiaLAltPhonE.checked=true; hideDiv('CallBacKsLisTBox'); - ManualDialNext(taskCBid,taskLEADid,'','',''); + ManualDialNext(taskCBid,taskLEADid,'','','','0'); } @@ -3658,6 +3767,11 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } else { + if (agent_allow_group_alias == 'Y') + { + document.getElementById("ManuaLDiaLGrouPSelecteD").innerHTML = "Group Alias: " + active_group_alias + ""; + document.getElementById("ManuaLDiaLGrouP").innerHTML = "Click Here to Choose a Group Alias"; + } showDiv('NeWManuaLDiaLBox'); } } @@ -3669,6 +3783,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} function NeWManuaLDiaLCalLSubmiT(tempDiaLnow) { hideDiv('NeWManuaLDiaLBox'); + document.getElementById("debugbottomspan").innerHTML = "TESTING NOW HERE" + document.vicidial_form.MDPhonENumbeR.value + "|" + active_group_alias; + + var sending_group_alias = 0; var MDDiaLCodEform = document.vicidial_form.MDDiaLCodE.value; var MDPhonENumbeRform = document.vicidial_form.MDPhonENumbeR.value; var MDDiaLOverridEform = document.vicidial_form.MDDiaLOverridE.value; @@ -3682,22 +3799,36 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (MDDiaLOverridEform.length > 0) { - basic_originate_call(session_id,'NO','YES',MDDiaLOverridEform,'YES','','1'); + agent_dialed_number=1; + agent_dialed_type='MANUAL_OVERRIDE'; + basic_originate_call(session_id,'NO','YES',MDDiaLOverridEform,'YES','','1','0'); } else { alt_phone_dialing=1; auto_dial_level=0; manual_dial_in_progress=1; + agent_dialed_number=1; MainPanelToFront(); + if (tempDiaLnow == 'PREVIEW') { + agent_dialed_type='MANUAL_PREVIEW'; buildDiv('DiaLLeaDPrevieW'); buildDiv('DiaLDiaLAltPhonE'); document.vicidial_form.LeadPreview.checked=true; document.vicidial_form.DiaLAltPhonE.checked=true; } - ManualDialNext("","",MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode); + else + { + agent_dialed_type='MANUAL_DIALNOW'; + document.vicidial_form.LeadPreview.checked=false; + document.vicidial_form.DiaLAltPhonE.checked=false; + } + if (active_group_alias.length > 1) + {var sending_group_alias = 1;} + + ManualDialNext("","",MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode,sending_group_alias); } document.vicidial_form.MDPhonENumbeR.value = ''; @@ -3722,6 +3853,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (document.vicidial_form.LeadLookuP.checked==true) {MDLookuPLeaD = 'lookup';} + agent_dialed_number=1; + agent_dialed_type='MANUAL_DIALFAST'; alt_phone_dialing=1; auto_dial_level=0; manual_dial_in_progress=1; @@ -3730,7 +3863,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} buildDiv('DiaLDiaLAltPhonE'); document.vicidial_form.LeadPreview.checked=false; document.vicidial_form.DiaLAltPhonE.checked=true; - ManualDialNext("","",MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode); + ManualDialNext("","",MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode,'0'); } } @@ -3901,7 +4034,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // ################################################################################ // Send the Manual Dial Next Number request - function ManualDialNext(mdnCBid,mdnBDleadid,mdnDiaLCodE,mdnPhonENumbeR,mdnStagE,mdVendorid) + function ManualDialNext(mdnCBid,mdnBDleadid,mdnDiaLCodE,mdnPhonENumbeR,mdnStagE,mdVendorid,mdgroupalias) { inOUT = 'OUT'; all_record = 'NO'; @@ -3952,7 +4085,16 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + dial_prefix + "&campaign_cid=" + campaign_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid; + if (cid_choice.length > 3) + {var call_cid = cid_choice;} + else + {var call_cid = campaign_cid;} + if (prefix_choice.length > 0) + {var call_prefix = prefix_choice;} + else + {var call_prefix = dial_prefix;} + + manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid + "&usegroupalias=" + mdgroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type; // alert(manual_dial_filter + "\n" +manDiaLnext_query); xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); @@ -3990,7 +4132,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (starting_dial_level == 0) { - document.getElementById("DiaLControl").innerHTML = "\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"Dial"; } else { @@ -3998,7 +4140,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; } else { @@ -4202,6 +4344,15 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } } delete xmlhttp; + + if (document.vicidial_form.LeadPreview.checked==false) + { + active_group_alias=''; + cid_choice=''; + prefix_choice=''; + agent_dialed_number=''; + agent_dialed_type=''; + } } } @@ -4309,16 +4460,21 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; } else { - document.getElementById("DiaLControl").innerHTML = "\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"Dial"; } } } } delete xmlhttp; + active_group_alias=''; + cid_choice=''; + prefix_choice=''; + agent_dialed_number=''; + agent_dialed_type=''; } } } @@ -4332,6 +4488,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} alt_dial_status_display = 0; all_record = 'NO'; all_record_count=0; + var usegroupalias=0; if (taskaltnum == 'ALTPhoneE') { var manDiaLonly_num = document.vicidial_form.alt_phone.value; @@ -4402,7 +4559,19 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + dial_prefix + "&campaign_cid=" + campaign_cid + "&omit_phone_code=" + omit_phone_code; + if (cid_choice.length > 3) + { + var call_cid = cid_choice; + usegroupalias=1; + } + else + {var call_cid = campaign_cid;} + if (prefix_choice.length > 0) + {var call_prefix = prefix_choice;} + else + {var call_prefix = dial_prefix;} + + manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(manDiaLonly_query); @@ -4411,6 +4580,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var MDOnextResponse = null; + // alert(manDiaLonly_query); // alert(xmlhttp.responseText); MDOnextResponse = xmlhttp.responseText; @@ -4466,6 +4636,11 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } } delete xmlhttp; + active_group_alias=''; + cid_choice=''; + prefix_choice=''; + agent_dialed_number=''; + agent_dialed_type=''; } } @@ -4491,7 +4666,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; } else { @@ -4507,7 +4682,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; } else { @@ -4721,7 +4896,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var check_VDIC_array=check_incoming.split("\n"); if (check_VDIC_array[0] == '1') { - // alert(xmlhttprequestcheckauto.responseText); + // alert(xmlhttprequestcheckauto.responseText); AutoDialWaiting = 0; var VDIC_data_VDAC=check_VDIC_array[1].split("|"); @@ -4756,6 +4931,21 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {LIVE_campaign_rec_filename = campaign_rec_filename;} + if ( (VDIC_data_VDIG[14].length > 1) && (VDIC_data_VDIG[14]!='NONE') ) + {LIVE_default_group_alias = VDIC_data_VDIG[14];} + else + {LIVE_default_group_alias = default_group_alias;} + + if ( (VDIC_data_VDIG[15].length > 1) && (VDIC_data_VDIG[15]!='NONE') ) + {LIVE_caller_id_number = VDIC_data_VDIG[15];} + else + {LIVE_caller_id_number = default_group_alias_cid;} + + if (VDIC_data_VDIG[16].length > 0) + {LIVE_web_vars = VDIC_data_VDIG[16];} + else + {LIVE_web_vars = default_web_vars;} + var VDIC_data_VDFR=check_VDIC_array[3].split("|"); if ( (VDIC_data_VDFR[1].length > 1) && (VDCL_fronter_display == 'Y') ) {VDIC_fronter = " Fronter: " + VDIC_data_VDFR[0] + " - " + VDIC_data_VDFR[1];} @@ -5375,7 +5565,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } else { - document.getElementById("DiaLControl").innerHTML = "\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"Dial"; } reselect_alt_dial = 0; } @@ -5706,6 +5896,38 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } } +// ################################################################################ +// Generate the Group Alias Chooser panel + function GroupAliasSelectContent_create(task3way) + { + showDiv('GroupAliasSelectBox'); + WaitingForNextStep=1; + GroupAlias_HTML = ''; + document.vicidial_form.GroupAliasSelection.value = ''; + var VD_group_aliases_ct_half = parseInt(VD_group_aliases_ct / 2); + GroupAlias_HTML = "
GROUP ALIAS
"; + if (task3way > 0) + { + VD_group_aliases_ct_half = (VD_group_aliases_ct_half - 1); + GroupAlias_HTML = GroupAlias_HTML + "CAMPAIGN - " + campaign_cid + "

"; + GroupAlias_HTML = GroupAlias_HTML + "CUSTOMER - " + document.vicidial_form.phone_number.value + "

"; + GroupAlias_HTML = GroupAlias_HTML + "AGENT_PHONE - " + outbound_cid + "

"; + } + var loop_ct = 0; + while (loop_ct < VD_group_aliases_ct) + { + GroupAlias_HTML = GroupAlias_HTML + "" + VARgroup_alias_ids[loop_ct] + " - " + VARgroup_alias_names[loop_ct] + " - " + VARcaller_id_numbers[loop_ct] + "

"; + loop_ct++; + if (loop_ct == VD_group_aliases_ct_half) + {GroupAlias_HTML = GroupAlias_HTML + "
";} + } + + var Go_BacK_LinK = "Go Back"; + + GroupAlias_HTML = GroupAlias_HTML + "


" + Go_BacK_LinK; + document.getElementById("GroupAliasSelectContent").innerHTML = GroupAlias_HTML; + } + // ################################################################################ // open web form, then submit disposition function WeBForMDispoSelect_submit() @@ -5893,7 +6115,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (manual_auto_hotkey == '1') { manual_auto_hotkey = 0; - ManualDialNext('','','','',''); + ManualDialNext('','','','','','0'); } } } @@ -5948,6 +6170,22 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } +// ################################################################################ +// Submit the Group Alias + function GroupAliasSelect_submit(newgroupalias,newgroupcid,newusegroup) + { + hideDiv('GroupAliasSelectBox'); + WaitingForNextStep=0; + + if (newusegroup > 0) + { + active_group_alias = newgroupalias; + document.getElementById("ManuaLDiaLGrouPSelecteD").innerHTML = "Group Alias: " + active_group_alias + ""; + document.getElementById("XfeRDiaLGrouPSelecteD").innerHTML = "Group Alias: " + active_group_alias + ""; + } + cid_choice = newgroupcid; + } + // ################################################################################ // Populate the dtmf and xfer number for each preset link in xfer-conf frame @@ -5966,13 +6204,13 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { document.vicidial_form.conf_dtmf.value = CalL_XC_a_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; - basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id,'YES','','1'); + basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id,'YES','','1','0'); } function DtMf_PreSet_b_DiaL() { document.vicidial_form.conf_dtmf.value = CalL_XC_b_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; - basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id,'YES','','1'); + basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id,'YES','','1','0'); } // ################################################################################ @@ -6461,6 +6699,7 @@ encoded=utf8_decode(xtest); var SCserver_ip = server_ip; var SCSIPexten = extension; var SCsession_id = session_id; + var SCweb_vars = LIVE_web_vars; if (encoded.match(RGiframe)) { @@ -6503,6 +6742,7 @@ encoded=utf8_decode(xtest); SCcustomer_zap_channel = SCcustomer_zap_channel.replace(RGplus,'+'); SCserver_ip = SCserver_ip.replace(RGplus,'+'); SCSIPexten = SCSIPexten.replace(RGplus,'+'); + SCweb_vars = SCweb_vars.replace(RGplus,'+'); } var RGvendor_lead_code = new RegExp("--A--vendor_lead_code--B--","g"); @@ -6546,6 +6786,7 @@ encoded=utf8_decode(xtest); var RGserver_ip = new RegExp("--A--server_ip--B--","g"); var RGSIPexten = new RegExp("--A--SIPexten--B--","g"); var RGsession_id = new RegExp("--A--session_id--B--","g"); + var RGweb_vars = new RegExp("--A--web_vars--B--","g"); encoded = encoded.replace(RGvendor_lead_code, SCvendor_lead_code); encoded = encoded.replace(RGsource_id, SCsource_id); @@ -6588,6 +6829,7 @@ encoded=utf8_decode(xtest); encoded = encoded.replace(RGserver_ip, SCserver_ip); encoded = encoded.replace(RGSIPexten, SCSIPexten); encoded = encoded.replace(RGsession_id, SCsession_id); + encoded = encoded.replace(RGweb_vars, SCweb_vars); } decoded=encoded; // simple no ? decoded = decoded.replace(RGnl, "
"); @@ -6914,6 +7156,7 @@ else hideDiv('CallBacKsLisTBox'); hideDiv('NeWManuaLDiaLBox'); hideDiv('PauseCodeSelectBox'); + hideDiv('GroupAliasSelectBox'); if (agentonly_callbacks != '1') {hideDiv('CallbacksButtons');} // if ( (agentcall_manual != '1') && (starting_dial_level > 0) ) @@ -7005,7 +7248,7 @@ else if (document.vicidial_form.DiaLAltPhonE.checked==true) { reselect_alt_dial = 1; - document.getElementById("DiaLControl").innerHTML = "\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"Dial"; document.getElementById("MainStatuSSpan").innerHTML = "Dial Next Call"; } @@ -7484,6 +7727,21 @@ else document.getElementById("XferControl").innerHTML = "\"Transfer"; } } + if (three_way_call_cid == 'AGENT_CHOOSE') + { + if ( (active_group_alias.length < 1) && (LIVE_default_group_alias.length > 1) && (LIVE_caller_id_number.length > 3) ) + { + active_group_alias = LIVE_default_group_alias; + cid_choice = LIVE_caller_id_number; + } + document.getElementById("XfeRDiaLGrouPSelecteD").innerHTML = "Group Alias: " + active_group_alias + ""; + document.getElementById("XfeRCID").innerHTML = "Click Here to Choose a Group Alias"; + } + else + { + document.getElementById("XfeRCID").innerHTML = ""; + document.getElementById("XfeRDiaLGrouPSelecteD").innerHTML = ""; + } } else { @@ -7524,7 +7782,7 @@ else { if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; + document.getElementById("DiaLControl").innerHTML = "\"\"Resume\"
\"Dial"; if (manual_dial_preview == 1) {buildDiv('DiaLLeaDPrevieW');} } @@ -7679,7 +7937,11 @@ echo "\n";   (This option if checked will attempt to find the phone number in the system before inserting it as a new lead) -

If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there.
  + +

+     +
+

If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there.
  Dial Override:   (digits only please) @@ -7712,7 +7974,7 @@ Your Status:
Calls Dialing: - Transfer - Conference
+ Transfer - Conference            
LOCAL CLOSER @@ -7881,7 +8143,15 @@ Your Status:
Calls Dialing: + + height=460>
SELECT A GROUP ALIAS :
+ Group Alias Selection + +

  +
+
+ + @@ -8008,7 +8278,7 @@ else
-Dial Next Number
+Dial Next Number
LEAD PREVIEW
ALT PHONE DIAL
diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 544acf29..80e89b96 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -13,7 +13,7 @@ require("dbconnect.php"); ###################################################################################################### $page_width='770'; -$section_width='720'; +$section_width='750'; $header_font_size='3'; $subheader_font_size='2'; $subcamp_font_size='2'; @@ -29,22 +29,16 @@ $scripts_color = '#99FFCC'; $filters_color = '#CCCCCC'; $admin_color = '#FF99FF'; $reports_color = '#99FF33'; -#$users_color = '#FFFF99'; -#$campaigns_color = '#FFFF99'; -#$lists_color = '#FFFF99'; -#$ingroups_color = '#FFFF99'; -#$remoteagent_color ='#FFFF99'; -#$usergroups_color = '#FFFF99'; -#$scripts_color = '#FFFF99'; -#$filters_color = '#FFFF99'; -#$admin_color = '#FFFF99'; -#$reports_color = '#FFFF99'; $times_color = '#FF33FF'; + $shifts_color = '#FF33FF'; $phones_color = '#FF33FF'; $conference_color = '#FF33FF'; $server_color = '#FF33FF'; + $templates_color = '#FF33FF'; + $carriers_color = '#FF33FF'; $settings_color = '#FF33FF'; $status_color = '#FF33FF'; +$subcamp_color = '#FF9933'; $users_font = 'BLACK'; $campaigns_font = 'BLACK'; $lists_font = 'BLACK'; @@ -61,9 +55,32 @@ $reports_font = 'BLACK'; $server_font = 'BLACK'; $settings_font = 'BLACK'; $status_font = 'BLACK'; -$subcamp_color = '#FF9933'; $subcamp_font = 'BLACK'; +### comment this section out for colorful section headings +$users_color = '#E6E6E6'; +$campaigns_color = '#E6E6E6'; +$lists_color = '#E6E6E6'; +$ingroups_color = '#E6E6E6'; +$remoteagent_color ='#E6E6E6'; +$usergroups_color = '#E6E6E6'; +$scripts_color = '#E6E6E6'; +$filters_color = '#E6E6E6'; +$admin_color = '#E6E6E6'; +$reports_color = '#E6E6E6'; + $times_color = '#C6C6C6'; + $shifts_color = '#C6C6C6'; + $phones_color = '#C6C6C6'; + $conference_color = '#C6C6C6'; + $server_color = '#C6C6C6'; + $templates_color = '#C6C6C6'; + $carriers_color = '#C6C6C6'; + $settings_color = '#C6C6C6'; + $status_color = '#C6C6C6'; +$subcamp_color = '#C6C6C6'; +### + + $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; @@ -915,6 +932,18 @@ if (isset($_GET["globals_string"])) {$globals_string=$_GET["globals_string"]; elseif (isset($_POST["globals_string"])) {$globals_string=$_POST["globals_string"];} if (isset($_GET["dialplan_entry"])) {$dialplan_entry=$_GET["dialplan_entry"];} elseif (isset($_POST["dialplan_entry"])) {$dialplan_entry=$_POST["dialplan_entry"];} +if (isset($_GET["group_alias_id"])) {$group_alias_id=$_GET["group_alias_id"];} + elseif (isset($_POST["group_alias_id"])) {$group_alias_id=$_POST["group_alias_id"];} +if (isset($_GET["group_alias_name"])) {$group_alias_name=$_GET["group_alias_name"];} + elseif (isset($_POST["group_alias_name"])) {$group_alias_name=$_POST["group_alias_name"];} +if (isset($_GET["caller_id_number"])) {$caller_id_number=$_GET["caller_id_number"];} + elseif (isset($_POST["caller_id_number"])) {$caller_id_number=$_POST["caller_id_number"];} +if (isset($_GET["caller_id_name"])) {$caller_id_name=$_GET["caller_id_name"];} + elseif (isset($_POST["caller_id_name"])) {$caller_id_name=$_POST["caller_id_name"];} +if (isset($_GET["agent_allow_group_alias"])) {$agent_allow_group_alias=$_GET["agent_allow_group_alias"];} + elseif (isset($_POST["agent_allow_group_alias"])) {$agent_allow_group_alias=$_POST["agent_allow_group_alias"];} +if (isset($_GET["default_group_alias"])) {$default_group_alias=$_GET["default_group_alias"];} + elseif (isset($_POST["default_group_alias"])) {$default_group_alias=$_POST["default_group_alias"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} @@ -1094,6 +1123,7 @@ $enable_vtiger_integration = ereg_replace("[^0-9]","",$enable_vtiger_integration $qc_features_active = ereg_replace("[^0-9]","",$qc_features_active); $outbound_autodial_active = ereg_replace("[^0-9]","",$outbound_autodial_active); $download_lists = ereg_replace("[^0-9]","",$download_lists); +$caller_id_number = ereg_replace("[^0-9]","",$caller_id_number); ### DIGITS and COLONS $shift_length = ereg_replace("[^\:0-9]","",$shift_length); @@ -1145,6 +1175,7 @@ $did_active = ereg_replace("[^NY]","",$did_active); $active_asterisk_server = ereg_replace("[^NY]","",$active_asterisk_server); $generate_vicidial_conf = ereg_replace("[^NY]","",$generate_vicidial_conf); $rebuild_conf_files = ereg_replace("[^NY]","",$rebuild_conf_files); +$agent_allow_group_alias = ereg_replace("[^NY]","",$agent_allow_group_alias); $qc_enabled = ereg_replace("[^0-9NY]","",$qc_enabled); @@ -1298,6 +1329,8 @@ $vtiger_screen_login = ereg_replace("[^-\_0-9a-zA-Z]","",$vtiger_screen_login); $cpd_amd_action = ereg_replace("[^-\_0-9a-zA-Z]","",$cpd_amd_action); $template_id = ereg_replace("[^-\_0-9a-zA-Z]","",$template_id); $carrier_id = ereg_replace("[^-\_0-9a-zA-Z]","",$carrier_id); +$group_alias_id = ereg_replace("[^-\_0-9a-zA-Z]","",$group_alias_id); +$default_group_alias = ereg_replace("[^-\_0-9a-zA-Z]","",$default_group_alias); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); @@ -1353,6 +1386,8 @@ $did_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$did_description); $alt_server_ip = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$alt_server_ip); $template_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$template_name); $carrier_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$carrier_name); +$group_alias_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_alias_name); +$caller_id_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$caller_id_name); ### ALPHA-NUMERIC and underscore and dash and slash and at and dot $call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); @@ -1585,11 +1620,15 @@ $dialplan_entry = ereg_replace(";","",$dialplan_entry); # 90202-0444 - Added cpd_amd_action option for processing of AMD messages # 90209-1339 - Added download_lists option to allow downloading of lists # 90210-1042 - Added options for auto-generation of asterisk conf files +# 90301-2026 - Added Vtiger group synchronization +# 90302-2046 - Changed Section heading to be on the left side of the screen +# 90303-0631 - Added web vars to agent campaign and in-group settings +# 90303-2047 - Added group aliases and default group aliases # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.5-164'; -$build = '90210-1042'; +$admin_version = '2.0.5-168'; +$build = '90303-2047'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -1744,13 +1783,14 @@ if ($ADD==111111) {$hh='usergroups'; echo "Add New Users Group";} if ($ADD==1111111) {$hh='scripts'; echo "Add New Script";} if ($ADD==11111111) {$hh='filters'; echo "Add New Filter";} if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Add New Call Time";} -if ($ADD==131111111) {$hh='admin'; $sh='times'; echo "Add New Shift";} +if ($ADD==131111111) {$hh='admin'; $sh='shifts'; echo "Add New Shift";} if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Add New State Call Time";} if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE";} if ($ADD==12111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE ALIAS";} +if ($ADD==13111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW GROUP ALIAS";} if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "ADD NEW SERVER";} -if ($ADD==131111111111) {$hh='admin'; $sh='server'; echo "ADD NEW CONF TEMPLATE";} -if ($ADD==141111111111) {$hh='admin'; $sh='server'; echo "ADD NEW CARRIER";} +if ($ADD==131111111111) {$hh='admin'; $sh='templates'; echo "ADD NEW CONF TEMPLATE";} +if ($ADD==141111111111) {$hh='admin'; $sh='carriers'; echo "ADD NEW CARRIER";} if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW CONFERENCE";} if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} if ($ADD=='2') {$hh='users'; echo "New User Addition";} @@ -1774,14 +1814,15 @@ if ($ADD==211111) {$hh='usergroups'; echo "New Users Group Addition";} if ($ADD==2111111) {$hh='scripts'; echo "New Script Addition";} if ($ADD==21111111) {$hh='filters'; echo "New Filter Addition";} if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "New Call Time Addition";} -if ($ADD==231111111) {$hh='admin'; $sh='times'; echo "New Shift Addition";} +if ($ADD==231111111) {$hh='admin'; $sh='shifts'; echo "New Shift Addition";} if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "New State Call Time Addition";} if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE";} if ($ADD==22111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE ALIAS";} +if ($ADD==23111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW GROUP ALIAS";} if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER";} if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER VICIDIAL TRUNK RECORD";} -if ($ADD==231111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW CONF TEMPLATE";} -if ($ADD==241111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW CARRIER";} +if ($ADD==231111111111) {$hh='admin'; $sh='templates'; echo "ADDING NEW CONF TEMPLATE";} +if ($ADD==241111111111) {$hh='admin'; $sh='carriers'; echo "ADDING NEW CARRIER";} if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW CONFERENCE";} if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL SYSTEM STATUSES";} @@ -1829,13 +1870,14 @@ if ($ADD==3111111) {$hh='scripts'; echo "Modify Script";} if ($ADD==31111111) {$hh='filters'; echo "Modify Filter";} if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Definitions List";} -if ($ADD==331111111) {$hh='admin'; $sh='times'; echo "Modify Shift";} +if ($ADD==331111111) {$hh='admin'; $sh='shifts'; echo "Modify Shift";} if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} if ($ADD==32111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE ALIAS";} +if ($ADD==33111111111) {$hh='admin'; $sh='phones'; echo "MODIFY GROUP ALIAS";} if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} -if ($ADD==331111111111) {$hh='admin'; $sh='server'; echo "MODIFY CONF TEMPLATE";} -if ($ADD==341111111111) {$hh='admin'; $sh='server'; echo "MODIFY CARRIER";} +if ($ADD==331111111111) {$hh='admin'; $sh='templates'; echo "MODIFY CONF TEMPLATE";} +if ($ADD==341111111111) {$hh='admin'; $sh='carriers'; echo "MODIFY CARRIER";} if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} @@ -1862,14 +1904,15 @@ if ($ADD==411111) {$hh='usergroups'; echo "Modify Users Groups";} if ($ADD==4111111) {$hh='scripts'; echo "Modify Script";} if ($ADD==41111111) {$hh='filters'; echo "Modify Filter";} if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} -if ($ADD==431111111) {$hh='admin'; $sh='times'; echo "Modify Shift";} +if ($ADD==431111111) {$hh='admin'; $sh='shifts'; echo "Modify Shift";} if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} if ($ADD==42111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE ALIAS";} +if ($ADD==43111111111) {$hh='admin'; $sh='phones'; echo "MODIFY GROUP ALIAS";} if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER VICIDIAL TRUNK RECORD";} -if ($ADD==431111111111) {$hh='admin'; $sh='server'; echo "MODIFY CONF TEMPLATE";} -if ($ADD==441111111111) {$hh='admin'; $sh='server'; echo "MODIFY CARRIER";} +if ($ADD==431111111111) {$hh='admin'; $sh='templates'; echo "MODIFY CONF TEMPLATE";} +if ($ADD==441111111111) {$hh='admin'; $sh='carriers'; echo "MODIFY CARRIER";} if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} @@ -1888,13 +1931,14 @@ if ($ADD==511111) {$hh='usergroups'; echo "Delete Users Group";} if ($ADD==5111111) {$hh='scripts'; echo "Delete Script";} if ($ADD==51111111) {$hh='filters'; echo "Delete Filter";} if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} -if ($ADD==531111111) {$hh='admin'; $sh='times'; echo "Delete Shift";} +if ($ADD==531111111) {$hh='admin'; $sh='shifts'; echo "Delete Shift";} if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} if ($ADD==52111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE ALIAS";} +if ($ADD==53111111111) {$hh='admin'; $sh='phones'; echo "DELETE GROUP ALIAS";} if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} -if ($ADD==531111111111) {$hh='admin'; $sh='server'; echo "DELETE CONF TEMPLATE";} -if ($ADD==541111111111) {$hh='admin'; $sh='server'; echo "DELETE CARRIER";} +if ($ADD==531111111111) {$hh='admin'; $sh='templates'; echo "DELETE CONF TEMPLATE";} +if ($ADD==541111111111) {$hh='admin'; $sh='carriers'; echo "DELETE CARRIER";} if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} if ($ADD==6) {$hh='users'; echo "Delete User";} @@ -1914,14 +1958,15 @@ if ($ADD==611111) {$hh='usergroups'; echo "Delete Users Group";} if ($ADD==6111111) {$hh='scripts'; echo "Delete Script";} if ($ADD==61111111) {$hh='filters'; echo "Delete Filter";} if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} -if ($ADD==631111111) {$hh='admin'; $sh='times'; echo "Delete Shift";} +if ($ADD==631111111) {$hh='admin'; $sh='shifts'; echo "Delete Shift";} if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} if ($ADD==62111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE ALIAS";} +if ($ADD==63111111111) {$hh='admin'; $sh='phones'; echo "DELETE GROUP ALIAS";} if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER VICIDIAL TRUNK RECORD";} -if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "DELETE CONF TEMPLATE";} -if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "DELETE CARRIER";} +if ($ADD==621111111111) {$hh='admin'; $sh='templates'; echo "DELETE CONF TEMPLATE";} +if ($ADD==621111111111) {$hh='admin'; $sh='carriers'; echo "DELETE CARRIER";} if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} if ($ADD==73) {$hh='campaigns'; echo "Dialable Lead Count";} @@ -1940,13 +1985,14 @@ if ($ADD==100000) {$hh='usergroups'; echo "User Groups";} if ($ADD==1000000) {$hh='scripts'; echo "Scripts";} if ($ADD==10000000) {$hh='filters'; echo "Filters";} if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Call Times";} -if ($ADD==130000000) {$hh='admin'; $sh='times'; echo "Shifts";} +if ($ADD==130000000) {$hh='admin'; $sh='shifts'; echo "Shifts";} if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "State Call Times";} if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "PHONE LIST";} if ($ADD==12000000000) {$hh='admin'; $sh='phones'; echo "PHONE ALIAS LIST";} +if ($ADD==13000000000) {$hh='admin'; $sh='phones'; echo "GROUP ALIAS LIST";} if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "SERVER LIST";} -if ($ADD==130000000000) {$hh='admin'; $sh='server'; echo "CONF TEMPLATE LIST";} -if ($ADD==140000000000) {$hh='admin'; $sh='server'; echo "CARRIER LIST";} +if ($ADD==130000000000) {$hh='admin'; $sh='templates'; echo "CONF TEMPLATE LIST";} +if ($ADD==140000000000) {$hh='admin'; $sh='carriers'; echo "CARRIER LIST";} if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";} if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL CONFERENCE LIST";} if ($ADD==550) {$hh='users'; echo "Search Form";} @@ -2027,7 +2073,7 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD $campaigns_to_print = mysql_num_rows($rslt); $campaigns_list=''; $campaigns_value=''; - $RANKcampaigns_list="CAMPAIGN     RANK     CALLS\n"; + $RANKcampaigns_list="CAMPAIGN     RANK     CALLSWEB VARS\n"; $o=0; while ($campaigns_to_print > $o) @@ -2042,30 +2088,40 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD $o=0; while ($campaigns_to_print > $o) { - $stmt="SELECT campaign_rank,calls_today from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; + $group_web_vars=''; + $campaign_web=''; + $stmt="SELECT campaign_rank,calls_today,group_web_vars from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; $rslt=mysql_query($stmt, $link); $ranks_to_print = mysql_num_rows($rslt); if ($ranks_to_print > 0) { $row=mysql_fetch_row($rslt); $SELECT_campaign_rank = $row[0]; - $calls_today = $row[1]; + $calls_today = $row[1]; + $group_web_vars = $row[2]; } else - {$calls_today=0; $SELECT_campaign_rank=0;} + {$calls_today=0; $SELECT_campaign_rank=0; $group_web_vars='';} if ( ($ADD=="4A") or ($ADD=="4B") ) { if (isset($_GET["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_GET["RANK_$campaign_id_values[$o]"];} elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} + if (isset($_GET["WEB_$campaign_id_values[$o]"])) {$campaign_web=$_GET["WEB_$campaign_id_values[$o]"];} + elseif (isset($_POST["WEB_$campaign_id_values[$o]"])) {$campaign_web=$_POST["WEB_$campaign_id_values[$o]"];} + if ($non_latin < 1) + { + $campaign_rank = ereg_replace("[^-\_0-9]","",$campaign_rank); + $campaign_web = preg_replace("/;|\"|\'/","",$campaign_web); + } if ($ranks_to_print > 0) { - $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', group_web_vars='$campaign_web' where campaign_id='$campaign_id_values[$o]' and user='$user';"; $rslt=mysql_query($stmt, $link); } else { - $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user';"; + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user', group_web_vars='$campaign_web';"; $rslt=mysql_query($stmt, $link); } @@ -2120,8 +2176,11 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD $RANKcampaigns_list .= ">$h"; $h--; } + if ( (strlen($campaign_web) < 1) and (strlen($group_web_vars) > 0) ) + {$campaign_web=$group_web_vars;} $RANKcampaigns_list .= "\n"; - $RANKcampaigns_list .= "     $calls_today\n"; + $RANKcampaigns_list .= "     $calls_today\n"; + $RANKcampaigns_list .= "     \n"; $o++; } ##### END get campaigns listing for rankings ##### @@ -2185,7 +2244,7 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD $groups_list=''; $groups_value=''; $XFERgroups_list=''; - $RANKgroups_list="INBOUND GROUP     RANK     CALLS\n"; + $RANKgroups_list="INBOUND GROUP     RANK     CALLSWEB VARS\n"; $o=0; while ($groups_to_print > $o) @@ -2199,14 +2258,17 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD $o=0; while ($groups_to_print > $o) { - $stmt="SELECT group_rank,calls_today from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; + $group_web_vars=''; + $group_web=''; + $stmt="SELECT group_rank,calls_today,group_web_vars from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; $rslt=mysql_query($stmt, $link); $ranks_to_print = mysql_num_rows($rslt); if ($ranks_to_print > 0) { $row=mysql_fetch_row($rslt); - $SELECT_group_rank = $row[0]; - $calls_today = $row[1]; + $SELECT_group_rank = $row[0]; + $calls_today = $row[1]; + $group_web_vars = $row[2]; } else {$calls_today=0; $SELECT_group_rank=0;} @@ -2214,15 +2276,23 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD { if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} + if (isset($_GET["WEB_$group_id_values[$o]"])) {$group_web=$_GET["WEB_$group_id_values[$o]"];} + elseif (isset($_POST["WEB_$group_id_values[$o]"])) {$group_web=$_POST["WEB_$group_id_values[$o]"];} + + if ($non_latin < 1) + { + $group_rank = ereg_replace("[^-\_0-9]","",$group_rank); + $group_web = preg_replace("/;|\"|\'/","",$group_web); + } if ($ranks_to_print > 0) { - $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_web_vars='$group_web' where group_id='$group_id_values[$o]' and user='$user';"; $rslt=mysql_query($stmt, $link); } else { - $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user';"; + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user', group_web_vars='$group_web';"; $rslt=mysql_query($stmt, $link); } @@ -2280,8 +2350,11 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD $RANKgroups_list .= ">$h"; $h--; } + if ( (strlen($group_web) < 1) and (strlen($group_web_vars) > 0) ) + {$group_web=$group_web_vars;} $RANKgroups_list .= "\n"; - $RANKgroups_list .= "     $calls_today\n"; + $RANKgroups_list .= "     $calls_today\n"; + $RANKgroups_list .= "     \n"; $o++; } if (strlen($groups_value)>2) {$groups_value .= " -";} @@ -2548,12 +2621,12 @@ if ($SSoutbound_autodial_active > 0)

-Campaign Ranks - In this section you can define the rank an agent will have for each campaign. These ranks can be used to allow for preferred call routing when Next Agent Call is set to campaign_rank. +Campaign Ranks - In this section you can define the rank an agent will have for each campaign. These ranks can be used to allow for preferred call routing when Next Agent Call is set to campaign_rank. Also in this section are the WEB VARs for each campaign. These allow each agent to have a different variable string that can be added to the WEB FORM or SCRIPT tab URLs by simply putting --A--web_vars--B-- as you would put any other field.

-Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. You will also be able to set the rank, or skill level, in this section for each of the inbound groups as well as being able to see the number of calls received from each inbound group for this specific agent. Also in this section is the ability to give the agent a rank for each inbound group. These ranks can be used for preferred call routing when that option is selected in the in-group screen. +Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. You will also be able to set the rank, or skill level, in this section for each of the inbound groups as well as being able to see the number of calls received from each inbound group for this specific agent. Also in this section is the ability to give the agent a rank for each inbound group. These ranks can be used for preferred call routing when that option is selected in the in-group screen. Also in this section are the WEB VARs for each campaign. These allow each agent to have a different variable string that can be added to the WEB FORM or SCRIPT tab URLs by simply putting --A--web_vars--B-- as you would put any other field.
@@ -3199,7 +3272,7 @@ if ($SSoutbound_autodial_active > 0)

-3-Way Call Outbound CallerID - This defines what is sent out as the outbound callerID number from 3-way calls placed by the agent, CAMPAIGN uses the custom campaign callerID, CUSTOMER uses the number of the customer that is active on the agents screen and AGENT_PHONE uses the callerID for the phone that the agent is logged into. +3-Way Call Outbound CallerID - This defines what is sent out as the outbound callerID number from 3-way calls placed by the agent, CAMPAIGN uses the custom campaign callerID, CUSTOMER uses the number of the customer that is active on the agents screen and AGENT_PHONE uses the callerID for the phone that the agent is logged into. AGENT_CHOOSE allows the agent to choose which callerID to use for 3-way calls from a list of choices.
@@ -3268,6 +3341,15 @@ if ($SSqc_features_active > 0)
Vtiger Screen Login - If Vtiger integration is enabled in the system settings then this setting will define whether the user is logged into the Vtiger interface automatically when they login to VICIDIAL. Default is Y. +
+
+
+Group Alias Allowed - If you want to allow your agents to use group aliases then you need to set this to Y. Group Aliases are explained more in the Admin section, they allow agents to select different callerIDs for outbound manual calls that they may place. Default is N. + +
+
+
+Default Group Alias - If you have allowed Group Aliases then this is the group alias that is selected first by default when the agent chooses to use a Group Alias for an outbound manual call. Default is NONE or empty. @@ -3594,6 +3676,12 @@ if ($SSqc_features_active > 0)
Stats Percent of Calls Answered Within X seconds - This field allows you to set the number of hold seconds that the realtime stats display will use to calculate the percentage of answered calls that were answered within X number of seconds on hold. +
+
+
+Default Group Alias - If you have allowed Group Aliases for the campaign that the agent is logged into then this is the group alias that is selected first by default on a call coming in from this inbound group when the agent chooses to use a Group Alias for an outbound manual call. Default is NONE or empty. + + @@ -4382,6 +4470,25 @@ if ($SSoutbound_autodial_active > 0)
Conf Override Settings - If populated, and the Template ID is set to --NONE-- then the contents of this field are used as the conf file entries for this phone. generate_vicidial_conf for this phones server must be set to Y for this to work. This field should NOT contain the [extension] line, that will be automatically generated. +
+
+
+Group Alias ID - The ID of the group alias used by agents to dial out calls from the VICIDIAL agent interface with different Caller IDs. no spaces or other special characters allowed. Must be between 2 and 20 characters in length. + +
+
+
+Group Alias Name - The name used to describe a group alias, Must be between 2 and 50 characters in length. + +
+
+
+Caller ID Number - The Caller ID number used in this Group Alias. Must be digits only. + +
+
+
+Caller ID Name - The Caller ID name that can be sent out with this Group Alias. As far as we know this will only work in Canada on PRI circuits and using an IAX loop trunk through Asterisk. @@ -5366,9 +5473,8 @@ $admin_home_url_LU = $row[0]; ?>
- BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0> + + +
  VICIDIAL ADMIN - HOME | Timeclock | Logout  
+ +
+VICIDIAL logo +ADMINISTRATION
+ + + + 1) { + ?> + >>>>>>> + + + + 1) + { + if ($sh=='basic') {$sh='list';} + if ($sh=='detail') {$sh='list';} + if ($sh=='dialstat') {$sh='list';} + + if ($sh=='list') {$list_sh="bgcolor=\"$subcamp_color\""; $list_fc="$subcamp_font";} + else {$list_sh=''; $list_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$subcamp_color\""; $status_fc="$subcamp_font";} + else {$status_sh=''; $status_fc='BLACK';} + if ($sh=='hotkey') {$hotkey_sh="bgcolor=\"$subcamp_color\""; $hotkey_fc="$subcamp_font";} + else {$hotkey_sh=''; $hotkey_fc='BLACK';} + if ($sh=='recycle') {$recycle_sh="bgcolor=\"$subcamp_color\""; $recycle_fc="$subcamp_font";} + else {$recycle_sh=''; $recycle_fc='BLACK';} + if ($sh=='autoalt') {$autoalt_sh="bgcolor=\"$subcamp_color\""; $autoalt_fc="$subcamp_font";} + else {$autoalt_sh=''; $autoalt_fc='BLACK';} + if ($sh=='pause') {$pause_sh="bgcolor=\"$subcamp_color\""; $pause_fc="$subcamp_font";} + else {$pause_sh=''; $pause_fc='BLACK';} + if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";} + else {$listmix_sh=''; $listmix_fc='BLACK';} + + ?> + > + + > + + > + + 0) + { + ?> + > + + > + + > + + + > + + + + 0) + { + ?> + + 1) { + ?> + >>>>> + + + + 1) + { + ?> + >> + + + 0) + { + ?> + + 1) + { + ?> + >> + + + + 1) + { + ?> + >>>>>> + + + + 1) + { + ?> + >>>> + + + + 1) + { + ?> + >> + + + + 1) + { + if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # pink + else {$times_sh=''; $times_fc='BLACK';} + if ($sh=='shifts') {$shifts_sh="bgcolor=\"$shifts_color\""; $shifts_fc="$shifts_font";} # pink + else {$shifts_sh=''; $shifts_fc='BLACK';} + if ($sh=='templates') {$templates_sh="bgcolor=\"$templates_color\""; $templates_fc="$templates_font";} # pink + else {$templates_sh=''; $templates_fc='BLACK';} + if ($sh=='carriers') {$carriers_sh="bgcolor=\"$carriers_color\""; $carriers_fc="$carriers_font";} # pink + else {$carriers_sh=''; $carriers_fc='BLACK';} + if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink + else {$phones_sh=''; $phones_fc='BLACK';} + if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink + else {$server_sh=''; $server_fc='BLACK';} + if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink + else {$conference_sh=''; $conference_fc='BLACK';} + if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink + else {$settings_sh=''; $settings_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink + else {$status_sh=''; $status_fc='BLACK';} + + ?> + > + + > + > + > + > + > + > + > + > + + + + +
WIDTH=160> + SIZE=>Users +
+   >Show Users +
+   >Add A New User +
+   >Copy User +
+   >Search For A User +
+   >User Stats +
+   >User Status +
+   >Time Sheet
> + SIZE=>Campaigns +
>   SIZE=>Campaigns Main
>   SIZE=>Statuses
>   SIZE=>HotKeys
>   SIZE=>Lead Recycle
>   SIZE=>Auto-Alt Dial
>   SIZE=>List Mix
>   SIZE=>Pause Codes
> SIZE=>Lists
  + > Show Lists +
  + > Add A New List +
  + > Search For A Lead +
  + > Add Number To DNC +
  + > Load New Leads +
> + SIZE=> Scripts +
  + > Show Scripts +
  + > Add A New Script +
> SIZE=> Filters
  + > Show Filters +
  + > Add A New Filter +
> + SIZE=> In-Groups +
  + > Show In-Groups +
  + > Add A New In-Group +
  + > Copy In-Group +
  + > Show DIDs +
  + > Add A New DID +
  + > Copy DID +
> + SIZE=> User Groups +
  + > Show User Groups +
  + > Add A New User Group +
  + > Group Hourly Report +
  + > Bulk Group Change +
> + SIZE=> Remote Agents +
  + > Show Remote Agents +
  + > Add New Remote Agents +
> + SIZE=> Admin +
COLSPAN=2>   + SIZE=> Call Times
>   + SIZE=> Shifts
>   + SIZE=> Phones
>   + SIZE=> Templates
>   + SIZE=> Carriers
>   + SIZE=> Servers
>   + SIZE=> Conferences
>   + SIZE=> System Settings
>   + SIZE=> System Statuses
> + SIZE=> Reports +
+
BGCOLOR=#D9E6FE> + + + HEIGHT=15> + + + + + + + + + + + + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) and (strlen($admin_hh) > 1) ) { + ?> + > + 1) and (strlen($admin_hh) > 1) ) { + ?> + > + 1) and (strlen($admin_hh) > 1) ) { + ?> + > + 1) { + ?> + > + 1) and (!eregi('campaign',$hh) ) ) { + ?> + > + \n"; + echo "You are not authorized to view this page. Please go back.\n"; + } + +if (strlen($reports_hh) > 1) { + ?> +> + + + + +
HOME | Timeclock | Logout  
>   > Show Campaigns     |     > Add A New Campaign     |     > Copy Campaign     |     > Real-Time Campaigns Summary
  > Show Call Times  | > Add A New Call Time  | > Show State Call Times  | > Add A New State Call Time
  > Show Shifts  | > Add A New Shift
  > Show Phones  | > Add A New Phone  | > Phone Alias List  | > Add A New Phone Alias  | > Group Alias List  | > Add A New Group Alias
  > Show Conferences   |   > Add A New Conference   |   > Show VICIDIAL Conferences   |   > Add A New VICIDIAL Conference
  > Show Servers   |   > Add A New Server
  > Show Templates   |   > Add A New Template
  > Show Carriers   |   > Add A New Carrier
  > System Settings
  > System Statuses   |   > Status Categories   |   > QC Status Codes
>  
\n"; + echo ""; + + echo "
ADD A NEW GROUP ALIAS
\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "
Group Alias ID: $NWB#phones-group_alias_id$NWE
Group Alias Name: $NWB#phones-group_alias_name$NWE
CallerID Number: $NWB#phones-caller_id_number$NWE
CallerID Name: $NWB#phones-caller_id_name$NWE
Active:
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } + } + + ###################### # ADD=111111111111 display the ADD NEW SERVER SCREEN ###################### @@ -6605,7 +7065,7 @@ if ($ADD==11111111111111) ###################### if ($ADD=="2") -{ + { echo ""; $stmt="SELECT count(*) from vicidial_users where user='$user';"; $rslt=mysql_query($stmt, $link); @@ -6702,6 +7162,7 @@ if ($ADD=="2") $roleid = 'H5'; $status = 'Active'; $groupid = '1'; + if ($user_level >= 7) {$roleid = 'H3';} if ($user_level >= 8) {$roleid = 'H4';} if ($user_level >= 9) {$roleid = 'H2';} if ($user_level >= 9) {$is_admin = 'on';} @@ -6709,6 +7170,56 @@ if ($ADD=="2") $salt = '$1$' . $salt . '$'; $encrypted_password = crypt($user_password, $salt); + ###################################### + ##### BEGIN Add/Update group info in Vtiger + $stmt="SELECT count(*) from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, update it + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + } + + ### user doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$user_group',description='';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + #### END CREATE NEW GROUP RECORD IN VTIGER + } + ##### END Add/Update group info in Vtiger + ###################################### + + ###################################### + ##### BEGIN Add/Update user info in Vtiger $stmt="SELECT count(*) from vtiger_users where user_name='$user_name';"; $rslt=mysql_query($stmt, $linkV); if ($DB) {echo "$stmt\n";} @@ -6726,6 +7237,13 @@ if ($ADD=="2") $row=mysql_fetch_row($rslt); $userid = $row[0]; + $stmt="SELECT count(*) from vtiger_users2group WHERE userid='$userid' and groupid='$groupid';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $usergroupcount = $row[0]; + $stmtA = "UPDATE vtiger_users SET user_password='$encrypted_password',last_name='$last_name',is_admin='$is_admin',status='$status' where id='$userid';"; if ($DB) {echo "|$stmtA|\n";} $rslt=mysql_query($stmtA, $linkV); @@ -6735,6 +7253,33 @@ if ($ADD=="2") if ($DB) {echo "|$stmtB|\n";} $rslt=mysql_query($stmtB, $linkV); if (!$rslt) {die('Could not execute: ' . mysql_error());} + + if ($usergroupcount < 1) + { + $stmt="SELECT user_group FROM vicidial_user_groups;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_groups_ct = mysql_num_rows($rslt); + $k=0; + $VD_groups_list=''; + while ($k < $VD_groups_ct) + { + $row=mysql_fetch_row($rslt); + $VD_groups_list .= "'$row[0]',"; + $k++; + } + $VD_groups_list = preg_replace("/.$/",'',$VD_groups_list); + + $stmtC = "DELETE FROM vtiger_users2group WHERE userid='$userid' and groupid IN(SELECT groupid from vtiger_groups where groupname IN($VD_groups_list));"; + if ($DB) {echo "|$stmtC|\n";} + $rslt=mysql_query($stmtC, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtD = "INSERT INTO vtiger_users2group SET userid='$userid',groupid='$groupid';"; + if ($DB) {echo "|$stmtD|\n";} + $rslt=mysql_query($stmtD, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } } ### user doesn't exist in vtiger, insert it @@ -6764,7 +7309,8 @@ if ($ADD=="2") #### END CREATE NEW USER RECORD IN VTIGER } - + ##### END Add/Update user info in Vtiger + ###################################### } ### END vtiger integration @@ -6778,15 +7324,15 @@ if ($ADD=="2") } } -$ADD=3; -} + $ADD=3; + } ###################### # ADD=2A adds the copied new user to the system ###################### if ($ADD=="2A") -{ + { echo ""; $stmt="SELECT count(*) from vicidial_users where user='$user';"; $rslt=mysql_query($stmt, $link); @@ -6872,17 +7418,6 @@ if ($ADD=="2A") if ($enable_vtiger_integration > 0) { - $stmt = "SELECT user_level,active FROM vicidial_users where user='$user';"; - $rslt=mysql_query($stmt, $link); - if ($DB) {echo "$stmt\n";} - $vuul_conf_ct = mysql_num_rows($rslt); - if ($vuul_conf_ct > 0) - { - $row=mysql_fetch_row($rslt); - $user_level = $row[0]; - $active = $row[1]; - } - ### connect to your vtiger database $linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass"); if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());} @@ -6896,14 +7431,64 @@ if ($ADD=="2A") $roleid = 'H5'; $status = 'Active'; $groupid = '1'; + if ($user_level >= 7) {$roleid = 'H3';} if ($user_level >= 8) {$roleid = 'H4';} if ($user_level >= 9) {$roleid = 'H2';} if ($user_level >= 9) {$is_admin = 'on';} - if (ereg('N',$active)) {$status = 'Inactive';} $salt = substr($user_name, 0, 2); $salt = '$1$' . $salt . '$'; $encrypted_password = crypt($user_password, $salt); + ###################################### + ##### BEGIN Add/Update group info in Vtiger + $stmt="SELECT count(*) from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, update it + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + } + + ### user doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$user_group',description='';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + #### END CREATE NEW GROUP RECORD IN VTIGER + } + ##### END Add/Update group info in Vtiger + ###################################### + + ###################################### + ##### BEGIN Add/Update user info in Vtiger $stmt="SELECT count(*) from vtiger_users where user_name='$user_name';"; $rslt=mysql_query($stmt, $linkV); if ($DB) {echo "$stmt\n";} @@ -6921,6 +7506,13 @@ if ($ADD=="2A") $row=mysql_fetch_row($rslt); $userid = $row[0]; + $stmt="SELECT count(*) from vtiger_users2group WHERE userid='$userid' and groupid='$groupid';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $usergroupcount = $row[0]; + $stmtA = "UPDATE vtiger_users SET user_password='$encrypted_password',last_name='$last_name',is_admin='$is_admin',status='$status' where id='$userid';"; if ($DB) {echo "|$stmtA|\n";} $rslt=mysql_query($stmtA, $linkV); @@ -6930,6 +7522,33 @@ if ($ADD=="2A") if ($DB) {echo "|$stmtB|\n";} $rslt=mysql_query($stmtB, $linkV); if (!$rslt) {die('Could not execute: ' . mysql_error());} + + if ($usergroupcount < 1) + { + $stmt="SELECT user_group FROM vicidial_user_groups;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_groups_ct = mysql_num_rows($rslt); + $k=0; + $VD_groups_list=''; + while ($k < $VD_groups_ct) + { + $row=mysql_fetch_row($rslt); + $VD_groups_list .= "'$row[0]',"; + $k++; + } + $VD_groups_list = preg_replace("/.$/",'',$VD_groups_list); + + $stmtC = "DELETE FROM vtiger_users2group WHERE userid='$userid' and groupid IN(SELECT groupid from vtiger_groups where groupname IN($VD_groups_list));"; + if ($DB) {echo "|$stmtC|\n";} + $rslt=mysql_query($stmtC, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtD = "INSERT INTO vtiger_users2group SET userid='$userid',groupid='$groupid';"; + if ($DB) {echo "|$stmtD|\n";} + $rslt=mysql_query($stmtD, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } } ### user doesn't exist in vtiger, insert it @@ -6959,7 +7578,8 @@ if ($ADD=="2A") #### END CREATE NEW USER RECORD IN VTIGER } - + ##### END Add/Update user info in Vtiger + ###################################### } ### END vtiger integration @@ -6977,16 +7597,15 @@ if ($ADD=="2A") } } } -exit; -} + exit; + } ###################### # ADD=21 adds the new campaign to the system ###################### if ($ADD==21) -{ - + { echo ""; $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; $rslt=mysql_query($stmt, $link); @@ -7030,16 +7649,15 @@ if ($ADD==21) } } } -$ADD=31; -} + $ADD=31; + } ###################### # ADD=20 adds copied new campaign to the system ###################### if ($ADD==20) -{ - + { echo ""; $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; $rslt=mysql_query($stmt, $link); @@ -7058,7 +7676,7 @@ if ($ADD==20) { echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; - $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias from vicidial_campaigns where campaign_id='$source_campaign_id';"; $rslt=mysql_query($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; @@ -7087,16 +7705,15 @@ if ($ADD==20) } } -$ADD=31; -} + $ADD=31; + } ###################### # ADD=22 adds the new campaign status to the system ###################### if ($ADD==22) -{ - + { echo ""; $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; $rslt=mysql_query($stmt, $link); @@ -7135,9 +7752,9 @@ if ($ADD==22) } } } -$SUB=22; -$ADD=31; -} + $SUB=22; + $ADD=31; + } ###################### @@ -7145,7 +7762,7 @@ $ADD=31; ###################### if ($ADD==23) -{ + { $HKstatus_data = explode('-----',$HKstatus); $status = $HKstatus_data[0]; $status_name = $HKstatus_data[1]; @@ -7180,9 +7797,9 @@ if ($ADD==23) } } } -$SUB=23; -$ADD=31; -} + $SUB=23; + $ADD=31; + } ###################### @@ -7190,7 +7807,7 @@ $ADD=31; ###################### if ($ADD==25) -{ + { $status = eregi_replace("-----.*",'',$status); echo ""; $stmt="SELECT count(*) from vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; @@ -7223,9 +7840,9 @@ if ($ADD==25) } } } -$SUB=25; -$ADD=31; -} + $SUB=25; + $ADD=31; + } ###################### @@ -7233,7 +7850,7 @@ $ADD=31; ###################### if ($ADD==26) -{ + { $status = eregi_replace("-----.*",'',$status); echo ""; $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; @@ -7270,9 +7887,9 @@ if ($ADD==26) } } } -$SUB=26; -$ADD=31; -} + $SUB=26; + $ADD=31; + } ###################### @@ -7280,7 +7897,7 @@ $ADD=31; ###################### if ($ADD==27) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; $rslt=mysql_query($stmt, $link); @@ -7311,9 +7928,9 @@ if ($ADD==27) } } } -$SUB=27; -$ADD=31; -} + $SUB=27; + $ADD=31; + } ###################### @@ -7321,7 +7938,7 @@ $ADD=31; ###################### if ($ADD==28) -{ + { $status = eregi_replace("-----.*",'',$status); echo ""; $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; @@ -7358,9 +7975,9 @@ if ($ADD==28) } } } -#$SUB=28; -$ADD=31; -} + #$SUB=28; + $ADD=31; + } ###################### @@ -7368,7 +7985,7 @@ $ADD=31; ###################### if ($ADD==211) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; $rslt=mysql_query($stmt, $link); @@ -7400,8 +8017,8 @@ if ($ADD==211) } } } -$ADD=311; -} + $ADD=311; + } @@ -7410,7 +8027,7 @@ $ADD=311; ###################### if ($ADD==2111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; $rslt=mysql_query($stmt, $link); @@ -7452,8 +8069,8 @@ if ($ADD==2111) } } } -$ADD=3111; -} + $ADD=3111; + } ###################### @@ -7461,7 +8078,7 @@ $ADD=3111; ###################### if ($ADD==2011) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; $rslt=mysql_query($stmt, $link); @@ -7478,7 +8095,7 @@ if ($ADD==2011) } else { - $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias from vicidial_inbound_groups where group_id=\"$source_group_id\";"; $rslt=mysql_query($stmt, $link); echo "
GROUP ADDED: $group_id\n"; @@ -7492,8 +8109,8 @@ if ($ADD==2011) } } } -$ADD=3111; -} + $ADD=3111; + } ###################### @@ -7501,7 +8118,7 @@ $ADD=3111; ###################### if ($ADD==2311) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_inbound_dids where did_pattern='$did_pattern';"; $rslt=mysql_query($stmt, $link); @@ -7544,8 +8161,8 @@ if ($ADD==2311) } } } -$ADD=3311; -} + $ADD=3311; + } ###################### @@ -7553,7 +8170,7 @@ $ADD=3311; ###################### if ($ADD==2411) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_inbound_dids where did_pattern='$did_pattern';"; $rslt=mysql_query($stmt, $link); @@ -7588,8 +8205,8 @@ if ($ADD==2411) } } } -$ADD=3311; -} + $ADD=3311; + } ###################### @@ -7597,7 +8214,7 @@ $ADD=3311; ###################### if ($ADD==21111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; $rslt=mysql_query($stmt, $link); @@ -7627,15 +8244,15 @@ if ($ADD==21111) } } } -$ADD=10000; -} + $ADD=10000; + } ###################### # ADD=211111 adds new user group to the system ###################### if ($ADD==211111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; $rslt=mysql_query($stmt, $link); @@ -7663,17 +8280,93 @@ if ($ADD==211111) fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); fclose($fp); } + + ############################################################### + ##### START SYSTEM_SETTINGS VTIGER CONNECTION INFO LOOKUP ##### + $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ss_conf_ct = mysql_num_rows($rslt); + if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_vtiger_integration = $row[0]; + $vtiger_server_ip = $row[1]; + $vtiger_dbname = $row[2]; + $vtiger_login = $row[3]; + $vtiger_pass = $row[4]; + $vtiger_url = $row[5]; + } + ##### END SYSTEM_SETTINGS VTIGER CONNECTION INFO LOOKUP ##### + ############################################################# + + if ($enable_vtiger_integration > 0) + { + ### connect to your vtiger database + $linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass"); + if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());} + echo 'Connected successfully'; + mysql_select_db("$vtiger_dbname", $linkV); + + ###################################### + ##### BEGIN Add/Update group info in Vtiger + $stmt="SELECT count(*) from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, update it + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + } + + ### user doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$user_group',description='$group_name';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + #### END CREATE NEW GROUP RECORD IN VTIGER + } + ##### END Add/Update group info in Vtiger + ###################################### + } } } -$ADD=100000; -} + $ADD=100000; + } ###################### # ADD=2111111 adds new script to the system ###################### if ($ADD==2111111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; $rslt=mysql_query($stmt, $link); @@ -7703,8 +8396,8 @@ if ($ADD==2111111) } } } -$ADD=1000000; -} + $ADD=1000000; + } ###################### @@ -7712,7 +8405,7 @@ $ADD=1000000; ###################### if ($ADD==21111111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; $rslt=mysql_query($stmt, $link); @@ -7742,8 +8435,8 @@ if ($ADD==21111111) } } } -$ADD=10000000; -} + $ADD=10000000; + } ###################### @@ -7751,7 +8444,7 @@ $ADD=10000000; ###################### if ($ADD==211111111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_call_times where call_time_id='$call_time_id';"; $rslt=mysql_query($stmt, $link); @@ -7781,8 +8474,8 @@ if ($ADD==211111111) } } } -$ADD=311111111; -} + $ADD=311111111; + } ###################### @@ -7790,7 +8483,7 @@ $ADD=311111111; ###################### if ($ADD==2111111111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_state_call_times where state_call_time_id='$call_time_id';"; $rslt=mysql_query($stmt, $link); @@ -7820,8 +8513,8 @@ if ($ADD==2111111111) } } } -$ADD=3111111111; -} + $ADD=3111111111; + } ###################### @@ -7829,7 +8522,7 @@ $ADD=3111111111; ###################### if ($ADD==231111111) -{ + { echo ""; $stmt="SELECT count(*) from vicidial_shifts where shift_id='$shift_id';"; $rslt=mysql_query($stmt, $link); @@ -7869,8 +8562,8 @@ if ($ADD==231111111) } } } -$ADD=331111111; -} + $ADD=331111111; + } ###################### @@ -7878,8 +8571,7 @@ $ADD=331111111; ###################### if ($ADD==21111111111) -{ -echo "
\n"; + { echo ""; $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; $rslt=mysql_query($stmt, $link); @@ -7922,8 +8614,8 @@ echo "
\n"; } } } -$ADD=31111111111; -} + $ADD=31111111111; + } ###################### @@ -7931,8 +8623,7 @@ $ADD=31111111111; ###################### if ($ADD==22111111111) -{ -echo "
\n"; + { echo ""; $stmt="SELECT count(*) from phones_alias where alias_id='$alias_id';"; $rslt=mysql_query($stmt, $link); @@ -7967,8 +8658,49 @@ echo "
\n"; } } } -$ADD=32111111111; -} + $ADD=32111111111; + } + + +###################### +# ADD=23111111111 adds new group alias to the system +###################### + +if ($ADD==23111111111) + { + echo ""; + $stmt="SELECT count(*) from groups_alias where group_alias_id='$group_alias_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP ALIAS NOT ADDED - there is already a Phone Alias in the system with this ID\n";} + else + { + if (preg_match("/AGENT_PHONE|CUSTOMER|CAMPAIGN|NONE/",'',$group_alias_id)) + {echo "
GROUP ALIAS NOT ADDED - you cannot use reserved words in group aliases\n";} + else + { + if ( (strlen($group_alias_id) < 1) or (strlen($group_alias_name) < 2) ) + {echo "
GROUP ALIAS NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
GROUP ALIAS ADDED\n"; + + $stmt="INSERT INTO groups_alias (group_alias_id,group_alias_name,caller_id_number,caller_id_name,active) values('$group_alias_id','$group_alias_name','$caller_id_number','$caller_id_name','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP ALIAS |$stmt|\n"); + fclose($fp); + } + } + } + } + $ADD=33111111111; + } ###################### @@ -7976,8 +8708,7 @@ $ADD=32111111111; ###################### if ($ADD==211111111111) -{ -echo "
\n"; + { echo ""; $stmt="SELECT count(*) from servers where server_id='$server_id';"; $rslt=mysql_query($stmt, $link); @@ -8004,8 +8735,8 @@ echo "
\n"; } } } -$ADD=311111111111; -} + $ADD=311111111111; + } ###################### @@ -8013,7 +8744,7 @@ $ADD=311111111111; ###################### if ($ADD==221111111111) -{ + { echo ""; $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; $rslt=mysql_query($stmt, $link); @@ -8062,8 +8793,8 @@ if ($ADD==221111111111) } } } -$ADD=311111111111; -} + $ADD=311111111111; + } ###################### @@ -8071,8 +8802,7 @@ $ADD=311111111111; ###################### if ($ADD==231111111111) -{ -echo "
\n"; + { echo ""; $stmt="SELECT count(*) from vicidial_conf_templates where template_id='$template_id';"; $rslt=mysql_query($stmt, $link); @@ -8099,8 +8829,8 @@ echo "
\n"; } } } -$ADD=331111111111; -} + $ADD=331111111111; + } ###################### @@ -8108,8 +8838,7 @@ $ADD=331111111111; ###################### if ($ADD==241111111111) -{ -echo "
\n"; + { echo ""; $stmt="SELECT count(*) from vicidial_server_carriers where carrier_id='$carrier_id';"; $rslt=mysql_query($stmt, $link); @@ -8136,8 +8865,8 @@ echo "
\n"; } } } -$ADD=341111111111; -} + $ADD=341111111111; + } ###################### @@ -8145,8 +8874,7 @@ $ADD=341111111111; ###################### if ($ADD==2111111111111) -{ -echo "
\n"; + { echo ""; $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; $rslt=mysql_query($stmt, $link); @@ -8165,8 +8893,8 @@ echo "\n"; +echo "
\n"; $rslt=mysql_query($stmt, $link); } } -$ADD=3111111111111; -} + $ADD=3111111111111; + } ###################### @@ -8174,8 +8902,7 @@ $ADD=3111111111111; ###################### if ($ADD==21111111111111) -{ -echo "
\n"; + { echo ""; $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; $rslt=mysql_query($stmt, $link); @@ -8194,8 +8921,8 @@ echo "\n"; } - echo "\n"; + echo "\n"; echo "\n"; + echo "\n"; + + if ($agent_allow_group_alias == 'Y') + { + ##### get groups_alias listings for dynamic default group alias pulldown list menu + $stmt="SELECT group_alias_id,group_alias_name from groups_alias where active='Y' order by group_alias_id"; + $rslt=mysql_query($stmt, $link); + $group_alias_to_print = mysql_num_rows($rslt); + $group_alias_menu=''; + $group_alias_selected=0; + $o=0; + while ($group_alias_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_alias_menu .= "\n"; + $o++; + } + + echo "\n"; + } + if ($SSenable_vtiger_integration > 0) { echo "\n"; @@ -15134,6 +16320,8 @@ if ($ADD==3111) $play_welcome_message = $row[52]; $answer_sec_pct_rt_stat_one = $row[53]; $answer_sec_pct_rt_stat_two = $row[54]; + $default_group_alias = $row[55]; + ##### get in-groups listings for dynamic pulldown $stmt="SELECT group_id,group_name from vicidial_inbound_groups where group_id NOT IN('AGENTDIRECT') order by group_id"; @@ -15324,6 +16512,31 @@ if ($ADD==3111) echo "$Xgroups_menu"; echo "$NWB#vicidial_inbound_groups-default_xfer_group$NWE\n"; + ##### get groups_alias listings for dynamic default group alias pulldown list menu + $stmt="SELECT group_alias_id,group_alias_name from groups_alias where active='Y' order by group_alias_id"; + $rslt=mysql_query($stmt, $link); + $group_alias_to_print = mysql_num_rows($rslt); + $group_alias_menu=''; + $group_alias_selected=0; + $o=0; + while ($group_alias_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_alias_menu .= "\n"; + $o++; + } + + echo "\n"; + echo "\n"; @@ -16552,16 +17765,50 @@ if ($ADD==32111111111) echo "
\n"; $rslt=mysql_query($stmt, $link); } } -$ADD=31111111111111; -} + $ADD=31111111111111; + } ###################### @@ -8203,8 +8930,7 @@ $ADD=31111111111111; ###################### if ($ADD==221111111111111) -{ - + { echo ""; $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; $rslt=mysql_query($stmt, $link); @@ -8243,8 +8969,8 @@ if ($ADD==221111111111111) } } } -$ADD=321111111111111; -} + $ADD=321111111111111; + } ###################### @@ -8252,8 +8978,7 @@ $ADD=321111111111111; ###################### if ($ADD==231111111111111) -{ - + { echo ""; $stmt="SELECT count(*) from vicidial_status_categories where vsc_id='$vsc_id';"; $rslt=mysql_query($stmt, $link); @@ -8293,8 +9018,8 @@ if ($ADD==231111111111111) } } } -$ADD=331111111111111; -} + $ADD=331111111111111; + } @@ -8303,8 +9028,7 @@ $ADD=331111111111111; ###################### if ($ADD==241111111111111) -{ - + { echo ""; $stmt="SELECT count(*) from vicidial_qc_codes where code='$code';"; $rslt=mysql_query($stmt, $link); @@ -8335,8 +9059,8 @@ if ($ADD==241111111111111) } } } -$ADD=341111111111111; -} + $ADD=341111111111111; + } @@ -8376,6 +9100,7 @@ if ($ADD=="4A") $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',add_timeclock_log='$add_timeclock_log',modify_timeclock_log='$modify_timeclock_log',delete_timeclock_log='$delete_timeclock_log',alter_custphone_override='$alter_custphone_override',vdc_agent_api_access='$vdc_agent_api_access',modify_inbound_dids='$modify_inbound_dids',delete_inbound_dids='$delete_inbound_dids',active='$active',download_lists='$download_lists' where user='$user';"; $rslt=mysql_query($stmt, $link); + ############################################################### ##### START SYSTEM_SETTINGS VTIGER CONNECTION INFO LOOKUP ##### $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; @@ -8410,14 +9135,64 @@ if ($ADD=="4A") $roleid = 'H5'; $status = 'Active'; $groupid = '1'; + if ($user_level >= 7) {$roleid = 'H3';} if ($user_level >= 8) {$roleid = 'H4';} if ($user_level >= 9) {$roleid = 'H2';} if ($user_level >= 9) {$is_admin = 'on';} - if (ereg('N',$active)) {$status = 'Inactive';} $salt = substr($user_name, 0, 2); $salt = '$1$' . $salt . '$'; $encrypted_password = crypt($user_password, $salt); + ###################################### + ##### BEGIN Add/Update group info in Vtiger + $stmt="SELECT count(*) from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, update it + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + } + + ### user doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$user_group',description='';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + #### END CREATE NEW GROUP RECORD IN VTIGER + } + ##### END Add/Update group info in Vtiger + ###################################### + + ###################################### + ##### BEGIN Add/Update user info in Vtiger $stmt="SELECT count(*) from vtiger_users where user_name='$user_name';"; $rslt=mysql_query($stmt, $linkV); if ($DB) {echo "$stmt\n";} @@ -8435,6 +9210,13 @@ if ($ADD=="4A") $row=mysql_fetch_row($rslt); $userid = $row[0]; + $stmt="SELECT count(*) from vtiger_users2group WHERE userid='$userid' and groupid='$groupid';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $usergroupcount = $row[0]; + $stmtA = "UPDATE vtiger_users SET user_password='$encrypted_password',last_name='$last_name',is_admin='$is_admin',status='$status' where id='$userid';"; if ($DB) {echo "|$stmtA|\n";} $rslt=mysql_query($stmtA, $linkV); @@ -8444,6 +9226,33 @@ if ($ADD=="4A") if ($DB) {echo "|$stmtB|\n";} $rslt=mysql_query($stmtB, $linkV); if (!$rslt) {die('Could not execute: ' . mysql_error());} + + if ($usergroupcount < 1) + { + $stmt="SELECT user_group FROM vicidial_user_groups;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_groups_ct = mysql_num_rows($rslt); + $k=0; + $VD_groups_list=''; + while ($k < $VD_groups_ct) + { + $row=mysql_fetch_row($rslt); + $VD_groups_list .= "'$row[0]',"; + $k++; + } + $VD_groups_list = preg_replace("/.$/",'',$VD_groups_list); + + $stmtC = "DELETE FROM vtiger_users2group WHERE userid='$userid' and groupid IN(SELECT groupid from vtiger_groups where groupname IN($VD_groups_list));"; + if ($DB) {echo "|$stmtC|\n";} + $rslt=mysql_query($stmtC, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtD = "INSERT INTO vtiger_users2group SET userid='$userid',groupid='$groupid';"; + if ($DB) {echo "|$stmtD|\n";} + $rslt=mysql_query($stmtD, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } } ### user doesn't exist in vtiger, insert it @@ -8473,7 +9282,8 @@ if ($ADD=="4A") #### END CREATE NEW USER RECORD IN VTIGER } - + ##### END Add/Update user info in Vtiger + ###################################### } ### END vtiger integration @@ -8558,14 +9368,64 @@ if ($ADD=="4B") $roleid = 'H5'; $status = 'Active'; $groupid = '1'; + if ($user_level >= 7) {$roleid = 'H3';} if ($user_level >= 8) {$roleid = 'H4';} if ($user_level >= 9) {$roleid = 'H2';} if ($user_level >= 9) {$is_admin = 'on';} - if (ereg('N',$active)) {$status = 'Inactive';} $salt = substr($user_name, 0, 2); $salt = '$1$' . $salt . '$'; $encrypted_password = crypt($user_password, $salt); + ###################################### + ##### BEGIN Add/Update group info in Vtiger + $stmt="SELECT count(*) from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, update it + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + } + + ### user doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$user_group',description='';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + #### END CREATE NEW GROUP RECORD IN VTIGER + } + ##### END Add/Update group info in Vtiger + ###################################### + + ###################################### + ##### BEGIN Add/Update user info in Vtiger $stmt="SELECT count(*) from vtiger_users where user_name='$user_name';"; $rslt=mysql_query($stmt, $linkV); if ($DB) {echo "$stmt\n";} @@ -8583,6 +9443,13 @@ if ($ADD=="4B") $row=mysql_fetch_row($rslt); $userid = $row[0]; + $stmt="SELECT count(*) from vtiger_users2group WHERE userid='$userid' and groupid='$groupid';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $usergroupcount = $row[0]; + $stmtA = "UPDATE vtiger_users SET user_password='$encrypted_password',last_name='$last_name',is_admin='$is_admin',status='$status' where id='$userid';"; if ($DB) {echo "|$stmtA|\n";} $rslt=mysql_query($stmtA, $linkV); @@ -8592,6 +9459,33 @@ if ($ADD=="4B") if ($DB) {echo "|$stmtB|\n";} $rslt=mysql_query($stmtB, $linkV); if (!$rslt) {die('Could not execute: ' . mysql_error());} + + if ($usergroupcount < 1) + { + $stmt="SELECT user_group FROM vicidial_user_groups;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_groups_ct = mysql_num_rows($rslt); + $k=0; + $VD_groups_list=''; + while ($k < $VD_groups_ct) + { + $row=mysql_fetch_row($rslt); + $VD_groups_list .= "'$row[0]',"; + $k++; + } + $VD_groups_list = preg_replace("/.$/",'',$VD_groups_list); + + $stmtC = "DELETE FROM vtiger_users2group WHERE userid='$userid' and groupid IN(SELECT groupid from vtiger_groups where groupname IN($VD_groups_list));"; + if ($DB) {echo "|$stmtC|\n";} + $rslt=mysql_query($stmtC, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtD = "INSERT INTO vtiger_users2group SET userid='$userid',groupid='$groupid';"; + if ($DB) {echo "|$stmtD|\n";} + $rslt=mysql_query($stmtD, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } } ### user doesn't exist in vtiger, insert it @@ -8621,7 +9515,8 @@ if ($ADD=="4B") #### END CREATE NEW USER RECORD IN VTIGER } - + ##### END Add/Update user info in Vtiger + ###################################### } ### END vtiger integration @@ -8666,7 +9561,6 @@ if ($ADD==4) $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',active='$active' where user='$user';"; $rslt=mysql_query($stmt, $link); - ############################################################### ##### START SYSTEM_SETTINGS VTIGER CONNECTION INFO LOOKUP ##### $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; @@ -8701,14 +9595,64 @@ if ($ADD==4) $roleid = 'H5'; $status = 'Active'; $groupid = '1'; + if ($user_level >= 7) {$roleid = 'H3';} if ($user_level >= 8) {$roleid = 'H4';} if ($user_level >= 9) {$roleid = 'H2';} if ($user_level >= 9) {$is_admin = 'on';} - if (ereg('N',$active)) {$status = 'Inactive';} $salt = substr($user_name, 0, 2); $salt = '$1$' . $salt . '$'; $encrypted_password = crypt($user_password, $salt); + ###################################### + ##### BEGIN Add/Update group info in Vtiger + $stmt="SELECT count(*) from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, update it + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + } + + ### user doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$user_group',description='';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + #### END CREATE NEW GROUP RECORD IN VTIGER + } + ##### END Add/Update group info in Vtiger + ###################################### + + ###################################### + ##### BEGIN Add/Update user info in Vtiger $stmt="SELECT count(*) from vtiger_users where user_name='$user_name';"; $rslt=mysql_query($stmt, $linkV); if ($DB) {echo "$stmt\n";} @@ -8726,6 +9670,13 @@ if ($ADD==4) $row=mysql_fetch_row($rslt); $userid = $row[0]; + $stmt="SELECT count(*) from vtiger_users2group WHERE userid='$userid' and groupid='$groupid';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $usergroupcount = $row[0]; + $stmtA = "UPDATE vtiger_users SET user_password='$encrypted_password',last_name='$last_name',is_admin='$is_admin',status='$status' where id='$userid';"; if ($DB) {echo "|$stmtA|\n";} $rslt=mysql_query($stmtA, $linkV); @@ -8735,6 +9686,33 @@ if ($ADD==4) if ($DB) {echo "|$stmtB|\n";} $rslt=mysql_query($stmtB, $linkV); if (!$rslt) {die('Could not execute: ' . mysql_error());} + + if ($usergroupcount < 1) + { + $stmt="SELECT user_group FROM vicidial_user_groups;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_groups_ct = mysql_num_rows($rslt); + $k=0; + $VD_groups_list=''; + while ($k < $VD_groups_ct) + { + $row=mysql_fetch_row($rslt); + $VD_groups_list .= "'$row[0]',"; + $k++; + } + $VD_groups_list = preg_replace("/.$/",'',$VD_groups_list); + + $stmtC = "DELETE FROM vtiger_users2group WHERE userid='$userid' and groupid IN(SELECT groupid from vtiger_groups where groupname IN($VD_groups_list));"; + if ($DB) {echo "|$stmtC|\n";} + $rslt=mysql_query($stmtC, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtD = "INSERT INTO vtiger_users2group SET userid='$userid',groupid='$groupid';"; + if ($DB) {echo "|$stmtD|\n";} + $rslt=mysql_query($stmtD, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } } ### user doesn't exist in vtiger, insert it @@ -8764,7 +9742,8 @@ if ($ADD==4) #### END CREATE NEW USER RECORD IN VTIGER } - + ##### END Add/Update user info in Vtiger + ###################################### } ### END vtiger integration @@ -8910,7 +9889,7 @@ if ($ADD==41) if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) {$hopper_level='100';} - $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix',web_form_target='$web_form_target',vtiger_search_category='$vtiger_search_category',vtiger_create_call_record='$vtiger_create_call_record',vtiger_create_lead_record='$vtiger_create_lead_record',vtiger_screen_login='$vtiger_screen_login',cpd_amd_action='$cpd_amd_action' where campaign_id='$campaign_id';"; + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix',web_form_target='$web_form_target',vtiger_search_category='$vtiger_search_category',vtiger_create_call_record='$vtiger_create_call_record',vtiger_create_lead_record='$vtiger_create_lead_record',vtiger_screen_login='$vtiger_screen_login',cpd_amd_action='$cpd_amd_action',agent_allow_group_alias='$agent_allow_group_alias',default_group_alias='$default_group_alias' where campaign_id='$campaign_id';"; $rslt=mysql_query($stmtA, $link); if ($reset_hopper == 'Y') @@ -9738,7 +10717,7 @@ if ($ADD==4111) echo "
GROUP MODIFIED: $group_id\n"; - $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message',answer_sec_pct_rt_stat_one='$answer_sec_pct_rt_stat_one',answer_sec_pct_rt_stat_two='$answer_sec_pct_rt_stat_two' where group_id='$group_id';"; + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message',answer_sec_pct_rt_stat_one='$answer_sec_pct_rt_stat_one',answer_sec_pct_rt_stat_two='$answer_sec_pct_rt_stat_two',default_group_alias='$default_group_alias' where group_id='$group_id';"; $rslt=mysql_query($stmt, $link); ### LOG CHANGES TO LOG FILE ### @@ -9872,6 +10851,87 @@ if ($ADD==411111) echo "
USER GROUP MODIFIED\n"; + ############################################################### + ##### START SYSTEM_SETTINGS VTIGER CONNECTION INFO LOOKUP ##### + $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ss_conf_ct = mysql_num_rows($rslt); + if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_vtiger_integration = $row[0]; + $vtiger_server_ip = $row[1]; + $vtiger_dbname = $row[2]; + $vtiger_login = $row[3]; + $vtiger_pass = $row[4]; + $vtiger_url = $row[5]; + } + ##### END SYSTEM_SETTINGS VTIGER CONNECTION INFO LOOKUP ##### + ############################################################# + + if ($enable_vtiger_integration > 0) + { + ### connect to your vtiger database + $linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass"); + if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());} + echo 'Connected successfully'; + mysql_select_db("$vtiger_dbname", $linkV); + + ###################################### + ##### BEGIN Add/Update group info in Vtiger + $stmt="SELECT count(*) from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, update it + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$user_group';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + + $stmtA = "UPDATE vtiger_groups SET description='$group_name' where groupid='$groupid';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } + + ### user doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$user_group',description='$group_name';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + #### END CREATE NEW GROUP RECORD IN VTIGER + } + ##### END Add/Update group info in Vtiger + ###################################### + } + ### LOG CHANGES TO LOG FILE ### if ($WeBRooTWritablE > 0) { @@ -10222,6 +11282,46 @@ $ADD=32111111111; # go to phone alias modification form below } +###################### +# ADD=43111111111 modify group alias record in the system +###################### + +if ($ADD==43111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from groups_alias where group_alias_id='$group_alias_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( (strlen($group_alias_id) < 1) or (strlen($group_alias_name) < 2) ) + {echo "
GROUP ALIAS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
GROUP ALIAS MODIFIED: $alias_id\n"; + + $stmt="UPDATE groups_alias set group_alias_name='$group_alias_name', caller_id_number='$caller_id_number', caller_id_name='$caller_id_name', active='$active' where group_alias_id='$group_alias_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUPS ALIAS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=33111111111; # go to group alias modification form below +} + + ###################### # ADD=411111111111 modify server record in the system ###################### @@ -11099,6 +12199,28 @@ $ADD='32111111111'; # go to phone alias modification below } +###################### +# ADD=53111111111 confirmation before deletion of group alias record +###################### + +if ($ADD==53111111111) +{ + echo ""; + + if ( (strlen($group_alias_id) < 1) or ($LOGast_delete_phones < 1) ) + { + echo "
GROUP ALIAS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group Alias ID must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP ALIAS DELETION CONFIRMATION: $group_alias_id\n"; + echo "

Click here to delete group alias $group_alias_id


\n"; + } +$ADD='33111111111'; # go to group alias modification below +} + + ###################### # ADD=511111111111 confirmation before deletion of server record ###################### @@ -12031,6 +13153,38 @@ $ADD='12000000000'; # go to phone alias list } +###################### +# ADD=63111111111 delete group alias record +###################### + +if ($ADD==63111111111) +{ + echo ""; + + if ( (strlen($group_alias_id) < 2) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
GROUP ALIAS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group Alias ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from groups_alias where group_alias_id='$group_alias_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETE GROUP ALIAS!|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + echo "
GROUP ALIAS DELETION COMPLETED: $group_alias_id\n"; + echo "

\n"; + } +$ADD='13000000000'; # go to group alias list +} + + ###################### # ADD=611111111111 delete server record ###################### @@ -12630,6 +13784,8 @@ if ($ADD==31) $vtiger_create_lead_record = $row[101]; $vtiger_screen_login = $row[102]; $cpd_amd_action = $row[103]; + $agent_allow_group_alias = $row[104]; + $default_group_alias = $row[105]; if (ereg("DISABLED",$list_order_mix)) {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} @@ -13092,10 +14248,40 @@ if ($ADD==31) { echo "
Agent Screen Extended Alt Dial: $NWB#vicidial_campaigns-agent_extended_alt_dial$NWE
3-Way Call Outbound CallerID: $NWB#vicidial_campaigns-three_way_call_cid$NWE
3-Way Call Outbound CallerID: $NWB#vicidial_campaigns-three_way_call_cid$NWE
3-Way Call Dial Prefix: $NWB#vicidial_campaigns-three_way_dial_prefix$NWE
Group Alias Allowed: $NWB#vicidial_campaigns-agent_allow_group_alias$NWE
Default Group Alias: $NWB#vicidial_campaigns-default_group_alias$NWE
Vtiger Search Category: $NWB#vicidial_campaigns-vtiger_search_category$NWE
Default Group Alias: $NWB#vicidial_inbound_groups-default_group_alias$NWE
Hold Recall Transfer In-Group: $NWB#vicidial_inbound_groups-hold_recall_xfer_group$NWE

\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS PHONE ALIAS\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} +###################### +# ADD=33111111111 modify group alias record in the system +###################### +if ($ADD==33111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + $stmt="SELECT group_alias_id,group_alias_name,caller_id_number,caller_id_name,active from groups_alias where group_alias_id='$group_alias_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + echo "
MODIFY A GROUP ALIAS RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group Alias ID: $row[0] $NWB#phones-group_alias_id$NWE
Group Alias Name: $NWB#phones-group_alias_name$NWE
CallerID Number: $NWB#phones-caller_id_number$NWE
CallerID Name: $NWB#phones-caller_id_name$NWE
Active:
\n"; if ($LOGast_delete_phones > 0) { - echo "

DELETE THIS PHONE ALIAS\n"; + echo "

DELETE THIS GROUP ALIAS\n"; } } else @@ -18498,6 +19745,48 @@ if ($ADD==12000000000) echo "
\n"; } +###################### +# ADD=13000000000 display all group alias +###################### +if ($ADD==13000000000) + { + echo "
\n"; + echo ""; + + $stmt="SELECT group_alias_id,group_alias_name,caller_id_number,caller_id_name,active from groups_alias order by group_alias_id;"; + $rslt=mysql_query($stmt, $link); + $phonealias_to_print = mysql_num_rows($rslt); + + echo "
GROUP ALIAS LISTINGS:\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $o=0; + while ($phonealias_to_print > $o) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + + echo "
GROUP ALIAS IDGROUP ALIAS NAMECID NUMBERCID NAMEACTIVEMODIFY
$row[0]$row[1]$row[2]$row[3]$row[4]MODIFY
\n"; + } + ###################### # ADD=100000000000 display all servers ###################### @@ -18803,23 +20092,22 @@ if ($ADD==999999) +echo "
\n"; echo "
\n"; $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); -echo "\n\n\n


\n
\n"; - - -echo "\n\n\n


\nscript runtime: $RUNtime seconds"; -echo "                   VERSION: $admin_version"; -echo "                   BUILD: $build
\n"; - +echo "
\n"; +echo "

"; +echo "VERSION: $admin_version
"; +echo "BUILD: $build
\n"; ?> - +
diff --git a/agc_2-X/trunk/www/vicidial/user_stats.php b/agc_2-X/trunk/www/vicidial/user_stats.php index 911b3827..9911d4e9 100644 --- a/agc_2-X/trunk/www/vicidial/user_stats.php +++ b/agc_2-X/trunk/www/vicidial/user_stats.php @@ -15,6 +15,7 @@ # 80617-1402 - Fixed timeclock total logged-in time # 81210-1634 - Added server recording display options # 90208-0504 - Added link to multi-day report and fixed call status summary section +# 90305-1226 - Added user_call_log manual dial logs # header ("Content-type: text/html; charset=utf-8"); @@ -103,7 +104,7 @@ echo "\n"
-
+
" ?>   VICIDIAL ADMIN: User Stats for  
@@ -590,7 +591,45 @@ echo "
" ?>   VICIDIAL ADMIN: User Stats for  
# LEAD\n"; +echo "


\n"; + + +##### vicidial agent outbound user manual calls for this time period ##### + +echo "MANUAL OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id from user_call_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME CALL TYPE SERVER PHONE DIALED LEAD CALLERID ALIAS
$u$row[0] $row[1] $row[2] $row[3] $row[4] $row[5] $row[6] $row[7]


\n"; + + $ENDtime = date("U"); diff --git a/agc_2-X/trunk/www/vicidial/vicidial_admin_web_logo.gif b/agc_2-X/trunk/www/vicidial/vicidial_admin_web_logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..8c5a9d22408e80c7343f613b839cec0561e0d599 GIT binary patch literal 2483 zcmV;k2~74!Nk%w1VX6Qv0M$PL;^yo)b)AT#xu&?t)!O1EY?!^t)adN+KzW`QW|qs; z-Q3~mScaw#CRhFb{(76V1znQy^Y)LMvZ=`0!_3!Dfub&WrStXp?eOzvoW052=tq5^ zVT`GqvcwEvlVNa?l&!$|`us9RaCD`@`1$*3kgP0knp>5)eu|}+ywb+d+O56JiL=Z? zQ+vD9;MfT~D|uz{}0sItR!fS&*V z{{dT(A^8LW002J#EC2ui0IC2j000L6z@KnPEE0Oe`11K0wFQS$P~Xv z5GAz8#|NT6CKS-e00>DZ3o!sZC?7WCJU$bgCOFqIII30<8xQg&31KEP@()`T2R{D) z*^qbu5#!%K1Iwxz^cT!!mjpwL!Tqw0lPJc0a z7SIsk#fu0U+`SXvz#on+5E%3$EE!M<7#>wfp6k(WF2*1DDz!+1h71%A0-J!!`APr+ z{w|dGp~DA-icn8r@zCMl3of(Y#w|kJqXQ6Yf0ot;Xors)NSBI`KtX{46)|KFHdvTS z1pxlw@(zKcg$M#MyoLlCqXQR_I|W1+lDsAdBBTXHoe&lr0Ki^K-CzS$4jAJ@3@)HU z8+n~c(F_I*1@J=x6U5a2%>?yaVFGSGz#sq@5O9FuLN6>c1V0`vprKrJ0W=^4BV1R} zQZ^89K?)}X$$|?b;F3;M6-ME~0~h#1z%m6)5J3bJxM;-&==pHLO>T{HfWBM&<^@IeSJ3~EHENLpcn3jR3oz@%JwAb?m3B#FfaZY^YhWH4%LC8fLy z;Xw*MNT6v_FF5f3DX5}aX6+Mg<;DTDTTsPki(V9PYEa8T@W7Y`@s#SW0L_?y3m5dj zR|72^lEV_n)}{mm9wcCKs+uu0O_&@bQK!WT&}&3al|5%{7E1#B4-C&bs;EEGKud6j zqiBGEo5I4N!O2BLoToqmFtE!29XwD$h|K^jW0(jq;PeKmCV)T*m<#|y2?4C-LDLLy zaP$uW3`W8OscLZ^ne}+NkZ4BCJl2dB0C1qDOodl=&+UF>Ed(YApukJ7!~g>T10X=L z0RJenArDhtaMci7gRsB_uQ(9H1q7tx=#&u*P!E>=M6lZzZWEv(1F|jzUE65BO`w4- z&@F)jDKO#x^QcLBP=NugI!D0K#rfkoHO%_6`i3RI=aD}oykJ5C#rv>22Tl4Q4H(j@ zoE`%Z2%x=|^RiwV+_1||yX|?Cni+|RVX(jg2T;qv3W%*9K(-M``hy2EWa&=`d0Buf ze2|t33?>3CdjPAJ28N6U>;VZ_!OMJLx+Ay^0OXrnMP^q!h^4PW2w-2U1W zrZ6P`paW;|hXGKa6@%nYWEV6TY8Li^80_qd5(|@xMwP20Y(P{1$d$hU){aU3LjkXH zLA=mFhqfB^uo1PQlu*AOE357CJ% zOwPdF{s^K+iy44V7%0In{Z&eYfGt}l`lS})Wsn2lpn3->;+e+h2y&S#DKt<)2!z8f zEIu=F@8XXb_4o^33U6!vb7m4E7K7n+D+2!!Lj+%DxtEPilz|*Vj#dz?rUYi59~?rV zn0GvZ?8zUG^W^_}Vn!d3KtD>@r$tv6%(1W%43=EpKdy&_3l2yJ5x^APL~u=V;xeKC zVM1N#W*|yO6oY^myhzrB?FDLaX44@OKKdRM<)(K@zZBmV}6!EZ< z!Zb6f`=b&DQW+8`^9N`10T6%C)0qNwj`$pAK^&mCG3ZOF4+>>dr&Apro$Cf4kOd2L zV1XQDU;-K74@`d`Q!SA#qgy-_2T~WwA5=7&N}x$&wOBGH3gZDGP--$G>r^o1ATJ17 z$_KO(3s+bXPr?*J0Q_g!BT&;-MCB6>G_-+Ku0Wd#-HZY>M3d*#lndQj9sx25pw6~2 z1r9LRxhm2E9xMO=1o)7I%$WeX0AOQAkQTL6!BuwVVx41I&Jpe?7H3j(Y|=#kjuH*x zfI7~#QbdTG6jien8Hm6=u#wGR!O}Z?WtRiCZRZ?)@VM+5=ctgI!DiA@50`{4pJb5M z1pUFX^qSNNL@@vj=fCMm_2{|x;R2mi+I`x58W130_ z5C8-m*gyql@EC(^DNF*W9s$zng%LSNp6{&-amVGG4{Z1b7xA!u%_*)D_^(6(+zbF% zwb>ukmW*w@@jpV4h*^X#vto_Q9U%?p2nWv~iTN$@JaPcy?r#S$xWFFJZQvdeZ0Exw zbW-j(K!6FCXaEvm6-i3~umkki1FUv+3|_#4>e>3cOVl)qIG}=J7u!47Eolc7U~CmA z-~|XK0t8N=fd;t`2RN9VIgB&_95fpT1JGvVv`s(^C}0K!U;qVFfP)pdV+O?rckTkv zfdxdMWD$t62}+=Ve!Dvt-7a>^&X9lt82sP`5Vi*pj&MyE;IA5xo7^;zf~qc@;Rdg% x)JpIG0X%>MCg4QD55AU>XB-I|@A${FwxNda58*tMgv@77^P1cI=06Am06X*l3Nioy literal 0 HcmV?d00001 diff --git a/agc_2-X/trunk/www/vicidial/vtiger_user.php b/agc_2-X/trunk/www/vicidial/vtiger_user.php index c0e15846..695c1622 100644 --- a/agc_2-X/trunk/www/vicidial/vtiger_user.php +++ b/agc_2-X/trunk/www/vicidial/vtiger_user.php @@ -1,95 +1,15 @@ column_fields["user_name"]; - global $mod_strings; - - $query = "SELECT user_name from vtiger_users where user_name=? AND id<>? AND deleted=0"; - $result =$this->db->pquery($query, array($usr_name, $this->id), true, "Error selecting possible duplicate users: "); - $dup_users = $this->db->fetchByAssoc($result); - - $query = "SELECT user_name from vtiger_users where is_admin = 'on' AND deleted=0"; - $result =$this->db->pquery($query, array(), true, "Error selecting possible duplicate vtiger_users: "); - $last_admin = $this->db->fetchByAssoc($result); - - $this->log->debug("last admin length: ".count($last_admin)); - $this->log->debug($last_admin['user_name']." == ".$usr_name); - - $verified = true; - if($dup_users != null) - { - $this->error_string .= $mod_strings['ERR_USER_NAME_EXISTS_1'].$usr_name.''.$mod_strings['ERR_USER_NAME_EXISTS_2']; - $verified = false; - } - if(!isset($_REQUEST['is_admin']) && - count($last_admin) == 1 && - $last_admin['user_name'] == $usr_name) { - $this->log->debug("last admin length: ".count($last_admin)); - - $this->error_string .= $mod_strings['ERR_LAST_ADMIN_1'].$usr_name.$mod_strings['ERR_LAST_ADMIN_2']; - $verified = false; - } - - return $verified; - } -*/ - - -# require("../vtigercrm/modules/Calendar/Activity.php"); - -# $verified = verify_data(); - - -/* - - * @return string encrypted password for storage in DB and comparison against DB password. - * @param string $user_name - Must be non null and at least 2 characters - * @param string $user_password - Must be non null and at least 1 character. - * @desc Take an unencrypted username and password and return the encrypted password - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. - * All Rights Reserved.. - * Contributor(s): ______________________________________.. - function encrypt_password($user_password, $crypt_type='') - { - // encrypt the password. - $salt = substr($this->column_fields["user_name"], 0, 2); - - // Fix for: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/4923 - if($crypt_type == '') { - // Try to get the crypt_type which is in database for the user - $crypt_type = $this->get_user_crypt_type(); - } - - // For more details on salt format look at: http://in.php.net/crypt - if($crypt_type == 'MD5') { - $salt = '$1$' . $salt . '$'; - } else if($crypt_type == 'BLOWFISH') { - $salt = '$2$' . $salt . '$'; - } - - $encrypted_password = crypt($user_password, $salt); - - return $encrypted_password; - - } -*/ - - - - - -##### vtiger_user.php - script used to synchronize the users from the VICIDIAL -##### vicidial_users table into the Vtiger system - +# vtiger_user.php - script used to synchronize the users from the VICIDIAL +# vicidial_users table into the Vtiger system as well as +# the groups from VICIDIAL to Vtiger +# +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# # CHANGES # 81231-1307 - First build +# 90228-2152 - Added Groups support # - header ("Content-type: text/html; charset=utf-8"); require("dbconnect.php"); @@ -138,8 +58,22 @@ if ($enable_vtiger_integration < 1) exit; } +##### grab the existing user_groups in the vicidial_user_groups table +$stmt="SELECT user_group,group_name FROM vicidial_user_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$VD_groups_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $VD_groups_ct) + { + $row=mysql_fetch_row($rslt); + $UGid[$i] = $row[0]; + $UGname[$i] = $row[1]; + $i++; + } + ##### grab the existing users in the vicidial_users table -$stmt="SELECT user,pass,full_name,user_level,active FROM vicidial_users;"; +$stmt="SELECT user,pass,full_name,user_level,active,user_group FROM vicidial_users;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $VD_users_ct = mysql_num_rows($rslt); @@ -152,6 +86,7 @@ while ($i < $VD_users_ct) $full_name[$i] = $row[2]; while (strlen($full_name[$i])>30) {$full_name[$i] = eregi_replace(".$",'',$full_name[$i]);} $user_level[$i] = $row[3]; $active[$i] = $row[4]; + $user_group[$i] = $row[5]; $i++; } @@ -159,21 +94,96 @@ while ($i < $VD_users_ct) ### connect to your vtiger database $linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass"); if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());} -echo 'Connected successfully'; +echo "Connected successfully\n
\n"; mysql_select_db("$vtiger_dbname", $linkV); +########################## +### BEGIN Group export +$i=0; +while ($i < $VD_groups_ct) + { + $VTgroup_name = $UGid[$i]; + $VTgroup_description = $UGname[$i]; + + $stmt="SELECT count(*) from vtiger_groups where groupname='$VTgroup_name';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $group_found_count = $row[0]; + + ### group exists in vtiger, grab groupid, update description + if ($group_found_count > 0) + { + $stmt="SELECT groupid from vtiger_groups where groupname='$VTgroup_name';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $groupid = $row[0]; + $VTugID[$i] = $groupid; + + $stmtA = "UPDATE vtiger_groups SET description='$VTgroup_description' where groupid='$groupid';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + echo "GROUP- $VTgroup_name: $groupid
\n"; + echo "
\n"; + } + + ### group doesn't exist in vtiger, insert it + else + { + #### BEGIN CREATE NEW GROUP RECORD IN VTIGER + + # Get next available id from vtiger_groups_seq to use as groupid + $stmt="SELECT id from vtiger_groups_seq;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + $row=mysql_fetch_row($rslt); + $groupid = ($row[0] + 1); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $VTugID[$i] = $groupid; + + # Increase next available groupid with 1 so next record gets proper id + $stmt="UPDATE vtiger_groups_seq SET id = '$groupid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtA = "INSERT INTO vtiger_groups SET groupid='$groupid',groupname='$VTgroup_name',description='$VTgroup_description';"; + if ($DB) {echo "|$stmtA|\n";} + $rslt=mysql_query($stmtA, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + echo "GROUP- $VTgroup_name: $groupid
\n"; + echo "
\n"; + #### END CREATE NEW GROUP RECORD IN VTIGER + } + $i++; + } +### END Group export +########################## + + + +########################## +### BEGIN User export $i=0; while ($i < $VD_users_ct) { $user_name = $user[$i]; + $VUgroup = $user_group[$i]; $user_password = $pass[$i]; $last_name = $full_name[$i]; $is_admin = 'off'; $roleid = 'H5'; $status = 'Active'; $groupid = '1'; - if ($user_level[$i] >= 8) {$roleid = 'H4';} + if ($user_level[$i] >= 7) {$roleid = 'H4';} + if ($user_level[$i] >= 8) {$roleid = 'H3';} if ($user_level[$i] >= 9) {$roleid = 'H2';} if ($user_level[$i] >= 9) {$is_admin = 'on';} if (ereg('N',$active[$i])) {$status = 'Inactive';} @@ -182,6 +192,22 @@ while ($i < $VD_users_ct) $encrypted_password = crypt($user_password, $salt); $i++; + $j=0; + $all_VICIDIAL_groups_SQL=''; + while ($j < $VD_groups_ct) + { + if ( (eregi("$UGid[$j]",$VUgroup)) and ( (strlen($UGid[$j]))==(strlen($VUgroup)) ) ) + { + $groupid = $VTugID[$j]; + $VTgroup_name = $UGid[$j]; + $VTgroup_description = $UGname[$j]; + } + else + {$all_VICIDIAL_groups_SQL .= "'$VTugID[$j]',";} + $j++; + } + $all_VICIDIAL_groups_SQL = preg_replace("/.$/",'',$all_VICIDIAL_groups_SQL); + $stmt="SELECT count(*) from vtiger_users where user_name='$user_name';"; $rslt=mysql_query($stmt, $linkV); if ($DB) {echo "$stmt\n";} @@ -199,6 +225,13 @@ while ($i < $VD_users_ct) $row=mysql_fetch_row($rslt); $userid = $row[0]; + $stmt="SELECT count(*) from vtiger_users2group WHERE userid='$userid' and groupid='$groupid';"; + $rslt=mysql_query($stmt, $linkV); + if ($DB) {echo "$stmt\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + $row=mysql_fetch_row($rslt); + $usergroupcount = $row[0]; + $stmtA = "UPDATE vtiger_users SET user_password='$encrypted_password',last_name='$last_name',is_admin='$is_admin',status='$status' where id='$userid';"; if ($DB) {echo "|$stmtA|\n";} $rslt=mysql_query($stmtA, $linkV); @@ -209,9 +242,26 @@ while ($i < $VD_users_ct) $rslt=mysql_query($stmtB, $linkV); if (!$rslt) {die('Could not execute: ' . mysql_error());} + if ($usergroupcount < 1) + { + $stmtC = "DELETE FROM vtiger_users2group WHERE userid='$userid' and groupid IN($all_VICIDIAL_groups_SQL);"; + if ($DB) {echo "|$stmtC|\n";} + $rslt=mysql_query($stmtC, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $stmtD = "INSERT INTO vtiger_users2group SET userid='$userid',groupid='$groupid';"; + if ($DB) {echo "|$stmtC|\n";} + $rslt=mysql_query($stmtD, $linkV); + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } + else + {$stmtC='';} + echo "$user_name: $userid
\n"; echo "$stmtA
\n"; echo "$stmtB
\n"; + echo "$stmtC
\n"; + echo "$stmtD
\n"; echo "
\n"; } @@ -252,6 +302,8 @@ while ($i < $VD_users_ct) } +### END User export +##########################