Added recording and webserver functions to the agent API
git-svn-id: svn://192.168.202.10@1847 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -78,6 +78,8 @@ OTHER CHANGES:
|
||||
|
||||
8. Added ability to download the Max System Stats and display by date range.
|
||||
|
||||
9. Added 'recording' and 'webserver' functions to the agent API
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2011-11-14
|
||||
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2012-08-10
|
||||
|
||||
This document describes the functions of an API(Application Programming Interface)
|
||||
for the VICIDIAL Agent screen. This functionality will be rather limited at first
|
||||
@@ -26,6 +26,8 @@ send_dtmf - sends dtmf signal string to agent's session
|
||||
transfer_conference - sends several commands related to the agent transfer-conf frame
|
||||
park_call - sends command to park customer or grab customer from park or ivr
|
||||
logout - logs the agent out of the agent interface
|
||||
recording - sends a recording start/stop signal or status of agent recording
|
||||
webserver - display webserver information, very useful for load balanced setups
|
||||
|
||||
|
||||
New scripts:
|
||||
@@ -79,6 +81,41 @@ VERSION: 2.0.5-2|BUILD: 90116-1229|DATE: 2009-01-15 14:59:33|EPOCH: 1222020803
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
webserver -
|
||||
|
||||
DESCRIPTION:
|
||||
shows version and build of the API, along with the date/time
|
||||
|
||||
VALUES: NONE
|
||||
|
||||
EXAMPLE URL:
|
||||
http://server/agc/api.php?source=test&user=6666&pass=1234&function=webserver
|
||||
|
||||
RESPONSES:
|
||||
Webserver Data:
|
||||
set.timezone: America/New_York
|
||||
abbr.timezone: EDT
|
||||
dst.timezone: 1
|
||||
uname: Linux dev-db 2.6.34.8-0.2-default #1 SMP 2011-04-06 18:11:26 +0200 x86_64
|
||||
host name: dev-db
|
||||
server name: www.vicidial.org
|
||||
php version: 5.3.3
|
||||
apache version: Apache/2.2.15 (Linux/SUSE)
|
||||
apache processes: 13
|
||||
system loadavg: 0.06
|
||||
disk_free_space: 444174315520
|
||||
date.timezone: America/New_York
|
||||
max_execution_time: 360
|
||||
max_input_time: 360
|
||||
memory_limit: 128M
|
||||
post_max_size: 48M
|
||||
upload_max_filesize: 42M
|
||||
default_socket_timeout: 360
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
external_hangup -
|
||||
|
||||
@@ -324,9 +361,6 @@ SUCCESS: change_ingroups function set - YES| TEST_IN SALESLINE -|6666
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
update_fields -
|
||||
|
||||
@@ -377,6 +411,8 @@ SUCCESS: update_fields lead updated - 6666|1234|87498|vendor_lead_code='1234567'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
set_timer_action -
|
||||
|
||||
@@ -405,6 +441,8 @@ SUCCESS: set_timer_action lead updated - 6666|1234|MESSAGE_ONLY|test message|15
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
st_login_log -
|
||||
|
||||
@@ -427,6 +465,8 @@ SUCCESS: st_login_log user found - 6666
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
st_get_agent_active_lead -
|
||||
|
||||
@@ -451,6 +491,8 @@ SUCCESS: st_get_agent_active_lead lead found - 6666|7275551212|123456|9987-12347
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
ra_call_control -
|
||||
|
||||
@@ -487,6 +529,8 @@ SUCCESS: ra_call_control hungup - 6666|Y0315201639000402027|HANGUP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
send_dtmf -
|
||||
|
||||
@@ -510,6 +554,8 @@ SUCCESS: send_dtmf function set - QQQQ1234SQQQQQ6654P|6666
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
park_call -
|
||||
|
||||
@@ -539,6 +585,8 @@ SUCCESS: park_call function set - PARK_CUSTOMER|6666
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
transfer_conference -
|
||||
|
||||
@@ -592,6 +640,37 @@ SUCCESS: transfer_conference function set - LOCAL_CLOSER|SALESLINE||YES|6666
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
recording -
|
||||
|
||||
DESCRIPTION:
|
||||
sends a recording start/stop signal or status of agent recording
|
||||
|
||||
VALUES:
|
||||
value -
|
||||
REQUIRED, choices are below
|
||||
START - sends a "start recording" signal to the agent screen
|
||||
(you can have multiple recordings going at the same time)
|
||||
STOP - sends a "stop recording" signal to the agent screen
|
||||
(this will stop all active recordings onthe agent screen)
|
||||
STATUS - displays results of active recording and agent session information
|
||||
(returns: user|recording_id|filename|server|start_time|agent_server|session|agent_status)
|
||||
|
||||
EXAMPLE URLS:
|
||||
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=recording&value=START
|
||||
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=recording&value=STOP
|
||||
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=recording&value=STATUS
|
||||
|
||||
RESPONSES:
|
||||
ERROR: no user found - 6666
|
||||
ERROR: agent_user is not logged in - 6666
|
||||
ERROR: stop recording error - 6666|||||192.168.1.5|8600051|PAUSED
|
||||
SUCCESS: recording function sent - 6666|STOP||||192.168.1.5|8600051|PAUSED
|
||||
SUCCESS: recording function sent - 6666|START||||192.168.1.5|8600051|PAUSED
|
||||
NOTICE: not recording - 6666|||||192.168.1.5|8600051|PAUSED
|
||||
NOTICE: recording active - 6666|121242|20120810-012008__6666_|192.168.1.5|2012-08-10 01:20:10|192.168.1.5|8600051|PAUSED
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ end_time DATETIME,
|
||||
end_epoch INT(10) UNSIGNED,
|
||||
length_in_sec MEDIUMINT(8) UNSIGNED,
|
||||
length_in_min DOUBLE(8,2),
|
||||
filename VARCHAR(50),
|
||||
filename VARCHAR(100),
|
||||
location VARCHAR(255),
|
||||
lead_id INT(9) UNSIGNED,
|
||||
user VARCHAR(20),
|
||||
@@ -398,6 +398,7 @@ ring_callerid VARCHAR(20) default '',
|
||||
last_inbound_call_time DATETIME,
|
||||
last_inbound_call_finish DATETIME,
|
||||
campaign_grade TINYINT(2) UNSIGNED default '1',
|
||||
external_recording VARCHAR(20) default '',
|
||||
index (random_id),
|
||||
index (last_call_time),
|
||||
index (last_update_time),
|
||||
@@ -2815,7 +2816,7 @@ CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer;
|
||||
CREATE TABLE vicidial_did_agent_log_archive LIKE vicidial_did_agent_log;
|
||||
CREATE UNIQUE INDEX vdala on vicidial_did_agent_log_archive (uniqueid,call_date,did_route);
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1322',db_schema_update_date=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1323',db_schema_update_date=NOW();
|
||||
|
||||
GRANT RELOAD ON *.* TO cron@'%';
|
||||
GRANT RELOAD ON *.* TO cron@localhost;
|
||||
|
||||
@@ -20,3 +20,10 @@ ALTER TABLE system_settings ADD call_menu_qualify_enabled ENUM('0','1') default
|
||||
ALTER TABLE vicidial_call_menu ADD qualify_sql TEXT;
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1322',db_schema_update_date=NOW() where db_schema_version < 1322;
|
||||
|
||||
ALTER TABLE recording_log MODIFY filename VARCHAR(100);
|
||||
|
||||
ALTER TABLE vicidial_live_agents ADD external_recording VARCHAR(20) default '';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1323',db_schema_update_date=NOW() where db_schema_version < 1323;
|
||||
|
||||
|
||||
@@ -59,10 +59,11 @@
|
||||
# 120301-1745 - Fixed ereg statements dashes
|
||||
# 120529-1551 - Fixed callback_datetime filter
|
||||
# 120731-1206 - Allow dot in vendor_id
|
||||
# 120809-2338 - Added recording and webserver functions
|
||||
#
|
||||
|
||||
$version = '2.4-25';
|
||||
$build = '120731-1206s';
|
||||
$version = '2.6-26';
|
||||
$build = '120809-2338';
|
||||
|
||||
$startMS = microtime();
|
||||
|
||||
@@ -387,6 +388,54 @@ if ($format=='debug')
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
### BEGIN - webserver - show webserver information
|
||||
################################################################################
|
||||
if ($function == 'webserver')
|
||||
{
|
||||
exec('ps aux | grep httpd', $output);
|
||||
$processes = count($output);
|
||||
$load = sys_getloadavg();
|
||||
|
||||
$data="Webserver Data:\n";
|
||||
$data .= "set.timezone: " . date('e') . "\n";
|
||||
$data .= "abbr.timezone: " . date('T') . "\n";
|
||||
$data .= "dst.timezone: " . date('I') . "\n";
|
||||
$data .= "uname: " . php_uname('e') . "\n";
|
||||
$data .= "host name: " . php_uname('n') . "\n";
|
||||
$data .= "server name: " . $_SERVER['SERVER_NAME'] . "\n";
|
||||
$data .= "php version: " . phpversion() . "\n";
|
||||
$data .= "apache version: " . apache_get_version() . "\n";
|
||||
$data .= "apache processes: " . $processes . "\n";
|
||||
$data .= "system loadavg: " . $load[0] . "\n";
|
||||
$data .= "disk_free_space: " . disk_free_space('/') . "\n";
|
||||
|
||||
if (ini_get('date.timezone'))
|
||||
{
|
||||
$data .= "date.timezone: " . ini_get('date.timezone') . "\n";
|
||||
$data .= "max_execution_time: " . ini_get('max_execution_time') . "\n";
|
||||
$data .= "max_input_time: " . ini_get('max_input_time') . "\n";
|
||||
$data .= "memory_limit: " . ini_get('memory_limit') . "\n";
|
||||
$data .= "post_max_size: " . ini_get('post_max_size') . "\n";
|
||||
$data .= "upload_max_filesize: " . ini_get('upload_max_filesize') . "\n";
|
||||
$data .= "default_socket_timeout: " . ini_get('default_socket_timeout') . "\n";
|
||||
}
|
||||
else {$data .= "ini_get not allowed: \n";}
|
||||
|
||||
$result = 'SUCCESS';
|
||||
echo "<PRE>$data</PRE>\n";
|
||||
$data = preg_replace("/\n/",'|',$data);
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
################################################################################
|
||||
### END - webserver
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
### BEGIN - external_hangup - hang up the active agent call
|
||||
################################################################################
|
||||
@@ -716,6 +765,127 @@ if ($function == 'logout')
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
### BEGIN - recording - send a start or stop recording signal to agent screen
|
||||
################################################################################
|
||||
if ($function == 'recording')
|
||||
{
|
||||
if ( ( ($value!='START') and ($value!='STOP') and ($value!='STATUS') ) or ( (strlen($agent_user)<1) and (strlen($alt_user)<2) ) )
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "recording not valid";
|
||||
echo "$result: $result_reason - $value|$agent_user\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($alt_user)>1)
|
||||
{
|
||||
$stmt = "select count(*) from vicidial_users where custom_three='$alt_user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row[0] > 0)
|
||||
{
|
||||
$stmt = "select user from vicidial_users where custom_three='$alt_user' order by user;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_user = $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "no user found";
|
||||
echo "$result: $result_reason - $alt_user\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
}
|
||||
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($row[0] > 0)
|
||||
{
|
||||
$stmt = "select external_recording,server_ip,conf_exten,status from vicidial_live_agents where user='$agent_user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$recording_id = $row[0];
|
||||
$AGENTserver_ip = $row[1];
|
||||
$AGENTconf_exten = $row[2];
|
||||
$AGENTstatus = $row[3];
|
||||
|
||||
if ($value=='STATUS')
|
||||
{
|
||||
if ( ($recording_id!='START') and ($recording_id!='STOP') and ($recording_id > 0) )
|
||||
{
|
||||
$RECfilename = '';
|
||||
$RECserver_ip = '';
|
||||
$RECstart_time = '';
|
||||
$stmt = "SELECT filename,server_ip,start_time FROM recording_log where recording_id='$recording_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rl_ct = mysql_num_rows($rslt);
|
||||
if ($rl_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RECfilename = $row[0];
|
||||
$RECserver_ip = $row[1];
|
||||
$RECstart_time = $row[2];
|
||||
}
|
||||
|
||||
$result = 'NOTICE';
|
||||
$result_reason = "recording active";
|
||||
echo "$result: $result_reason - $agent_user|$recording_id|$RECfilename|$RECserver_ip|$RECstart_time|$AGENTserver_ip|$AGENTconf_exten|$AGENTstatus\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = 'NOTICE';
|
||||
$result_reason = "not recording";
|
||||
echo "$result: $result_reason - $agent_user|||||$AGENTserver_ip|$AGENTconf_exten|$AGENTstatus\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ($value=='STOP') and ( ($recording_id=='STOP') or ($recording_id < 1) ) )
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "stop recording error";
|
||||
echo "$result: $result_reason - $agent_user|$recording_id||||$AGENTserver_ip|$AGENTconf_exten|$AGENTstatus\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_recording='$value' where user='$agent_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$result = 'SUCCESS';
|
||||
$result_reason = "recording function sent";
|
||||
echo "$result: $result_reason - $agent_user|$value||||$AGENTserver_ip|$AGENTconf_exten|$AGENTstatus\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "agent_user is not logged in";
|
||||
echo "$result: $result_reason - $agent_user\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
}
|
||||
}
|
||||
################################################################################
|
||||
### END - recording
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
### BEGIN - external_dial - place a manual dial phone call
|
||||
################################################################################
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.4
|
||||
# conf_exten_check.php version 2.6
|
||||
#
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
@@ -55,10 +55,11 @@
|
||||
# 101123-1105 - Added api manual dial queue feature to external_dial function
|
||||
# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406)
|
||||
# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report
|
||||
# 120809-2353 - Added external_recording function
|
||||
#
|
||||
|
||||
$version = '2.4-30';
|
||||
$build = '110610-0059';
|
||||
$version = '2.6-31';
|
||||
$build = '120809-2353';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=38;
|
||||
$one_mysql_log=0;
|
||||
@@ -426,7 +427,7 @@ if ($ACTION == 'refresh')
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds,external_dtmf,external_transferconf,external_park,external_timer_action_destination from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds,external_dtmf,external_transferconf,external_park,external_timer_action_destination,external_recording from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
@@ -444,6 +445,7 @@ if ($ACTION == 'refresh')
|
||||
$external_transferconf = $row[10];
|
||||
$external_park = $row[11];
|
||||
$timer_action_destination = $row[12];
|
||||
$external_recording = $row[13];
|
||||
|
||||
$MDQ_count=0;
|
||||
if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') )
|
||||
@@ -664,7 +666,7 @@ if ($ACTION == 'refresh')
|
||||
$external_pause='';
|
||||
}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . "\n";
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . '|APIRecording: ' . $external_recording . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# manager_send.php version 2.4
|
||||
# manager_send.php version 2.6
|
||||
#
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
@@ -109,11 +109,13 @@
|
||||
# 101125-1018 - Added call_variables Originate variables
|
||||
# 110224-1710 - Added compatibility with QM phone environment logging
|
||||
# 110626-2320 - Added qm_extension
|
||||
# 120810-0030 - Added external_recording
|
||||
#
|
||||
|
||||
$version = '2.4-56';
|
||||
$build = '110626-2320';
|
||||
$version = '2.6-57';
|
||||
$build = '120810-0030';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=116;
|
||||
$mysql_log_count=118;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
@@ -1924,6 +1926,12 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") )
|
||||
|
||||
if ($FROMvdc=='YES')
|
||||
{
|
||||
##### update vla record with recording_id
|
||||
$stmt = "UPDATE vicidial_live_agents SET external_recording='$recording_id' where user='$user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02117',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
##### get call type from vicidial_live_agents table
|
||||
$VLA_inOUT='NONE';
|
||||
$stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;";
|
||||
@@ -1988,6 +1996,15 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") )
|
||||
if (strlen($uniqueid) > 8)
|
||||
{$uniqueidSQL = ",vicidial_id='$uniqueid'";}
|
||||
}
|
||||
|
||||
if ($FROMvdc=='YES')
|
||||
{
|
||||
##### update vla recording record to blank
|
||||
$stmt = "UPDATE vicidial_live_agents SET external_recording='' where user='$user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02118',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
|
||||
$stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
@@ -6121,7 +6121,7 @@ if ($ACTION == 'updateDISPO')
|
||||
}
|
||||
|
||||
### reset the API fields in vicidial_live_agents record
|
||||
$stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='',external_update_fields='0',external_update_fields_data='',external_timer_action_seconds='-1',external_dtmf='',external_transferconf='',external_park='',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';";
|
||||
$stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='',external_update_fields='0',external_update_fields_data='',external_timer_action_seconds='-1',external_dtmf='',external_transferconf='',external_park='',external_recording='',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00141',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
@@ -381,10 +381,11 @@
|
||||
# 120427-1718 - Fixed 3-way logging issue
|
||||
# 120512-0849 - Added In-Group Manual Dial functions
|
||||
# 120518-1225 - Added transfer call to answering machine message with hotkey (LTMG or XFTAMM)
|
||||
# 120810-0056 - Added recording api function
|
||||
#
|
||||
|
||||
$version = '2.6-349c';
|
||||
$build = '120518-1225';
|
||||
$version = '2.6-350c';
|
||||
$build = '120810-0056';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=77;
|
||||
$one_mysql_log=0;
|
||||
@@ -4449,6 +4450,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
api_timer_action_seconds = APITimerSeconds_array[1];
|
||||
var APITimerDestination_array = check_time_array[23].split("APITimerDestination: ");
|
||||
api_timer_action_destination = APITimerDestination_array[1];
|
||||
var APIRecording_array = check_time_array[25].split("APIRecording: ");
|
||||
var api_recording = APIRecording_array[1];
|
||||
var APIdtmf_array = check_time_array[20].split("APIdtmf: ");
|
||||
api_dtmf = APIdtmf_array[1];
|
||||
var APItransfercond_array = check_time_array[21].split("APItransferconf: ");
|
||||
@@ -4461,6 +4464,14 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
var APIpark_array = check_time_array[22].split("APIpark: ");
|
||||
api_parkcustomer = APIpark_array[1];
|
||||
|
||||
if (api_recording=='START')
|
||||
{
|
||||
conf_send_recording('MonitorConf', session_id,'','1');
|
||||
}
|
||||
if (api_recording=='STOP')
|
||||
{
|
||||
conf_send_recording('StopMonitorConf', session_id, recording_filename,'1');
|
||||
}
|
||||
if (api_transferconf_function.length > 0)
|
||||
{
|
||||
if (api_transferconf_function == 'HANGUP_XFER')
|
||||
@@ -4905,7 +4916,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
|
||||
// ################################################################################
|
||||
// Send MonitorConf/StopMonitorConf command for recording of conferences
|
||||
function conf_send_recording(taskconfrectype,taskconfrec,taskconffile)
|
||||
function conf_send_recording(taskconfrectype,taskconfrec,taskconffile,taskfromapi)
|
||||
{
|
||||
if (inOUT == 'OUT')
|
||||
{
|
||||
@@ -4992,7 +5003,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
document.getElementById("RecorDControl").innerHTML = conf_rec_start_html;
|
||||
}
|
||||
}
|
||||
confmonitor_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=" + taskconfrectype + "&format=text&channel=" + channelrec + "&filename=" + filename + "&exten=" + query_recording_exten + "&ext_context=" + ext_context + "&lead_id=" + document.vicidial_form.lead_id.value + "&ext_priority=1&FROMvdc=YES&uniqueid=" + tmp_vicidial_id;
|
||||
confmonitor_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=" + taskconfrectype + "&format=text&channel=" + channelrec + "&filename=" + filename + "&exten=" + query_recording_exten + "&ext_context=" + ext_context + "&lead_id=" + document.vicidial_form.lead_id.value + "&ext_priority=1&FROMvdc=YES&uniqueid=" + tmp_vicidial_id + "&FROMapi=" + taskfromapi;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(confmonitor_query);
|
||||
|
||||
Reference in New Issue
Block a user