diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 64ab9a9a..e5755069 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -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 + diff --git a/agc_2-X/trunk/docs/AGENT_API.txt b/agc_2-X/trunk/docs/AGENT_API.txt index c885c9ae..f922ca1a 100644 --- a/agc_2-X/trunk/docs/AGENT_API.txt +++ b/agc_2-X/trunk/docs/AGENT_API.txt @@ -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 + + 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 1b7e6a90..900d1545 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -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; diff --git a/agc_2-X/trunk/extras/upgrade_2.6.sql b/agc_2-X/trunk/extras/upgrade_2.6.sql index 4823a56c..9dc89330 100644 --- a/agc_2-X/trunk/extras/upgrade_2.6.sql +++ b/agc_2-X/trunk/extras/upgrade_2.6.sql @@ -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; + diff --git a/agc_2-X/trunk/www/agc/api.php b/agc_2-X/trunk/www/agc/api.php index 1acc1073..f094e56e 100644 --- a/agc_2-X/trunk/www/agc/api.php +++ b/agc_2-X/trunk/www/agc/api.php @@ -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 "
$data\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";} + $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 ################################################################################ diff --git a/agc_2-X/trunk/www/agc/conf_exten_check.php b/agc_2-X/trunk/www/agc/conf_exten_check.php index 78e24c0a..253fbea0 100644 --- a/agc_2-X/trunk/www/agc/conf_exten_check.php +++ b/agc_2-X/trunk/www/agc/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell