1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 04:54:45 +01:00
This commit is contained in:
Daniil Gentili 2017-08-05 15:43:09 +00:00
commit d95e46e292
3 changed files with 19 additions and 11 deletions

View File

@ -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) {
@ -112,10 +111,17 @@ $calls = [];
break;
case 'updatePhoneCall':
if (is_object($update['update']['phone_call']) && isset($update['update']['phone_call']->madeline) && $update['update']['phone_call']->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_INCOMING) {
include('songs.php');
include 'songs.php';
$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';

View File

@ -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',
];
for ($x = 0; $x < count($songs); $x++) { shuffle($songs); }

View File

@ -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]);
}