phone.AcceptCall
Accept incoming call
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.AcceptCall({
peer: new Api.InputPhoneCall({
id: BigInt("-4156887774564"),
accessHash: BigInt("-4156887774564"),
}),
gB: Buffer.from("arbitrary data here"),
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.AcceptCall({
peer: new Api.InputPhoneCall({
id: BigInt("-4156887774564"),
accessHash: BigInt("-4156887774564"),
}),
gB: Buffer.from("arbitrary data here"),
protocol: new Api.PhoneCallProtocol({
minLayer: 43,
maxLayer: 43,
libraryVersions: ["some string here"],
udpP2p: true,
udpReflector: true,
}),
})
);
console.log(result); // prints the result
})();
Parameters
| Name | Type | Description |
|---|---|---|
| peer | InputPhoneCall | The call to accept |
| gB | bytes | Parameter for E2E encryption key exchange ยป |
| protocol | PhoneCallProtocol | Phone call settings |
Result
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CALL_ALREADY_ACCEPTED | The call was already accepted. |
| 400 | CALL_ALREADY_DECLINED | The call was already declined. |
| 500 | CALL_OCCUPY_FAILED | The call failed because the user is already making another call. |
| 400 | CALL_PEER_INVALID | The provided call peer object is invalid. |
| 400 | CALL_PROTOCOL_FLAGS_INVALID | Call protocol flags invalid. |
Can bots use this method?
No