Added md_check option for transfer_conference function for Agent API

Added ConfBridge support for 3-way press-1 features

git-svn-id: svn://192.168.202.10@3829 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2024-04-26 02:13:22 +00:00
parent 7effda83b2
commit e210febaeb
5 changed files with 63 additions and 12 deletions
+10 -2
View File
@@ -35,6 +35,7 @@
# 231227-1428 - Added multi-phone ability # 231227-1428 - Added multi-phone ability
# 240114-0942 - Added agent_heartbeat # 240114-0942 - Added agent_heartbeat
# 240116-2110 - Added CLI flags for timeout and outside-agent dial timeout # 240116-2110 - Added CLI flags for timeout and outside-agent dial timeout
# 240425-2207 - Added ConfBridge support
# #
$script = 'agi-3way_press_agent.agi'; $script = 'agi-3way_press_agent.agi';
@@ -48,6 +49,7 @@ $one_mysql_log=0;
$MT[0]=''; $MT[0]='';
$timeout=100; $timeout=100;
$Local_dial_timeout=80; $Local_dial_timeout=80;
$conf_engine='';
$now_date_epoch = time(); $now_date_epoch = time();
@@ -117,7 +119,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr; or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database ### Grab Server values from the database
$stmtA = "SELECT agi_output,local_gmt FROM servers where server_ip = '$VARserver_ip';"; $stmtA = "SELECT agi_output,local_gmt,conf_engine FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
@@ -129,6 +131,7 @@ while ($sthArows > $rec_count)
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$DBagi_output = $aryA[0]; $DBagi_output = $aryA[0];
$local_gmt = $aryA[1]; $local_gmt = $aryA[1];
$conf_engine = $aryA[2];
if ($isdst) {$local_gmt++;} if ($isdst) {$local_gmt++;}
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
@@ -593,11 +596,16 @@ while ($wait_loop < $timeout)
# $affected_rowsD = $dbhA->do($stmtA); # $affected_rowsD = $dbhA->do($stmtA);
# if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsD|$stmtA|"; &agi_output;} # if ($AGILOG) {$agi_string = "-- vicidial_conferences UPDATE: |$affected_rowsD|$stmtA|"; &agi_output;}
if ($conf_engine eq "CONFBRIDGE")
{$XFERstr = "8$CALLconf_exten";}
else
{$XFERstr = "7$CALLconf_exten";}
if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;} if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|$VIDqueryCID|"; &agi_output;}
print "SET CONTEXT $ext_context\n"; print "SET CONTEXT $ext_context\n";
$result = <STDIN>; $result = <STDIN>;
checkresult($result); checkresult($result);
print "SET EXTENSION 7$CALLconf_exten\n"; print "SET EXTENSION $XFERstr\n";
$result = <STDIN>; $result = <STDIN>;
checkresult($result); checkresult($result);
print "SET PRIORITY 1\n"; print "SET PRIORITY 1\n";
+10 -2
View File
@@ -55,6 +55,7 @@
# 240108-1503 - Added call_channel and call_transfer logging # 240108-1503 - Added call_channel and call_transfer logging
# 240114-0946 - Added check of agent_heartbeat # 240114-0946 - Added check of agent_heartbeat
# 240116-2109 - Added CLI flag for timeout # 240116-2109 - Added CLI flag for timeout
# 240425-2208 - Added ConfBridge support
# #
$script = 'agi-3way_press_outside.agi'; $script = 'agi-3way_press_outside.agi';
@@ -67,6 +68,7 @@ $mysql_log_count=272;
$one_mysql_log=0; $one_mysql_log=0;
$MT[0]=''; $MT[0]='';
$timeout=100; $timeout=100;
$conf_engine='';
$now_date_epoch = time(); $now_date_epoch = time();
@@ -135,7 +137,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr; or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database ### Grab Server values from the database
$stmtA = "SELECT agi_output,local_gmt FROM servers where server_ip = '$VARserver_ip';"; $stmtA = "SELECT agi_output,local_gmt,conf_engine FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
@@ -147,6 +149,7 @@ while ($sthArows > $rec_count)
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$DBagi_output = $aryA[0]; $DBagi_output = $aryA[0];
$local_gmt = $aryA[1]; $local_gmt = $aryA[1];
$conf_engine = $aryA[2];
if ($isdst) {$local_gmt++;} if ($isdst) {$local_gmt++;}
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
@@ -563,11 +566,16 @@ if ($stage =~ /accepted/i)
$affected_rowsE = $dbhA->do($stmtA); $affected_rowsE = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live transfer DELETE: |$affected_rowsE|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live transfer DELETE: |$affected_rowsE|$stmtA|"; &agi_output;}
if ($conf_engine eq "CONFBRIDGE")
{$XFERstr = "8$CALLconf_exten";}
else
{$XFERstr = "7$CALLconf_exten";}
if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|"; &agi_output;} if ($AGILOG) {$agi_string = "3-WAY AGENT TRANSFER: |$CALLuser|$CALLserver_ip|$CALLconf_exten|$calleridname|"; &agi_output;}
print "SET CONTEXT $ext_context\n"; print "SET CONTEXT $ext_context\n";
$result = <STDIN>; $result = <STDIN>;
checkresult($result); checkresult($result);
print "SET EXTENSION 7$CALLconf_exten\n"; print "SET EXTENSION $XFERstr\n";
$result = <STDIN>; $result = <STDIN>;
checkresult($result); checkresult($result);
print "SET PRIORITY 1\n"; print "SET PRIORITY 1\n";
+4 -1
View File
@@ -1,4 +1,4 @@
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2023-12-22 AGENT API DOCUMENT Started: 2008-07-03 Updated: 2024-04-25
This document describes the functions of an API(Application Programming Interface) This document describes the functions of an API(Application Programming Interface)
for the VICIDIAL Agent screen. This functionality will be rather limited at first for the VICIDIAL Agent screen. This functionality will be rather limited at first
@@ -717,6 +717,8 @@ VALUES:
OPTIONAL, alternate method for caller ID number to use when doing DIAL_WITH_CUSTOMER or PARK_CUSTOMER_DIAL: 'CAMPAIGN','AGENT_PHONE','CUSTOMER','CUSTOM_CID' OPTIONAL, alternate method for caller ID number to use when doing DIAL_WITH_CUSTOMER or PARK_CUSTOMER_DIAL: 'CAMPAIGN','AGENT_PHONE','CUSTOMER','CUSTOM_CID'
multi_dial_phones - multi_dial_phones -
OPTIONAL, for use only with "Agent 3-way Press-1 Calls", contains up to 10 phone numbers separated by commas: "2125551212,4075551212,3125551212" (duplicates will be removed) OPTIONAL, for use only with "Agent 3-way Press-1 Calls", contains up to 10 phone numbers separated by commas: "2125551212,4075551212,3125551212" (duplicates will be removed)
md_check -
OPTIONAL, for use only with 'multi_dial_phones' option above, if this is set to 'YES' it will check for still-active previous 3-way calls and show an error if any are found
EXAMPLE URLS: EXAMPLE URLS:
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=HANGUP_XFER http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=HANGUP_XFER
@@ -743,6 +745,7 @@ ERROR: agent_user does not have a live call - 6666
ERROR: caller_id_number from group_alias is not valid - 6666|TESTING|123 ERROR: caller_id_number from group_alias is not valid - 6666|TESTING|123
ERROR: group_alias is not valid - 6666|TESTING ERROR: group_alias is not valid - 6666|TESTING
ERROR: cid_choice is not valid - 6666|TESTING ERROR: cid_choice is not valid - 6666|TESTING
ERROR: agent_user has previous active 3-way calls - 6666|1|0|YES
SUCCESS: transfer_conference function set - LOCAL_CLOSER|SALESLINE||YES|6666|M2141842580000000044| SUCCESS: transfer_conference function set - LOCAL_CLOSER|SALESLINE||YES|6666|M2141842580000000044|
@@ -1,11 +1,11 @@
VICIdial ConfBridge Support: STARTED: 2022-06-22 UPDATED: 2024-04-20 VICIdial ConfBridge Support: STARTED: 2022-06-22 UPDATED: 2024-04-25
!!! NOTE: VICIdial ConfBridge has been in use by several companies in production for over a year now and is considered stable !!! !!! NOTE: VICIdial ConfBridge has been in use by several companies in production for over a year now and is considered stable !!!
!!! NOTE: VICIdial ConfBridge support requires Asterisk 16 or higher to be installed on your dialers. Code development and testing was done with VICIbox 11 and the optional Asterisk 16 package available through VICIbox 11 !!! !!! NOTE: VICIdial ConfBridge support requires Asterisk 16 or higher to be installed on your dialers. Code development and testing was done with VICIbox 11 and the optional Asterisk 16 package available through VICIbox 11 !!!
!!! NOTE: As of svn/trunk revision 3826, the new 'AST_conf_update_screen.pl' script is installed by the VICIdial codebase and the 'AST_VDremote_agents.pl.diff' patch is already applied by default. !!! NOTE: As of svn/trunk revision 3828, the new 'AST_conf_update_screen.pl' script is installed by the VICIdial codebase and all other required code patches are already applied by default.
BETA support for ConfBridge was first included in the VICIdial svn/trunk codebase as of revision 3624. BETA support for ConfBridge was first included in the VICIdial svn/trunk codebase as of revision 3624.
+37 -5
View File
@@ -113,10 +113,11 @@
# 231129-1457 - Added refresh_panel function # 231129-1457 - Added refresh_panel function
# 231222-2105 - Added multi_dial_phones option to the transfer_conference function # 231222-2105 - Added multi_dial_phones option to the transfer_conference function
# 240219-1500 - Added daily_limit setting to change_ingroups function # 240219-1500 - Added daily_limit setting to change_ingroups function
# 240425-1901 - Added md_check option for transfer_conference function
# #
$version = '2.14-78'; $version = '2.14-79';
$build = '240219-1500'; $build = '240425-1901';
$php_script = 'api.php'; $php_script = 'api.php';
$startMS = microtime(); $startMS = microtime();
@@ -292,6 +293,8 @@ if (isset($_GET["text_color"])) {$text_color=$_GET["text_color"];}
elseif (isset($_POST["text_color"])) {$text_color=$_POST["text_color"];} elseif (isset($_POST["text_color"])) {$text_color=$_POST["text_color"];}
if (isset($_GET["multi_dial_phones"])) {$multi_dial_phones=$_GET["multi_dial_phones"];} if (isset($_GET["multi_dial_phones"])) {$multi_dial_phones=$_GET["multi_dial_phones"];}
elseif (isset($_POST["multi_dial_phones"])) {$multi_dial_phones=$_POST["multi_dial_phones"];} elseif (isset($_POST["multi_dial_phones"])) {$multi_dial_phones=$_POST["multi_dial_phones"];}
if (isset($_GET["md_check"])) {$md_check=$_GET["md_check"];}
elseif (isset($_POST["md_check"])) {$md_check=$_POST["md_check"];}
$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
@@ -354,6 +357,7 @@ $dnc_check=preg_replace("/[^-_0-9a-zA-Z]/","",$dnc_check);
$campaign_dnc_check=preg_replace("/[^-_0-9a-zA-Z]/","",$campaign_dnc_check); $campaign_dnc_check=preg_replace("/[^-_0-9a-zA-Z]/","",$campaign_dnc_check);
$notification_date = preg_replace('/[^- \:0-9]/','',$notification_date); $notification_date = preg_replace('/[^- \:0-9]/','',$notification_date);
$multi_dial_phones = preg_replace('/[^\,0-9]/','',$multi_dial_phones); $multi_dial_phones = preg_replace('/[^\,0-9]/','',$multi_dial_phones);
$md_check = preg_replace("/[^0-9a-zA-Z]/","",$md_check);
if ($non_latin < 1) if ($non_latin < 1)
{ {
@@ -4248,9 +4252,37 @@ if ($function == 'transfer_conference')
$affected_rowsVP=0; $affected_rowsVP=0;
if ($vp > 0) if ($vp > 0)
{ {
$stmtVP = "INSERT IGNORE INTO vicidial_3way_press_multi SET user='$agent_user',call_date=NOW(),phone_numbers='$multi_dial_phones_STRING',phone_numbers_ct='$vp',status='NEW' ON DUPLICATE KEY UPDATE call_date=NOW(),phone_numbers='$multi_dial_phones_STRING',phone_numbers_ct='$vp',status='NEW';"; $md_check_ok=1;
$rslt=mysql_to_mysqli($stmtVP, $link); $md_check_ct=0;
$affected_rowsVP = mysqli_affected_rows($link); if (preg_match("/YES/i",$md_check))
{
# check for still-active previous 3-way calls from this agent and send error if any are found
$stmt = "select count(*) from vicidial_3way_press_live where user='$agent_user' and status!='HUNGUP';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$VDTW_live_ct = mysqli_num_rows($rslt);
if ($VDTW_live_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$md_check_ct = $row[0];
}
if ($md_check_ct > 0) {$md_check_ok = 0;}
}
if ($md_check_ok > 0)
{
$stmtVP = "INSERT IGNORE INTO vicidial_3way_press_multi SET user='$agent_user',call_date=NOW(),phone_numbers='$multi_dial_phones_STRING',phone_numbers_ct='$vp',status='NEW' ON DUPLICATE KEY UPDATE call_date=NOW(),phone_numbers='$multi_dial_phones_STRING',phone_numbers_ct='$vp',status='NEW';";
$rslt=mysql_to_mysqli($stmtVP, $link);
$affected_rowsVP = mysqli_affected_rows($link);
}
else
{
$result = _QXZ("ERROR");
$result_reason = _QXZ("agent_user has previous active 3-way calls");
$data = "$md_check_ct|$md_check_ok|$md_check";
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;
}
} }
$multi_dial_phones_OUTPUT = "|Multi-phones: $vp $mp $affected_rowsVP"; $multi_dial_phones_OUTPUT = "|Multi-phones: $vp $mp $affected_rowsVP";
} }