Added Music on hold chooser to in-group screen

git-svn-id: svn://192.168.202.10@1216 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-09-04 20:03:12 +00:00
parent cce126488b
commit a38c85305a
4 changed files with 187 additions and 5 deletions
+25
View File
@@ -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:
<success is inferred by output of moh classes list>
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
+4 -3
View File
@@ -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 "<tr bgcolor=#B6D3FC><td align=right>Play Welcome Message: </td><td align=left><select size=1 name=play_welcome_message><option>ALWAYS</option><option>NEVER</option><option>IF_WAIT_ONLY</option><option>YES_UNLESS_NODELAY</option><option SELECTED>$play_welcome_message</option></select>$NWB#vicidial_inbound_groups-play_welcome_message$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Music On Hold Context: </td><td align=left><input type=text name=moh_context size=10 maxlength=20 value=\"$moh_context\">$NWB#vicidial_inbound_groups-moh_context$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Music On Hold Context: </td><td align=left><input type=text name=moh_context id=moh_context size=50 maxlength=50 value=\"$moh_context\"> <a href=\"javascript:launch_moh_chooser('moh_context','moh',500);\">moh chooser</a> $NWB#vicidial_inbound_groups-moh_context$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>On Hold Prompt Filename: </td><td align=left><input type=text name=onhold_prompt_filename id=onhold_prompt_filename size=50 maxlength=255 value=\"$onhold_prompt_filename\"> <a href=\"javascript:launch_chooser('onhold_prompt_filename','date',600);\">audio chooser</a> $NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE</td></tr>\n";
+14
View File
@@ -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 = '<IFRAME SRC="' + audiolistURL + '?' + audiolistQuery + '" style="width:740;height:440;background-color:white;" scrolling="NO" frameborder="0" allowtransparency="true" id="audio_chooser_frame' + epoch + '" name="audio_chooser_frame" width="740" height="460" STYLE="z-index:2"> </iframe>';
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';
+144 -2
View File
@@ -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 "<HTML><head><title>NON-AGENT API</title>\n";
echo "<script language=\"Javascript\">\n";
echo "function choose_file(filename,fieldname)\n";
echo " {\n";
echo " if (filename.length > 0)\n";
echo " {\n";
echo " parent.document.getElementById(fieldname).value = filename;\n";
echo " document.getElementById(\"selectframe\").innerHTML = '';\n";
echo " document.getElementById(\"selectframe\").style.visibility = 'hidden';\n";
echo " parent.close_chooser();\n";
echo " }\n";
echo " }\n";
echo "function close_file()\n";
echo " {\n";
echo " document.getElementById(\"selectframe\").innerHTML = '';\n";
echo " document.getElementById(\"selectframe\").style.visibility = 'hidden';\n";
echo " parent.close_chooser();\n";
echo " }\n";
echo "</script>\n";
echo "</head>\n\n";
echo "<body>\n";
echo "<a href=\"javascript:close_file();\"><font size=1 face=\"Arial,Helvetica\">close frame</font></a>\n";
echo "<div id='selectframe' style=\"height:400px;width:710px;overflow:scroll;\">\n";
echo "<table border=0 cellpadding=1 cellspacing=2 width=690 bgcolor=white><tr>\n";
echo "<td width=30>#</td>\n";
echo "<td colspan=2>Music On Hold Class</td>\n";
echo "<td>Name</td>\n";
echo "<td>Random</td>\n";
echo "</tr>\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 "<tr $bgcolor><td width=30><font size=1 face=\"Arial,Helvetica\">$sf</td>\n";
echo "<td colspan=2><a href=\"javascript:choose_file('$moh_id[$k]','$comments');\"><font size=2 face=\"Arial,Helvetica\">$moh_id[$k]</a></td>\n";
echo "<td><font size=2 face=\"Arial,Helvetica\">$moh_name[$k]</td>\n";
echo "<td><font size=2 face=\"Arial,Helvetica\">$random[$k]</td></tr>\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] &nbsp; ";
$m++;
}
echo "<tr $bgcolor><td colspan=2 width=100><font size=1 face=\"Arial,Helvetica\">&nbsp;</td>\n";
echo "<td colspan=3 width=590><font size=2 face=\"Arial,Helvetica\">Files: </font><font size=1 face=\"Arial,Helvetica\">$MOHfiles</td></tr>\n";
$k++;
}
echo "</table></div></body></HTML>\n";
exit;
}
}
}
################################################################################
### blind_monitor - sends call to phone from session from listening