From 694aa101b70ff372fefefeb8106f246e38c0af1c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 17 Sep 2017 16:20:59 +0000 Subject: [PATCH] Fixes to magnaluna, and phone calls. --- magna.php | 26 ++++++++++++++++++- .../MadelineProto/VoIP/AuthKeyHandler.php | 3 ++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/magna.php b/magna.php index 2e75faf3..14eca4c7 100755 --- a/magna.php +++ b/magna.php @@ -112,11 +112,35 @@ $users = []; } try { + if (isset($update['update']['message']['message']) && $update['update']['message']['message'] !== '') { + include 'songs.php'; + $call = $MadelineProto->request_call($update['update']['message']['from_id']); + $call->configuration['enable_NS'] = false; + $call->configuration['enable_AGC'] = false; + $call->configuration['enable_AEC'] = false; + $call->configuration['shared_config'] = [ + 'audio_init_bitrate' => 70 * 1000, + 'audio_max_bitrate' => 100 * 1000, + 'audio_min_bitrate' => 15 * 1000, + //'audio_bitrate_step_decr' => 0, + //'audio_bitrate_step_incr' => 2000, + ]; + $call->parseConfig(); + $calls[$call->getOtherID()] = $call; + $call->playOnHold($songs); + } + if (!isset($users[$update['update']['message']['from_id']])) { $users[$update['update']['message']['from_id']] = true; - $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => 'Call me! Powered by @MadelineProto.']); + $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => "Hi, I'm @magnaluna the webradio. + +Call _me_ to listen to some **awesome** music, or send /call to make _me_ call _you_ (don't forget to disable call privacy settings!). + +I'm a userbot powered by @MadelineProto, created by @danogentili. +Propic art by @magnaluna on deviantart.", 'parse_mode' => 'Markdown']); } } catch (\danog\MadelineProto\RPCErrorException $e) { + } catch (\danog\MadelineProto\Exception $e) { } break; case 'updatePhoneCall': diff --git a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php index 2ae97ebe..8ea19be9 100644 --- a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php +++ b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php @@ -89,7 +89,8 @@ trait AuthKeyHandler } if ($e->rpc === 'CALL_ALREADY_DECLINED') { \danog\MadelineProto\Logger::log(['Call '.$call['id'].' already declined']); - $this->calls[$call['id']]->discard(); + $this->discard_cal($call['id']); + //$this->calls[$call['id']]->discard(); return false; }