Link Search Menu Expand Document

danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Back to index

Author: Daniil Gentili daniil@daniil.it

Controller for a Telegram end-to-end encrypted conference call

(end-to-end group calls).

It owns the two block subchains ({@see ConferenceChain} + {@see Verification}), turns the accepted blocks into media-encryption epochs, and drives a {@see GroupConnection} whose RTP frames are end-to-end encrypted by a {@see FrameCryptor} — the SFU only ever forwards ciphertext. It is both the connection’s owner and the cryptor’s key provider.

This is the internal controller; the public handle library users receive from {@see \danog\MadelineProto\MTProto::createConferenceCall()} and {@see \danog\MadelineProto\MTProto::joinConferenceCall()} is the {@see ConferenceCallUpdate} returned by {@see self::getPublic()}, which delegates back here by call id. The controller implements the common {@see Call} media interface plus conference-specific controls (verification, encrypted messages).

Properties

  • $API: danog\MadelineProto\MTProto

Method list:

Methods:

__construct(\danog\MadelineProto\MTProto $API)

Parameters:

  • $API: \danog\MadelineProto\MTProto

See also:

  • \danog\MadelineProto\MTProto

resumeAfterRestart(): void

Resume the conference after the process restarted: reopen the media connection, re-register for push updates, restart the backstop poll and catch up on any blocks missed while stopped. Named
to avoid clashing with the {@see Call} playback {@see self::resume()}.

setCall(array $call): void

Point this controller at an existing conference (its groupCall), before joining it.

Parameters:

  • $call: array

getInputCall(): array

Return value: The inputGroupCall, once the conference exists.

getPublic(): \danog\MadelineProto\EventHandler\Calls\ConferenceCall

The public {@see ConferenceCallUpdate} handle for this conference, built lazily once the call exists. This is the object handed to library users; it delegates every operation back to this
controller by call id.

See also:

isJoined(): bool

Whether we are currently in the conference (joined and not left/forbidden).

isCallEnded(): bool

Whether we left (or discarded) the conference for good: the playback machinery stops then, but not while we are merely between a drop and the automatic re-join.

getCallState(): \danog\MadelineProto\EventHandler\Calls\GroupCallState

Get the state of the conference call.

See also:

activeEpochs(): array

selfSeed(): string

publicKeyForSsrc(int $ssrc): ?string

Parameters:

  • $ssrc: int

create(bool $muted = false): void

Create a brand-new conference call with ourselves as the sole participant and join it. Returns the raw phone.groupCall this controller now drives.

Parameters:

  • $muted: bool

join(bool $muted = false): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Join an existing conference call: fetch the chain, add ourselves in a new block, and join with that block.

Parameters:

  • $muted: bool

editParticipant(array|string|int $participant, ?bool $muted = NULL, ?int $volume = NULL, ?bool $videoPaused = NULL): void

Change a participant’s state (phone.editGroupCallParticipant): mute them for ourselves, set our playback volume of them, or pause/resume our own video.

Parameters:

  • $participant: array|string|int
  • $muted: ?bool
  • $volume: ?int
  • $videoPaused: ?bool

toggleSettings(?bool $joinMuted = NULL, bool $resetInviteHash = false, ?bool $messagesEnabled = NULL): void

Change the conference’s settings (phone.toggleGroupCallSettings): whether new members join muted, whether in-call messages are enabled, or invalidate its conference link.

Parameters:

  • $joinMuted: ?bool
  • $resetInviteHash: bool
  • $messagesEnabled: ?bool

invite(string|int ...$users): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Invite users to the conference call (phone.inviteConferenceCallParticipant), ringing them; once they accept they add themselves to the chain with their own self-join block.

Parameters:

  • ...$users: string|int

exportInvite(bool $canSelfUnmute = false): string

The conference link » of the call: it is created with the call and carried by its groupCall (invite_link), so, like official clients, we
read it from there rather than exporting one.

Parameters:

  • $canSelfUnmute: bool

removeParticipant(string|int ...$participants): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Remove participants from the conference: build a block dropping them and rekeying for the remaining members, then submit it with phone.deleteConferenceCallParticipants. Requires the
remove_users permission. The removed members can no longer decrypt media once the new epoch
takes over.

Parameters:

  • ...$participants: string|int

syncChain(int $subChainId): void

Fetch and apply every block of a subchain from our current offset until caught up.

Parameters:

  • $subChainId: int

then(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Parameters:

  • $file: \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream
  • $dest: \danog\MadelineProto\MediaDestination

See also:

discard(): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

End the conference for everyone (phone.discardGroupCall, allowed to its creator only) and leave it; if the server refuses, just leave.

leave(): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Leave the conference, keeping it running for the other participants: stop the backstop poll and stop receiving its updates.

getParticipants(): array<int, \danog\MadelineProto\EventHandler\Calls\ConferenceCallParticipant>

The participants currently in the conference, keyed by user id, each with their Ed25519 public key, permission bits and protocol version from the shared-state chain.

See also:

getVisualization(): (list<string>|null)

The four verification emojis of the current chain head, or null until every member has committed and revealed their nonce for it.

sendMessage(string $message, ?\danog\MadelineProto\ParseMode $parseMode = NULL, ?int $paidStars = NULL, mixed $sendAs = NULL): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Send an end-to-end encrypted in-call message to every participant: a groupCallMessage JSON document, as the protocol
defines, encrypted with {@see CallPacket} on channel 0 for the current epochs.

Parameters:

  • $message: string
  • $parseMode: ?\danog\MadelineProto\ParseMode
  • $paidStars: ?int
  • $sendAs: mixed

See also:

sendReaction(string $emoji, ?int $customEmojiId = NULL): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Send an end-to-end encrypted in-call reaction: a single emoji, or a custom emoji with $emoji as its fallback.

Parameters:

  • $emoji: string
  • $customEmojiId: ?int

setOutput(\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream $file, string|int|null $participant = NULL, ?\danog\MadelineProto\RecordingFormat $format = NULL, ?StreamMask $streams = NULL): StreamMask

Record one participant’s (decrypted) media into a single file (or stream) with a fixed set of tracks, see {@see GroupMediaTrait::recordParticipant()}.

Parameters:

  • $file: \danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream
  • $participant: string|int|null
  • $format: ?\danog\MadelineProto\RecordingFormat
  • $streams: ?StreamMask The {@see CallStream} flags to record, or null for every available one.

Return value: The streams the participant currently sends, as {@see CallStream} flags.

See also:

setOutputFolder(\danog\MadelineProto\LocalDirectory $dir, string|int|null $participant = NULL, ?\danog\MadelineProto\RecordingFormat $format = NULL): \danog\MadelineProto\Tgcalls\E2E\ConferenceCall

Record the conference (decrypted) into a directory, as numbered series of Matroska files, one per participant, see {@see GroupMediaTrait::recordFolder()}.

Parameters:

  • $dir: \danog\MadelineProto\LocalDirectory
  • $participant: string|int|null
  • $format: ?\danog\MadelineProto\RecordingFormat

See also:

getChain(): \danog\MadelineProto\Tgcalls\E2E\ConferenceChain

See also:

  • \danog\MadelineProto\Tgcalls\E2E\ConferenceChain

log(string $message, int $level = \danog\MadelineProto\Logger::NOTICE): void

Parameters:

  • $message: string
  • $level: int

onIncomingSource(int $source): void

Parameters:

  • $source: int

onConnectionFailed(): void

play(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static

Play a file, transmitting its audio and, if it carries a transmittable one, its video.

Parameters:

  • $file: \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream
  • $dest: \danog\MadelineProto\MediaDestination

See also:

playBlocking(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static

Play a file, blocking until it has finished playing if a stream was passed.

Parameters:

  • $file: \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream
  • $dest: \danog\MadelineProto\MediaDestination

See also:

playOnHold(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera, \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream ...$files): static

Set the files to play, on loop, while the given stream’s main playlist is empty.

Parameters:

  • $dest: \danog\MadelineProto\MediaDestination
  • ...$files: \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream

See also:

skip(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static

Skip to the next file in the playlist.

Parameters:

  • $dest: \danog\MadelineProto\MediaDestination

See also:

stop(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static

Stop playing all files, clearing the main and the hold playlist; stopping the presentation stops sharing the screen.

Parameters:

  • $dest: \danog\MadelineProto\MediaDestination

See also:

pause(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static

Pause playback of the current file.

Parameters:

  • $dest: \danog\MadelineProto\MediaDestination

See also:

resume(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static

Resume playback of the current file.

Parameters:

  • $dest: \danog\MadelineProto\MediaDestination

See also:

getCurrent(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|string|null

The file or stream currently being played, if any.

Parameters:

  • $dest: \danog\MadelineProto\MediaDestination

See also:

isPaused(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): bool

Whether playback of the current file is paused.

Parameters:

  • $dest: \danog\MadelineProto\MediaDestination

See also:

enablePresentation(): static

Start the separate screen-share connection (phone.joinGroupCallPresentation) if it is not up yet. The screen-share is a fully separate WebRTC connection with its own SSRC and transport;
see https://core.telegram.org/api/group-calls. Idempotent.

disablePresentation(): static

Stop sharing the screen: tear down the presentation connection and leave it server-side.

isSharingScreen(): bool

Whether a screen-share is currently being transmitted.

setMuted(bool $muted = true): static

Mute or unmute ourselves.

Parameters:

  • $muted: bool

isMuted(): bool

Whether we are muted.

setTitle(string $title): static

Change the title of the call.

Parameters:

  • $title: string

Generated by danog/phpdoc