diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 40c9a222..3b5ba593 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -10302,7 +10302,13 @@ class PD_Controller extends REST_Controller //print_r($records); if (!$records['is_call_ended']) // != '' || $records['video_room_info_id'] != null) { - $id = $this->PD_Model->saveRecords($records, VIDEO_ROOM_INFO); + + $video_sql_stmt = "SELECT * FROM " . VIDEO_ROOM_INFO . " where fk_pd_id = ".$records['fk_pd_id']." and isactive = 1 and room_id = '".$records['room_id']."'"; + $video_records = $this->db->query($video_sql_stmt); + if ($video_records->num_rows() == 0) { + $id = $this->PD_Model->saveRecords($records, VIDEO_ROOM_INFO);log_message('ERROR', 'Video Entry Inserted'); } + else{ $id = 'Video Duplicated Entry Founded'; log_message('ERROR', 'Video Duplicated Entry Founded '); } + if($records['user_id'] != null){ $log_array = array('primary_key'=>$records['fk_pd_id'],'table_name'=>'t_pd_triggered', 'field_name'=>'video_call_initiate_user','old_value'=>null,'new_value'=>null, @@ -10321,6 +10327,7 @@ class PD_Controller extends REST_Controller $records['twilo_status'] = $composition_result_data['status']; $records['composition_id'] = $composition_result_data['compositionId']; $id = $this->PD_Model->updateRecords($records, VIDEO_ROOM_INFO, array('room_id' => $records['room_id'], 'fk_pd_id' => $records['fk_pd_id'])); + // $id = "Updated"; } if ($id) { $data['dataStatus'] = true;