RequestCallRequest
Only users can use this method. See code examples.
---functions--- phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall
Returns
| phone.PhoneCall |
This type can only be an instance of:
| PhoneCall |
Parameters
| user_id | InputUser | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.). |
| g_a_hash | bytes | |
| protocol | PhoneCallProtocol | |
| video | flag | This argument defaults to None and can be omitted. |
| random_id | int | If left unspecified, it will be inferred automatically. |
Known RPC errors
This request can cause 6 known errors:
CallProtocolFlagsInvalidError | Call protocol flags invalid. |
ParticipantCallFailedError | Failure while making call. |
ParticipantVersionOutdatedError | The other participant does not use an up to date telegram client with support for calls. |
UserIdInvalidError | Invalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited. |
UserIsBlockedError | User is blocked. |
UserPrivacyRestrictedError | The user's privacy settings do not allow you to do this. |
You can import these from telethon.errors.
Example
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.phone.RequestCallRequest(
user_id='username',
g_a_hash=b'arbitrary\x7f data \xfa here',
protocol=types.PhoneCallProtocol(
min_layer=42,
max_layer=42,
library_versions=['some string here'],
udp_p2p=True,
udp_reflector=True
),
video=True
))
print(result.stringify())