> For the complete documentation index, see [llms.txt](https://painor.gitbook.io/gramjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://painor.gitbook.io/gramjs/working-with-voip-calls/phone.confirmcall.md).

# phone.confirmCall

[Complete phone call E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls)

## 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.confirmCall({
        peer: new Api.InputPhoneCall({...}),
        gA: Buffer.from('some bytes here'),
        keyFingerprint: 8851789,
        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.confirmCall({
        peer: new Api.InputPhoneCall({...}),
        gA: Buffer.from('some bytes here'),
        keyFingerprint: 8851789,
        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.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;
```

## Parameters

|         Name         | Type                                                                  | Description                                                                                         |
| :------------------: | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|       **peer**       | [InputPhoneCall](https://core.telegram.org/type/InputPhoneCall)       | The phone call                                                                                      |
|       **g\_a**       | [bytes](https://core.telegram.org/type/bytes)                         | [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls) |
| **key\_fingerprint** | [long](https://core.telegram.org/type/long)                           | Key fingerprint                                                                                     |
|     **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\_ALREADY\_DECLINED | The call was already declined            |
|  400 | CALL\_PEER\_INVALID     | The provided call peer object is invalid |

## Can bots use this methd ?

### yes

## Related pages

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