Add td_api::sendCallLog.
This commit is contained in:
parent
1f4890c906
commit
af97e963a9
|
@ -2339,8 +2339,8 @@ callStateReady protocol:callProtocol servers:vector<callServer> config:string en
|
|||
//@description The call is hanging up after discardCall has been called
|
||||
callStateHangingUp = CallState;
|
||||
|
||||
//@description The call has ended successfully @reason The reason, why the call has ended @need_rating True, if the call rating must be sent to the server @need_debug_information True, if the call debug information must be sent to the server
|
||||
callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_information:Bool = CallState;
|
||||
//@description The call has ended successfully @reason The reason, why the call has ended @need_rating True, if the call rating must be sent to the server @need_debug_information True, if the call debug information must be sent to the server @need_log True, if the call log must be sent to the server
|
||||
callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_information:Bool need_log:Bool = CallState;
|
||||
|
||||
//@description The call has ended with an error @error Error. An error with the code 4005000 will be returned if an outgoing call is missed because of an expired timeout
|
||||
callStateError error:error = CallState;
|
||||
|
@ -5421,9 +5421,12 @@ discardCall call_id:int32 is_disconnected:Bool duration:int32 is_video:Bool conn
|
|||
//@description Sends a call rating @call_id Call identifier @rating Call rating; 1-5 @comment An optional user comment if the rating is less than 5 @problems List of the exact types of problems with the call, specified by the user
|
||||
sendCallRating call_id:int32 rating:int32 comment:string problems:vector<CallProblem> = Ok;
|
||||
|
||||
//@description Sends debug information for a call @call_id Call identifier @debug_information Debug information in application-specific format
|
||||
//@description Sends debug information for a call to Telegram servers @call_id Call identifier @debug_information Debug information in application-specific format
|
||||
sendCallDebugInformation call_id:int32 debug_information:string = Ok;
|
||||
|
||||
//@description Sends log file for a call to Telegram servers @call_id Call identifier @log_file Call log file
|
||||
sendCallLog call_id:int32 log_file:InputFile = Ok;
|
||||
|
||||
|
||||
//@description Returns list of participant identifiers, on whose behalf a video chat in the chat can be joined @chat_id Chat identifier
|
||||
getVideoChatAvailableParticipants chat_id:int53 = MessageSenders;
|
||||
|
|
|
@ -128,7 +128,7 @@ tl_object_ptr<td_api::CallState> CallState::get_call_state_object() const {
|
|||
return make_tl_object<td_api::callStateHangingUp>();
|
||||
case Type::Discarded:
|
||||
return make_tl_object<td_api::callStateDiscarded>(get_call_discard_reason_object(discard_reason), need_rating,
|
||||
need_debug_information);
|
||||
need_debug_information, need_log);
|
||||
case Type::Error:
|
||||
CHECK(error.is_error());
|
||||
return make_tl_object<td_api::callStateError>(make_tl_object<td_api::error>(error.code(), error.message().str()));
|
||||
|
@ -159,7 +159,7 @@ void CallActor::create_call(UserId user_id, tl_object_ptr<telegram_api::InputUse
|
|||
promise.set_value(CallId(local_call_id_));
|
||||
}
|
||||
|
||||
void CallActor::accept_call(CallProtocol &&protocol, Promise<> promise) {
|
||||
void CallActor::accept_call(CallProtocol &&protocol, Promise<Unit> promise) {
|
||||
if (state_ != State::SendAcceptQuery) {
|
||||
return promise.set_error(Status::Error(400, "Unexpected acceptCall"));
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void CallActor::update_call_signaling_data(string data) {
|
|||
send_closure(G()->td(), &Td::send_update, std::move(update));
|
||||
}
|
||||
|
||||
void CallActor::send_call_signaling_data(string &&data, Promise<> promise) {
|
||||
void CallActor::send_call_signaling_data(string &&data, Promise<Unit> promise) {
|
||||
if (call_state_.type != CallState::Type::Ready) {
|
||||
return promise.set_error(Status::Error(400, "Call is not active"));
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ void CallActor::send_call_signaling_data(string &&data, Promise<> promise) {
|
|||
}
|
||||
|
||||
void CallActor::discard_call(bool is_disconnected, int32 duration, bool is_video, int64 connection_id,
|
||||
Promise<> promise) {
|
||||
Promise<Unit> promise) {
|
||||
promise.set_value(Unit());
|
||||
if (state_ == State::Discarded || state_ == State::WaitDiscardResult || state_ == State::SendDiscardQuery) {
|
||||
return;
|
||||
|
@ -244,7 +244,7 @@ void CallActor::discard_call(bool is_disconnected, int32 duration, bool is_video
|
|||
}
|
||||
|
||||
void CallActor::rate_call(int32 rating, string comment, vector<td_api::object_ptr<td_api::CallProblem>> &&problems,
|
||||
Promise<> promise) {
|
||||
Promise<Unit> promise) {
|
||||
if (!call_state_.need_rating) {
|
||||
return promise.set_error(Status::Error(400, "Unexpected sendCallRating"));
|
||||
}
|
||||
|
@ -309,11 +309,15 @@ void CallActor::on_set_rating_query_result(Result<NetQueryPtr> r_net_query) {
|
|||
if (res.is_error()) {
|
||||
return on_error(res.move_as_error());
|
||||
}
|
||||
call_state_.need_rating = false;
|
||||
if (call_state_.need_rating) {
|
||||
call_state_.need_rating = false;
|
||||
call_state_need_flush_ = true;
|
||||
loop();
|
||||
}
|
||||
send_closure(G()->updates_manager(), &UpdatesManager::on_get_updates, res.move_as_ok(), Promise<Unit>());
|
||||
}
|
||||
|
||||
void CallActor::send_call_debug_information(string data, Promise<> promise) {
|
||||
void CallActor::send_call_debug_information(string data, Promise<Unit> promise) {
|
||||
if (!call_state_.need_debug_information) {
|
||||
return promise.set_error(Status::Error(400, "Unexpected sendCallDebugInformation"));
|
||||
}
|
||||
|
@ -333,7 +337,23 @@ void CallActor::on_set_debug_query_result(Result<NetQueryPtr> r_net_query) {
|
|||
if (res.is_error()) {
|
||||
return on_error(res.move_as_error());
|
||||
}
|
||||
call_state_.need_debug_information = false;
|
||||
if (!res.ok() && !call_state_.need_log) {
|
||||
call_state_.need_log = true;
|
||||
call_state_need_flush_ = true;
|
||||
}
|
||||
if (call_state_.need_debug_information) {
|
||||
call_state_.need_debug_information = false;
|
||||
call_state_need_flush_ = true;
|
||||
}
|
||||
loop();
|
||||
}
|
||||
|
||||
void CallActor::send_call_log(td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise) {
|
||||
if (!call_state_.need_log) {
|
||||
return promise.set_error(Status::Error(400, "Unexpected sendCallLog"));
|
||||
}
|
||||
|
||||
promise.set_error(Status::Error(500, "Unsupported"));
|
||||
}
|
||||
|
||||
// Requests
|
||||
|
|
|
@ -76,6 +76,7 @@ struct CallState {
|
|||
bool is_received{false};
|
||||
bool need_debug_information{false};
|
||||
bool need_rating{false};
|
||||
bool need_log{false};
|
||||
|
||||
int64 key_fingerprint{0};
|
||||
string key;
|
||||
|
@ -94,13 +95,14 @@ class CallActor final : public NetQueryCallback {
|
|||
|
||||
void create_call(UserId user_id, tl_object_ptr<telegram_api::InputUser> &&input_user, CallProtocol &&protocol,
|
||||
bool is_video, Promise<CallId> &&promise);
|
||||
void accept_call(CallProtocol &&protocol, Promise<> promise);
|
||||
void accept_call(CallProtocol &&protocol, Promise<Unit> promise);
|
||||
void update_call_signaling_data(string data);
|
||||
void send_call_signaling_data(string &&data, Promise<> promise);
|
||||
void discard_call(bool is_disconnected, int32 duration, bool is_video, int64 connection_id, Promise<> promise);
|
||||
void send_call_signaling_data(string &&data, Promise<Unit> promise);
|
||||
void discard_call(bool is_disconnected, int32 duration, bool is_video, int64 connection_id, Promise<Unit> promise);
|
||||
void rate_call(int32 rating, string comment, vector<td_api::object_ptr<td_api::CallProblem>> &&problems,
|
||||
Promise<> promise);
|
||||
void send_call_debug_information(string data, Promise<> promise);
|
||||
Promise<Unit> promise);
|
||||
void send_call_debug_information(string data, Promise<Unit> promise);
|
||||
void send_call_log(td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise);
|
||||
|
||||
void update_call(tl_object_ptr<telegram_api::PhoneCall> call);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void CallManager::create_call(UserId user_id, tl_object_ptr<telegram_api::InputU
|
|||
std::move(promise));
|
||||
}
|
||||
|
||||
void CallManager::accept_call(CallId call_id, CallProtocol &&protocol, Promise<> promise) {
|
||||
void CallManager::accept_call(CallId call_id, CallProtocol &&protocol, Promise<Unit> promise) {
|
||||
auto actor = get_call_actor(call_id);
|
||||
if (actor.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Call not found"));
|
||||
|
@ -78,7 +78,7 @@ void CallManager::accept_call(CallId call_id, CallProtocol &&protocol, Promise<>
|
|||
send_closure(actor, &CallActor::accept_call, std::move(protocol), std::move(promise));
|
||||
}
|
||||
|
||||
void CallManager::send_call_signaling_data(CallId call_id, string &&data, Promise<> promise) {
|
||||
void CallManager::send_call_signaling_data(CallId call_id, string &&data, Promise<Unit> promise) {
|
||||
auto actor = get_call_actor(call_id);
|
||||
if (actor.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Call not found"));
|
||||
|
@ -87,7 +87,7 @@ void CallManager::send_call_signaling_data(CallId call_id, string &&data, Promis
|
|||
}
|
||||
|
||||
void CallManager::discard_call(CallId call_id, bool is_disconnected, int32 duration, bool is_video, int64 connection_id,
|
||||
Promise<> promise) {
|
||||
Promise<Unit> promise) {
|
||||
auto actor = get_call_actor(call_id);
|
||||
if (actor.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Call not found"));
|
||||
|
@ -96,7 +96,7 @@ void CallManager::discard_call(CallId call_id, bool is_disconnected, int32 durat
|
|||
}
|
||||
|
||||
void CallManager::rate_call(CallId call_id, int32 rating, string comment,
|
||||
vector<td_api::object_ptr<td_api::CallProblem>> &&problems, Promise<> promise) {
|
||||
vector<td_api::object_ptr<td_api::CallProblem>> &&problems, Promise<Unit> promise) {
|
||||
auto actor = get_call_actor(call_id);
|
||||
if (actor.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Call not found"));
|
||||
|
@ -104,7 +104,7 @@ void CallManager::rate_call(CallId call_id, int32 rating, string comment,
|
|||
send_closure(actor, &CallActor::rate_call, rating, std::move(comment), std::move(problems), std::move(promise));
|
||||
}
|
||||
|
||||
void CallManager::send_call_debug_information(CallId call_id, string data, Promise<> promise) {
|
||||
void CallManager::send_call_debug_information(CallId call_id, string data, Promise<Unit> promise) {
|
||||
auto actor = get_call_actor(call_id);
|
||||
if (actor.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Call not found"));
|
||||
|
@ -112,6 +112,14 @@ void CallManager::send_call_debug_information(CallId call_id, string data, Promi
|
|||
send_closure(actor, &CallActor::send_call_debug_information, std::move(data), std::move(promise));
|
||||
}
|
||||
|
||||
void CallManager::send_call_log(CallId call_id, td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise) {
|
||||
auto actor = get_call_actor(call_id);
|
||||
if (actor.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Call not found"));
|
||||
}
|
||||
send_closure(actor, &CallActor::send_call_log, std::move(log_file), std::move(promise));
|
||||
}
|
||||
|
||||
CallId CallManager::create_call_actor() {
|
||||
if (next_call_id_ == std::numeric_limits<int32>::max()) {
|
||||
next_call_id_ = 1;
|
||||
|
|
|
@ -29,13 +29,20 @@ class CallManager final : public Actor {
|
|||
|
||||
void create_call(UserId user_id, tl_object_ptr<telegram_api::InputUser> &&input_user, CallProtocol &&protocol,
|
||||
bool is_video, Promise<CallId> promise);
|
||||
void accept_call(CallId call_id, CallProtocol &&protocol, Promise<> promise);
|
||||
void send_call_signaling_data(CallId call_id, string &&data, Promise<> promise);
|
||||
|
||||
void accept_call(CallId call_id, CallProtocol &&protocol, Promise<Unit> promise);
|
||||
|
||||
void send_call_signaling_data(CallId call_id, string &&data, Promise<Unit> promise);
|
||||
|
||||
void discard_call(CallId call_id, bool is_disconnected, int32 duration, bool is_video, int64 connection_id,
|
||||
Promise<> promise);
|
||||
Promise<Unit> promise);
|
||||
|
||||
void rate_call(CallId call_id, int32 rating, string comment,
|
||||
vector<td_api::object_ptr<td_api::CallProblem>> &&problems, Promise<> promise);
|
||||
void send_call_debug_information(CallId call_id, string data, Promise<> promise);
|
||||
vector<td_api::object_ptr<td_api::CallProblem>> &&problems, Promise<Unit> promise);
|
||||
|
||||
void send_call_debug_information(CallId call_id, string data, Promise<Unit> promise);
|
||||
|
||||
void send_call_log(CallId call_id, td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise);
|
||||
|
||||
private:
|
||||
bool close_flag_ = false;
|
||||
|
|
|
@ -5764,6 +5764,13 @@ void Td::on_request(uint64 id, td_api::sendCallDebugInformation &request) {
|
|||
std::move(request.debug_information_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::sendCallLog &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
send_closure(G()->call_manager(), &CallManager::send_call_log, CallId(request.call_id_), std::move(request.log_file_),
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getVideoChatAvailableParticipants &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
|
|
|
@ -744,6 +744,8 @@ class Td final : public Actor {
|
|||
|
||||
void on_request(uint64 id, td_api::sendCallDebugInformation &request);
|
||||
|
||||
void on_request(uint64 id, td_api::sendCallLog &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getVideoChatAvailableParticipants &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::setVideoChatDefaultParticipant &request);
|
||||
|
|
|
@ -3035,10 +3035,15 @@ class CliClient final : public Actor {
|
|||
problems.emplace_back(td_api::make_object<td_api::callProblemDistortedSpeech>());
|
||||
send_request(td_api::make_object<td_api::sendCallRating>(call_id, rating, "Wow, such good call! (TDLib test)",
|
||||
std::move(problems)));
|
||||
} else if (op == "scdi" || op == "SendCallDebugInformation") {
|
||||
} else if (op == "scdi") {
|
||||
CallId call_id;
|
||||
get_args(args, call_id);
|
||||
send_request(td_api::make_object<td_api::sendCallDebugInformation>(call_id, "{}"));
|
||||
} else if (op == "sclog") {
|
||||
CallId call_id;
|
||||
string log_file;
|
||||
get_args(args, call_id, log_file);
|
||||
send_request(td_api::make_object<td_api::sendCallLog>(call_id, as_input_file(log_file)));
|
||||
} else if (op == "gvcap") {
|
||||
ChatId chat_id;
|
||||
get_args(args, chat_id);
|
||||
|
|
Loading…
Reference in New Issue
Block a user