From 4609fea1e9ce6e60d2c48370e5d7ea6e8ab7e796 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Wed, 5 Apr 2023 16:01:14 +0530 Subject: [PATCH] twlio s3 url changes --- api/application/config/constants.php | 5 ++++ api/application/controllers/PD_Controller.php | 30 +++++++++---------- .../helpers/video_grabber_helper.php | 6 ++-- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index b4a6a8ef..be15e296 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -119,6 +119,8 @@ defined('CAMUNDA_URL') OR define('CAMUNDA_URL','http://34.121.71.79:8080/engine- defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); if(ENVIRONMENT == 'development') { + +defined('TWILIO_CONTENT_BUCKET_NAME') OR define('TWILIO_CONTENT_BUCKET_NAME','twilio-content'); defined('SATELLITE_IMAGE_LOCATION') OR define('SATELLITE_IMAGE_LOCATION','phantomsatellite_dev'); defined('DETAILED_SCORE_CARD_IMAGE_LOCATION') OR define('DETAILED_SCORE_CARD_IMAGE_LOCATION','phantom_dsc_dev'); defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','test-lender'); @@ -147,6 +149,7 @@ defined('CET_CREDITPD_INTEGRATION_REINSERTIMG_URL') OR define('CET_CREDITPD_INTE } else if(ENVIRONMENT == 'testing') { + defined('TWILIO_CONTENT_BUCKET_NAME') OR define('TWILIO_CONTENT_BUCKET_NAME','twilio-content'); defined('SATELLITE_IMAGE_LOCATION') OR define('SATELLITE_IMAGE_LOCATION','phantomsatellite_test'); defined('DETAILED_SCORE_CARD_IMAGE_LOCATION') OR define('DETAILED_SCORE_CARD_IMAGE_LOCATION','phantom_dsc_test'); defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','test-lender'); @@ -175,6 +178,7 @@ else if(ENVIRONMENT == 'testing') } else if(ENVIRONMENT == 'production') { + defined('TWILIO_CONTENT_BUCKET_NAME') OR define('TWILIO_CONTENT_BUCKET_NAME','twilio-content-live'); defined('SATELLITE_IMAGE_LOCATION') OR define('SATELLITE_IMAGE_LOCATION','phantomsatellite_test'); defined('DETAILED_SCORE_CARD_IMAGE_LOCATION') OR define('DETAILED_SCORE_CARD_IMAGE_LOCATION','phantom_dsc_test'); defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','pdgenie-lender'); @@ -216,6 +220,7 @@ defined('TWLIO_SID') OR define('TWLIO_SID',getenv('TWLIO_SID')); defined('TWLIO_AUTH_TOKEN') OR define('TWLIO_AUTH_TOKEN',getenv('TWLIO_AUTH_TOKEN')); defined('TWILIO_API_KEY') OR define('TWILIO_API_KEY',getenv('TWILIO_API_KEY')); defined('TWILIO_API_KEY_SECRET') OR define('TWILIO_API_KEY_SECRET',getenv('TWILIO_API_KEY_SECRET')); + /*************************END OF TWILO CONSTANTS************************************************************/ diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index dcfab8cf..47263925 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -9237,23 +9237,23 @@ class PD_Controller extends REST_Controller if ($value['composition_id'] && $value['vsp'] != 'google') { $res = $this->twlio->getCompositionStatus($value['composition_id']); - if (count($res) && $res['status'] == 'completed') { + // if (count($res) && $res['status'] == 'completed') { - $is_copied = $this->copyMediaFromTwiloToS3($pd_master_details, $value, $pd_category); // copy media from twlio s3 to our s3 - $fields_to_update = array('twilo_status' => 'completed'); - if ($is_copied) { - $fields_to_update['s3_copied'] = 1; - } - $id = $this->PD_Model->updateRecords($fields_to_update, VIDEO_ROOM_INFO, array('video_room_info_id' => $value['video_room_info_id'])); + // // $is_copied = $this->copyMediaFromTwiloToS3($pd_master_details, $value, $pd_category); // copy media from twlio s3 to our s3 + // // $fields_to_update = array('twilo_status' => 'completed'); + // // if ($is_copied) { + // // $fields_to_update['s3_copied'] = 1; + // // } + // $id = $this->PD_Model->updateRecords($fields_to_update, VIDEO_ROOM_INFO, array('video_room_info_id' => $value['video_room_info_id'])); - if ($id) { - if ($room_id) { - $result_data = $is_copied; - } else { - $result_data++; - } - } - } + // if ($id) { + // if ($room_id) { + // $result_data = $is_copied; + // } else { + // $result_data++; + // } + // } + // } } else { $room_status = $this->twlio->getRoomDataByRoomID($value['room_id']); if ($room_status == 'completed') { diff --git a/api/application/helpers/video_grabber_helper.php b/api/application/helpers/video_grabber_helper.php index beca56e4..476b9571 100644 --- a/api/application/helpers/video_grabber_helper.php +++ b/api/application/helpers/video_grabber_helper.php @@ -21,7 +21,8 @@ class video_grabber_helper if($pd_category == '1'){ $pd_master_details = $CI->PD_Model->getPDMasterDetails($pd_id,$random_string);} } - $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + // $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + $bucket_name = TWILIO_CONTENT_BUCKET_NAME; $result_data = array(); $query = "SELECT * FROM ".VIDEO_ROOM_INFO." where fk_pd_id = $pdid and isactive = 1 and pd_category = $pd_category"; @@ -41,7 +42,8 @@ class video_grabber_helper if($value['s3_copied']) { - $final_key = 'pd'.$pd_master_details[0]['pd_id'].'/video/'.$file_name; + // $final_key = 'pd'.$pd_master_details[0]['pd_id'].'/video/'.$file_name; + $final_key = $file_name; $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$final_key,'+7 days'); $shortURL = VIDEO_SHORT_URL . substr($video_name,0,6);