mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
VoIP is done on an operator by operator basis
This commit is contained in:
@@ -62,14 +62,16 @@ if (isset($_POST['operator']))
|
||||
$supervisor = 0;
|
||||
$temporary = 0;
|
||||
$refusal = 0;
|
||||
$voip = 0;
|
||||
if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1;
|
||||
if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1;
|
||||
if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1;
|
||||
if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1;
|
||||
if (!empty($_POST['operator']))
|
||||
{
|
||||
$sql = "INSERT INTO operator
|
||||
(`operator_id` ,`username` ,`firstName` ,`lastName`, `extension`, `Time_zone_name`)
|
||||
VALUES (NULL , $operator, $firstname , $lastname, $extension, $time_zone_name);";
|
||||
(`operator_id` ,`username` ,`firstName` ,`lastName`, `extension`, `Time_zone_name`,`voip`)
|
||||
VALUES (NULL , $operator, $firstname , $lastname, $extension, $time_zone_name, $voip);";
|
||||
|
||||
if ($db->Execute($sql))
|
||||
{
|
||||
@@ -123,6 +125,7 @@ if ($a)
|
||||
<p><? echo T_("Enter the surname of an operator to add:"); ?> <input name="lastname" type="text"/></p>
|
||||
<p><? echo T_("Enter the Time Zone of an operator to add:"); ?> <input name="Time_zone_name" type="text" value="<? echo DEFAULT_TIME_ZONE; ?>"/></p>
|
||||
<p><? echo T_("Enter the telephone extension number:"); ?> <input name="extension" type="text"/></p>
|
||||
<p><? echo T_("Will this operator be using VoIP?"); ?> <input name="voip" type="checkbox" checked="checked"/></p>
|
||||
<p><? echo T_("Is the operator a normal interviewer?"); ?> <input name="temporary" type="checkbox" checked="checked"/></p>
|
||||
<p><? echo T_("Is the operator a supervisor?"); ?> <input name="supervisor" type="checkbox"/></p>
|
||||
<p><? echo T_("Is the operator a refusal converter?"); ?> <input name="refusal" type="checkbox"/></p>
|
||||
@@ -134,4 +137,3 @@ if ($a)
|
||||
xhtml_foot();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
10
call.php
10
call.php
@@ -155,7 +155,7 @@ if (isset($_POST['submit']))
|
||||
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true);
|
||||
if ($call_id)
|
||||
{
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
@@ -173,7 +173,7 @@ if (isset($_POST['submit']))
|
||||
{
|
||||
$outcome_id = bigintval($_POST['outcome']);
|
||||
end_call($operator_id,$outcome_id);
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
@@ -187,7 +187,7 @@ if (isset($_POST['submit']))
|
||||
else
|
||||
{
|
||||
//if no outcome selected, just hang up the call
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
@@ -251,7 +251,7 @@ switch($state)
|
||||
{
|
||||
//determine whether to begin calling based on extension status
|
||||
$es = 1;
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
@@ -331,7 +331,7 @@ switch($state)
|
||||
{
|
||||
//determine whether to begin calling based on extension status
|
||||
$es = 1;
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
|
||||
@@ -304,6 +304,7 @@ CREATE TABLE `operator` (
|
||||
`extension` varchar(10) NOT NULL,
|
||||
`Time_zone_name` char(64) NOT NULL,
|
||||
`enabled` tinyint(1) NOT NULL default '1',
|
||||
`voip` tinyint(1) NOT NULL default '1',
|
||||
PRIMARY KEY (`operator_id`),
|
||||
UNIQUE KEY `username` (`username`),
|
||||
UNIQUE KEY `extension` (`extension`)
|
||||
|
||||
@@ -44,6 +44,32 @@ include_once(dirname(__FILE__).'/../config.inc.php');
|
||||
include_once(dirname(__FILE__).'/../db.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
* Return if VOIP is enabled on an operator by operator basis
|
||||
* Will always return false if VOIP is globally disabled
|
||||
*
|
||||
* @param int $operator_id the operator id
|
||||
* @return bool True if enabled, false if not
|
||||
*/
|
||||
function is_voip_enabled($operator_id)
|
||||
{
|
||||
if (VOIP_ENABLED == false)
|
||||
return false;
|
||||
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT voip
|
||||
FROM operator
|
||||
WHERE operator_id = '$operator_id'";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if ($rs['voip'] == '1')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the period of the day for the respondent
|
||||
*
|
||||
|
||||
@@ -2094,7 +2094,7 @@ UpdateSessionGroupList($_SESSION['s_lang']);
|
||||
{
|
||||
if (isset($_GET[$field]))
|
||||
{
|
||||
$_SESSION[$field]=$_GET[$field];
|
||||
$_SESSION[$field]=urldecode($_GET[$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ if (is_on_call($operator_id) == 3)
|
||||
{
|
||||
$newtext = T_("Stop REC");
|
||||
xhtml_head(T_("Record"),true,array("css/call.css"),array("js/window.js"),"onload='toggleRec(\"$newtext\",\"record.php?stop=stop\",\"online\")'");
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
$call_id = get_call($operator_id);
|
||||
if ($call_id)
|
||||
@@ -77,7 +77,7 @@ if (is_on_call($operator_id) == 3)
|
||||
{
|
||||
$newtext = T_("Start REC");
|
||||
xhtml_head(T_("Record"),true,array("css/call.css"),array("js/window.js"),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\")'");
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
|
||||
@@ -58,7 +58,7 @@ $btext = false;
|
||||
if ($state == 4 && AUTO_POPUP)
|
||||
$btext = "onload=\"poptastic('call.php')\"";
|
||||
|
||||
xhtml_head(T_("Status"),true,array("css/status.css"),array("js/popupkeep.js"),$btext,5);
|
||||
xhtml_head(T_("Status"),true,array("css/status.css"),array("js/popupkeep.js"),$btext,10);
|
||||
|
||||
print "<div class='text'>" . get_operator_time($operator_id,"%a %d %b %h:%i%p") ."</div>";
|
||||
|
||||
@@ -66,16 +66,16 @@ print "<div class='text'>" . get_operator_time($operator_id,"%a %d %b %h:%i%p")
|
||||
|
||||
//Then confirm whether or not they are on a call (or use the database table, call to determine)
|
||||
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
$v->connect(VOIP_SERVER);
|
||||
$ext = get_extension($operator_id);
|
||||
if ($v->getExtensionStatus($ext))
|
||||
print "<div class='online statusbutton'><a href='news://turnvoipoff/'>" . T_("VoIP On") . "</a></div>";
|
||||
print "<div class='online statusbutton'>" . T_("VoIP On") . "</div>";
|
||||
else
|
||||
print "<div class='offline statusbutton'><a href='irc://$ext:$ext@" . VOIP_SERVER . "'>" . T_("VoIP Off") . "</a></div>";
|
||||
print "<div class='offline statusbutton'>" . T_("VoIP Off") . "</div>";
|
||||
}
|
||||
else
|
||||
print "<div class='online statusbutton'>" . T_("No VoIP") . "</div>";
|
||||
|
||||
@@ -58,19 +58,28 @@ $callstatus = is_on_call($operator_id);
|
||||
|
||||
if ($callstatus == 3) //On a call
|
||||
{
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
if (isset($_GET['callsupervisor']))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
$v->connect(VOIP_SERVER);
|
||||
$v->addParty(get_extension($operator_id),SUPERVISOR_EXTENSION);
|
||||
print "<p>" . T_("Calling the supervisor, you may close this window") . "</p>";
|
||||
if (strcmp($_GET['callsupervisor'],"hangup") == 0)
|
||||
{
|
||||
$v->hangup(get_extension($operator_id));
|
||||
print "<p>" . T_("You may now close this window") . "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$v->addParty(get_extension($operator_id),SUPERVISOR_EXTENSION);
|
||||
print "<p>" . T_("Calling the supervisor, you may close this window") . "</p>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p><a href='?callsupervisor=callsupervisor'>" . T_("Click here to call the supervisor's phone. A conference call will be created with the respondent, yourself and the supervisor. Otherwise close this window") . "</a></p>";
|
||||
// print "<p><a href='?callsupervisor=hangup'>" . T_("Hangup when calling the supervisor") . "</a></p>";
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -80,19 +89,28 @@ if ($callstatus == 3) //On a call
|
||||
}
|
||||
else if ($callstatus == 0 || $callstatus == 4 || $callstatus == 5)
|
||||
{
|
||||
if (VOIP_ENABLED)
|
||||
if (is_voip_enabled($operator_id))
|
||||
{
|
||||
if (isset($_GET['callsupervisor']))
|
||||
{
|
||||
include("functions/functions.voip.php");
|
||||
$v = new voip();
|
||||
$v->connect(VOIP_SERVER);
|
||||
$v->dial(get_extension($operator_id),SUPERVISOR_EXTENSION);
|
||||
print "<p>" . T_("Calling the supervisor, you may close this window") . "</p>";
|
||||
if (strcmp($_GET['callsupervisor'],"hangup") == 0)
|
||||
{
|
||||
$v->hangup(get_extension($operator_id));
|
||||
print "<p>" . T_("You may now close this window") . "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$v->dial(get_extension($operator_id),SUPERVISOR_EXTENSION);
|
||||
print "<p>" . T_("Calling the supervisor, you may close this window") . "</p>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p><a href='?callsupervisor=callsupervisor'>" . T_("Click here to call the supervisor's phone. Otherwise close this window") . "</a></p>";
|
||||
// print "<p><a href='?callsupervisor=hangup'>" . T_("Hangup when calling the supervisor") . "</a></p>";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user