Apologies for the late response.
Since, we found it quite difficult to install ODBC to suse OS. We have since then moved on to execute mysql commands through simple PHP scripts.
[default]
;add this in default context, this is for local sip users logged in through x-lite/zoiper
;for agent login dial 543
exten => 543,1,Answer()
exten => 543,n,SET(_CLI=${CALLERID(num)})
exten => 543,n,Set(STA=${CURL(
http://192.168.68.114/vicidial/odbc/on_off.php?id=${CLI}&status=y)})
exten => 543,n,Playback(agent-loginok)
exten => 543,n,Hangup()
;for agent logout dial 544
exten => 544,1,Answer()
exten => 544,n,SET(_CLI=${CALLERID(num)})
exten => 544,n,Set(STA=${CURL(
http://192.168.68.114/vicidial/odbc/on_off.php?id=${CLI}&status=n)})
exten => 544,n,Playback(agent-loggedoff)
exten => 544,n,Hangup()
;to know the extension number dial 1234
exten => 1234,1,Answer()
exten => 1234,2,SET(RCLI=${CALLERID(num)})
exten => 1234,3,SayAlpha(${RCLI})
exten => 1234,4,Hangup()
;to know the last number received on the extension dial 555 from same extension
exten => 555,1,Answer()
exten => 555,n,SET(_CLI=${CALLERID(num)})
exten => 555,n,Set(R1CLI=${CURL(
http://192.168.68.114/vicidial/odbc/las ... r.php?id=${CLI})})
exten => 555,n,SayAlpha(${R1CLI})
exten => 555,n,Hangup()
;dispose call by dialling 52 and disposition number
exten => _52X,1,Answer()
exten => _52X,n,SET(_DISP=${EXTEN:2})
exten => _52X,n,SET(_CLI=${CALLERID(num)})
exten => _52X,n,Set(R1CLI=${CURL(
http://192.168.68.114/vicidial/odbc/dispo.php?id=${CLI}&key=${DISP})})
exten => _52X,n,SayAlpha(${R1CLI})
exten => _52X,n,Hangup()
;chanspy
exten => _88,1,ChanSpy()
exten => _88,n,Hangup()
Create a folder odbc in /srv/www/htdocs/vicidial
Now create following files odbc folder,
dispo.php
last_number.php
on_off.php
wfh_on_off.php
make sure you give rwx rights to all the files.
dispo.php
<?php
$localhost="localhost";
$user="cron";
$pwd="1234";
$database="asterisk";
$con = mysqli_connect($localhost, $user, $pwd) or die(mysqli_error());
mysqli_select_db($con,$database) or die(mysqli_error());
$id = $_REQUEST['id'];
$key = $_REQUEST['key'];
//----------------------------------------------getting last number and lead id from user id
$sel = "select phone_number, lead_id from vicidial_log where user='$id' order by end_epoch desc limit 1";
$res = mysqli_query($con, $sel);
while($row = mysqli_fetch_array($res))
{
$number = $row['phone_number'];
$lead_id = $row['lead_id'];
}
//----------------------------------------------getting dispo from from key (srno)
$sel1 = "select dispo from dispos where id='$key'";
$res1 = mysqli_query($con, $sel1);
while($row1 = mysqli_fetch_array($res1))
{
$status = $row1['dispo'];
}
//----------------------------------------------update records in vicidial_log table
$update = "UPDATE vicidial_log SET status = '$status' WHERE lead_id='$lead_id' LIMIT 1";
mysqli_query($con, $update);
//----------------------------------------------update records in vicidail_list table
$update = "UPDATE vicidial_list SET status = '$status' where lead_id='$lead_id'";
mysqli_query($con, $update);
echo $updatedstatus = $status;
?>
last_number.php
<?php
$localhost="localhost";
$user="cron";
$pwd="1234";
$database="asterisk";
$con = mysqli_connect($localhost, $user, $pwd) or die(mysqli_error());
mysqli_select_db($con,$database) or die(mysqli_error());
$id = $_REQUEST['id'];
//----------------------------------------------getting last number and lead id from user id
$sel = "select phone_number from vicidial_log where user='$id' order by end_epoch desc limit 1";
$res = mysqli_query($con, $sel);
while($row = mysqli_fetch_array($res))
{
echo $number = $row['phone_number'];
}
?>
on_off.php
<?php
$localhost="localhost";
$user="cron";
$pwd="1234";
$database="asterisk";
$con = mysqli_connect($localhost, $user, $pwd) or die(mysqli_error());
mysqli_select_db($con,$database) or die(mysqli_error());
$id = $_REQUEST['id'];
$status = $_REQUEST['status'];
if($status == y)
{
$update = "UPDATE vicidial_remote_agents SET status = 'ACTIVE' WHERE user_start='$id' LIMIT 1";
mysqli_query($con, $update);
echo "ACTIVE";
}
else
{
$update = "UPDATE vicidial_remote_agents SET status = 'INACTIVE' WHERE user_start='$id' LIMIT 1";
mysqli_query($con, $update);
echo "INACTIVE";
}
?>
wfh_on_off.php
<?php
$localhost="localhost";
$user="cron";
$pwd="1234";
$database="asterisk";
$con = mysqli_connect($localhost, $user, $pwd) or die(mysqli_error());
mysqli_select_db($con,$database) or die(mysqli_error());
$number = $_REQUEST['number'];
$status = $_REQUEST['status'];
if($status == y)
{
$update = "UPDATE vicidial_remote_agents SET status = 'ACTIVE' WHERE conf_exten='$number' LIMIT 1";
mysqli_query($con, $update);
echo "ACTIVE";
}
else
{
$update = "UPDATE vicidial_remote_agents SET status = 'INACTIVE' WHERE conf_exten='$number' LIMIT 1";
mysqli_query($con, $update);
echo "INACTIVE";
}
?>
If you face any issue configuring, let us know, we will add additional steps to it.
This is tested with ViciBox v.8.1.2, VERSION: 2.14-882a