* @copyright ACSPRI 2010 * @package queXS * @subpackage user * @link http://www.acspri.org.au/ queXS was writen for ACSPRI - Australian Consortium for Social and Political Research Inc. * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * */ /** * Configuration file */ include ("config.inc.php"); /** * XHTML functions */ include ("functions/functions.xhtml.php"); /** * Language functions */ include ("lang.inc.php"); if (isset($_GET['contact_phone'])) { include_once ("functions/functions.operator.php"); include_once ("functions/functions.input.php"); $operator_id = get_operator_id(); $contact_phone_id = bigintval($_GET['contact_phone']); $call_attempt_id = get_call_attempt($operator_id,false); $respondent_id = get_respondent_id($call_attempt_id); $call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true); if ($call_id) { if (is_voip_enabled($operator_id)) { include("functions/functions.voip.php"); $v = new voip(); $v->connect(VOIP_SERVER); $v->dial(get_extension($operator_id),get_call_number($call_id)); } header('Location: '.get_respondentselection_url($operator_id,false)); die(); } } $js = array(); if (AUTO_LOGOUT_MINUTES !== false) $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js"); $jsw = "js/window.js"; if (browser_ie()) $jsw = "js/window_ie6.js"; $js[] = $jsw; xhtml_head(T_("No call available"),true,array("css/table.css"),$js); ?>
GetOne($sql); } else { //determine whether we should make any more calls based on the last call outcome $sql = "SELECT o.tryanother, o.require_note FROM `call` as c, `outcome` as o WHERE c.call_attempt_id = '$call_attempt_id' AND c.outcome_id = o.outcome_id ORDER BY call_id DESC LIMIT 1"; $rs = $db->GetRow($sql); if ((empty($rs) || $rs['tryanother'] == 1)) //dial another number only when available and not ending { $rn = 0; if (!empty($rs) && $rs['require_note'] == 1) $rn = 1; //an exclusion left join $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 //could be updated to take in to account the time delay and outcome $rs = $db->GetAll($sql); if (!empty($rs)) { $contact_phone_id = $rs[0]['contact_phone_id']; } } } $jsfunctocall = ""; $texttodisplay = ""; $endtexttodisplay = ""; if ($contact_phone_id !== false) { //got a number to dial so initiate the countdown to begin dialing $texttodisplay = TQ_("Will dial in"); $endtexttodisplay = TQ_("Dialling now"); $jsfunctocall = "document.location.href = 'nocallavailable.php?contact_phone=" . $contact_phone_id . "';"; } else { //no more numbers to dial so initiate the countdown to end the case $texttodisplay = TQ_("Will end case in"); $endtexttodisplay = TQ_("Ending case now"); $jsfunctocall = "openParent('endcase=endcase');"; } print ""; print " "; } else { //voip extension not active print "