MT#59038 add recording query capabilities

Change-Id: I990ff2b443cf7f83b41839d268e9ad1e03d863d0
pull/1802/head
Richard Fuchs 2 years ago
parent b6b9395fd5
commit 698ab0272b

@ -2468,6 +2468,25 @@ static void ng_stats_monologue(bencode_item_t *dict, const struct call_monologue
medias = bencode_dictionary_add_list(sub, "medias");
bencode_item_t *list = bencode_dictionary_add_list(sub, "VSC");
for (unsigned int i = 0; i < ml->num_dtmf_triggers; i++) {
const struct dtmf_trigger_state *state = &ml->dtmf_trigger_state[i];
if (state->trigger.len == 0)
continue;
bencode_item_t *vsc = bencode_list_add_dictionary(list);
const char *type = dtmf_trigger_types[state->type];
if (type)
bencode_dictionary_add_string(vsc, "type", type);
bencode_dictionary_add_str(vsc, "trigger", &state->trigger);
bencode_dictionary_add_integer(vsc, "active", !state->inactive);
}
if (ml->call->recording) {
bencode_item_t *rec = bencode_dictionary_add_dictionary(sub, "recording");
bencode_dictionary_add_integer(rec, "excluded", !!ML_ISSET(ml, NO_RECORDING));
bencode_dictionary_add_integer(rec, "forwarding", !!ML_ISSET(ml, REC_FORWARDING));
}
stats:
for (unsigned int i = 0; i < ml->medias->len; i++) {
m = ml->medias->pdata[i];
@ -2615,6 +2634,12 @@ stats:
dict = bencode_dictionary_add_dictionary(output, "totals");
ng_stats(bencode_dictionary_add_dictionary(dict, "RTP"), &totals->totals[0], NULL);
ng_stats(bencode_dictionary_add_dictionary(dict, "RTCP"), &totals->totals[1], NULL);
if (call->recording) {
bencode_item_t *rec = bencode_dictionary_add_dictionary(output, "recording");
bencode_dictionary_add_integer(rec, "call recording", !!CALL_ISSET(call, RECORDING_ON));
bencode_dictionary_add_integer(rec, "forwarding", !!CALL_ISSET(call, REC_FORWARDING));
}
}
static void ng_list_calls(bencode_item_t *output, long long int limit) {

@ -615,10 +615,11 @@ static void cli_list_call_info(struct cli_writer *cw, call_t *c) {
"last_signal: %llu\n"
"redis_keyspace: %i\n"
"foreign: %s\n"
"recording: %s\n"
"\n",
c->callid.s, c->ml_deleted ? "yes" : "no", (int) c->created.tv_sec, c->created_from,
(unsigned int) c->tos, (unsigned long long) c->last_signal, c->redis_hosted_db,
IS_FOREIGN_CALL(c) ? "yes" : "no");
IS_FOREIGN_CALL(c) ? "yes" : "no", c->recording ? "yes" : "no");
for (__auto_type l = c->monologues.head; l; l = l->next) {
ml = l->data;
@ -732,12 +733,13 @@ static void cli_list_tag_info(struct cli_writer *cw, struct call_monologue *ml)
static void cli_incoming_list_sessions(str *instr, struct cli_writer *cw) {
bool found = false;
enum { all, own, foreign } which = -1;
enum { all, own, foreign, recording } which = -1;
static const char *keywords[] = {
[all] = "all",
[own] = "own",
[foreign] = "foreign",
[recording] = "recording",
};
if (str_shift(instr, 1)) {
@ -769,14 +771,19 @@ static void cli_incoming_list_sessions(str *instr, struct cli_writer *cw) {
if (IS_FOREIGN_CALL(call))
goto next;
break;
case recording:
if (!call->recording)
goto next;
break;
}
found = true;
cw->cw_printf(cw, "ID: %60s | del:%s | creat:%12li | prx:%s | redis:%2i | frgn:%s\n",
cw->cw_printf(cw, "ID: %60s | del:%s | creat:%12li | prx:%s | redis:%2i | frgn:%s | rec:%s\n",
call->callid.s, call->ml_deleted ? "y" : "n",
(long) call->created.tv_sec,
call->created_from, call->redis_hosted_db,
IS_FOREIGN_CALL(call) ? "y" : "n");
IS_FOREIGN_CALL(call) ? "y" : "n",
call->recording ? "y" : "n");
next:;
ITERATE_CALL_LIST_NEXT_END(call);

Loading…
Cancel
Save