if ($can_qty == 'NA') { $can_qty = 0; } $handpick = $_POST['handpick']; // Job variables $message = $_POST['message']; $caller_id = $_POST['caller_id']; $timestamp = $_POST['timestamp']; $session_id = $_POST['session_id']; $p_t = $_POST['p_t']; $mileage = $_POST['mileage']; // Initialize variables $job_name = ''; $employee_name = ''; // Parse passthrough data (p_t) to an array $p_t_Array = IfByPhone_Util::processPassThrough($p_t); // Create variables from data needed in the passthrough array $event_id = $p_t_Array['event_id']; $job_name = $p_t_Array['company']; $employee_name = $p_t_Array['employee_name']; $job_id = $p_t_Array['job_pk_id']; // If user hung up the tasks will be "NA". Exit script and do not update the database if ($sweep == 'NA' || $trashcans == 'NA' || $handpick == 'NA') { Database::logMessage('Hangup without service tasks with passthrough (' . $p_t . ')'); exit; } // If user entered "No" (case sensitive) for all options, send them to the IVR error message: // (4. Sweep - All NO Answers Error) and reprompt. // Not all answers can be "No". if ($sweep == 'No' && $trashcans == 'No' && $handpick == 'No') { echo "<action>\n\t\t\t<app>survo</app>\n\t\t\t\t<parameters>\n\t\t\t\t\t<id>412191</id>\n\t\t\t\t\t<p_t>" . $p_t . "</p_t>\n\t\t\t\t</parameters>\n\t\t\t</action>";
// This is caused by a hangup without entering information. Check for this first and exit without logging an error. if ($servicecategory == 'NA') { Database::logMessage('Hangup without servicecategory with passthrough (' . $p_t . ')'); exit; } $caller_id = $_POST['caller_id']; $timestamp = $_POST['timestamp']; $session_id = $_POST['session_id']; $employee_id = ''; $job_id = ''; $job_pk_id = ''; $job_name = ''; $employee_name = ''; $p_t = $_POST['p_t']; // passthrough data = employee_id|value||job_id|value $passthrough_array = IfByPhone_Util::processPassThrough($p_t); $employee_id = $passthrough_array['employee_id']; $job_id = $passthrough_array['job_id']; $job_pk_id = $passthrough_array['job_pk_id']; $job_name = $passthrough_array['company']; $employee_name = $passthrough_array['employee_name']; try { // create connection to DB $conn = Database::getDB(); $query = "CALL start_event('{$servicecategory}','{$caller_id}','{$timestamp}','{$session_id}','{$employee_id}','{$job_id}')"; $conn->query($query); // update successful - play event started message echo "<action>\n\t\t\t<app>survo</app>\n\t\t\t\t<parameters>\n\t\t\t\t\t<id>368911</id>\n\t\t\t\t</parameters>\n\t\t </action>"; } catch (PDOException $e) { Database::logError('start_event', $e); Database::sendToIvrError();