Exemplo n.º 1
0
 /**
  * Index Action - "http://SERVER/internal"   
  * This is where the internal's POST Messages will point to.- 
  * aFirst step get the parameters in POST
  * 
  */
 public function indexAction()
 {
     $params = Application_Model_General::getParamsArray($this->getRequest()->getParams());
     // backward compatability
     if (isset($params['NUMBER'])) {
         $params['PHONE_NUMBER'] = $params['NUMBER'];
         unset($params['NUMBER']);
     }
     if (isset($params['TO'])) {
         $params['TO_PROVIDER'] = $params['TO'];
         unset($params['TO']);
     }
     if (isset($params['FROM'])) {
         $params['FROM_PROVIDER'] = $params['FROM'];
         unset($params['FROM']);
     }
     //		error_log(print_R($params, 1));
     $this->AddParamsToInternalReq($params);
     $model = new Application_Model_Internal($params);
     $obj = new stdClass();
     $obj->status = $model->Execute();
     $request_params = $model->getParams();
     if (isset($request_params)) {
         $obj->reqId = isset($request_params['REQUEST_ID']) ? $request_params['REQUEST_ID'] : '';
         $obj->msgType = isset($request_params['MSG_TYPE']) ? $request_params['MSG_TYPE'] : '';
     }
     $desc = $model->getErrorMsg();
     if (!empty($desc)) {
         $obj->msgDesc = $obj->desc = $desc;
     } else {
         $obj->msgDesc = $obj->desc = '';
     }
     $this->view->ack = $obj;
     // log the request and response
     $logContentRequest = "Receive from internal " . PHP_EOL . print_R($this->getRequest()->getParams(), 1) . PHP_EOL;
     Application_Model_General::logRequest($logContentRequest, $obj->reqId);
     $logContentResponse = "Response to internal " . PHP_EOL . print_R($obj, 1) . PHP_EOL;
     Application_Model_General::logRequest($logContentResponse, $obj->reqId);
 }