- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/call/signaling.php
- Класс: BitrixImCallSignaling
- Вызов: Signaling::getInvitePush
protected function getInvitePush(int $senderId, int $toUserId, $isLegacyMobile, $video)
{
$users = $this->call->getUsers();
$associatedEntity = $this->call->getAssociatedEntity();
$name = $associatedEntity ? $associatedEntity->getName($toUserId) : Loc::getMessage('IM_CALL_INVITE_NA');
$email = null;
$phone = null;
if ($associatedEntity instanceof Chat)
{
if ($associatedEntity->isPrivateChat())
{
$userInstance = BitrixImUser::getInstance($senderId);
$email = $userInstance->getEmail();
$phone = $userInstance->getPhone();
$phone = preg_replace("/[^0-9#*+,;]/", "", $phone);
}
$avatar = $associatedEntity->getAvatar($toUserId);
}
$pushText = Loc::getMessage('IM_CALL_INVITE', ['#USER_NAME#' => $name]);
$pushTag = 'IM_CALL_'.$this->call->getId();
$push = [
'message' => $pushText,
'expiry' => 0,
'params' => [
'ACTION' => 'IMINV_'.$this->call->getId()."_".time()."_".($video ? 'Y' : 'N'),
'PARAMS' => [
'type' => 'internal',
'callerName' => htmlspecialcharsback($name),
'callerAvatar' => $avatar ?? '',
'call' => $this->call->toArray($toUserId),
'video' => $video,
'users' => $users,
'isLegacyMobile' => $isLegacyMobile,
'senderId' => $senderId,
'senderEmail' => $email,
'senderPhone' => $phone,
'logToken' => $this->call->getLogToken($toUserId),
'ts' => time(),
]
],
'advanced_params' => [
'id' => $pushTag,
'notificationsToCancel' => [$pushTag],
'androidHighPriority' => true,
'useVibration' => true,
'isVoip' => true,
'callkit' => true,
],
'sound' => 'call.aif',
'send_immediately' => 'Y'
];
return $push;
}