1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
BitrixCall.php
См. документацию.
1<?php
2
4
10
11
12class BitrixCall extends Call
13{
14 protected $provider = parent::PROVIDER_BITRIX;
15
19 protected function initCall(): void
20 {
21 if (!$this->endpoint)
22 {
23 $this->uuid = Util::generateUUID();
24 $this->secretKey = Random::getString(10, true);
25
26 if (!$this->getId())
27 {
28 $this->save();
29 }
30
31 $createResult = (new ControllerClient())->createCall($this);
32
33 if (!$createResult->isSuccess())
34 {
35 parent::finish();
36
37 $this->addErrors($createResult->getErrors());
38 }
39 $callData = $createResult->getData();
40 if (!$callData['endpoint'])
41 {
42 parent::finish();
43
44 $this->addError(new Error('Empty endpoint', 'empty_endpoint'));
45
46 return;
47 }
48
49 $this->setEndpoint($callData['endpoint']);
50 $this->save();
51 }
52 }
53
54 public function finish(): void
55 {
56 if ($this->getState() != static::STATE_FINISHED)
57 {
58 (new ControllerClient())->finishCall($this);
59 }
60 parent::finish();
61 }
62
63 protected function generateJwt(int $userId): string
64 {
65 return JWT::encode(
66 [
67 'uuid' => $this->getUuid(),
68 'userId' => (string)$userId,
69 ],
70 $this->getSecretKey()
71 );
72 }
73
74 public function getConnectionData(int $userId): array
75 {
76 return [
77 'endpoint' => $this->endpoint ?: null,
78 'jwt' => $this->generateJwt($userId),
79 ];
80 }
81
82 public function inviteUsers(int $senderId, array $toUserIds, $isLegacyMobile, $video = false, $sendPush = true): void
83 {
84 foreach ($toUserIds as $toUserId)
85 {
86 $this->getSignaling()->sendInviteToUser(
87 $senderId,
88 $toUserId,
89 $toUserIds,
90 $isLegacyMobile,
91 $video,
92 $sendPush
93 );
94 }
95 }
96
97 public function getMaxUsers(): int
98 {
99 return parent::getMaxCallServerParticipants();
100 }
101}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
Определения call.php:24
addError(Error $error)
Определения call.php:180
getSecretKey()
Определения call.php:490
getId()
Определения call.php:102
getUuid()
Определения call.php:485
addErrors(array $errors)
Определения call.php:153
getSignaling()
Определения call.php:388
setEndpoint($endpoint)
Определения call.php:702
getState()
Определения call.php:454
save()
Определения call.php:795
Определения util.php:6
inviteUsers(int $senderId, array $toUserIds, $isLegacyMobile, $video=false, $sendPush=true)
Определения BitrixCall.php:82
generateJwt(int $userId)
Определения BitrixCall.php:63
getConnectionData(int $userId)
Определения BitrixCall.php:74
Определения error.php:15
Определения jwt.php:23
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения BitrixCall.php:3