Browse Source

Refactored NG protocol handling of "record call" settings

I refactored the handling of the "record-call" flag in the
"rtpengine_offer" and "rtpengine_answer" handler. We now set the
recording data structures in a function called `set_record_call`.
We also only handle "record-call" flags on OP_ANSWER for SDP answers.
pull/245/head
Dylan Mikus 10 years ago
committed by Eric Green
parent
commit
c787ab9c4e
1 changed files with 28 additions and 14 deletions
  1. +28
    -14
      daemon/call_interfaces.c

+ 28
- 14
daemon/call_interfaces.c View File

@ -25,7 +25,7 @@
int trust_address_def;
int dtls_passive_def;
int set_record_call(struct call *call, str recordcall);
static int call_stream_address_gstring(GString *o, struct packet_stream *ps, enum stream_address_format format) {
@ -689,19 +689,9 @@ static const char *call_offer_answer_ng(bencode_item_t *input, struct callmaster
if (!call)
goto out;
if (recordcall.s) {
if (!str_cmp(&recordcall, "yes")) {
call->record_call = TRUE;
if (call->recording == NULL) {
call->recording = g_slice_alloc0(sizeof(struct recording));
call->recording->recording_pd = NULL;
call->recording->recording_pdumper = NULL;
meta_setup_file(call->recording, call->callid);
}
} else if (!str_cmp(&recordcall, "no")) {
call->record_call = FALSE;
} else {
ilog(LOG_INFO, "\"record-call\" flag %s is invalid flag.", recordcall.s);
if (opmode == OP_ANSWER) {
if (recordcall.s) {
set_record_call(call, recordcall);
}
}
@ -1084,3 +1074,27 @@ const char *call_list_ng(bencode_item_t *input, struct callmaster *m, bencode_it
return NULL;
}
/**
* Controls the setting of recording variables on a `struct call *`.
* Sets the `record_call` value on the `struct call`, initializing the
* recording struct if necessary.
*
* Returns a boolean for whether or not the call is being recorded.
*/
int set_record_call(struct call *call, str recordcall) {
if (!str_cmp(&recordcall, "yes")) {
call->record_call = TRUE;
if (call->recording == NULL) {
call->recording = g_slice_alloc0(sizeof(struct recording));
call->recording->recording_pd = NULL;
call->recording->recording_pdumper = NULL;
meta_setup_file(call->recording, call->callid);
}
} else if (!str_cmp(&recordcall, "no")) {
call->record_call = FALSE;
} else {
ilog(LOG_INFO, "\"record-call\" flag %s is invalid flag.", recordcall.s);
}
return call->record_call;
}

Loading…
Cancel
Save