Skip to main content

Vicidial Enable Contact Phonebook and Transfer on Mobile

Vicidial Enable Contact (Phone book) and Transfer on Mobile

 Step 1

Enable Contact in System Settings 


Step 2 

Changes in Campaign:

 

Add Below mention changed in file in /agc/vdc_db_query.php file modification for %LIKE% search.




############################################################################################################################################################
### SEARCHCONTACTSRESULTSview - display search results for contacts search // Added by Manish date 15-03-2022 LIKE SEARCH RESULTSview
############################################################################################################################################################
if ($ACTION == 'SEARCHCONTACTSRESULTSview')
{
if (strlen($stage) < 3)
{$stage = '670';}

$stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';";
if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);}
$camps_to_print = mysqli_num_rows($rslt);
if ($camps_to_print > 0)
{
$row=mysqli_fetch_row($rslt);
$agent_lead_search_method = $row[0];
$manual_dial_list_id = $row[1];

$searchSQL='';
$searchmethodSQL='';

$last_name = preg_replace("/\'|\"|\\\\|;/","",$last_name);
$first_name = preg_replace("/\'|\"|\\\\|;/","",$first_name);
$phone_number = preg_replace("/\'|\"|\\\\|;/","",$phone_number);
$bu_name = preg_replace("/\'|\"|\\\\|;/","",$bu_name);
$department = preg_replace("/\'|\"|\\\\|;/","",$department);
$group_name = preg_replace("/\'|\"|\\\\|;/","",$group_name);
$job_title = preg_replace("/\'|\"|\\\\|;/","",$job_title);
$location = preg_replace("/\'|\"|\\\\|;/","",$location);

if (strlen($phone_number) >= 2)
{
$searchSQL .= "office_num LIKE '$%phone_number%'";
}
elseif (strlen($last_name) > 0)
{
$searchSQL = "last_name LIKE \"%$last_name%\"";
if (strlen($first_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "first_name LIKE \"$first_name\"";
}
if (strlen($bu_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "bu_name LIKE \"%$bu_name%\"";
}

if (strlen($department) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "department LIKE \"%$department%\"";
}
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($first_name) > 0)
{
$searchSQL = "first_name LIKE \"%$first_name%\"";
if (strlen($bu_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "bu_name LIKE \"%$bu_name%\"";
}
if (strlen($department) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "department LIKE \"%$department%\"";
}
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($bu_name) > 0)
{
$searchSQL = "bu_name LIKE \"$bu_name\"";
if (strlen($department) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "department LIKE \"%$department%\"";
}
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($department) > 0)
{
$searchSQL = "department LIKE \"%$department%\"";
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($group_name) > 0)
{
$searchSQL = "group_name LIKE \"%$group_name%\"";
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($job_title) > 0)
{
$searchSQL = "job_title LIKE \"%$job_title%\"";
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($location) > 0)
{
$searchSQL = "location LIKE \"%$location%\"";
}
else
{
echo _QXZ("ERROR").": "._QXZ("You must enter in search terms, one of these must be populated: office number, last name, first name")."\n";
echo "<BR><BR>";
echo "<a href=\"#\" onclick=\"hideDiv('SearcHResultSContactsBox');return false;\">"._QXZ("Go Back")."</a>";
echo "</CENTER>";
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$startMS,$link,$ACTION,$php_script,$user,$stage,$lead_id,$session_name,$stmt);}
exit;
}

$ALLsort = array();
$ALLfirst = array();
$ALLlast = array();
$ALLoffice_num = array();
$ALLcell_num = array();
$ALLother_num1 = array();
$ALLother_num2 = array();
$ALLbu_name = array();
$ALLdepartment = array();
$ALLgroup_name = array();
$ALLjob_title = array();
$ALLlocation = array();

##### BEGIN search queries and output #####
$stmt="SELECT count(*) from contact_information where $searchSQL;";

### LOG INSERTION Search Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";";
if ($DB) {echo "|$stmtL|\n";}
$rslt=mysql_to_mysqli($stmtL, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtL,'00432',$user,$server_ip,$session_name,$one_mysql_log);}
$search_log_id = mysqli_insert_id($link);

if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) )
{
$linkALT=mysqli_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass");
if (!$linkALT) {die(_QXZ("Could not connect: ")."$alt_log_server_ip|$alt_log_login" . mysqli_connect_error());}
mysqli_select_db($linkALT, "$alt_log_dbname");
}
else
{$linkALT = $link;}

$rsltALT=mysql_to_mysqli($stmt, $linkALT);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);}
$counts_to_print = mysqli_num_rows($rsltALT);
if ($counts_to_print > 0)
{
$row=mysqli_fetch_row($rsltALT);
$search_result_count = $row[0];

$end_process_time = date("U");
$search_seconds = ($end_process_time - $StarTtime);

$stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';";
if ($DB) {echo "|$stmtL|\n";}
$rslt=mysql_to_mysqli($stmtL, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtL,'00434',$user,$server_ip,$session_name,$one_mysql_log);}

echo "<CENTER>\n";
echo "<font style=\"font-size:14px;font-family:sans-serif;\"><B>";
echo _QXZ("Results Found:")." $search_result_count";
echo "</B></font>\n";
echo "<BR>\n";
echo "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0 WIDTH=$stage>";
echo "<TR>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:10px;font-family:sans-serif;\"><B> &nbsp; # &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; "._QXZ("FIRST NAME")." &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; "._QXZ("LAST NAME")." &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; "._QXZ("OFFICE")." &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; "._QXZ("MOBILE")." &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; "._QXZ("OTHER 1")." &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; "._QXZ("OTHER 2")." &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; "._QXZ("BU NAME")." &nbsp; </font></TD>";
echo "</TR>";

if ($search_result_count)
{
$stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;";
$rsltALT=mysql_to_mysqli($stmt, $linkALT);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);}
$out_logs_to_print = mysqli_num_rows($rsltALT);
if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";}

$g=0;
$u=0;
while ($out_logs_to_print > $u)
{
$row=mysqli_fetch_row($rsltALT);
$ALLsort[$g] = "$row[0]-----$g";
$ALLfirst[$g] = $row[0];
$ALLlast[$g] = $row[1];
$ALLoffice_num[$g] = $row[2];
$ALLcell_num[$g] = $row[3];
$ALLother_num1[$g] = $row[4];
$ALLother_num2[$g] = $row[5];
$ALLbu_name[$g] = $row[6];
$ALLdepartment[$g] = $row[7];
$ALLgroup_name[$g] = $row[8];
$ALLjob_title[$g] = $row[9];
$ALLlocation[$g] = $row[10];

$g++;
$u++;
}

if ($g < 1)
{echo "<tr bgcolor=white><td colspan=10 align=center>"._QXZ("No results found")."</td></tr>";}

$u=0;
while ($g > $u)
{
$sort_split = explode("-----",$ALLsort[$u]);
$i = $sort_split[1];

if (preg_match("/1$|3$|5$|7$|9$/i", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}

$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u </td>";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\">$ALLfirst[$i] </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\">$ALLlast[$i] </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> &nbsp; <a href=\"#\" onclick=\"PresetSelect_submit('$ALLfirst[$i] $ALLlast[$i]','$ALLoffice_num[$i]','','N','Y');return false;\">$ALLoffice_num[$i]</a> </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> &nbsp; <a href=\"#\" onclick=\"PresetSelect_submit('$ALLfirst[$i] $ALLlast[$i]','$ALLcell_num[$i]','','N','Y');return false;\">$ALLcell_num[$i]</a> </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> &nbsp; <a href=\"#\" onclick=\"PresetSelect_submit('$ALLfirst[$i] $ALLlast[$i]','$ALLother_num1[$i]','','N','Y');return false;\">$ALLother_num1[$i]</a> </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> &nbsp; <a href=\"#\" onclick=\"PresetSelect_submit('$ALLfirst[$i] $ALLlast[$i]','$ALLother_num2[$i]','','N','Y');return false;\">$ALLother_num2[$i]</a> </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\">$ALLbu_name[$i] </td>\n";
echo "</tr>\n";
echo "<tr $bgcolor>";
echo "<td colspan=8><font class='sh_text'> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <B>"._QXZ("Dept:")."</B> $ALLdepartment[$i] &nbsp; &nbsp; &nbsp; <B>"._QXZ("Group").":</B> $ALLgroup_name[$i] &nbsp; &nbsp; &nbsp; <B>"._QXZ("Job:")."</B> $ALLjob_title[$i] &nbsp; &nbsp; &nbsp; <B>"._QXZ("Location:")."</B> $ALLlocation[$i]</td>";
echo "</tr>\n";
}

$end_process_time = date("U");
$search_seconds = ($end_process_time - $StarTtime);

$stmtL="UPDATE vicidial_lead_search_log set seconds='$search_seconds' where search_log_id='$search_log_id';";
if ($DB) {echo "|$stmtL|\n";}
$rslt=mysql_to_mysqli($stmtL, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtL,'00436',$user,$server_ip,$session_name,$one_mysql_log);}
}
else
{echo "<tr bgcolor=white><td colspan=10 align=center>"._QXZ("No results found")."</td></tr>";}

echo "</TABLE>";
echo "<BR>";
echo "<a href=\"#\" onclick=\"hideDiv('SearcHResultSContactsBox');return false;\">"._QXZ("Go Back")."</a>";
echo "</CENTER>";
}
else
{
echo _QXZ("ERROR").": "._QXZ("There was a problem with your search terms")."\n";
echo "<BR><BR>";
echo "<a href=\"#\" onclick=\"hideDiv('SearcHResultSContactsBox');return false;\">"._QXZ("Go Back")."</a>";
echo "</CENTER>";
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$startMS,$link,$ACTION,$php_script,$user,$stage,$lead_id,$session_name,$stmt);}
exit;
}
##### END search queries and output #####
}
else
{
echo _QXZ("ERROR").": "._QXZ("Campaign not found")."\n";
echo "<BR><BR>";
echo "<a href=\"#\" onclick=\"hideDiv('SearcHResultSContactsBox');return false;\">"._QXZ("Go Back")."</a>";
echo "</CENTER>";
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$startMS,$link,$ACTION,$php_script,$user,$stage,$lead_id,$session_name,$stmt);}
exit;
}
}


 

 

Comments

Popular posts from this blog

Vicidial Scratch installation Alma -9

Step 1 – Download the dependencies   hostnamectl set-hostname xxxxxx.xxxxx.xxx ### Use YOUR SubDomain vi /etc/hosts ##Change domain name for actual server ip (xxx.xxx.xxx.xxx   complete domain name    subdomain only) timedatectl set-timezone Asia/Kolkata yum check-update yum update -y yum -y install epel-release yum update -y yum install git -y yum install -y kernel* sudo dnf install kernel-devel-$(uname -r) -y #Disable SELINUX sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config     reboot Step 2 – Run the Script cd /usr/src/ git clone https://github.com/manish23k/vicidial-install-scripts cd vicidial-install-scripts ####For PHP 7.4 use this script. chmod +x alma-rocky9-ast16.sh ./alma-rocky9-ast16.sh Or the Asterisk 18 version: chmod +x alma-rocky9-ast18.sh ./alma-rocky9-ast18.sh ####For PHP 8 use this script. chmod +x main-installer-php8.sh ./main-installer-php8.sh

How to delete old call logs and other logs in vicidial or goautodial.

Step 1 : SSH to the server using the Putty Step 2:   login to mysql by typing   mysql -p                    (if you dont know password try below command )               mysql -ucron -p1234 Step 3 : select the asterisk database by typing               use asterisk step 4: Run the below command to check total disk occupied by asterisk database                SELECT table_schema AS "asterisk", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema; Step 5 : Run the below command to check disk space consumed by each table in asterisk database SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema.TABLES WHERE table_schema = "asterisk" ORDER BY (data_length + inde...

Alma 9 Vicidial Selfsign Webrtc

I am going to provide step by step guide to integrate, enable and configure the viciphone(a webrtc phone) in vicidial (also applicable to any vicidial based system) using the Self Signed SSL Certificate ,ie without a public-ip and FQDN or accessing the vicidial with internal LAN IP. 1️⃣ Install OpenSSL (if not installed) sudo dnf install -y openssl 2️⃣ Generate a Private Key openssl genpkey -algorithm RSA -out selfsigned.key -pkeyopt rsa_keygen_bits:2048 3️⃣ Create a Certificate Signing Request (CSR) openssl req -new -key selfsigned.key -out selfsigned.csr It will prompt you for details like: Country Name (e.g., IN ) State or Province (e.g., Gujarat ) Locality (City) Organization Name Common Name (Domain, e.g., example.com or your server IP) Email Address You can use localhost or an IP address if needed. 4️⃣ Generate a Self-Signed Certificate openssl x509 -req -days 365 -in selfsigned.csr -signkey selfsigned.key -out selfsigned.crt -days 365 → Valid for 1 year (Adjust as needed) ...