From a38c85305a10b65b213042a6524669b554a93965 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 4 Sep 2009 20:03:12 +0000 Subject: [PATCH] Added Music on hold chooser to in-group screen git-svn-id: svn://192.168.202.10@1216 3d104415-ff17-0410-8863-d5cf3c621b8a --- docs/NON-AGENT_API.txt | 25 ++++++ www/vicidial/admin.php | 7 +- www/vicidial/admin_header.php | 14 ++++ www/vicidial/non_agent_api.php | 146 ++++++++++++++++++++++++++++++++- 4 files changed, 187 insertions(+), 5 deletions(-) diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index e5ba7edf..5d3617f3 100644 --- a/docs/NON-AGENT_API.txt +++ b/docs/NON-AGENT_API.txt @@ -20,6 +20,7 @@ Changes: 90428-0208 - Added blind_monitor function 90513-1720 - Added sounds_list function 90721-1432 - Added rank and owner +90904-1535 - Added moh_list function @@ -68,6 +69,30 @@ ERROR: sounds_list CENTRAL SOUND CONTROL IS NOT ACTIVE +-------------------------------------------------------------------------------- +moh_list - outputs a list of music on hold classes in the system + +NOTE: api user for this function must have user_level set to 7 or higher + +OPTIONAL FIELDS- +format - format of the output(tab, link, selectframe) +comments - name of the field to populate + + +Example URL strings for API calls: +http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=moh_list&format=selectframe&comments=fieldname&stage=date + +Example responses: + + +ERROR: moh_list USER DOES NOT HAVE PERMISSION TO VIEW SOUNDS LIST + +ERROR: moh_list CENTRAL SOUND CONTROL IS NOT ACTIVE + + + + + -------------------------------------------------------------------------------- blind_monitor - calls user-defined phone and places them in session as blind monitor diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 53439306..990f9a74 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1938,11 +1938,12 @@ else # 90808-0300 - Added longest_wait_time option for agent call routing # 90827-1552 - Added agent_script_override option for lists # 90830-2217 - Added Music On Hold section +# 90904-1536 - Added moh chooser option # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.2.0-213'; -$build = '90830-2217'; +$admin_version = '2.2.0-214'; +$build = '90904-1536'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -18645,7 +18646,7 @@ if ($ADD==3111) echo "Play Welcome Message: $NWB#vicidial_inbound_groups-play_welcome_message$NWE\n"; - echo "Music On Hold Context: $NWB#vicidial_inbound_groups-moh_context$NWE\n"; + echo "Music On Hold Context: moh chooser $NWB#vicidial_inbound_groups-moh_context$NWE\n"; echo "On Hold Prompt Filename: audio chooser $NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE\n"; diff --git a/www/vicidial/admin_header.php b/www/vicidial/admin_header.php index 40d70f6f..4a27ef91 100644 --- a/www/vicidial/admin_header.php +++ b/www/vicidial/admin_header.php @@ -15,6 +15,7 @@ # 90627-0548 - Added no-agent-no-queue options # 90628-1016 - Added Text-to-speech options # 90830-2213 - Added Music On Hold options +# 90904-1534 - Added launch_moh_chooser # @@ -396,6 +397,19 @@ else document.getElementById("audio_chooser_span").innerHTML = Iframe_content; } + function launch_moh_chooser(fieldname,stage,vposition) + { + var audiolistURL = "./non_agent_api.php"; + var audiolistQuery = "source=admin&function=moh_list&user=" + user + "&pass=" + pass + "&format=selectframe&stage=" + stage + "&comments=" + fieldname; + var Iframe_content = ''; + + document.getElementById("audio_chooser_span").style.position = "absolute"; + document.getElementById("audio_chooser_span").style.left = "220px"; + document.getElementById("audio_chooser_span").style.top = vposition + "px"; + document.getElementById("audio_chooser_span").style.visibility = 'visible'; + document.getElementById("audio_chooser_span").innerHTML = Iframe_content; + } + function close_chooser() { document.getElementById("audio_chooser_span").style.visibility = 'hidden'; diff --git a/www/vicidial/non_agent_api.php b/www/vicidial/non_agent_api.php index da8d1ad4..f84246dd 100644 --- a/www/vicidial/non_agent_api.php +++ b/www/vicidial/non_agent_api.php @@ -25,10 +25,11 @@ # 90522-0506 - Security fix # 90530-0946 - Added QueueMetrics blind monitoring option # 90721-1428 - Added rank and owner as vicidial_list fields +# 90904-1535 - Added moh_list # -$version = '2.2.0-11'; -$build = '90721-1428'; +$version = '2.2.0-12'; +$build = '90904-1535'; require("dbconnect.php"); @@ -449,6 +450,147 @@ if ($function == 'sounds_list') +################################################################################ +### moh_list - sends a list of the moh classes in the system +################################################################################ +if ($function == 'moh_list') + { + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_user=$row[0]; + if ($allowed_user < 1) + { + $result = 'ERROR'; + $result_reason = "sounds_list USER DOES NOT HAVE PERMISSION TO VIEW SOUNDS LIST"; + echo "$result: $result_reason: |$user|$allowed_user|\n"; + $data = "$allowed_user"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + exit; + } + else + { + $server_name = getenv("SERVER_NAME"); + $server_port = getenv("SERVER_PORT"); + if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} + $admDIR = "$HTTPprotocol$server_name:$server_port"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT use_non_latin,sounds_central_control_active,sounds_web_server,sounds_web_directory FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ss_conf_ct = mysql_num_rows($rslt); + if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $sounds_central_control_active = $row[1]; + $sounds_web_server = $row[2]; + $sounds_web_directory = $row[3]; + } + ##### END SETTINGS LOOKUP ##### + ########################################### + + if ($sounds_central_control_active < 1) + { + $result = 'ERROR'; + $result_reason = "sounds_list CENTRAL SOUND CONTROL IS NOT ACTIVE"; + echo "$result: $result_reason: |$user|$sounds_central_control_active|\n"; + $data = "$sounds_central_control_active"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + exit; + } + else + { + echo "\n"; + echo "NON-AGENT API\n"; + echo "\n"; + echo "\n\n"; + + echo "\n"; + echo "close frame\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT moh_id,moh_name,random from vicidial_music_on_hold where active='Y' order by moh_id"; + $rslt=mysql_query($stmt, $link); + $moh_to_print = mysql_num_rows($rslt); + $k=0; + $sf=0; + while ($moh_to_print > $k) + { + $rowx=mysql_fetch_row($rslt); + $moh_id[$k] = $rowx[0]; + $moh_name[$k] = $rowx[1]; + $random[$k] = $rowx[2]; + $k++; + } + + $k=0; + $sf=0; + while ($moh_to_print > $k) + { + $sf++; + if (eregi("1$|3$|5$|7$|9$", $sf)) + {$bgcolor='bgcolor="#E6E6E6"';} + else + {$bgcolor='bgcolor="#F6F6F6"';} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT filename from vicidial_music_on_hold_files where moh_id='$moh_id[$k]';"; + $rslt=mysql_query($stmt, $link); + $mohfiles_to_print = mysql_num_rows($rslt); + $m=0; + while ($mohfiles_to_print > $m) + { + $rowx=mysql_fetch_row($rslt); + $MOHfiles .= "$rowx[0]   "; + $m++; + } + + + echo "\n"; + echo "\n"; + + $k++; + } + echo "
#Music On Hold ClassNameRandom
$sf$moh_id[$k]$moh_name[$k]$random[$k]
 Files: $MOHfiles
\n"; + + exit; + } + } + } + + + ################################################################################ ### blind_monitor - sends call to phone from session from listening