Function requestMsisdn - Hàm khởi tạo kết nối tới CSP Mobifone để nhận diện thuê bao

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 9/30/18 17:50

@return mixed|void
198091
public function requestMsisdn()
    {
        // Khởi tạo cấu hình Csp Config
        $cspConfig = $this->config[self::CSP_CONFIG];
        // Khởi tạo link callback Get Msisdn
        $linkCallbackGetMsisdn = trim($cspConfig['domainUrl']) . trim($cspConfig['callbackGetMsisdn']);
        // Redirect Params
        $params         = [
            'sp'   => $cspConfig['spNumber'],
            'link' => $this->encrypt($linkCallbackGetMsisdn)
        ];
        $cspRedirectUrl = $cspConfig['addressConnectGetMsisdn'] . '?' . http_build_query($params);
        // Debug
        $this->debug->debug(__FUNCTION__, '$cspConfig: ' . json_encode($cspConfig));
        $this->debug->debug(__FUNCTION__, '$linkCallbackGetMsisdn: ' . json_encode($linkCallbackGetMsisdn));
        $this->debug->debug(__FUNCTION__, '$params: ' . json_encode($params));
        $this->debug->info(__FUNCTION__, '$cspRedirectUrl: ' . json_encode($cspRedirectUrl));
        $this->debug->debug(__FUNCTION__, 'Request from IP: ' . json_encode($this->IP->getIpAddress()));
        // Chuyển hướng tới Csp MobiFone
        Utils::redirect($cspRedirectUrl);
    }
470610
public function createRequestToVnmGateway()
    {
        try {
            $telcoName = self::VIETNAMOBILE;
            $vnm       = new Vietnamobile($this->vendorDebug);
            if (isset($this->objectSession) && $this->objectSession != NULL && is_object($this->objectSession)) {
                $this->logger->info(__FUNCTION__, 'Session with CI Session Class');
                $sessionId = $this->objectSession->has_userdata(self::SESSION_ID_CURRENT_USER_MSISDN);
            } else {
                $this->logger->info(__FUNCTION__, 'Session with The Http Foundation Component');
                $sessionId = $this->session->has(self::SESSION_ID_CURRENT_USER_MSISDN);
            }
            if (!$sessionId) {
                $vnm->setHostname($this->providerServices[$telcoName]['hostname']);
                $vnm->setDomainUrl($this->providerServices[$telcoName]['callback']['domainUrl']);
                $vnm->setRedirectUrl($this->providerServices[$telcoName]['callback']['callbackUrl']);
                $vnm->setConfig($this->providerServices[$telcoName]);
                $result = $vnm->createRequestMsisdn();
            } else {
                $result = NULL;
            }
            $this->logger->info(__FUNCTION__, 'setData: ' . json_encode($this->providerServices[$telcoName]));
            $this->logger->info(__FUNCTION__, 'Result: ' . json_encode($result));

            return $result;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->logger->error(__FUNCTION__, $message);

            return NULL;
        }

    }
74722
public function send()
    {
        $args = func_get_args();
        if (count($args) > 1) {
            $message = call_user_func_array('sprintf', $args);
        } else {
            $message = $args[0];
        }
        $this->response->send($message);
    }
934356
public function signIn($msisdn = '', $password = '')
    {
        try {
            $inputParams = [
                'msisdn'   => $msisdn,
                'password' => $password
            ];
            $this->debug->info(__FUNCTION__, 'Input Params: ' . json_encode($inputParams));
            // Sử dụng API: /api/v1/utils/user/signin.html
            $loginUrl       = $this->hostname . $this->config[self::API_LOGIN]['path'];
            $loginToken     = $this->config[self::API_LOGIN]['token'];
            $loginPrefix    = $this->config[self::API_LOGIN]['prefix'];
            $loginSignature = md5($msisdn . $loginPrefix . $password . $loginPrefix . $loginToken);
            $loginParams    = [
                'msisdn'    => $msisdn,
                'password'  => $password,
                'signature' => $loginSignature
            ];
            $this->debug->debug(__FUNCTION__, '$loginUrl: ' . json_encode($loginUrl));
            $this->debug->debug(__FUNCTION__, '$loginToken: ' . json_encode($loginToken));
            $this->debug->debug(__FUNCTION__, '$loginPrefix: ' . json_encode($loginPrefix));
            $this->debug->debug(__FUNCTION__, '$loginSignature: ' . json_encode($loginSignature));
            $this->debug->debug(__FUNCTION__, '$loginParams: ' . json_encode($loginParams));
            $loginRequest = $this->requests->sendRequest($loginUrl, $loginParams, 'GET');
            $this->debug->info(__FUNCTION__, '$loginRequest: ' . json_encode($loginRequest));
            if ($loginRequest !== NULL) {
                if ($this->nativeSession === TRUE) {
                    $this->debug->info(__FUNCTION__, 'set native Session');
                    $phone_number = new Phone_number();
                    $phone_number->setDebugStatus($this->options['debugStatus']);
                    $phone_number->setLoggerPath($this->options['debugLoggerPath']);
                    $phone_number->__construct();
                    $this->debug->info(__FUNCTION__, '$phone_number: ' . json_encode($phone_number));
                    $isMsisdn = $phone_number->format($msisdn);
                    $this->debug->info(__FUNCTION__, '$isMsisdn: ' . json_encode($isMsisdn));
                    Session::setUserdata(self::SESSION_MSISDN_DEFAULT, $isMsisdn);
                }

                return json_decode(trim($loginRequest));
            } else {
                $this->debug->warning(__FUNCTION__, 'Request Response is Empty');

                return FALSE;
            }
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
514875
public function newPost( array $params ,$is_csdn = false ){
        $this->method = "metaWeblog.newPost";
        if( $is_csdn ){//csdn要特殊处理下
        	$this->blog_id = 895030;
		}
        $this->buildXML( $params );
        $res_xml = $this->doPost();;
		if( !$res_xml ){
			$this->error = new MetaWeblog_Error(-32700, 'response is empty');
			return false;
		}

        $this->metaweblog_response = new MetaWeblog_Message( $res_xml );
        if( !$this->metaweblog_response->parse() ){
            $this->error = new MetaWeblog_Error(-32700, 'parse error. not well formed');
            return false;
        }

        if ($this->metaweblog_response->messageType == 'fault') {
            $this->error = new MetaWeblog_Error($this->metaweblog_response->faultCode, $this->metaweblog_response->faultString);
            return false;
        }

        $this->setBlogId( $this->metaweblog_response->params[0] );

        return true;
    }
464761
function accept()
    {
        $client_socket = stream_socket_accept($this->server_sock, 0);
        //惊群
        if ($client_socket === false)
        {
            return false;
        }
        $client_socket_id = (int)$client_socket;
        stream_set_blocking($client_socket, $this->client_block);
        $this->client_sock[$client_socket_id] = $client_socket;
        $this->client_num++;
        if ($this->client_num > $this->max_connect)
        {
            Swoole\Network\Stream::close($client_socket);
            return false;
        }
        else
        {
            //设置写缓冲区
            stream_set_write_buffer($client_socket, $this->write_buffer_size);
            return $client_socket_id;
        }
    }
491251
public function querySendDetails($phone, $sendDate, $page=1, $pageSize=10, $bizId="") {
        if(!$phone || !$sendDate){
            return $this->error('参数有误');
        }
        $request = new QuerySendDetailsRequest();
        $request->setPhoneNumber($phone);
        $request->setSendDate($sendDate);
        $request->setPageSize($pageSize);
        $request->setCurrentPage($page);
        if($bizId){
            $request->setBizId($bizId);
        }
        return $this->parseResponse($request, '查询');
    }
835253
function sendTemplateSMS($to,$datas,$tempId)
    {
        //主帐号鉴权信息验证，对必选参数进行判空。
        $auth=$this->accAuth();
        if($auth!=""){
            return $auth;
        }
        // 拼接请求包体
        if($this->BodyType=="json"){
           $data="";
           for($i=0;$i<count($datas);$i++){
              $data = $data. "'".$datas[$i]."',";
           }
           $body= "{'to':'$to','templateId':'$tempId','appId':'$this->AppId','datas':[".$data."]}";
        }else{
           $data="";
           for($i=0;$i<count($datas);$i++){
              $data = $data. "<data>".$datas[$i]."</data>";
           }
           $body="<TemplateSMS>
                    <to>$to</to> 
                    <appId>$this->AppId</appId>
                    <templateId>$tempId</templateId>
                    <datas>".$data."</datas>
                  </TemplateSMS>";
        }
        $this->showlog("request body = ".$body);
        // 大写的sig参数
        $sig =  strtoupper(md5($this->AccountSid . $this->AccountToken . $this->Batch));
        // 生成请求URL
        $url="https://$this->ServerIP:$this->ServerPort/$this->SoftVersion/Accounts/$this->AccountSid/SMS/TemplateSMS?sig=$sig";
        $this->showlog("request url = ".$url);
        // 生成授权：主帐户Id + 英文冒号 + 时间戳。
        $authen = base64_encode($this->AccountSid . ":" . $this->Batch);
        // 生成包头
        $header = array("Accept:application/$this->BodyType","Content-Type:application/$this->BodyType;charset=utf-8","Authorization:$authen");
        // 发送请求
        $result = $this->curl_post($url,$body,$header);
        $this->showlog("response body = ".$result);
        if($this->BodyType=="json"){//JSON格式
           $datas=json_decode($result);
        }else{ //xml格式
           $datas = simplexml_load_string(trim($result," \t\n\r"));
        }
      //  if($datas == FALSE){
//            $datas = new stdClass();
//            $datas->statusCode = '172003';
//            $datas->statusMsg = '返回包体错误'; 
//        }
        //重新装填数据
        if($datas->statusCode==0){
         if($this->BodyType=="json"){
            $datas->TemplateSMS =$datas->templateSMS;
            unset($datas->templateSMS);
          }
        }

        return $datas;
    }
911857
function callBack($from,$to,$customerSerNum,$fromSerNum,$promptTone)
	  {
        //子帐号鉴权信息验证，对必选参数进行判空。
        $auth=$this->subAuth();
        if($auth!=""){
            return $auth;
        }
        // 拼接请求包体
        if($this->BodyType=="json"){
           $body= "{'from':'$from','to':'$to','customerSerNum':'$customerSerNum','fromSerNum':'$fromSerNum','promptTone':'$promptTone'}";
        }else{
           $body= "<CallBack>
                     <from>$from</from>
                     <to>$to</to>
                     <customerSerNum>$customerSerNum</customerSerNum>
                     <fromSerNum>$fromSerNum</fromSerNum>
                     <promptTone>$promptTone</promptTone>
                   </CallBack>";
        }
        $this->showlog("request body = ".$body);
        // 大写的sig参数
        $sig =  strtoupper(md5($this->SubAccountSid . $this->SubAccountToken . $this->Batch));
        // 生成请求URL
        $url="https://$this->ServerIP:$this->ServerPort/$this->SoftVersion/SubAccounts/$this->SubAccountSid/Calls/Callback?sig=$sig";
        $this->showlog("request url = ".$url);
        // 生成授权：子帐号Id + 英文冒号 + 时间戳
        $authen=base64_encode($this->SubAccountSid . ":" . $this->Batch);
        // 生成包头
        $header = array("Accept:application/$this->BodyType","Content-Type:application/$this->BodyType;charset=utf-8","Authorization:$authen");
        // 发请求
        $result = $this->curl_post($url,$body,$header);
        $this->showlog("response body = ".$result);
        if($this->BodyType=="json"){//JSON格式
           $datas=json_decode($result);
        }else{ //xml格式
           $datas = simplexml_load_string(trim($result," \t\n\r"));
        }
      //  if($datas == FALSE){
//            $datas = new stdClass();
//            $datas->statusCode = '172003';
//            $datas->statusMsg = '返回包体错误'; 
//        }
        return $datas;
	}
74623
public function sendDatasConfirmAction()
    {
        $ds = DIRECTORY_SEPARATOR;
        $platformOptionsFile = $this->container->getParameter('kernel.root_dir') .
            $ds . 'config' . $ds . 'platform_options.yml';

        if (is_null($this->configHandler->getParameter('token'))) {
            $token = $this->generateToken(20);
            $this->configHandler->setParameter('token', $token);
        }
        $this->sendDatas();

        $this->configHandler->setParameter('confirm_send_datas', 'OK');

        return new RedirectResponse(
            $this->router->generate('claro_admin_parameters_index')
        );
    }
315107
protected function createServer(): void
    {
        $server = null;
        $opts   = $this->serverSettings;

        $host = $opts['host'];
        $port = $opts['port'];
        $mode = $opts['mode'] === self::MODE_BASE ? SWOOLE_BASE : SWOOLE_PROCESS;
        $type = \strtolower($opts['type']);

        $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_HTTP];

        // create swoole server
        // 使用SSL必须在编译swoole时加入--enable-openssl选项,并且配置证书文件
        switch ($type) {
            case self::PROTOCOL_TCP:
                $server      = new Server($host, $port, $mode, SWOOLE_SOCK_TCP);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_TCP];
                break;

            case self::PROTOCOL_UDP:
                $server      = new Server($host, $port, $mode, SWOOLE_SOCK_UDP);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_TCP];
                break;

            case self::PROTOCOL_HTTP:
                $server = new HttpServer($host, $port, $mode);
                break;

            case self::PROTOCOL_HTTPS:
                $this->checkEnvWhenEnableSSL();
                $server = new HttpServer($host, $port, $mode, SWOOLE_SOCK_TCP | SWOOLE_SSL);
                break;

            case self::PROTOCOL_RDS:
                $server      = new RedisServer($host, $port, $mode);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_RDS];
                break;

            case self::PROTOCOL_WS:
                $server      = new WebSocketServer($host, $port, $mode);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_WS];
                break;

            case self::PROTOCOL_WSS:
                $this->checkEnvWhenEnableSSL();
                $server      = new WebSocketServer($host, $port, $mode, SWOOLE_SOCK_TCP | SWOOLE_SSL);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_WS];
                break;

            default:
                $supportedProtocol = implode(',', $this->getSupportedProtocols());
                Show::error("The socket protocol <bold>$type</bold> is not supported. Allow: $supportedProtocol", 1);
                break;
        }

        $this->server = $server;
        $this->server->set($this->swooleSettings);

        $this->log("The main server was created successfully. Listening on <cyan>$type://{$host}:{$port}</cyan>");
        $this->setSwooleEvents($protoEvents);
    }
253675
public function requestVerifySms()
    {
        $minutes = self::getCodeValidMinutes();
        $code = $this->verifyCode();
        $for = $this->input(self::getMobileField());

        $content = $this->generateSmsContent($code, $minutes);
        $templates = $this->generateTemplates(self::VERIFY_SMS);
        $tplData = $this->generateTemplateData($code, $minutes, self::VERIFY_SMS);

        $result = PhpSms::make($templates)->to($for)->data($tplData)->content($content)->send();
        if ($result === null || $result === true || (isset($result['success']) && $result['success'])) {
            $this->state['sent'] = true;
            $this->state['to'] = $for;
            $this->state['code'] = $code;
            $this->state['deadline'] = time() + ($minutes * 60);
            $this->storeState();
            $this->setCanResendAfter(self::getInterval());

            return self::generateResult(true, 'sms_sent_success');
        }

        return self::generateResult(false, 'sms_sent_failure');
    }
807533
public function mobifoneCallbackMsisdn()
    {
        try {
            $mobi = new Mobifone($this->vendorDebug);
            $mobi->setConfig($this->providerServices[self::MOBIFONE]);
            $mobi->setListPackage($this->packageSettings[self::MOBIFONE]);
            $mobi->setKeyEncrypt($this->providerServices[self::MOBIFONE][self::MOBIFONE_CSP_CONFIG]['keyEncrypt']);
            $result = $mobi->receivedDataMsisdn();
            if (is_array($result) && isset($result['status']) && $result['status'] == 0) {
                if (isset($result['data'])) {
                    $msisdn          = $result['data']['msisdn'];
                    $telcoData       = $this->phoneDetect->getTelcos();
                    $data_to_session = [
                        self::SESSION_ID_CURRENT_USER_MSISDN    => $this->formatMsisdn($msisdn),
                        self::SESSION_ID_CURRENT_MSISDN         => $this->formatMsisdn($msisdn),
                        self::SESSION_ID_CURRENT_MSISDN_CHANNEL => self::CHANNEL_IS_DETECT,
                        self::SESSION_ID_CURRENT_TELCO_NAME     => $telcoData['telco_name'],
                        self::SESSION_ID_CURRENT_TELCO_ID       => $telcoData['telco_id'],
                        self::SESSION_ID_CURRENT_USER_IP        => $this->Ip->getIpByHaProxy(),
                        self::SESSION_ID_MSISDN_HAS_DETECT      => TRUE
                    ];
                    $this->logger->info(__FUNCTION__, 'Save MSISDN & Telco Data: ', $data_to_session);
                    if (isset($this->objectSession) && $this->objectSession != NULL && is_object($this->objectSession)) {
                        $this->logger->info(__FUNCTION__, 'Session with CI Session Class');
                        $this->objectSession->set_userdata($data_to_session);
                    } else {
                        $this->logger->info(__FUNCTION__, 'Session with The Http Foundation Component');
                        foreach ($data_to_session as $name => $value) {
                            $this->session->set($name, $value);
                        }
                    }
                }
            } else {
                $this->user_is_guest();
                $this->logger->info(__FUNCTION__, 'User is GUEST');
            }
            if (isset($this->objectSession) && $this->objectSession != NULL && is_object($this->objectSession)) {
                $this->logger->info(__FUNCTION__, 'Session with CI Session Class');
                if (!$this->objectSession->has_userdata(self::SESSION_ID_LINK_REDIRECT_MSISDN_DETECT)) {
                    $this->objectSession->set_userdata(self::SESSION_ID_LINK_REDIRECT_MSISDN_DETECT, self::SESSION_VALUE_LINK_REDIRECT_MSISDN_DETECT);
                    Utils::redirect('');
                }
            } else {
                $this->logger->info(__FUNCTION__, 'Session with The Http Foundation Component');
                if (!$this->session->has(self::SESSION_ID_LINK_REDIRECT_MSISDN_DETECT)) {
                    $this->session->set(self::SESSION_ID_LINK_REDIRECT_MSISDN_DETECT, self::SESSION_VALUE_LINK_REDIRECT_MSISDN_DETECT);
                    Utils::redirect('');
                }
            }

            return TRUE;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->logger->error(__FUNCTION__, $message);

            return $message;
        }
    }
1149185
protected function sendPayRequest()
	{
		$this->newTransaction();

		$params = array(
			'pin' => $this->config->get('gateway.parsian.pin'),
			'amount' => $this->amount,
			'orderId' => $this->transactionId(),
			'callbackUrl' => $this->getCallback(),
			'authority' => 0,
			'status' => 1
		);

		try {
			$soap = new SoapClient($this->serverUrl);
			$response = $soap->PinPaymentRequest($params);

		} catch (\SoapFault $e) {
			$this->transactionFailed();
			$this->newLog('SoapFault', $e->getMessage());
			throw $e;
		}

		if ($response !== false) {
			$authority = $response->authority;
			$status = $response->status;

			if ($authority && $status == 0) {
				$this->refId = $authority;
				$this->transactionSetRefId();
				return true;
			}

			$errorMessage = ParsianResult::errorMessage($status);
			$this->transactionFailed();
			$this->newLog($status, $errorMessage);
			throw new ParsianErrorException($errorMessage, $status);

		} else {
			$this->transactionFailed();
			$this->newLog(-1, 'خطا در اتصال به درگاه پارسیان');
			throw new ParsianErrorException('خطا در اتصال به درگاه پارسیان', -1);
		}
	}
240853
function isFlashRequest()
    {
        /** @var iHeader $header */
        if (! $this->getMessageObject()->headers()->has('User-Agent') )
            return false;

        $header = $this->getMessageObject()->headers()->get('User-Agent');
        return false !== $header && stristr(\Poirot\Http\Header\renderHeader($header), ' flash');
    }
980291
private function _scsi()
    {
        foreach ($this->readaixdata() as $line) {
            if (preg_match("/^[\*\+]\s\S+\s+\S+\s+(.*SCSI.*)/", $line, $ar_buf)) {
                $dev = new HWDevice();
                $dev->setName(trim($ar_buf[1]));
                $this->sys->setScsiDevices($dev);
            }
        }
    }
24754
public function getMsisdn()
    {
        try {
            $telco = $this->getTelcos();
            $this->logger->debug(__FUNCTION__, 'Current Telco: ', $telco);
            if ($telco !== NULL && is_array($telco)) {
                if ($telco['telco_name'] == self::VINAPHONE || $telco['telco_name'] == self::VINAPHONE) {
                    // Nếu thuộc nhà mạng VINAPHONE
                    $msisdn          = $this->phoneDetect->getMsisdn();
                    $telcoData       = $this->phoneDetect->getTelcos();
                    $data_to_session = [
                        self::SESSION_ID_CURRENT_USER_MSISDN    => $this->formatMsisdn($msisdn),
                        self::SESSION_ID_CURRENT_MSISDN         => $this->formatMsisdn($msisdn),
                        self::SESSION_ID_CURRENT_MSISDN_CHANNEL => self::CHANNEL_IS_DETECT,
                        self::SESSION_ID_CURRENT_TELCO_NAME     => $telcoData['telco_name'],
                        self::SESSION_ID_CURRENT_TELCO_ID       => $telcoData['telco_id'],
                        self::SESSION_ID_CURRENT_USER_IP        => $this->Ip->getIpByHaProxy(),
                        self::SESSION_ID_MSISDN_HAS_DETECT      => TRUE
                    ];
                    $this->logger->info(__FUNCTION__, 'Save MSISDN & Telco Data: ', $data_to_session);
                    if (isset($this->objectSession) && $this->objectSession != NULL && is_object($this->objectSession)) {
                        $this->logger->info(__FUNCTION__, 'Session with CI Session Class');
                        $this->objectSession->set_userdata($data_to_session);
                    } else {
                        $this->logger->info(__FUNCTION__, 'Session with The Http Foundation Component');
                        foreach ($data_to_session as $name => $value) {
                            $this->session->set($name, $value);
                        }
                    }
                } elseif ($telco['telco_name'] == self::MOBIFONE || $telco['telco_name'] == self::MOBIFONE) {
                    // Nếu thuộc nhà mạng MOBIFONE
                    $msisdn          = $this->phoneDetect->getMsisdn();
                    $telcoData       = $this->phoneDetect->getTelcos();
                    $data_to_session = [
                        self::SESSION_ID_CURRENT_USER_MSISDN    => $this->formatMsisdn($msisdn),
                        self::SESSION_ID_CURRENT_MSISDN         => $this->formatMsisdn($msisdn),
                        self::SESSION_ID_CURRENT_MSISDN_CHANNEL => self::CHANNEL_IS_DETECT,
                        self::SESSION_ID_CURRENT_TELCO_NAME     => $telcoData['telco_name'],
                        self::SESSION_ID_CURRENT_TELCO_ID       => $telcoData['telco_id'],
                        self::SESSION_ID_CURRENT_USER_IP        => $this->Ip->getIpByHaProxy(),
                        self::SESSION_ID_MSISDN_HAS_DETECT      => TRUE
                    ];
                    $this->logger->info(__FUNCTION__, 'Save MSISDN & Telco Data: ', $data_to_session);
                    if (isset($this->objectSession) && $this->objectSession != NULL && is_object($this->objectSession)) {
                        $this->logger->info(__FUNCTION__, 'Session with CI Session Class');
                        $this->objectSession->set_userdata($data_to_session);
                    } else {
                        $this->logger->info(__FUNCTION__, 'Session with The Http Foundation Component');
                        foreach ($data_to_session as $name => $value) {
                            $this->session->set($name, $value);
                        }
                    }
                } elseif ($telco['telco_name'] == self::VIETTEL || $telco['telco_name'] == self::VIETNAMOBILE) {
                    // Nếu thuộc nhà mạng Viettel hoặc Vietnamobile, lấy MSISDN trong SESSON
                    $msisdn = $this->getMsisdnInSession();
                    $this->logger->info(__FUNCTION__, 'MSISDN in Session: ' . json_encode($msisdn));
                    if ($msisdn === NULL) {
                        // Nếu chưa tồn tại Session MSISDN -> chưa nhận diện thuê bao, cần xử lý tùy Logic nhà mạng
                        if ($this->providerTelcos[self::VIETTEL] === TRUE && $telco['telco_name'] == self::VIETTEL) {
                            $this->logger->info(__FUNCTION__, 'TelcoName ' . self::VIETTEL);
                            $this->redirectToMpsViettel($this->providerServices[self::VIETTEL]['statusReturnUrl'], $this->providerServices[self::VIETTEL]['domainUrl']);
                        }
                        if ($this->providerTelcos[self::VIETNAMOBILE] === TRUE && $telco['telco_name'] == self::VIETNAMOBILE) {
                            $this->logger->info(__FUNCTION__, 'TelcoName ' . self::VIETNAMOBILE);
                            $this->createRequestToVnmGateway();
                        }
                    }
                } else {
                    $msisdn = NULL;
                    $this->logger->info(__FUNCTION__, 'Current MSISDN is Null');
                    $this->user_is_guest();
                }
            } else {
                $msisdn = NULL;
                $this->logger->info(__FUNCTION__, 'Current MSISDN is Null');
                $this->user_is_guest();
            }
            $this->logger->info(__FUNCTION__, 'Current MSISDN: ' . $msisdn);

            return $msisdn;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->logger->error(__FUNCTION__, $message);
            $this->user_is_guest();

            return NULL;
        }
    }