added experimental voice_lab.php script for speech lab functionality
git-svn-id: svn://192.168.202.10@441 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -324,6 +324,9 @@ exten => _X48600XXX,2,Hangup
|
||||
exten => _X38600XXX,1,MeetMeAdmin(${EXTEN:2},t,${EXTEN:0:1})
|
||||
exten => _X38600XXX,2,Hangup
|
||||
|
||||
exten => _55558600XXX,1,MeetMeAdmin(${EXTEN:4},K)
|
||||
exten => _55558600XXX,2,Hangup
|
||||
|
||||
exten => 8300,1,Hangup
|
||||
|
||||
; VICIDIAL conferences
|
||||
@@ -482,6 +485,12 @@ exten => _78600XXX,1,Meetme,${EXTEN:1}|q
|
||||
; quiet monitor extensions for meetme rooms (for room managers)
|
||||
exten => _68600XXX,1,Meetme,${EXTEN:1}|mq
|
||||
|
||||
; voicelab exten
|
||||
exten => _86009XX,1,Meetme,${EXTEN}|mq
|
||||
; voicelab exten moderator
|
||||
exten => _986009XX,1,Meetme,${EXTEN:1}
|
||||
|
||||
|
||||
|
||||
; park channel for client GUI parking, hangup after 30 minutes
|
||||
; create a GSM formatted audio file named "park.gsm" that is 30 minutes long
|
||||
|
||||
@@ -34,6 +34,7 @@ conf => 8600026
|
||||
conf => 8600027
|
||||
conf => 8600028
|
||||
conf => 8600029
|
||||
|
||||
conf => 8600051
|
||||
conf => 8600052
|
||||
conf => 8600053
|
||||
@@ -184,3 +185,14 @@ conf => 8600197
|
||||
conf => 8600198
|
||||
conf => 8600199
|
||||
conf => 8600200
|
||||
|
||||
conf => 8600900
|
||||
conf => 8600901
|
||||
conf => 8600902
|
||||
conf => 8600903
|
||||
conf => 8600904
|
||||
conf => 8600905
|
||||
conf => 8600906
|
||||
conf => 8600907
|
||||
conf => 8600908
|
||||
conf => 8600909
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
<?
|
||||
### voice_lab.php
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
# 61220-1050 - First Build
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
|
||||
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
|
||||
if (isset($_GET["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_GET["NEW_VOICE_LAB"];}
|
||||
elseif (isset($_POST["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_POST["NEW_VOICE_LAB"];}
|
||||
if (isset($_GET["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_GET["KILL_VOICE_LAB"];}
|
||||
elseif (isset($_POST["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_POST["KILL_VOICE_LAB"];}
|
||||
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
||||
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
|
||||
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
|
||||
|
||||
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
|
||||
|
||||
$STARTtime = date("U");
|
||||
$TODAY = date("Y-m-d");
|
||||
$MYSQL_datetime = date("Y-m-d H:i:s");
|
||||
$FILE_datetime = date("Ymd-His_");
|
||||
$secX = $STARTtime;
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
$fp = fopen ("./project_auth_entries.txt", "a");
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
|
||||
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($auth>0)
|
||||
{
|
||||
$office_no=strtoupper($PHP_AUTH_USER);
|
||||
$password=strtoupper($PHP_AUTH_PW);
|
||||
$stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LOGfullname=$row[0];
|
||||
fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
|
||||
fclose($fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$stmt="SELECT full_name from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
|
||||
}
|
||||
|
||||
|
||||
##### get server listing for dynamic pulldown
|
||||
$stmt="SELECT server_ip,server_description from servers order by server_ip";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$servers_to_print = mysql_num_rows($rslt);
|
||||
$servers_list='';
|
||||
|
||||
$o=0;
|
||||
while ($servers_to_print > $o)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
|
||||
$o++;
|
||||
}
|
||||
|
||||
##### get campaigns listing for dynamic pulldown
|
||||
$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$campaigns_to_print = mysql_num_rows($rslt);
|
||||
$campaigns_list='';
|
||||
|
||||
$o=0;
|
||||
while ($campaigns_to_print > $o)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
|
||||
$o++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>VICIDIAL VOICE LAB: Admin</title>
|
||||
<?
|
||||
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
?>
|
||||
</head>
|
||||
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
|
||||
<CENTER>
|
||||
|
||||
<?
|
||||
if ($NEW_VOICE_LAB > 0)
|
||||
{
|
||||
if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) )
|
||||
{
|
||||
echo "<br><br><br>TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW<br><br><br>\n";
|
||||
|
||||
|
||||
$S='*';
|
||||
$D_s_ip = explode('.', $server_ip);
|
||||
if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";}
|
||||
if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";}
|
||||
if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";}
|
||||
if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";}
|
||||
if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";}
|
||||
if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";}
|
||||
if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";}
|
||||
if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";}
|
||||
$remote_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$session_id";
|
||||
|
||||
$thirty_minutes_old = mktime(date("H"), date("i"), date("s")-30, date("m"), date("d"), date("Y"));
|
||||
$past_thirty = date("Y-m-d H:i:s",$thirty_minutes_old);
|
||||
|
||||
$stmt="SELECT conf_exten,server_ip,user from vicidial_live_agents where last_update_time > '$past_thirty' and campaign_id='$campaign_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$agents_to_loop = mysql_num_rows($rslt);
|
||||
$agents_sessions[0]='';
|
||||
$agents_servers[0]='';
|
||||
$agents_users[0]='';
|
||||
|
||||
$o=0;
|
||||
while ($agents_to_loop > $o)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$agents_sessions[$o] = "$rowx[0]";
|
||||
$agents_servers[$o] = "$rowx[1]";
|
||||
$agents_users[$o] = "$rowx[2]";
|
||||
$o++;
|
||||
}
|
||||
|
||||
$o=0;
|
||||
while ($agents_to_loop > $o)
|
||||
{
|
||||
if ($agents_servers[$o] == "$server_ip")
|
||||
{$dial_string = $session_id;}
|
||||
else
|
||||
{$dial_string = $remote_dialstring;}
|
||||
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$agents_servers[$o]','','Originate','VL$FILE_datetime$o','Channel: $local_DEF$dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $agents_sessions[$o]','Priority: 1','Callerid: VL$FILE_datetime$o','','','','','')";
|
||||
echo "|$stmt|\n<BR><BR>\n";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
echo "LOGGED IN USER $agents_users[$o] at session $agents_sessions[$o] on server $agents_servers[$o]\n";
|
||||
|
||||
$o++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n";
|
||||
echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n";
|
||||
echo "<input type=hidden name=session_id value=8600900>\n";
|
||||
echo "<input type=hidden name=server_ip value=$server_ip>\n";
|
||||
echo "<input type=hidden name=campaign_id value=$campaign_id>\n";
|
||||
echo "<input type=submit name=submit value='KILL THIS VOICE LAB'>\n";
|
||||
echo "</form><BR><BR><BR>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n";
|
||||
echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br>Start a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n";
|
||||
echo "<input type=hidden name=NEW_VOICE_LAB value=2>\n";
|
||||
echo "<input type=hidden name=session_id value=8600900>\n";
|
||||
echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n";
|
||||
echo "<BR>\n";
|
||||
echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>";
|
||||
echo "<BR>\n";
|
||||
echo "<input type=submit name=submit value=submit>\n";
|
||||
echo "</form><BR><BR><BR>\n";
|
||||
|
||||
|
||||
echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n";
|
||||
echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n";
|
||||
echo "<input type=hidden name=session_id value=8600900>\n";
|
||||
echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n";
|
||||
echo "<BR>\n";
|
||||
echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>";
|
||||
echo "<BR>\n";
|
||||
echo "<input type=submit name=submit value=submit>\n";
|
||||
echo "</form><BR><BR><BR>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($KILL_VOICE_LAB > 1)
|
||||
{
|
||||
if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) )
|
||||
{
|
||||
$kill_dial_string = "5555$session_id";
|
||||
$hangup_exten='8300';
|
||||
$stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VLK$FILE_datetime','Channel: $local_DEF$kill_dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $hangup_exten','Priority: 1','Callerid: VLK$FILE_datetime','','','','','')";
|
||||
echo "|$stmt|\n<BR><BR>\n";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
echo "VOICELAB SESSION KILLED: $session_id at $server_ip | $KILL_VOICE_LAB\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n";
|
||||
echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</BODY></HTML>
|
||||
Reference in New Issue
Block a user