$case_id = get_case_id($operator_id); $fname = get_respondent_variable("firstName", $respondent_id); $lname = get_respondent_variable("lastName", $respondent_id); print "<h4>" . T_("Name") . ": {$fname} {$lname}</h4>"; $appointment = is_on_appointment($ca); $call_id = get_call($operator_id); $sql = "SELECT o.tryanother, o.require_note\r\n\t\tFROM `call` as c, `outcome` as o\r\n\t\tWHERE c.call_attempt_id = '{$ca}'\r\n\t\tAND c.outcome_id = o.outcome_id\r\n\t\tORDER BY call_id DESC\r\n\t\tLIMIT 1"; $rst = $db->GetRow($sql); if (empty($rst) || $rst['tryanother'] == 1) { if (isset($_POST['contactphone'])) { $pcontact_phone_id = intval($_POST['contactphone']); //If an outcome already assigned, end the current call and start the enxt one to pcontact_phone_id //Otherwise bring up the assign outcome window if (!$call_id) { $call_id = get_call($operator_id, $respondent_id, $pcontact_phone_id, true); echo "<script type='text/javascript'>openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id, false) . "\");</script>"; } else { //bring up assign outcome window print "<script type='text/javascript'>parent.poptastic('call_interface2.php');</script>"; } } if (!$call_id) { $sql = "SELECT c. *\r\n FROM contact_phone AS c\r\n LEFT JOIN (\r\n SELECT contact_phone.contact_phone_id\r\n FROM contact_phone\r\n LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )\r\n LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )\r\n WHERE contact_phone.case_id = '{$case_id}'\r\n AND outcome.tryagain =0\r\n ) AS l ON l.contact_phone_id = c.contact_phone_id\r\n LEFT JOIN\r\n (\r\n SELECT contact_phone_id\r\n FROM `call`\r\n WHERE call_attempt_id = '{$ca}'\r\n AND outcome_id != 18\r\n ) as ca on ca.contact_phone_id = c.contact_phone_id\r\n WHERE c.case_id = '{$case_id}'\r\n AND l.contact_phone_id IS NULL\r\n AND ca.contact_phone_id IS NULL\r\n\t\t\t\torder by c.priority ASC"; $numsa = $db->GetRow($sql); if (!empty($numsa)) { if ($appointment) { //create a call on the appointment number $sql = "SELECT cp.*\r\n\t\t\t\t\t\tFROM contact_phone as cp, appointment as a\r\n\t\t\t\t\t\tWHERE cp.case_id = '{$case_id}'\r\n\t\t\t\t\t\tAND a.appointment_id = '{$appointment}'\r\n\t\t\t\t\t\tAND a.contact_phone_id = cp.contact_phone_id"; $rs = $db->GetRow($sql); $contact_phone_id = $rs['contact_phone_id']; } else {
xhtml_head(T_("Call"), true, array("css/call.css"), array($js), "onload='toggleRec(\"{$newtext}\",\"record.php?start=start\",\"offline\"); openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id) . "\"); parent.closePopup();'", false, false, false, false); } else { //if no outcome selected, just hang up the call if (is_voip_enabled($operator_id)) { include "functions/functions.voip.php"; $v = new voip(); $v->connect(VOIP_SERVER); $v->hangup(get_extension($operator_id)); } //disable recording $newtext = T_("Start REC"); $js = "js/window.js"; if (browser_ie()) { $js = "js/window_ie6.js"; } xhtml_head(T_("Call"), true, array("css/call.css"), array($js), "onload='toggleRec(\"{$newtext}\",\"record.php?start=start\",\"offline\"); openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id) . "\"); parent.closePopup();'", false, false, false, false); } } print "<p></p>"; //for XHTML xhtml_foot(); $db->CompleteTrans(); exit; } $call_attempt_id = get_call_attempt($operator_id, false); $case_id = get_case_id($operator_id); /** * Set the state manually if necessary (i.e if VOIP state is playing up) */ if (isset($_GET['newstate'])) { $ns = bigintval($_GET['newstate']);
$sql = "SELECT c. *\r\n\t\t\t\t\t\tFROM contact_phone AS c\r\n\t\t\t\t\t\tLEFT JOIN (\r\n\t\t\t\t\t\t\t\tSELECT contact_phone.contact_phone_id\r\n\t\t\t\t\t\t\t\tFROM contact_phone\r\n\t\t\t\t\t\t\t\tLEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )\r\n\t\t\t\t\t\t\t\tLEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )\r\n\t\t\t\t\t\t\t\tWHERE contact_phone.case_id = '{$case_id}'\r\n\t\t\t\t\t\t\t\tAND outcome.tryagain =0\r\n\t\t\t\t\t\t\t ) AS l ON l.contact_phone_id = c.contact_phone_id\r\n\t\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t SELECT contact_phone_id\r\n\t\t\t\t\t\t FROM `call`\r\n\t\t\t\t\t\t WHERE call_attempt_id = '{$ca}'\r\n\t\t\t\t\t\t AND outcome_id NOT IN (15,18)\r\n\t\t\t\t\t\t) as ca on ca.contact_phone_id = c.contact_phone_id\r\n\t\t\t\t\t\tWHERE c.case_id = '{$case_id}'\r\n\t\t\t\t\t\tAND l.contact_phone_id IS NULL\r\n\t\t\t\t\t\tAND ca.contact_phone_id IS NULL\r\n\t\t\t\t\t\torder by c.priority ASC"; } $rs = $db->GetRow($sql); if (!empty($rs)) { $contact_phone_id = $rs['contact_phone_id']; if (!isset($rs['respondent_id'])) { $sql = "SELECT respondent_id\r\n\t\t\t\t\t\t\tFROM respondent\r\n\t\t\t\t\t\t\tWHERE case_id = {$case_id}"; $respondent_id = $db->GetOne($sql); } else { $respondent_id = $rs['respondent_id']; } $call_id = get_call($operator_id, $respondent_id, $contact_phone_id, true); } } if (!is_respondent_selection($operator_id)) { $data = get_limesurvey_url($operator_id); } else { $data = get_respondentselection_url($operator_id, true, true); } //use second interface xhtml_object($data, "main-content", "embeddedobject content"); ?> </div> </div> <?php xhtml_foot(); //if ($db->HasFailedTrans()){ print "<p>FAILED AT END of index</p>"; exit();} $db->CompleteTrans();
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"); } if (isset($_GET['interface2'])) { if (browser_ie()) { $jsw = "js/window_ie6_interface2.js"; } else { $jsw = "js/window_interface2.js"; } } else { if (browser_ie()) {