mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 11:18:59 +01:00
Merge branch 'master' of https://github.com/danog/Madelineproto
This commit is contained in:
commit
d95e46e292
10
magna.php
10
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
|
$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) {
|
foreach ($calls as $key => $call) {
|
||||||
if ($call->getOutputState() >= \danog\MadelineProto\VoIP::AUDIO_STATE_CREATED) {
|
if ($call->getOutputState() >= \danog\MadelineProto\VoIP::AUDIO_STATE_CREATED) {
|
||||||
$call->setBitrate(100*1000);
|
|
||||||
try {
|
try {
|
||||||
$MadelineProto->messages->sendMessage(['peer' => $call->getOtherID(), 'message' => 'Emojis: '.implode('', $call->getVisualization())]);
|
$MadelineProto->messages->sendMessage(['peer' => $call->getOtherID(), 'message' => 'Emojis: '.implode('', $call->getVisualization())]);
|
||||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||||
@ -112,10 +111,17 @@ $calls = [];
|
|||||||
break;
|
break;
|
||||||
case 'updatePhoneCall':
|
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) {
|
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_NS'] = false;
|
||||||
$update['update']['phone_call']->configuration['enable_AGC'] = false;
|
$update['update']['phone_call']->configuration['enable_AGC'] = false;
|
||||||
$update['update']['phone_call']->configuration['enable_AEC'] = 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();
|
$update['update']['phone_call']->parseConfig();
|
||||||
if ($update['update']['phone_call']->accept() === false) {
|
if ($update['update']['phone_call']->accept() === false) {
|
||||||
echo 'DID NOT ACCEPT A CALL';
|
echo 'DID NOT ACCEPT A CALL';
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
$songs = [
|
$songs = [
|
||||||
'Aronchupa - Little Swing' => 'input.raw',
|
'Aronchupa - Little Swing' => 'input.raw',
|
||||||
'Parov Stelar - Booty Swing' => 'inputa.raw',
|
// 'Parov Stelar - Booty Swing' => 'inputa.raw',
|
||||||
'Parov Stelar - All night' => 'inpute.raw',
|
// 'Parov Stelar - All night' => 'inpute.raw',
|
||||||
'Caravan Palace - Lone Digger' => 'inputb.raw',
|
// 'Caravan Palace - Lone Digger' => 'inputb.raw',
|
||||||
// 'Swingrowers - Butterfly' => 'inputc.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); }
|
for ($x = 0; $x < count($songs); $x++) { shuffle($songs); }
|
||||||
|
@ -134,6 +134,9 @@ trait AuthKeyHandler
|
|||||||
}
|
}
|
||||||
$this->calls[$params['id']]->setVisualization($visualization);
|
$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([
|
$this->calls[$params['id']]->configuration = array_merge([
|
||||||
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
||||||
'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000,
|
'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000,
|
||||||
@ -146,8 +149,6 @@ trait AuthKeyHandler
|
|||||||
|
|
||||||
'auth_key' => $key,
|
'auth_key' => $key,
|
||||||
'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET,
|
'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']]->configuration);
|
||||||
$this->calls[$params['id']]->parseConfig();
|
$this->calls[$params['id']]->parseConfig();
|
||||||
$res = $this->calls[$params['id']]->startTheMagic();
|
$res = $this->calls[$params['id']]->startTheMagic();
|
||||||
@ -195,6 +196,8 @@ trait AuthKeyHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->calls[$params['id']]->setVisualization($visualization);
|
$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([
|
$this->calls[$params['id']]->configuration = array_merge([
|
||||||
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
||||||
@ -208,9 +211,8 @@ trait AuthKeyHandler
|
|||||||
|
|
||||||
'auth_key' => $key,
|
'auth_key' => $key,
|
||||||
'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET,
|
'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);
|
], $this->calls[$params['id']]->configuration);
|
||||||
|
var_dump($this->calls[$params['id']]->configuration);
|
||||||
$this->calls[$params['id']]->parseConfig();
|
$this->calls[$params['id']]->parseConfig();
|
||||||
|
|
||||||
return $this->calls[$params['id']]->startTheMagic();
|
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);
|
\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]);
|
$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);
|
\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]);
|
$this->method_call('phone.saveCallDebug', ['peer' => $call, 'debug' => $this->calls[$call['id']]->getDebugLog()], ['datacenter' => $this->datacenter->curdc]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user