Browse Source

add stop recording comand to ng interface

pull/398/head
Claudiu Boriga 8 years ago
parent
commit
cf15275f30
4 changed files with 25 additions and 1 deletions
  1. +18
    -0
      daemon/call_interfaces.c
  2. +2
    -1
      daemon/cli.c
  3. +4
    -0
      daemon/control_ng.c
  4. +1
    -0
      daemon/control_ng.h

+ 18
- 0
daemon/call_interfaces.c View File

@ -1121,3 +1121,21 @@ const char *call_start_recording_ng(bencode_item_t *input, struct callmaster *m,
return NULL;
}
const char *call_stop_recording_ng(bencode_item_t *input, struct callmaster *m, bencode_item_t *output) {
str callid;
struct call *call;
if (!bencode_dictionary_get_str(input, "call-id", &callid))
return "No call-id in message";
call = call_get_opmode(&callid, m, OP_OTHER);
if (!call)
return "Unknown call-id";
recording_stop(call);
rwlock_unlock_w(&call->master_lock);
obj_put(call);
return NULL;
}

+ 2
- 1
daemon/cli.c View File

@ -185,7 +185,7 @@ static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m
}
for (GList *l = list; l; l = l->next) {
struct control_ng_stats* cur = l->data;
printlen = snprintf(replybuffer,(outbufend-replybuffer), " %20s | %10u | %10u | %10u | %10u | %10u | %10u | %10u | %10u \n",
printlen = snprintf(replybuffer,(outbufend-replybuffer), " %20s | %10u | %10u | %10u | %10u | %10u | %10u | %10u | %10u | %10u \n",
sockaddr_print_buf(&cur->proxy),
cur->offer,
cur->answer,
@ -194,6 +194,7 @@ static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m
cur->list,
cur->query,
cur->start_recording,
cur->stop_recording,
cur->errors);
ADJUSTLEN(printlen,outbufend,replybuffer);
}


+ 4
- 0
daemon/control_ng.c View File

@ -229,6 +229,10 @@ static void control_ng_incoming(struct obj *obj, str *buf, const endpoint_t *sin
errstr = call_start_recording_ng(dict, c->callmaster, resp);
g_atomic_int_inc(&cur->start_recording);
}
else if (!str_cmp(&cmd, "stop recording")) {
errstr = call_stop_recording_ng(dict, c->callmaster, resp);
g_atomic_int_inc(&cur->stop_recording);
}
else
errstr = "Unrecognized command";


+ 1
- 0
daemon/control_ng.h View File

@ -19,6 +19,7 @@ struct control_ng_stats {
int query;
int list;
int start_recording;
int stop_recording;
int errors;
};


Loading…
Cancel
Save