VideoChatAccessKey Changes : ps

This commit is contained in:
Sanjeev 2021-06-01 15:40:41 +05:30
parent ef6336349d
commit 3d049a9fe6

View File

@ -1263,11 +1263,29 @@ class Common_Masters_Controller extends REST_Controller {
// if($apiKeySecret && is_array($apiKeySecret))
// {
$roomName = $random_key.$pd_id;
$officerName = $user_type == 'PDOFFICER' ? 'PDOFFICER' : 'CUSTOMER';
$videoAccessToken = $this->twlio->getVideoAccessJWTToken(TWILIO_API_KEY,TWILIO_API_KEY_SECRET,$roomName,$officerName);
$roomName = $random_key.$pd_id;
$temp = 0;
if (is_numeric($user_type)){
// echo 'B4 '.gettype($user_type);
$this->load->model('User_Management_Model');
$user_type = (int)$user_type;
$userDetails = $this->User_Management_Model->getUserDetails($user_type);
$creditManagerRoleId = (ENVIRONMENT == 'production' ? 26 : 26);
$userRoleId = $userDetails["data"][0]['user_role'];
$name = $userDetails["data"][0]['user_first_name'].$userDetails["data"][0]['user_last_name'];
$officerName = strtoupper(preg_replace('/\s+/', '', $name));
$temp = ($userRoleId == $creditManagerRoleId) ? 0 : 1;
}else{
$officerName = $user_type == 'PDOFFICER' ? 'PDOFFICER' : 'CUSTOMER';
$temp = 1;
}
if($videoAccessToken)
if($temp == 1){
$videoAccessToken = $this->twlio->getVideoAccessJWTToken(TWILIO_API_KEY,TWILIO_API_KEY_SECRET,$roomName,$officerName);
}
if(!empty($videoAccessToken))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;