echo CUtil::PhpToJsObject($arResult); } else if ($_POST['IM_CALL'] == 'Y') { $chatId = intval($_POST['CHAT_ID']); $userId = intval($USER->GetId()); $errorMessage = ""; if ($_POST['COMMAND'] == 'invite') { if ($_POST['CHAT'] != 'Y') $chatId = CIMMessage::GetChatId($userId, intval($_POST['CHAT_ID'])); $arCallData = CIMCall::Invite(Array( 'CHAT_ID' => $chatId, 'USER_ID' => $userId, 'RECIPIENT_ID' => $_POST['CHAT'] != 'Y'? intval($_POST['CHAT_ID']): 0, 'VIDEO' => $_POST['VIDEO'], )); if (!$arCallData) { if ($e = $GLOBALS["APPLICATION"]->GetException()) $errorMessage = $e->GetString(); echo CUtil::PhpToJsObject(Array( 'ERROR' => $errorMessage )); } else { echo CUtil::PhpToJsObject(Array( 'CHAT_ID' => $arCallData['CHAT_ID'],