Use readable radio call states and completion reasons in logs
This commit is contained in:
1 parent
1b3269f76b
commit
a0e440c0f5
1 file changed
+5
-3
@@ -1,5 +1,5 @@
|
||||
/* Короткоживущие приглашения в рацию; один pending, ограниченный кэш результатов.
|
||||
* Повторы нужны также после смены router epoch. Одна периодическая задача владеет
|
||||
* Повторы нужны также после смены router epoch. Один таймер владеет ближайшим
|
||||
* всеми deadline; callback не хранит указателей на освобождаемые сессии. */
|
||||
#include <string.h>
|
||||
#include "radio_call.h"
|
||||
@@ -68,12 +68,14 @@ static void rc_schedule(struct radio_call_context* ctx) {
|
||||
|
||||
/* Формат события: id/group/peer:8LE, state/reason/incoming:1 (27 байт). */
|
||||
static void rc_event(struct radio_call_context* ctx, const struct radio_call_session* s) {
|
||||
static const char* states[] = {"invalid", "outgoing", "incoming", "ringing", "finished"};
|
||||
static const char* reasons[] = {"none", "accepted", "declined", "busy", "cancelled", "unavailable", "no_answer", "audio_error"};
|
||||
uint8_t data[27];
|
||||
memcpy(data, &s->id, 8); memcpy(data + 8, &s->group, 8); memcpy(data + 16, &s->peer, 8);
|
||||
data[24] = s->state; data[25] = s->reason; data[26] = s->incoming;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_RADIO, "radio call id=%016llx group=%016llx peer=%016llx incoming=%u state=%u reason=%u elapsed_ms=%llu",
|
||||
DEBUG_INFO(DEBUG_CATEGORY_RADIO, "radio call id=%016llx group=%016llx peer=%016llx incoming=%u state=%s reason=%s elapsed_ms=%llu",
|
||||
(unsigned long long)s->id, (unsigned long long)s->group, (unsigned long long)s->peer,
|
||||
s->incoming, s->state, s->reason, (unsigned long long)((get_time_tb() - s->started) / 10));
|
||||
s->incoming, states[s->state], reasons[s->reason], (unsigned long long)((get_time_tb() - s->started) / 10));
|
||||
chat_event_post(ctx->inst, CHAT_EVT_RADIO_CALL, data, sizeof(data));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user