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(); } $sms = IfByPhone_Util::smsIvrEvent($conn, $servicecategory, 'STARTED', $job_pk_id, $timestamp, $employee_name, $job_name);
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>"; // Stop the PHP script before it hits the database; exit; } // Query statement $query = "CALL proc_endSweepJob('{$event_id}', '{$timestamp}', '{$caller_id}', '{$session_id}',\n\t\t\t\t'{$message}', '{$mileage}', '{$sweep}', '{$trashcans}', '{$can_qty}', '{$handpick}', @confirmation)"; // Connect to the database $conn = Database::getDB(); try { $conn->beginTransaction(); $results = $conn->query($query); // Return value is the confirmation code $results = $conn->query("SELECT @confirmation"); $conn->commit(); foreach ($results as $result) { // Process confirmation code to create a digit by digit message. // (e.g., 1 2 3 instead of 123) $conf = IfByPhone_Util::processConfirmationCode($result["@confirmation"]); } // Select the confirmation code survo on the IVR system echo "<action>\n\t\t\t\t\t<app>survo</app>\n\t\t\t\t\t\t<parameters>\n\t\t\t\t\t\t\t<id>362811</id>\n\t\t\t\t\t\t\t<user_parameters>\n\t\t\t\t\t\t\t\t<conf>" . $conf . "</conf>\n\t\t\t\t\t\t\t</user_parameters>\n\t\t\t\t\t\t</parameters>\n\t\t\t\t\t</action>"; } catch (PDOException $e) { // Error handling $conn->rollBack(); Database::logError('sweep', $e); Database::sendToIvrError(); } // Send SMS message notifying job completion $sms = IfByPhone_Util::smsIvrEvent($conn, 'sweeping', 'FINISHED', $job_id, $timestamp, $employee_name, $job_name);
if ($lawn == 'No' && $herbicid == 'No' && $fertilize == 'No' && $prune == 'No') { echo "<action>\n\t\t\t<app>survo</app>\n\t\t\t\t<parameters>\n\t\t\t\t\t<id>412231</id>\n\t\t\t\t\t<p_t>" . $p_t . "</p_t>\n\t\t\t\t</parameters>\n\t\t\t</action>"; // Stop the PHP script before it hits the database; exit; } // Query statement $query = "CALL proc_endLawnJob('{$event_id}', '{$timestamp}', '{$caller_id}', '{$session_id}', '{$message}',\n\t'{$lawn}', '{$herbicide}', '{$fertilize}', '{$prune}', @confirmation)"; // Connect to the database $conn = Database::getDB(); try { $conn->beginTransaction(); $results = $conn->query($query); // Return value is the confirmation code $results = $conn->query("SELECT @confirmation"); $conn->commit(); foreach ($results as $result) { // Process confirmation code to create a digit by digit message. // (e.g., 1 2 3 instead of 123) $conf = IfByPhone_Util::processConfirmationCode($result["@confirmation"]); } // Select the confirmation code survo on the IVR system echo "<action>\n\t\t\t<app>survo</app>\n\t\t\t\t<parameters>\n\t\t\t\t\t<id>362811</id>\n\t\t\t\t\t<user_parameters>\n\t\t\t\t\t\t<conf>" . $conf . "</conf>\n\t\t\t\t\t</user_parameters>\n\t\t\t\t</parameters>\n\t\t\t</action>"; } catch (PDOException $e) { // Error handling $conn->rollBack(); Database::logError('lawn', $e); Database::sendToIvrError(); } // Send SMS message notifying job completion $sms = IfByPhone_Util::smsIvrEvent($conn, 'lawn service', 'FINISHED', $job_id, $timestamp, $employee_name, $job_name);