From 19f133676fb6bb7b5ea064669ebf8fa390e8c855 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 26 Jun 2017 15:57:03 +0200 Subject: [PATCH] Fixes to the lua module --- src/danog/MadelineProto/Lua.php | 2 +- src/danog/MadelineProto/MTProto.php | 2 +- src/danog/MadelineProto/TL/TL.php | 5 +++++ src/danog/MadelineProto/VoIP/AuthKeyHandler.php | 14 ++++++++++---- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/danog/MadelineProto/Lua.php b/src/danog/MadelineProto/Lua.php index bef9a33a..8e96e73f 100644 --- a/src/danog/MadelineProto/Lua.php +++ b/src/danog/MadelineProto/Lua.php @@ -46,7 +46,7 @@ class Lua $this->Lua->registerCallback($method, [$this->MadelineProto->API, $method]); } $methods = []; - foreach ($this->MadelineProto->API->methods->method_namespace as $method => $namespace) { + foreach ($this->MadelineProto->get_methods_namespaced() as $method => $namespace) { $methods[$namespace][$method] = [$this->MadelineProto->{$namespace}, $method]; } foreach ($this->MadelineProto->get_method_namespaces() as $namespace) { diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index cd45e83a..3fc814e5 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -735,7 +735,7 @@ class MTProto extends \Volatile public function getV() { - return 45; + return 47; } public function get_self() diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index f9c6c101..dd2f573c 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -221,6 +221,11 @@ trait TL return array_unique($this->array_values($this->methods->method_namespace)); } + public function get_methods_namespaced() + { + return $this->methods->method_namespace; + } + public function serialize_bool($bool) { return $this->constructors->find_by_predicate($bool ? 'boolTrue' : 'boolFalse')['id']; diff --git a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php index ef1bead3..5ed2e597 100644 --- a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php +++ b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php @@ -90,15 +90,21 @@ trait AuthKeyHandler $this->calls[$params['id']]['controller'] = new \danog\MadelineProto\VoIP($this->calls[$params['id']]['callbacks']['set_state'], $this->calls[$params['id']]['callbacks']['incoming'], $this->calls[$params['id']]['callbacks']['outgoing'], $this, $this->calls[$params['id']]['InputPhoneCall']); $this->calls[$params['id']]['controller']->setEncryptionKey($key['auth_key'], true); $this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']); - var_dump('config'); + var_dump($this->config['call_connect_timeout_ms'] / 1000); + $this->calls[$params['id']]['controller']->setConfig($this->config['call_receive_timeout_ms'] / 1000, $this->config['call_connect_timeout_ms'] / 1000, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']); - var_dump('shared config'); $this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc])); - var_dump('endpoints'); - var_dump(array_merge([$res['connection']], $res['alternative_connections'])); $this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$res['connection']], $res['alternative_connections']), $this->settings['calls']['allow_p2p']); var_dump('start'); $this->calls[$params['id']]['controller']->start(); + readline(); + var_dump("SENDING DAT"); + $f = fopen("output.raw", 'r'); + while (!feof($f)) { + var_dump("SENDING 960 frames"); + $this->calls[$params['id']]['controller']->writeFrames(stream_get_contents($f, 960*2)); + } + $this->handle_pending_updates(); }