1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
ControllerClient.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Call;
4
5
use Bitrix\Main\Result;
6
use Bitrix\Main\Config\Option;
7
use Bitrix\Main\Service\MicroService\BaseSender;
8
use Bitrix\Im\Call\Call;
9
10
class
ControllerClient
extends
BaseSender
11
{
12
private
const
SERVICE_MAP = [
13
'ru'
=>
'https://videocalls.bitrix.info'
,
14
'eu'
=>
'https://videocalls-de.bitrix.info'
,
15
'us'
=>
'https://videocalls-us.bitrix.info'
,
16
];
17
private
const
REGION_RU = [
'ru'
,
'by'
,
'kz'
];
18
private
const
REGION_EU = [
'de'
,
'eu'
,
'fr'
,
'it'
,
'pl'
,
'tr'
,
'uk'
];
19
20
private
array
$httpClientParameters = [];
21
28
public
function
getEndpoint
(
string
$region
): string
29
{
30
$endpoint = Option::get(
'im'
,
'call_server_url'
);
31
32
if
(empty($endpoint))
33
{
34
if
(in_array(
$region
, self::REGION_RU,
true
))
35
{
36
$endpoint = self::SERVICE_MAP[
'ru'
];
37
}
38
elseif
(in_array(
$region
, self::REGION_EU,
true
))
39
{
40
$endpoint = self::SERVICE_MAP[
'eu'
];
41
}
42
else
43
{
44
$endpoint = self::SERVICE_MAP[
'us'
];
45
}
46
}
47
elseif
(!(mb_strpos($endpoint,
'https://'
) === 0 || mb_strpos($endpoint,
'http://'
) === 0))
48
{
49
$endpoint =
'https://'
. $endpoint;
50
}
51
52
return
$endpoint;
53
}
54
55
61
protected
function
getServiceUrl
(): string
62
{
63
$region
=
\Bitrix\Main\Application::getInstance
()->getLicense()->getRegion() ?:
'ru'
;
64
65
return
$this->
getEndpoint
(
$region
);
66
}
67
73
public
function
createCall
(
Call
$call):
Result
74
{
75
$action
=
'callcontroller.InternalApi.createCall'
;
76
$data
= [
77
'callType'
=>
'call'
,
78
'roomType'
=> $call->
getType
(),
79
'uuid'
=> $call->
getUuid
(),
80
'initiatorUserId'
=> $call->
getInitiatorId
(),
81
'callId'
=> $call->
getId
(),
82
'version'
=>
\Bitrix\Main\ModuleManager::getVersion
(
'call'
),
83
'usersCount'
=>
count
($call->
getUsers
()),
84
];
85
86
if
($call instanceof
ConferenceCall
)
87
{
88
$data
[
'callType'
] =
'conference'
;
89
}
90
91
if
($call instanceof
PlainCall
)
92
{
93
$action
=
'callcontroller.InternalApi.createPlain'
;
94
$data
[
'callType'
] =
'plain'
;
95
$this->httpClientParameters = [
96
'waitResponse'
=>
false
,
97
'socketTimeout'
=> 5,
98
'streamTimeout'
=> 5,
99
];
100
}
101
else
102
{
103
$data
= array_merge(
$data
, [
104
'secretKey'
=> $call->
getSecretKey
(),
105
'maxParticipants'
=> \
Bitrix
\
Im
\
Call
\Call::getMaxCallServerParticipants(),
106
]);
107
$this->httpClientParameters = [
108
'waitResponse'
=>
true
,
109
'socketTimeout'
=> 10,
110
'streamTimeout'
=> 15,
111
];
112
}
113
114
return
$this->
performRequest
(
$action
,
$data
);
115
}
116
122
public
function
finishCall
(
Call
$call):
Result
123
{
124
$data
= [
125
'uuid'
=> $call->
getUuid
()
126
];
127
128
$this->httpClientParameters = [
129
'waitResponse'
=>
false
,
130
'socketTimeout'
=> 5,
131
'streamTimeout'
=> 5,
132
];
133
134
$action
=
'callcontroller.InternalApi.finishCall'
;
135
if
($call instanceof
ConferenceCall
)
136
{
137
$data
[
'callType'
] =
'conference'
;
138
}
139
if
($call instanceof
PlainCall
)
140
{
141
$action
=
'callcontroller.InternalApi.finishPlain'
;
142
$data
[
'callType'
] =
'plain'
;
143
}
144
145
return
$this->
performRequest
(
$action
,
$data
);
146
}
147
148
public
function
getHttpClientParameters
():
array
149
{
150
return
array_merge(parent::getHttpClientParameters(), $this->httpClientParameters);
151
}
152
}
Bitrix\Im\Call\Call
Определения
call.php:24
Bitrix\Im\Call\Call\getSecretKey
getSecretKey()
Определения
call.php:490
Bitrix\Im\Call\Call\getUsers
getUsers()
Определения
call.php:227
Bitrix\Im\Call\Call\getId
getId()
Определения
call.php:102
Bitrix\Im\Call\Call\getUuid
getUuid()
Определения
call.php:485
Bitrix\Im\Call\Call\getType
getType()
Определения
call.php:110
Bitrix\Im\Call\Call\getInitiatorId
getInitiatorId()
Определения
call.php:134
Bitrix\Im\V2\Call\ConferenceCall
Определения
ConferenceCall.php:6
Bitrix\Im\V2\Call\ControllerClient
Определения
ControllerClient.php:11
Bitrix\Im\V2\Call\ControllerClient\getEndpoint
getEndpoint(string $region)
Определения
ControllerClient.php:28
Bitrix\Im\V2\Call\ControllerClient\getServiceUrl
getServiceUrl()
Определения
ControllerClient.php:61
Bitrix\Im\V2\Call\ControllerClient\createCall
createCall(Call $call)
Определения
ControllerClient.php:73
Bitrix\Im\V2\Call\ControllerClient\finishCall
finishCall(Call $call)
Определения
ControllerClient.php:122
Bitrix\Im\V2\Call\ControllerClient\getHttpClientParameters
getHttpClientParameters()
Определения
ControllerClient.php:148
Bitrix\Im\V2\Call\PlainCall
Определения
PlainCall.php:10
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
Bitrix\Main\ModuleManager\getVersion
static getVersion($moduleName)
Определения
modulemanager.php:89
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
Bitrix\Main\Service\MicroService\BaseSender
Определения
basesender.php:15
Bitrix\Main\Service\MicroService\BaseSender\performRequest
performRequest($action, array $parameters=[])
Определения
basesender.php:25
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$region
$region
Определения
.description.php:13
Bitrix\Im
Bitrix
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
$action
$action
Определения
file_dialog.php:21
bitrix
modules
im
lib
V2
Call
ControllerClient.php
Создано системой
1.14.0