Closed merlinkory closed 5 years ago
@merlinkory And other methods before authentication without timeout? It's a bit strange. Hard to answer. Can you give some output of your scripts?
For following code:
<?php
Error_Reporting(E_ALL);
ini_set('display_errors', 1);
$client = new TDLib\JsonClient();
$query = json_encode([
"@type" => "setTdlibParameters",
"parameters" => [
"use_test_dc" => false,
"database_directory" => "/var/tmp/tdlib",
"files_directory" => "/var/tmp/tdlib",
"use_file_database" => false,
"use_chat_info_database" => false,
"use_message_database" => false,
"use_secret_chats" => false,
"api_id" => xxx,
"api_hash" => "xxx",
"system_language_code" => "en",
"device_model" => php_uname('s'),
"system_version" => php_uname('v'),
"application_version" => "0.0.6",
"enable_storage_optimizer" => true,
"ignore_file_names" => false
]
]);
$result = $client->query($query, 10);
$response = json_decode($result, true);
var_dump($response);
$query = json_encode([
'@type' => 'setDatabaseEncryptionKey',
]);
$result = $client->query($query, 10);
$response = json_decode($result, true);
var_dump($response);
$query = json_encode([
'@type' => 'getAuthorizationState',
'@extra' => 1.01234
]);
$result = $client->query($query, 10);
$response = json_decode($result, true);
var_dump($response);
$query = json_encode([
'@type' => 'setAuthenticationPhoneNumber ',
'phone_number' => '+xxx'
]);
$result = $client->query($query,30);
$response = json_decode($result, true);
var_dump($response);
$client->destroy();
output is
[ 3][t 4][1548650288.084987402][Td.cpp:4238][!Td][&td_requests] Sending update: updateAuthorizationState { authorization_state = authorizationStateWaitTdlibParameters { } }
[ 3][t 4][1548650288.086034060][Td.cpp:3308][!Td][&td_requests] Receive request 1: setTdlibParameters { parameters = tdlibParameters { use_test_dc = false database_directory = "/var/tmp/tdlib" files_directory = "/var/tmp/tdlib" use_file_database = false use_chat_info_database = false use_message_database = false use_secret_chats = false api_id = xxx api_hash = "xxx" system_language_code = "en" device_model = "Linux" system_version = "#33-Ubuntu SMP Fri Dec 7 09:32:27 UTC 2018" application_version = "0.0.6" enable_storage_optimizer = true ignore_file_names = false } }
[ 3][t 4][1548650288.087177038][Binlog.cpp:368][!Td] Load: init encryption [ 3][t 4][1548650288.087664366][Td.cpp:4238][!Td][&td_requests] Sending update: updateAuthorizationState { authorization_state = authorizationStateWaitEncryptionKey { is_encrypted = true } }
[ 3][t 4][1548650288.087781429][Td.cpp:4253][!Td][&td_requests] Sending result for request 1: ok { }
[ 3][t 4][1548650288.090218306][Td.cpp:3308][!Td][&td_requests] Receive request 2: setDatabaseEncryptionKey { new_encryption_key = bytes [0] { } }
[ 3][t 4][1548650288.090561390][Binlog.cpp:368][!Td] Load: init encryption [ 3][t 4][1548650288.092144251][Td.cpp:3943][!Td] Successfully inited database in [database_directory:/var/tmp/tdlib/] and [files_directory:/var/tmp/tdlib/] [ 4][t 4][1548650288.092209816][Global.cpp:81][!Td] LOAD: [server_time_difference:1548650056.255799] [ 3][t 4][1548650288.093618631][NetQueryDispatcher.cpp:261][!Td] [main_dc_id:1] [ 3][t 3][1548650288.095602989][ResourceManager.cpp:135][!UploadResourceManager] [unused:2097152] [ 4][t 4][1548650288.097177982][utils.cpp:21][!Td] Create storer for help_getNearestDc { }
[ 3][t 4][1548650288.097267628][NetQuery.h:347][!Td] [Query:[id:65536][tl:0x1fb33026][state:Query]] [ 3][t 4][1548650288.097381830][Td.cpp:3427][!Td][&net_query] Send [Query:[id:65536][tl:0x1fb33026][state:Query]] to dispatcher [ 3][t 4][1548650288.097411156][NetQuery.h:239][!Td][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:Td: send to NetQueryDispatcher] [ 3][t 4][1548650288.097442150][NetQuery.h:239][!Td][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:dispatch] [ 2][t 4][1548650288.097531796][AuthDataShared.cpp:111][!Td] DcId{1} [auth_key_id:13801123172548870897][state:KeyNoAuth] [ 3][t 4][1548650288.097736359][NetQuery.h:239][!Td][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:sent to main session multi proxy DcId{1}] [ 3][t 4][1548650288.098056078][ConnectionCreator.cpp:1116][!ConnectionCreator] SAVE DcOptions{[DcOption:DcId{1}[ip:149.154.175.50][port:443][secret_len:0][flags:]], [DcOption:DcId{1}[ip:149.154.175.50][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{1}[ip:2001:b28:f23d:f001::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{2}[ip:149.154.167.51][port:443][secret_len:0][flags:]], [DcOption:DcId{2}[ip:149.154.167.51][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{2}[ip:2001:67c:4e8:f002::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{3}[ip:149.154.175.100][port:443][secret_len:0][flags:]], [DcOption:DcId{3}[ip:149.154.175.100][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{3}[ip:2001:b28:f23d:f003::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{4}[ip:149.154.167.91][port:443][secret_len:0][flags:]], [DcOption:DcId{4}[ip:149.154.167.91][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{4}[ip:2001:67c:4e8:f004::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{4}[ip:149.154.165.120][port:443][secret_len:0][flags:(MediaOnly)]], [DcOption:DcId{4}[ip:2001:67c:4e8:f004::b][port:443][secret_len:0][flags:(MediaOnly)(IPv6)]], [DcOption:DcId{5}[ip:2001:b28:f23f:f005::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{5}[ip:91.108.56.140][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{5}[ip:91.108.56.132][port:443][secret_len:0][flags:]]} [ 3][t 4][1548650288.099590302][ConfigManager.cpp:547][!Recoverer][&config_recoverer] Successfully connected [ 3][t 4][1548650288.099630117][ConfigManager.cpp:608][!Recoverer][&config_recoverer] Wakeup NEVER [ 4][t 4][1548650288.099677324][utils.cpp:21][!ConfigManager] Create storer for help_getConfig { }
[ 3][t 4][1548650288.099715948][NetQuery.h:347][!ConfigManager] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [ 3][t 4][1548650288.099752426][NetQuery.h:239][!ConfigManager][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:dispatch] [ 3][t 4][1548650288.099777937][NetQuery.h:239][!ConfigManager][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:sent to main session multi proxy DcId{1}] [ 3][t 4][1548650288.100561142][StorageManager.cpp:237][!StorageManager] Schedule next file gc in 87 [ 4][t 4][1548650288.100681782][TopDialogManager.cpp:470][!TopDialogManager] Init is enabled: true [ 3][t 4][1548650288.101117611][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "version" value = optionValueString { value = "1.3.0" } }
[ 3][t 4][1548650288.101245880][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "t_me_url" value = optionValueString { value = "https://t.me/" } }
[ 3][t 4][1548650288.101361036][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "pinned_chat_count_max" value = optionValueInteger { value = 5 } }
[ 3][t 4][1548650288.101449966][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "supergroup_size_max" value = optionValueInteger { value = 200000 } }
[ 3][t 4][1548650288.101545334][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "forwarded_message_count_max" value = optionValueInteger { value = 100 } }
[ 3][t 4][1548650288.101624966][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "test_mode" value = optionValueBoolean { value = false } }
[ 3][t 4][1548650288.101671934][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "message_text_length_max" value = optionValueInteger { value = 4096 } }
[ 3][t 4][1548650288.101745367][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "call_connect_timeout_ms" value = optionValueInteger { value = 30000 } }
[ 3][t 4][1548650288.101831436][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "call_packet_timeout_ms" value = optionValueInteger { value = 10000 } }
[ 3][t 4][1548650288.101957321][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "animation_search_bot_username" value = optionValueString { value = "gif" } }
[ 3][t 4][1548650288.102080584][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "message_caption_length_max" value = optionValueInteger { value = 1024 } }
[ 3][t 4][1548650288.102170944][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "photo_search_bot_username" value = optionValueString { value = "bing" } }
[ 3][t 4][1548650288.102256536][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "venue_search_bot_username" value = optionValueString { value = "foursquare" } }
[ 3][t 4][1548650288.102342606][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "calls_enabled" value = optionValueBoolean { value = false } }
[ 3][t 4][1548650288.102442265][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "favorite_stickers_limit" value = optionValueInteger { value = 5 } }
[ 3][t 4][1548650288.102524519][Td.cpp:4238][!Td][&td_requests] Sending update: updateOption { name = "basic_group_size_max" value = optionValueInteger { value = 200 } }
[ 3][t 4][1548650288.102568150][Td.cpp:4238][!Td][&td_requests] Sending update: updateAuthorizationState { authorization_state = authorizationStateWaitPhoneNumber { } }
[ 3][t 4][1548650288.102618217][Td.cpp:4253][!Td][&td_requests] Sending result for request 2: ok { }
[ 3][t 4][1548650288.102732420][ConfigManager.cpp:547][!Recoverer][&config_recoverer] Successfully connected [ 3][t 4][1548650288.102797985][ConfigManager.cpp:608][!Recoverer][&config_recoverer] Wakeup NEVER [ 3][t 4][1548650288.102828503][ConfigManager.cpp:391][!Recoverer][&config_recoverer] ON CONNECTING true [ 3][t 4][1548650288.102886915][ConfigManager.cpp:545][!Recoverer][&config_recoverer] Failed to connect for 0.000000 [ 3][t 4][1548650288.102920294][ConfigManager.cpp:605][!Recoverer][&config_recoverer] Wakeup in 20.0s [ 2][t 4][1548650288.102959633][SessionMultiProxy.cpp:107][!SessionMultiProxy:1:main] [session_count:1] [ 3][t 4][1548650288.103035688][NetQuery.h:239][!SessionMultiProxy:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:SessionMultiProxy:1:main: send to proxy #0] [ 2][t 4][1548650288.103565454][Session.cpp:130][!SessionProxy:1:main] Generate new session_id 17542074364008855025 for auth key 13801123172548870897 for DC1 [ 3][t 4][1548650288.103672266][NetQuery.h:239][!SessionProxy:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:SessionProxy:1:main: sent to session] [ 3][t 4][1548650288.103768110][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:Session: received from SessionProxy] [ 3][t 4][1548650288.103795528][Session.cpp:223][!Session:1:main][&net_query] got query [Query:[id:65536][tl:0x1fb33026][state:Query]] [ 3][t 4][1548650288.103844643][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:Session: pending] [ 3][t 4][1548650288.103913784][NetQuery.h:239][!SessionMultiProxy:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:SessionMultiProxy:1:main: send to proxy #0] [ 3][t 4][1548650288.103976011][NetQuery.h:239][!SessionProxy:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:SessionProxy:1:main: sent to session] [ 3][t 4][1548650288.104515314][ConnectionCreator.cpp:867][!ConnectionCreator] Create: [149.154.175.50:443] to DcId{1} [ 4][t 4][1548650288.104795933][Session.cpp:1210][!Session:1:main] Wakeup after 1000.000000 [ 3][t 4][1548650288.104869843][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:Session: received from SessionProxy] [ 3][t 4][1548650288.104894638][Session.cpp:223][!Session:1:main][&net_query] got query [Query:[id:131072][tl:0xc4f9186b][state:Query]] [ 3][t 4][1548650288.104938745][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:Session: pending] [ 3][t 4][1548650288.104995728][InlineQueriesManager.cpp:929][!InlineQueriesManager] Inline query loop [ 3][t 4][1548650288.105162859][Td.cpp:4238][!Td][&td_requests] Sending update: updateConnectionState { state = connectionStateConnecting { } }
[ 3][t 4][1548650288.105925798][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:Session: try send to mtproto::connection] [ 3][t 4][1548650288.105956078][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Query]] [debug:Session: send to mtproto::connection] [ 3][t 4][1548650288.106045723][Session.cpp:834][!Session:1:main][&net_query] send query to connection [Query:[id:65536][tl:0x1fb33026][state:Query]] [msg_id:0x5c4e872fbbb918d4][invoke_after:0x0000000000000000] [ 3][t 4][1548650288.106122255][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:Session: try send to mtproto::connection] [ 3][t 4][1548650288.106143951][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Query]] [debug:Session: send to mtproto::connection] [ 3][t 4][1548650288.106198072][Session.cpp:834][!Session:1:main][&net_query] send query to connection [Query:[id:131072][tl:0xc4f9186b][state:Query]] [msg_id:0x5c4e872fbbb92ba4][invoke_after:0x0000000000000000] [ 4][t 4][1548650288.106748819][Session.cpp:1210][!Session:1:main] Wakeup after 60.000000 [ 3][t 4][1548650288.106848001][Td.cpp:3308][!Td][&td_requests] Receive request 3: getAuthorizationState { }
[ 3][t 4][1548650288.106996059][Td.cpp:4253][!Td][&td_requests] Sending result for request 3: authorizationStateWaitPhoneNumber { }
[ 1][t 0][1548650288.109395742][ClientJson.cpp:71] Failed to parse [request:{\0042@extra\0042:1681692777,\0042@type\0042:\0042setAuthenticationPhoneNumber \0042,\0042phone_number\0042:\0042+xxx\0042}] [Error : 0 : Unknown class] [ 4][t 4][1548650288.357208252][BufferedFd.h:183][!Session:1:main] flush_write: +476B[left:0B] [ 4][t 4][1548650288.357277632][Session.cpp:1210][!Session:1:main] Wakeup after 59.749049 [ 4][t 4][1548650288.610198021][BufferedFd.h:174][!Session:1:main] flush_read: +204B[total:204B] [ 4][t 4][1548650288.610523462][AuthData.cpp:66][!Session:1:main] UPDATE_SERVER_TIME_DIFFERENCE: 1548650056.255799 -> 1548650056.018660 [ 4][t 4][1548650288.610555887][AuthData.cpp:74][!Session:1:main] SERVER_TIME: 0x5c4e8730 [ 3][t 4][1548650288.610975266][ConfigManager.cpp:391][!Recoverer][&config_recoverer] ON CONNECTING false [ 3][t 4][1548650288.611005068][ConfigManager.cpp:547][!Recoverer][&config_recoverer] Successfully connected [ 3][t 4][1548650288.611102581][ConfigManager.cpp:608][!Recoverer][&config_recoverer] Wakeup NEVER [ 3][t 4][1548650288.611368179][Session.cpp:458][!Session:1:main] new_session_created 12555510556161627071 6651402338755483860 [ 4][t 4][1548650288.611394405][Session.cpp:460][!Session:1:main] Sending updatesTooLong to force getDifference [ 3][t 4][1548650288.611499548][NetQuery.h:347][!Session:1:main] [Query:[id:0][tl:0x00000000][state:Result][tl:0xe317af7e]] [ 3][t 4][1548650288.611582756][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:0][tl:0x00000000][state:Result][tl:0xe317af7e]] [debug:dispatch] [ 3][t 4][1548650288.611616611][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:0][tl:0x00000000][state:Result][tl:0xe317af7e]] [debug:sent to td (no callback)] [ 3][t 4][1548650288.611849546][Session.cpp:538][!Session:1:main][&net_query] Ack [msg_id:6651402338755483860][Query:[id:65536][tl:0x1fb33026][state:Query]] [ 3][t 4][1548650288.611945152][Session.cpp:538][!Session:1:main][&net_query] Ack [msg_id:6651402338755488676][Query:[id:131072][tl:0xc4f9186b][state:Query]] [ 4][t 4][1548650288.612027168][Session.cpp:1210][!Session:1:main] Wakeup after 29.999467 [ 3][t 4][1548650288.612095118][Td.cpp:4238][!Td][&td_requests] Sending update: updateConnectionState { state = connectionStateReady { } }
[ 3][t 4][1548650288.612176418][NetQuery.h:239][!Td][&net_query] [Query:[id:0][tl:0x00000000][state:Result][tl:0xe317af7e]] [debug:Td: received from DcManager] [ 3][t 4][1548650288.612202406][Td.cpp:3451][!Td][&net_query] on_result [Query:[id:0][tl:0x00000000][state:Result][tl:0xe317af7e]] [ 3][t 4][1548650288.627945900][UpdatesManager.cpp:629][!Td] Receive updatesTooLong { }
[ 3][t 4][1548650288.627994776][UpdatesManager.cpp:632][!Td] Ignore updates received before authorization or after logout [ 4][t 4][1548650288.628197432][BufferedFd.h:174][!Session:1:main] flush_read: +568B[total:568B] [ 3][t 4][1548650288.629179001][Session.cpp:634][!Session:1:main][&net_query] Return query result [Query:[id:65536][tl:0x1fb33026][state:Query]] [ 3][t 4][1548650288.629217625][NetQuery.h:127][!Session:1:main][&net_query] Got answer [Query:[id:65536][tl:0x1fb33026][state:Query]] [ 3][t 4][1548650288.629237652][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Result][tl:0x8e1a1775]] [debug:dispatch] [ 3][t 4][1548650288.629269123][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Result][tl:0x8e1a1775]] [debug:sent to callback] [ 3][t 4][1548650288.629307508][NetQuery.h:239][!Td][&net_query] [Query:[id:65536][tl:0x1fb33026][state:Result][tl:0x8e1a1775]] [debug:Td: received from DcManager] [ 3][t 4][1548650288.629328012][Td.cpp:3451][!Td][&net_query] on_result [Query:[id:65536][tl:0x1fb33026][state:Result][tl:0x8e1a1775]] [ 3][t 4][1548650288.631675005][Session.cpp:634][!Session:1:main][&net_query] Return query result [Query:[id:131072][tl:0xc4f9186b][state:Query]] [ 3][t 4][1548650288.631712675][NetQuery.h:127][!Session:1:main][&net_query] Got answer [Query:[id:131072][tl:0xc4f9186b][state:Query]] [ 3][t 4][1548650288.631737471][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Result][tl:0x3213dbba]] [debug:dispatch] [ 3][t 4][1548650288.631759644][NetQuery.h:239][!Session:1:main][&net_query] [Query:[id:131072][tl:0xc4f9186b][state:Result][tl:0x3213dbba]] [debug:sent to callback] [ 3][t 4][1548650288.638977528][ConfigManager.cpp:547][!Recoverer][&config_recoverer] Successfully connected [ 3][t 4][1548650288.639015436][ConfigManager.cpp:608][!Recoverer][&config_recoverer] Wakeup NEVER [ 3][t 4][1548650288.639048100][ConfigManager.cpp:762][!ConfigManager] config { flags = 3592 date = 1548650288 expires = 1548654186 test_mode = false this_dc = 1 dc_options = vector[17] { dcOption { flags = 0 id = 1 ip_address = "149.154.175.50" port = 443 } dcOption { flags = 16 id = 1 ip_address = "149.154.175.50" port = 443 } dcOption { flags = 1 id = 1 ip_address = "2001:0b28:f23d:f001:0000:0000:0000:000a" port = 443 } dcOption { flags = 0 id = 2 ip_address = "149.154.167.51" port = 443 } dcOption { flags = 16 id = 2 ip_address = "149.154.167.51" port = 443 } dcOption { flags = 1 id = 2 ip_address = "2001:067c:04e8:f002:0000:0000:0000:000a" port = 443 } dcOption { flags = 0 id = 3 ip_address = "149.154.175.100" port = 443 } dcOption { flags = 16 id = 3 ip_address = "149.154.175.100" port = 443 } dcOption { flags = 1 id = 3 ip_address = "2001:0b28:f23d:f003:0000:0000:0000:000a" port = 443 } dcOption { flags = 0 id = 4 ip_address = "149.154.167.91" port = 443 } dcOption { flags = 16 id = 4 ip_address = "149.154.167.91" port = 443 } dcOption { flags = 1 id = 4 ip_address = "2001:067c:04e8:f004:0000:0000:0000:000a" port = 443 } dcOption { flags = 2 id = 4 ip_address = "149.154.165.120" port = 443 } dcOption { flags = 3 id = 4 ip_address = "2001:067c:04e8:f004:0000:0000:0000:000b" port = 443 } dcOption { flags = 1 id = 5 ip_address = "2001:0b28:f23f:f005:0000:0000:0000:000a" port = 443 } dcOption { flags = 16 id = 5 ip_address = "91.108.56.140" port = 443 } dcOption { flags = 0 id = 5 ip_address = "91.108.56.132" port = 443 } } dc_txt_domain_name = "apv2.stel.com" chat_size_max = 200 megagroup_size_max = 200000 forwarded_count_max = 100 online_update_period_ms = 210000 offline_blur_timeout_ms = 5000 offline_idle_timeout_ms = 30000 online_cloud_timeout_ms = 300000 notify_cloud_delay_ms = 30000 notify_default_delay_ms = 1500 push_chat_period_ms = 60000 push_chat_limit = 2 saved_gifs_limit = 200 edit_time_limit = 172800 revoke_time_limit = 172800 revoke_pm_time_limit = 172800 rating_e_decay = 2419200 stickers_recent_limit = 200 stickers_faved_limit = 5 channels_read_media_period = 604800 pinned_dialogs_count_max = 5 call_receive_timeout_ms = 20000 call_ring_timeout_ms = 90000 call_connect_timeout_ms = 30000 call_packet_timeout_ms = 10000 me_url_prefix = "https://t.me/" gif_search_username = "gif" venue_search_username = "foursquare" img_search_username = "bing" caption_length_max = 1024 message_length_max = 4096 webfile_dc_id = 4 }
[ 3][t 4][1548650288.639402151][ConnectionCreator.cpp:1116][!ConnectionCreator] SAVE DcOptions{[DcOption:DcId{1}[ip:149.154.175.50][port:443][secret_len:0][flags:]], [DcOption:DcId{1}[ip:149.154.175.50][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{1}[ip:2001:b28:f23d:f001::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{2}[ip:149.154.167.51][port:443][secret_len:0][flags:]], [DcOption:DcId{2}[ip:149.154.167.51][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{2}[ip:2001:67c:4e8:f002::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{3}[ip:149.154.175.100][port:443][secret_len:0][flags:]], [DcOption:DcId{3}[ip:149.154.175.100][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{3}[ip:2001:b28:f23d:f003::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{4}[ip:149.154.167.91][port:443][secret_len:0][flags:]], [DcOption:DcId{4}[ip:149.154.167.91][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{4}[ip:2001:67c:4e8:f004::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{4}[ip:149.154.165.120][port:443][secret_len:0][flags:(MediaOnly)]], [DcOption:DcId{4}[ip:2001:67c:4e8:f004::b][port:443][secret_len:0][flags:(MediaOnly)(IPv6)]], [DcOption:DcId{5}[ip:2001:b28:f23f:f005::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{5}[ip:91.108.56.140][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{5}[ip:91.108.56.132][port:443][secret_len:0][flags:]]} [ 4][t 4][1548650288.640055656][Session.cpp:1210][!Session:1:main] Wakeup after 29.971492 [ 3][t 4][1548650289.098720789][StateManager.cpp:139][!State manager] Auto set net_type = Other [ 3][t 4][1548650289.098975897][ConfigManager.cpp:547][!Recoverer][&config_recoverer] Successfully connected [ 3][t 4][1548650289.099011183][ConfigManager.cpp:608][!Recoverer][&config_recoverer] Wakeup NEVER [ 4][t 4][1548650289.099113941][Session.cpp:1210][!Session:1:main] Wakeup after 29.512037 [ 3][t 4][1548650308.106156588][ConfigManager.cpp:547][!Recoverer][&config_recoverer] Successfully connected [ 3][t 4][1548650308.106227160][ConfigManager.cpp:608][!Recoverer][&config_recoverer] Wakeup NEVER PHP Fatal error: Uncaught Exception: Timeout waiting for response in /var/www/html/1.php:54 Stack trace:
0 /var/www/html/1.php(54): TDLib\JsonClient->query('{"@type":"setAu...', 30)
1 {main}
thrown in /var/www/html/1.php on line 54
and for following code:
<?php
TDApi\LogConfiguration::setLogVerbosityLevel(\TDApi\LogConfiguration::LVL_ERROR);
$client = new TDLib\JsonClient();
$client->getAuthorizationState();
$api_id = xxx;
$api_hash = 'xxx';
$phone_number = '+xxx';
$tdlibParams = new TDApi\TDLibParameters();
$tdlibParams
->setParameter('use_test_dc', false)
->setParameter('database_directory', '/var/tmp/tdlib')
->setParameter('files_directory', '/var/tmp/tdlib')
->setParameter('use_file_database', false)
->setParameter('use_chat_info_database', false)
->setParameter('use_message_database', false)
->setParameter('use_secret_chats', false)
->setParameter('api_id', $api_id)
->setParameter('api_hash', $api_hash)
->setParameter('system_language_code', 'en')
->setParameter('device_model', php_uname('s'))
->setParameter('system_version', php_uname('v'))
->setParameter('application_version', '0.1.0')
->setParameter('enable_storage_optimizer', true)
->setParameter('ignore_file_names', false);
$result = $client->setTdlibParameters($tdlibParams);
$result = $client->setDatabaseEncryptionKey();
$result = $client->setAuthenticationPhoneNumber($phone_number);
$result = $client->getAuthorizationState();
$result = $client->query(json_encode(['@type' => 'searchPublicChat', 'username' => 'telegram']), 10);
var_dump($result);
$allNotifications = $client->getReceivedResponses();
var_dump($allNotifications);
$client->destroy();
output is
PHP Fatal error: Uncaught Exception: Timeout waiting for response in /var/www/html/test.php:31 Stack trace:
0 /var/www/html/test.php(31): TDLib\JsonClient->setAuthenticationPhoneNumber('+xxx')
1 {main}
thrown in /var/www/html/test.php on line 31
api key & hash and phone number i changed to xxx
I think problem related with Failed to parse [request:{\0042@extra\0042:1681692777,\0042@type\0042:\0042setAuthenticationPhoneNumber \0042,\0042phone_number\0042:\0042+xxx\0042}] [Error : 0 : Unknown class]
Hi, @merlinkory
Please, check if the phone number has valid format. It should contain only digits, there should be no +
sign or any other characters.
And check if the telegram services are blocked in your country. If you use proxy in your default Telegram client, then you have to use proxy when you are using tdlib:
$proxy = [
'@type' => 'proxyTypeSocks5',
'username' => $proxyUsername,
'password' => $proxyPassword
];
$this->telegramClient->query(json_encode([
'@type' => 'addProxy',
'server' => $proxyHost,
'port' => (int)$proxyPort,
'enable' => true,
'type' => $proxy
]), 10);
Hi @maxvgi Yes, i'm sure about phone number (i tried with +7 and without +7, also i tried phone number as string and as integer). My server hosted on Amazon AWS (in USA region) and i cheacked connect to telegram servers: it is ok!
Also i tried edit timeout in $client->query($query,XX);
I've solved it. In case with
$query = json_encode([
'@type' => 'setAuthenticationPhoneNumber ',
'phone_number' => '+xxx'
]);
It is silly mistake Was excess 'space' after setAuthenticationPhoneNumber, but in other case with
$client->setAuthenticationPhoneNumber($phone_number);
i still getting Uncaught Exception: Timeout waiting for response
@merlinkory did you solve the problem?
@maxvgi yes in case if i doing folliwing:
$query = json_encode([
'@type' => 'setAuthenticationPhoneNumber',
'phone_number' => $phone_number
]);
but example from your documentation is not work $client->setAuthenticationPhoneNumber($phone_number);
@merlinkory need check and fix. When have more time. For now please use query
instead built-in methods.
By the way we with @maxvgi agreed on that extension wouldn't have no other helper methods (like setAuthenticationPhoneNumber
) than query
. For helpers need write wrapper.
@yaroslavche Yes i understood it. I've using "query" for any call. Thank you )
I have faced this problem in one of my projects just now.
The setDefaultTimeout
method with appropriate argument solves the problem:
$client->setDefaultTimeout(10);
$client->setAuthenticationPhoneNumber($phone_number);
BTW, me too =) Few days ago. But I don't even think about this issue. Now I understand. I set default timeout 1 second (btw as I can remember - can't pass float as timeout, maybe I'm wrong). And i just increase timeout arg in setAuthenticationPhoneNumber
query.
@yaroslavche timeout
is a float value.
Default is 0.5
I try using library as in your example, but always getting exception "Timeout waiting for response" on line $client->setAuthenticationPhoneNumber($phone_number); or in other case $query = json_encode(['@type' =>'setAuthenticationPhoneNumber ','phone_number' => 'xxx']); $result = $client->query($query, 10);
Could you tell, how can resolve it? Thank you