3namespace Bitrix\Im\Call\Integration;
5use Bitrix\Im\Call\Call;
6use Bitrix\Im\Call\CallUser;
9use Bitrix\Im\V2\Chat\NullChat;
10use Bitrix\Im\V2\Message;
11use Bitrix\Im\V2\Message\Params;
12use Bitrix\Main\Application;
13use Bitrix\Main\ArgumentException;
14use Bitrix\Main\Localization\Loc;
15use Bitrix\Main\UserTable;
42 $params[
'USER_ID'] = $this->initiatorId;
47 $this->chatFields = $this->getChatFields($chat);
49 $users = $chat->getRelationProvider()->getAllMemberIds();
50 $users[
$call->getInitiatorId()] =
$call->getInitiatorId();
53 $activeRealUsers = UserTable::getList([
60 '=IS_REAL_USER' =>
'Y',
65 $this->chatUsers = array_column($activeRealUsers,
'ID');
87 return $this->call->getInitiatorId() == $currentUserId ? $this->entityId : $this->call->getInitiatorId();
102 return $this->chatUsers;
119 return (
$userId === (
int)$this->entityId ||
$userId === (
int)$this->initiatorId);
137 && \
Bitrix\
Main\Loader::includeModule(
'socialnetwork')
142 && \CSocNetUser::IsFriendsAllowed()
151 && \CSocNetUser::IsFriendsAllowed()
168 if (!empty($this->chatFields[
'owner']))
170 return (
int)$this->chatFields[
'owner'];
182 if (!empty($this->chatFields[
'manager_list']))
184 return array_map(
'intVal', $this->chatFields[
'manager_list']);
198 if (!$this->chatFields)
205 return \Bitrix\Im\User::getInstance($this->
getEntityId($currentUserId))->getFullName();
209 return $this->chatFields[
'name'];
217 if (!$this->chatFields)
224 return \Bitrix\Im\User::getInstance($this->
getEntityId($currentUserId))->getAvatarHr();
228 return $this->chatFields[
'avatar'];
236 if (!$this->chatFields)
243 return \Bitrix\Im\User::getInstance($this->
getEntityId($currentUserId))->getColor();
247 return $this->chatFields[
'color'];
266 $chat = new \CIMChat();
268 $users = $this->chatUsers;
271 $chatId = $chat->add([
'USERS' => $users]);
279 $this->call->setAssociatedEntity(static::getEntityType(),
'chat'.
$chatId);
281 if ($this->call->getAssociatedEntity())
283 $this->call->getAssociatedEntity()->onCallCreate();
289 $chat = new \CIMChat();
299 if (isset($this->chatFields[
'message_type']) && $this->chatFields[
'message_type'] ===
IM_MESSAGE_PRIVATE)
309 $chat = new \CIMChat();
312 return $chat->addUser(
$chatId, $userIds);
326 $message = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_FINISHED_V2", [
330 $skipCounterInc =
true;
332 $userIds = array_values(array_filter($this->call->getUsers(),
function(
$userId) use (
$initiatorId)
338 'MESSAGE_TYPE' =>
'FINISH',
339 'CALL_ID' => $this->call->getId(),
340 'INITIATOR_ID' => $this->call->getActionUserId(),
346 $otherUserState = $this->call->getUser($userIds[0]) ? $this->call->getUser($userIds[0])->getState() :
'';
351 $message = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_USER_DECLINED_V2_" . $otherUser->getGender(), [
352 '#NAME#' => $otherUser->getFullName(
false)
358 $message = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_USER_BUSY_" . $otherUser->getGender(), [
359 '#NAME#' => $otherUser->getFullName(
false)
362 $skipCounterInc =
false;
367 $message = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_MISSED", [
368 '#NAME#' => $otherUser->getFullName(
false)
371 $skipCounterInc =
false;
389 $message = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_STARTED_V2", [
390 "#ID#" => $this->call->getId()
393 'MESSAGE_TYPE' =>
'START',
394 'CALL_ID' => $this->call->getId(),
410 && $this->chatFields[
'entity_data_1'] ===
'BROADCAST';
415 $initiator = $this->
getCall()->getInitiatorId();
421 $chatId = $this->call->getChatId();
422 if (!empty($this->call->getParentId()))
429 'WAIT_FULL_EXECUTION' =>
'N',
432 'FROM_USER_ID' => $initiator,
435 'SKIP_COUNTER_INCREMENTS' => $skipCounterInc ?
'Y' :
'N',
437 'NOTIFY' => $muted ?
'N':
'Y',
438 'COMPONENT_ID' =>
'CallMessage',
454 'chatId' => $this->chatId,
458 'userCounter' =>
count($this->chatUsers),
460 'chatType' => $this->chatFields[
'type'],
461 'entityType' => $this->chatFields[
'entity_type'],
462 'entityId' => $this->chatFields[
'entity_id'],
463 'entityData1' => $this->chatFields[
'entity_data_1'],
464 'entityData2' => $this->chatFields[
'entity_data_2'],
465 'entityData3' => $this->chatFields[
'entity_data_3']
472 if (!$this->chatFields)
480 $entityType = $this->chatFields[
'entity_type'];
481 $options = \CIMChat::GetChatOptions();
482 return (
bool)(
$options[$entityType][
'EXTEND'] ??
true);
487 $interval = $this->call->getStartDate()->getDiff($this->call->getEndDate());
489 [
$hours, $minutes, $seconds] = explode(
' ', $interval->format(
'%H %I %S'));
494 $result[] = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_DURATION_HOURS", [
499 if ((
int)$minutes > 0)
501 $result[] = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_DURATION_MINUTES", [
502 "#MINUTES#" => (
int)$minutes
506 if ((
int)$seconds > 0 && !((
int)
$hours > 0))
508 $result[] = Loc::getMessage(
"IM_CALL_INTEGRATION_CHAT_CALL_DURATION_SECONDS", [
509 "#SECONDS#" => (
int)$seconds
518 return $chat->toPullFormat();
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
const ENTITY_TYPE_VIDEOCONF
getAvatarColor($currentUserId)
canStartCall(int $userId)
__construct(Call $call, $entityId)
onStateChange($state, $prevState)
getEntityId($currentUserId=0)
onExistingUsersInvite($userIds)
sendMessage($message, $muted=false, $skipCounterInc=false, $componentParams=[])
getAvatar($currentUserId)
sendMessageDeferred($message, $muted=false, $skipCounterInc=false, $componentParams=[])
static getChatId($dialogId, $userId=null)
static hasAccess($dialogId, $userId=null)
static getInstance($userId=null)
static isModuleInstalled($moduleName)
static IsFriends($firstUserID, $secondUserID)
const PRIVACY_RESULT_CONTACT
static GetPrivacy($type, $userId=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
</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."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']