# phone.requestCall

Start a telegram phone call

## Example

{% tabs %}
{% tab title="Javascript" %}

```javascript
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.phone.requestCall({
        video: true,
        userId: new Api.InputUser({...}),
        randomId: 3511366,
        gAHash: Buffer.from('some bytes here'),
        protocol: new Api.PhoneCallProtocol({...}),
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result: Api.phone.PhoneCall = await client.invoke(new Api.phone.requestCall({
        video: true,
        userId: new Api.InputUser({...}),
        randomId: 3511366,
        gAHash: Buffer.from('some bytes here'),
        protocol: new Api.PhoneCallProtocol({...}),
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}
{% endtabs %}

## TL schema

```
phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall;
---functions---
phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
```

## Parameters

|      Name      | Type                                                                                                                              | Description                                                                                             |
| :------------: | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|    **flags**   | [#](https://core.telegram.org/type/%23)                                                                                           | Flags, see [TL conditional fields](https://core.telegram.org/mtproto/TL-combinators#conditional-fields) |
|    **video**   | [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).0?[true](https://core.telegram.org/constructor/true) | Whether to start a video call                                                                           |
|  **user\_id**  | [InputUser](https://core.telegram.org/type/InputUser)                                                                             | Destination of the phone call                                                                           |
| **random\_id** | [int](https://core.telegram.org/type/int)                                                                                         | Random ID to avoid resending the same object                                                            |
| **g\_a\_hash** | [bytes](https://core.telegram.org/type/bytes)                                                                                     | [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls)     |
|  **protocol**  | [PhoneCallProtocol](https://core.telegram.org/type/PhoneCallProtocol)                                                             | Phone call settings                                                                                     |

## Result

[phone.PhoneCall](https://core.telegram.org/type/phone.PhoneCall)

## Possible errors

| Code | Type                           | Description                                                                             |
| :--: | ------------------------------ | --------------------------------------------------------------------------------------- |
|  400 | CALL\_PROTOCOL\_FLAGS\_INVALID | Call protocol flags invalid                                                             |
|  400 | PARTICIPANT\_VERSION\_OUTDATED | The other participant does not use an up to date telegram client with support for calls |
|  400 | USER\_ID\_INVALID              | The provided user ID is invalid                                                         |
|  403 | USER\_IS\_BLOCKED              | You were blocked by this user                                                           |
|  403 | USER\_PRIVACY\_RESTRICTED      | The user's privacy settings do not allow you to do this                                 |

## Can bots use this methd ?

### yes

## Related pages

### [End-to-End Encrypted Voice Calls](https://core.telegram.org/api/end-to-end/voice-calls)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://painor.gitbook.io/gramjs/working-with-voip-calls/phone.requestcall.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
