Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
CallController.php
1<?php
2
4
9
11{
15 public function finishCallAction(string $callUuid): ?array
16 {
17 $call = CallFactory::searchActiveByUuid(Call::PROVIDER_BITRIX, $callUuid);
18
19 if (!isset($call))
20 {
21 $this->addError(new CallError(CallError::CALL_NOT_FOUNT));
22
23 return null;
24 }
25
26 $isSuccess = $call->getSignaling()->sendFinish();
27
28 if (!$isSuccess)
29 {
30 $this->addError(new CallError(CallError::SEND_PULL_ERROR));
31
32 return null;
33 }
34
35 return ['result' => true];
36 }
37
41 public function disconnectUserAction(string $callUuid, int $userId): ?array
42 {
43 $call = CallFactory::searchActiveByUuid(Call::PROVIDER_BITRIX, $callUuid);
44
45 if (!isset($call))
46 {
47 $this->addError(new CallError(CallError::CALL_NOT_FOUNT));
48
49 return null;
50 }
51
52 $isSuccess = $call->getSignaling()->sendHangup($userId, $call->getUsers(), null);
53
54 if (!$isSuccess)
55 {
56 $this->addError(new CallError(CallError::SEND_PULL_ERROR));
57
58 return null;
59 }
60
61 return ['result' => true];
62 }
63}
disconnectUserAction(string $callUuid, int $userId)