38 $preparedDataResult = self::prepareConferenceParams($data);
39 if (!$preparedDataResult->isSuccess())
41 return $result->addErrors($preparedDataResult->getErrors());
44 $preparedData = $preparedDataResult->getData();
45 $zoomOAuth = new \CSocServZoom($userId);
46 $createResult = $zoomOAuth->createConference($preparedData);
47 if(!$createResult->isSuccess())
49 return $result->addErrors($createResult->getErrors());
55 public static function update(
int $userId, array $updateParams):
Result
58 if (!Loader::includeModule(
'socialservices'))
60 return $result->addError(
new Error(
'Socialservices module is not installed'));
63 $zoomOAuth = new \CSocServZoom($userId);
64 $updateResult = $zoomOAuth->updateConference($updateParams);
66 if (!$updateResult->isSuccess())
68 return $result->addErrors($updateResult->getErrors());
70 $conferenceData = $updateResult->getData();
72 return $result->setData($conferenceData);
75 public static function delete(
int $conferenceId):
Result
79 if ($conferenceId <= 0)
81 return $result->addError(
new Error(
'Incorrect conference id'));
84 $deleteResult = ZoomMeetingTable::delete($conferenceId);
85 if (!$deleteResult->isSuccess())
87 return $result->addErrors($deleteResult->getErrors());
91 if (!$deleteRecordingsResult->isSuccess())
93 return $result->addErrors($deleteRecordingsResult->getErrors());
173 $getListResult = ZoomMeetingTable::getList([
175 '=CONFERENCE_EXTERNAL_ID' => $conferenceId,
178 'select' => [
'ENTITY_ID',
'ENTITY_TYPE_ID',
'ID']
181 if ($meeting = $getListResult->fetch())
183 $updateResult = ZoomMeetingTable::update($meeting[
'ID'], $params);
184 if (!$updateResult->isSuccess())
186 $result->addError(
new Error(
'Error while update join status.'));
188 if ($updateResult->isSuccess() && $updateResult->getAffectedRowsCount() === 0)
190 $result->addError(
new Error(
'Error: status has already been updated.'));
193 $result->setData($meeting);
197 $result->addError(
new Error(
'No conference to update'));
272 if (!Loader::includeModule(
'socialservices'))
274 return $result->addError(
new Error(
'Module socialservices is not installed.'));
277 if (!is_array($recordingsData[
'recording_files']))
279 return $result->addError(
new Error(
'Error: recording_files key is not found in recording data'));
282 $meeting = ZoomMeetingTable::getRowByExternalId($conferenceId);
285 return $result->addError(
new Error(
"Meeting {$conferenceId} is not found"));
287 $meetingId = $meeting[
'ID'];
288 if ($meeting[
'HAS_RECORDING'] !==
'Y')
290 ZoomMeetingTable::update($meetingId, [
291 'HAS_RECODING' =>
'Y'
294 $crmInstalled = Loader::includeModule(
'crm');
296 foreach ($recordingsData[
'recording_files'] as $record)
298 $startDateTimestamp = \DateTime::createFromFormat(DATE_ATOM, $record[
'recording_start'])->getTimestamp();
299 $endDateTimestamp = \DateTime::createFromFormat(DATE_ATOM, $record[
'recording_end'])->getTimestamp();
302 'EXTERNAL_ID' => $record[
'id'],
303 'MEETING_ID' => $meetingId,
306 'FILE_TYPE' => $record[
'file_type'],
307 'FILE_SIZE' => (int)$record[
'file_size'],
308 'PLAY_URL' => $record[
'play_url'],
309 'DOWNLOAD_URL' => $record[
'download_url'],
310 'RECORDING_TYPE' => $record[
'recording_type'],
311 'DOWNLOAD_TOKEN' => $downloadToken,
312 'PASSWORD' => $recordingsData[
'password']
315 $addResult = ZoomMeetingRecordingTable::add($recordFields);
316 if (!$addResult->isSuccess())
318 return $result->addErrors($addResult->getErrors());
320 $recordingId = $addResult->getId();
321 if($crmInstalled && $meeting[
'ENTITY_TYPE_ID'] === static::ACTIVITY_ENTITY_TYPE && $meeting[
'ENTITY_ID'] > 0)
323 $activityId = (int)$meeting[
'ENTITY_ID'];
324 if ($record[
'recording_type'] === static::ZOOM_AUDIO_ONLY)
326 DownloadAgent::scheduleDownload($activityId, $recordingId);