Index: pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php	(revision 483)
+++ pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php	(revision 499)
@@ -16,4 +16,13 @@
 	}
 	
+	public function index () 
+	{
+		error_reporting(E_ALL);
+		$this->load->model('Services_model');
+		//$this->Services_model->cardPaidProcess($aryParams);
+		echo $this->Services_model->processMORequest('01662860000', strtoupper('Sbg vip 1'));
+		
+	}
+	
 	public function testmo() {
 		$url = 'http://10.58.38.162/violetservice/soanbai/mo?wsdl';
@@ -59,5 +68,5 @@
 	}
 	
-	public function send($msg)
+	public function send($msg, $receiverID)
 	{
 		$url = $this->config->item('mt_service_url');
@@ -66,5 +75,10 @@
 		$operator = 'InsertMT';
 		$operation = 'http://tempuri.org/InsertMT';
-			
+		
+		$aryMatch = array();
+		if (preg_match('/^(0)([0-9]{9,10})$/', $receiverID, $aryMatch) == 1) {
+			$receiverID = '84'. $aryMatch[2];
+		}
+		
 		$aryParams = array(
 				'User' => $username,
@@ -73,5 +87,5 @@
 				'UserID' => '841662860000',
 				'RequestID' => '4',
-				'ReceiverID' => '84988568786',
+				'ReceiverID' => $receiverID,
 				'ServiceID' => '8062',
 				'CommandCode' => 'SBG',
@@ -93,4 +107,6 @@
 		}
 	
+		var_dump($result);
+		
 		echo "<br/>";
 		echo "<h2>Request</h2>";
@@ -104,6 +120,5 @@
 	{
 		$url = $this->config->item('topup_service_url');
-		$operator = 'TopupService';
-		$operation = 'http://soanbaigiang.smas.vn/ITopupService/TopUp';
+		$operation = 'http://tempuri.org/ITopupService/TopUp';;
 		
 		$username = 'sbg';
@@ -162,5 +177,5 @@
 				'user' => $username,
 				'pass' => $password,
-				'MSISDN' => '1689925260',
+				'MSISDN' => '01662860000',
 				'Charging' => '100',
 				'Contents' => 'Namta-Active'
@@ -180,4 +195,6 @@
 		}
 		
+		var_dump($result);
+		
 		echo "<br/>";
 		echo "<h2>Request</h2>";
Index: pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php	(revision 483)
+++ pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php	(revision 499)
@@ -35,5 +35,5 @@
 		function messageReceiver(){
 			$aryArgs = func_get_args();
-			list($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $contentType ,$info, $receiveTime) = $aryArgs;
+			list($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $info, $receiveTime) = $aryArgs;
 			
 			$msgType = '0'; //text message
@@ -48,25 +48,20 @@
 			if ($username != $mo_username) return '0|0|Username is not corrected!';
 			if ($password != $mo_password) return '0|0|Password is not corrected!';
-			if (!$requestID) return '0|0|requestID is required!';
-			if ((int)$requestID != 4) return '0|0|requestID is not corrected!';
+			if (!$requestID) return '0|0|requestID is required!';			
 			if (!$userID) return '0|0|UserID is required!';
 			if (!$serviceID) return '0|0|serviceID is required!';
 			if ($serviceID != '8062') return '0|0|serviceID is not corrected!';
-			
-			$status = 0;
-			$sentNumber = $userID;									
-			$username = !$receiverID ? $sentNumber : $receiverID;
-			
-			$CI->load->model('frontend/user_model', 'userModel');
-			$password = $CI->userModel->create_random_password();		
-			
-			$result = $CI->userModel->register ($sentNumber, $receiverID, $serviceID, $commandCode, $info, $receiveTime, $status);
+
+			$CI->load->model('Services_model');
+			$CI->load->model('frontend/User_model', 'objUserModel');
+			$result = $CI->Services_model->processMORequest($userID, strtoupper($info));
+			$CI->objUserModel->insertSmslog($receiverID, $serviceID, $commandCode, $info, $receiveTime);
 					
 			$aryResult = explode ('|', $result);
-			
 			return $aryResult[0].'|'.$msgType.'|'.$aryResult[1];
 		}
 		
 		$this->_server->addFunction('messageReceiver');
+		
 		try {
 			ob_start();
