function addExternalNote() { $response = array('action' => 'addNote', 'message' => 'Lưu nội dung cuộc gọi ngoài thành công'); // collect parameters $sNote = trim(getParameter('note')); $sCallerId = trim(getParameter('callerid')); if ($sCallerId == '' || is_null($sCallerId) || $sNote == '') { $response['action'] = 'error'; $response['message'] = 'Lưu nội dung cuộc gọi ngoài: không có số điện thoại hoặc không có nội dung!'; $json = new Services_JSON(); Header('Content-Type: application/json'); return $json->encode($response); } $sAgent = $_SESSION['callcenter']['extension']; global $arrConf; $oCustomer = new getInfoMainConsole(); $oCustomer->callcenter_db_connect($arrConf['cadena_dsn']); $result = $oCustomer->addExternalNote($sAgent, $sCallerId, $sNote); $oCustomer->callcenter_db_disconnect(); // return json if (!$result) { $response['action'] = 'error'; $response['message'] = 'Lỗi: ' . $oCustomer->errMsg; } $json = new Services_JSON(); Header('Content-Type: application/json'); return $json->encode($response); }