Got this to work +-

This commit is contained in:
Daniil Gentili 2017-06-27 09:52:25 +02:00
parent 3160917b5e
commit bfe30d805f
2 changed files with 11 additions and 10 deletions

View File

@ -527,8 +527,8 @@ class MTProto extends \Volatile
'allow_p2p' => false, // Should I accept p2p calls?
'incoming_callback' => 'default_incoming_call_callback',
'network_type' => 7,
'log_file_path' => '/tmp/logs,txt',
'stats_dump_file_path' => '/dev/stdout',
'log_file_path' => '/tmp/logs.txt',
'stats_dump_file_path' => '/tmp/stats.txt',
],
'threading' => [
'allow_threading' => false, // Should I use threading, if it is enabled?
@ -735,7 +735,7 @@ class MTProto extends \Volatile
public function getV()
{
return 47;
return 48;
}
public function get_self()

View File

@ -88,16 +88,15 @@ trait AuthKeyHandler
$this->calls[$params['id']] = ['status' => self::READY, 'key' => $key, 'admin' => true, 'user_id' => $params['participant_id'], 'InputPhoneCall' => ['id' => $params['id'], 'access_hash' => $params['access_hash'], '_' => 'inputPhoneCall'], 'in_seq_no_x' => 0, 'out_seq_no_x' => 1, 'layer' => $this->settings['tl_schema']['layer'], 'updated' => time(), 'incoming' => [], 'outgoing' => [], 'created' => time(), 'protocol' => $params['protocol'], 'callbacks' => $this->calls[$params['id']]['callbacks']];
$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']->setConfig($this->config['call_receive_timeout_ms'] / 1000, $this->config['call_connect_timeout_ms'] / 1000, \danog\MadelineProto\VoIP::DATA_SAVING_NEVER, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']);
$this->calls[$params['id']]['controller']->setEncryptionKey($key['auth_key'], true);
$this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']);
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']);
$this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
$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']->setRemoteEndpoints(array_merge([$res['connection']], $res['alternative_connections']), $params['protocol']['udp_p2p']);
$this->calls[$params['id']]['controller']->start();
$this->calls[$params['id']]['controller']->connect();
/*
$samplerate = 48000;
$period = 1 / $samplerate;
$writePeriod = $period * 960;
@ -114,6 +113,7 @@ trait AuthKeyHandler
$time = microtime(true);
$this->calls[$params['id']]['controller']->writeFrames(stream_get_contents($f, 960 * 2));
}
*/
$this->handle_pending_updates();
}
@ -146,10 +146,11 @@ 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'], false);
$this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']);
$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']);
$this->calls[$params['id']]['controller']->setConfig($this->config['call_receive_timeout_ms'] / 1000, $this->config['call_connect_timeout_ms'] / 1000, \danog\MadelineProto\VoIP::DATA_SAVING_NEVER, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']);
$this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
$this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$params['connection']], $params['alternative_connections']), $this->settings['calls']['allow_p2p']);
$this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$params['connection']], $params['alternative_connections']), $params['protocol']['udp_p2p']);
$this->calls[$params['id']]['controller']->start();
$this->calls[$params['id']]['controller']->connect();
}
public function call_status($id)