mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
New feature: Auto close and code a case on no answer / disconnected
This commit is contained in:
@@ -612,7 +612,7 @@ else
|
|||||||
ELSE
|
ELSE
|
||||||
CONCAT('<a href=\'casestatus.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Case status and assignment"). "\' data-toggle=\'tooltip\'><i class=\'fa fa-question-circle fa-2x\'></i></a>')
|
CONCAT('<a href=\'casestatus.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Case status and assignment"). "\' data-toggle=\'tooltip\'><i class=\'fa fa-question-circle fa-2x\'></i></a>')
|
||||||
END as casestatus
|
END as casestatus
|
||||||
FROM questionnaire";
|
FROM questionnaire ORDER BY questionnaire_id DESC";
|
||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
$columns = array("qid","description","status","enabledisable","outcomes","calls","casestatus","shifts","assample","quotareport","dataout","modify","setoutcomes","inlime","prefill","deletee");
|
$columns = array("qid","description","status","enabledisable","outcomes","calls","casestatus","shifts","assample","quotareport","dataout","modify","setoutcomes","inlime","prefill","deletee");
|
||||||
|
|||||||
1
call.php
1
call.php
@@ -451,6 +451,7 @@ switch($state)
|
|||||||
print "<div><input type='submit' value=\"" . T_("Hangup") . "\" name='submit' id='submit'/></div></form>";
|
print "<div><input type='submit' value=\"" . T_("Hangup") . "\" name='submit' id='submit'/></div></form>";
|
||||||
break;
|
break;
|
||||||
case 4: //requires coding
|
case 4: //requires coding
|
||||||
|
case 6:
|
||||||
print "<div class='status'>" . T_("Requires coding") . "</div>";
|
print "<div class='status'>" . T_("Requires coding") . "</div>";
|
||||||
print "<form action='?' method='post'>";
|
print "<form action='?' method='post'>";
|
||||||
display_outcomes(false,$call_attempt_id,$case_id);
|
display_outcomes(false,$call_attempt_id,$case_id);
|
||||||
|
|||||||
@@ -466,6 +466,7 @@ switch($state)
|
|||||||
case 2: //ringing
|
case 2: //ringing
|
||||||
case 3: //answered
|
case 3: //answered
|
||||||
case 4: //requires coding
|
case 4: //requires coding
|
||||||
|
case 6: //no answer
|
||||||
// print "<div class='status'>" . T_("Requires coding") . "</div>";
|
// print "<div class='status'>" . T_("Requires coding") . "</div>";
|
||||||
print "<form action='?' method='post'><div class=\" \">";
|
print "<form action='?' method='post'><div class=\" \">";
|
||||||
display_outcomes(false,$call_attempt_id,$case_id);
|
display_outcomes(false,$call_attempt_id,$case_id);
|
||||||
|
|||||||
@@ -114,6 +114,11 @@ if (!defined('MEET_ME_ROOM')) define('MEET_ME_ROOM','5000');
|
|||||||
*/
|
*/
|
||||||
if (!defined('AUTO_POPUP')) define('AUTO_POPUP',false);
|
if (!defined('AUTO_POPUP')) define('AUTO_POPUP',false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to automatically code a no answer
|
||||||
|
*/
|
||||||
|
if (!defined('AUTO_CLOSE_NO_ANSWER')) define('AUTO_CLOSE_NO_ANSWER',false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The extension of the supervisor for dialing the supervisor
|
* The extension of the supervisor for dialing the supervisor
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -281,8 +281,9 @@ function import_file($file, $description, $fields, $firstrow = 2)
|
|||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
|
|
||||||
$sql = "INSERT INTO sample_import
|
$sql = "INSERT INTO sample_import
|
||||||
(sample_import_id, description)
|
(sample_import_id, description,call_restrict)
|
||||||
VALUES (NULL, '$description')";
|
VALUES (NULL, '$description',0)";
|
||||||
|
|
||||||
|
|
||||||
// print("$sql<br/>");
|
// print("$sql<br/>");
|
||||||
// if ($db->HasFailedTrans()) { print "FAILED"; exit(); }
|
// if ($db->HasFailedTrans()) { print "FAILED"; exit(); }
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ class voipWatch extends voip {
|
|||||||
/**
|
/**
|
||||||
* The call is ringing
|
* The call is ringing
|
||||||
*/
|
*/
|
||||||
if (preg_match("{Event: Dial.*SubEvent: Begin.*Channel: ((SIP/|IAX2/)[0-9]+)}is",$line,$regs))
|
if (preg_match("{Event: DialBegin.*Channel: ((SIP/|IAX2/)[0-9]+)}is",$line,$regs))
|
||||||
{
|
{
|
||||||
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
||||||
if ($call_id != 0)
|
if ($call_id != 0)
|
||||||
@@ -569,15 +569,24 @@ class voipWatch extends voip {
|
|||||||
/**
|
/**
|
||||||
* The call has been hung up
|
* The call has been hung up
|
||||||
*/
|
*/
|
||||||
else if (preg_match("{Event: Hangup.*Channel: ((SIP/|IAX2/)[0-9]+)}is",$line,$regs))
|
else if (preg_match("{Event: Hangup.*Channel: ((SIP/|IAX2/)[0-9]+).*Cause: ([0-9]+)}is",$line,$regs))
|
||||||
{
|
{
|
||||||
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
||||||
|
// print_r($regs);
|
||||||
if ($call_id != 0)
|
if ($call_id != 0)
|
||||||
{
|
{
|
||||||
|
if ($regs[3] == 16) { //Cause 16 - was ringing so this is an auto no-answer hangup
|
||||||
|
print T_("No Answer - Auto Hangup") . T_(" Extension ") . $regs[1] . " " . T_("Case id") . ": <a href=\"supervisor.php?case_id=$case_id\">$case_id</a>\n";
|
||||||
|
$this->setState($call_id,6,true);
|
||||||
|
} else if ($regs[3] == 19) { //Cause 19 - Disconnected
|
||||||
|
print T_("Disconnected - Auto Hangup") . T_(" Extension ") . $regs[1] . " " . T_("Case id") . ": <a href=\"supervisor.php?case_id=$case_id\">$case_id</a>\n";
|
||||||
|
$this->setState($call_id,7,true);
|
||||||
|
} else {
|
||||||
print T_("Hangup") . T_(" Extension ") . $regs[1] . " " . T_("Case id") . ": <a href=\"supervisor.php?case_id=$case_id\">$case_id</a>\n";
|
print T_("Hangup") . T_(" Extension ") . $regs[1] . " " . T_("Case id") . ": <a href=\"supervisor.php?case_id=$case_id\">$case_id</a>\n";
|
||||||
$this->setState($call_id,4,true);
|
$this->setState($call_id,4,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The status of an extension has changed to unregistered
|
* The status of an extension has changed to unregistered
|
||||||
|
|||||||
51
index.php
51
index.php
@@ -108,6 +108,56 @@ if (isset($_GET['endcase']))
|
|||||||
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
|
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
|
||||||
$db->Execute($sql);
|
$db->Execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$endthecase = true;
|
||||||
|
|
||||||
|
if (isset($_GET['outcome']))
|
||||||
|
{
|
||||||
|
$outcome_id = intval($_GET['outcome']);
|
||||||
|
end_call($operator_id,$outcome_id);
|
||||||
|
|
||||||
|
$sql = "SELECT tryanother
|
||||||
|
FROM outcome
|
||||||
|
WHERE outcome_id = '$outcome_id'";
|
||||||
|
|
||||||
|
$rs = $db->GetRow($sql);
|
||||||
|
|
||||||
|
if (!empty($rs) && $rs['tryanother'] == 1)
|
||||||
|
{
|
||||||
|
//we can try another number...
|
||||||
|
|
||||||
|
$case_id = get_case_id($operator_id,false);
|
||||||
|
$call_attempt_id = get_call_attempt($operator_id,false);
|
||||||
|
//check if there is another number to try...
|
||||||
|
$sql = "SELECT c. *
|
||||||
|
FROM contact_phone AS c
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT contact_phone.contact_phone_id
|
||||||
|
FROM contact_phone
|
||||||
|
LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )
|
||||||
|
LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )
|
||||||
|
WHERE contact_phone.case_id = '$case_id'
|
||||||
|
AND outcome.tryagain =0
|
||||||
|
) AS l ON l.contact_phone_id = c.contact_phone_id
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT contact_phone_id
|
||||||
|
FROM `call`
|
||||||
|
WHERE call_attempt_id = '$call_attempt_id'
|
||||||
|
AND outcome_id != 18
|
||||||
|
) as ca on ca.contact_phone_id = c.contact_phone_id
|
||||||
|
WHERE c.case_id = '$case_id'
|
||||||
|
AND l.contact_phone_id IS NULL
|
||||||
|
AND ca.contact_phone_id IS NULL"; //only select numbers that should be tried again and have not been tried in this attempt which are not the accidental hang up outcome
|
||||||
|
|
||||||
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
|
if (!empty($rs))
|
||||||
|
$endthecase = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($endthecase) {
|
||||||
end_call_attempt($operator_id);
|
end_call_attempt($operator_id);
|
||||||
end_case($operator_id);
|
end_case($operator_id);
|
||||||
|
|
||||||
@@ -116,6 +166,7 @@ if (isset($_GET['endcase']))
|
|||||||
//redirect back here
|
//redirect back here
|
||||||
header('Location: index.php');
|
header('Location: index.php');
|
||||||
exit();
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
//$db->StartTrans();
|
//$db->StartTrans();
|
||||||
//if ($db->HasFailedTrans()) {print "<p>FAILED AT ENDCASE</p>"; exit();}
|
//if ($db->HasFailedTrans()) {print "<p>FAILED AT ENDCASE</p>"; exit();}
|
||||||
|
|||||||
14
status.php
14
status.php
@@ -71,7 +71,13 @@ $state = is_on_call($operator_id);
|
|||||||
$btext = false;
|
$btext = false;
|
||||||
|
|
||||||
if ($state == 4 && AUTO_POPUP)
|
if ($state == 4 && AUTO_POPUP)
|
||||||
$btext = "onload=\"poptastic('call.php')\"";
|
$btext = "onload=\"parent.poptastic('call.php')\"";
|
||||||
|
|
||||||
|
if ($state == 6 && AUTO_CLOSE_NO_ANSWER)
|
||||||
|
$btext = "onload=\"parent.location.href = 'index.php?outcome=2&endcase=endcase&note=AutoCloseNoAnswer'\"";
|
||||||
|
|
||||||
|
if ($state == 7 && AUTO_CLOSE_NO_ANSWER)
|
||||||
|
$btext = "onload=\"parent.location.href = 'index.php?outcome=14&endcase=endcase&note=AutoCloseDisconnect'\"";
|
||||||
|
|
||||||
$js = array("js/popupkeep.js");
|
$js = array("js/popupkeep.js");
|
||||||
if (AUTO_LOGOUT_MINUTES !== false)
|
if (AUTO_LOGOUT_MINUTES !== false)
|
||||||
@@ -80,7 +86,7 @@ if (AUTO_LOGOUT_MINUTES !== false)
|
|||||||
$js[] = "js/childnap.js";
|
$js[] = "js/childnap.js";
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Status"),true,array("css/status.css"),$js,$btext,60,false,false,false,false);
|
xhtml_head(T_("Status"),true,array("css/status.css"),$js,$btext,5,false,false,false,false);
|
||||||
|
|
||||||
print "<div class='text'>" . get_operator_time($operator_id,DATE_TIME_FORMAT) ."</div>";
|
print "<div class='text'>" . get_operator_time($operator_id,DATE_TIME_FORMAT) ."</div>";
|
||||||
|
|
||||||
@@ -111,6 +117,10 @@ if (!$state || $state == 5)
|
|||||||
{
|
{
|
||||||
print("<div class='offline statusbutton'>" . T_("No call") . "</div>");
|
print("<div class='offline statusbutton'>" . T_("No call") . "</div>");
|
||||||
}
|
}
|
||||||
|
else if ($state == 6)
|
||||||
|
{
|
||||||
|
print("<div class='online statusbutton'>" . T_("No answer") . "</div>");
|
||||||
|
}
|
||||||
else if ($state == 4)
|
else if ($state == 4)
|
||||||
{
|
{
|
||||||
print("<div class='tobecoded statusbutton'>" . T_("To be coded") . "</div>");
|
print("<div class='tobecoded statusbutton'>" . T_("To be coded") . "</div>");
|
||||||
|
|||||||
Reference in New Issue
Block a user