コード例 #1
0
 public function sendMessage($job, $data)
 {
     $id = $job->getJobId();
     try {
         for ($i = 0; $i < count($data); $i++) {
             Mensaje::crear($id, $data[$i]);
             $Outbound = new Outbound();
             $request = array('message' => array('message_id' => $data[$i]['message_id'], 'status' => 'delivered'));
             $response = $Outbound->setMessageStatus($request);
             $pos = strpos($data[$i]['body'], 'completed');
             $pos2 = strpos($data[$i]['body'], 'suspended');
             $pos3 = strpos($data[$i]['body'], 'notdone');
             $pos4 = strpos($data[$i]['body'], 'canceled');
             $activityId = '';
             $codactud = explode("appt_number>", $data[$i]['body']);
             $codactu = explode("<", $codactud[1]);
             if ($activityId != '' and $codactu[0] != '') {
                 if ($pos !== false) {
                     $this->completarOfsc($activityId, $codactu[0]);
                 } elseif ($pos2 !== false) {
                     $this->suspenderOfsc($activityId, $codactu[0]);
                 } elseif ($pos3 !== false) {
                     $this->norealizadoOfsc($activityId, $codactu[0]);
                 } elseif ($pos4 !== false) {
                     //$this->cancelarOfsc($activityId,$codactu);
                 }
             }
         }
     } catch (Exception $e) {
     }
     $job->delete();
 }