This commit is contained in:
Daniil Gentili 2018-07-12 19:28:02 +02:00
parent 3bda743116
commit 69f0dfa756

View File

@ -14,6 +14,11 @@ if (!file_exists('input.raw')) {
copy('https://github.com/danog/MadelineProto/raw/master/input.raw', 'input.raw');
}
$call = $MadelineProto->request_call('@danogentili')->play('input.raw')->then('input.raw')->playOnHold(['input.raw'])->setOutputFile('output.raw');
// We need to receive updates in order to avoid closing the script before the call has ended
while ($call->getCallState() < \danog\MadelineProto\VoIP::CALL_STATE_ENDED) {
$MadelineProto->get_updates();
}
```
The wrapper consists in the `\danog\MadelineProto\VoIP` class, that can be installed by compiling the [php-libtgvoip](https://voip.madelineproto.xyz) extension.
@ -104,6 +109,7 @@ Accepting calls is just as easy: you will receive an [updatePhoneCall](https://d
This array will contain a VoIP object under the `phone_call` key.
```php
while (true) {
$updates = $MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
foreach ($updates as $update) {
\danog\MadelineProto\Logger::log([$update]);
@ -115,6 +121,7 @@ foreach ($updates as $update) {
}
}
}
}
```
<a href="https://docs.madelineproto.xyz/docs/SECRET_CHATS.html">Next section</a>