GramJS

phone.ConfirmCall

Complete phone call E2E encryption key exchange »

Example

const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.phone.ConfirmCall({
      peer: new Api.InputPhoneCall({
        id: BigInt("-4156887774564"),
        accessHash: BigInt("-4156887774564"),
      }),
      gA: Buffer.from("arbitrary data here"),
      keyFingerprint: BigInt("-4156887774564"),
      protocol: new Api.PhoneCallProtocol({
        minLayer: 43,
        maxLayer: 43,
        libraryVersions: ["some string here"],
        udpP2p: true,
        udpReflector: true,
      }),
    })
  );
  console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result: Api.phone.PhoneCall = await client.invoke(
    new Api.phone.ConfirmCall({
      peer: new Api.InputPhoneCall({
        id: BigInt("-4156887774564"),
        accessHash: BigInt("-4156887774564"),
      }),
      gA: Buffer.from("arbitrary data here"),
      keyFingerprint: BigInt("-4156887774564"),
      protocol: new Api.PhoneCallProtocol({
        minLayer: 43,
        maxLayer: 43,
        libraryVersions: ["some string here"],
        udpP2p: true,
        udpReflector: true,
      }),
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
peerInputPhoneCallThe phone call
gAbytesParameter for E2E encryption key exchange »
keyFingerprintlongKey fingerprint
protocolPhoneCallProtocolPhone call settings

Result

phone.PhoneCall

Possible errors

CodeTypeDescription
400CALL_ALREADY_DECLINEDThe call was already declined
400CALL_PEER_INVALIDThe provided call peer object is invalid

Can bots use this method?

No

End-to-End Encrypted Voice Calls