diff --git a/magna.php b/magna.php index f2dcd0da..80eafedb 100755 --- a/magna.php +++ b/magna.php @@ -90,7 +90,6 @@ $calls = []; $updates = $MadelineProto->API->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 ($calls as $key => $call) { if ($call->getOutputState() >= \danog\MadelineProto\VoIP::AUDIO_STATE_CREATED) { - $call->setBitrate(100 * 1000); try { $MadelineProto->messages->sendMessage(['peer' => $call->getOtherID(), 'message' => 'Emojis: '.implode('', $call->getVisualization())]); } catch (\danog\MadelineProto\RPCErrorException $e) { @@ -108,6 +107,13 @@ $calls = []; $update['update']['phone_call']->configuration['enable_NS'] = false; $update['update']['phone_call']->configuration['enable_AGC'] = false; $update['update']['phone_call']->configuration['enable_AEC'] = false; + $update['update']['phone_call']->configuration['shared_config'] = [ + 'audio_init_bitrate' => 40*1000, + 'audio_max_bitrate' => 50*1000, + 'audio_min_bitrate' => 15*1000, + //'audio_bitrate_step_decr' => 0, + //'audio_bitrate_step_incr' => 2000, + ]; $update['update']['phone_call']->parseConfig(); if ($update['update']['phone_call']->accept() === false) { echo 'DID NOT ACCEPT A CALL'; diff --git a/songs.php b/songs.php index 19b5068b..b7033f76 100644 --- a/songs.php +++ b/songs.php @@ -2,10 +2,10 @@ $songs = [ 'Aronchupa - Little Swing' => 'input.raw', - 'Parov Stelar - Booty Swing' => 'inputa.raw', - 'Parov Stelar - All night' => 'inpute.raw', - 'Caravan Palace - Lone Digger' => 'inputb.raw', +// 'Parov Stelar - Booty Swing' => 'inputa.raw', +// 'Parov Stelar - All night' => 'inpute.raw', +// 'Caravan Palace - Lone Digger' => 'inputb.raw', // 'Swingrowers - Butterfly' => 'inputc.raw', - 'Postmodern Jukebox - Thrift Shop' => 'inputd.raw', +// 'Postmodern Jukebox - Thrift Shop' => 'inputd.raw', ]; shuffle($songs); diff --git a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php index 5369b03c..a7a5129d 100644 --- a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php +++ b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php @@ -134,6 +134,9 @@ trait AuthKeyHandler } $this->calls[$params['id']]->setVisualization($visualization); + $this->calls[$params['id']]->configuration['shared_config'] = array_merge($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), $this->calls[$params['id']]->configuration['shared_config']); + $this->calls[$params['id']]->configuration['endpoints'] = array_merge([$params['connection']], $params['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']); + $this->calls[$params['id']]->configuration = array_merge([ 'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000, 'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000, @@ -146,8 +149,6 @@ trait AuthKeyHandler 'auth_key' => $key, 'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET, - 'shared_config' => $this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), - 'endpoints' => array_merge([$res['connection']], $res['alternative_connections']), ], $this->calls[$params['id']]->configuration); $this->calls[$params['id']]->parseConfig(); $res = $this->calls[$params['id']]->startTheMagic(); @@ -195,6 +196,8 @@ trait AuthKeyHandler } $this->calls[$params['id']]->setVisualization($visualization); + $this->calls[$params['id']]->configuration['shared_config'] = array_merge($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), $this->calls[$params['id']]->configuration['shared_config']); + $this->calls[$params['id']]->configuration['endpoints'] = array_merge([$params['connection']], $params['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']); $this->calls[$params['id']]->configuration = array_merge([ 'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000, @@ -208,9 +211,8 @@ trait AuthKeyHandler 'auth_key' => $key, 'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET, - 'shared_config' => $this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), - 'endpoints' => array_merge([$params['connection']], $params['alternative_connections']), ], $this->calls[$params['id']]->configuration); + var_dump($this->calls[$params['id']]->configuration); $this->calls[$params['id']]->parseConfig(); return $this->calls[$params['id']]->startTheMagic(); @@ -270,7 +272,7 @@ trait AuthKeyHandler \danog\MadelineProto\Logger::log(['Setting rating for call '.$call['id'].'...'], \danog\MadelineProto\Logger::VERBOSE); $this->method_call('phone.setCallRating', ['peer' => $call, 'rating' => $rating['rating'], 'comment' => $rating['comment']], ['datacenter' => $this->datacenter->curdc]); } - if ($need_debug) { + if ($need_debug) {//} && isset($this->calls[$call['id']]->storage['not_modified'])) { \danog\MadelineProto\Logger::log(['Saving debug data for call '.$call['id'].'...'], \danog\MadelineProto\Logger::VERBOSE); $this->method_call('phone.saveCallDebug', ['peer' => $call, 'debug' => $this->calls[$call['id']]->getDebugLog()], ['datacenter' => $this->datacenter->curdc]); }