Browse Source

Only turn on or off recording if explicitly specified

When we receive an offer or an answer, we will only turn recording on if
it contains the "record-call=yes" flag. Likewise, we only turn recording
off if it contains the "record-call=no" flag. If no flag is specified,
the call keeps its current recording status. It used to be the case that
not specifying "record-call=yes" would turn off call recording.

This fix is necessary to account for SDP renegotiation during
hold/unhold. If the call system sends over another offer during SDP
renegotiation to hold and then unhold, we don't want to change recording
behavior unless the call system specifically says so.
pull/245/head
Dylan Mikus 10 years ago
committed by Eric Green
parent
commit
1cec331d1c
4 changed files with 23 additions and 21 deletions
  1. +1
    -0
      daemon/call.h
  2. +19
    -20
      daemon/call_interfaces.c
  3. +1
    -1
      daemon/media_socket.c
  4. +2
    -0
      daemon/recording.c

+ 1
- 0
daemon/call.h View File

@ -432,6 +432,7 @@ struct call {
unsigned int redis_hosted_db;
unsigned int foreign_call; // created_via_redis_notify call
int record_call;
struct recording *recording;
};


+ 19
- 20
daemon/call_interfaces.c View File

@ -689,29 +689,28 @@ static const char *call_offer_answer_ng(bencode_item_t *input, struct callmaster
if (!call)
goto out;
if (recordcall.s && !str_cmp(&recordcall, "yes")) {
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);
}
bencode_dictionary_get_str(input, "metadata", &metadata);
if (metadata.len > 0) {
if (call->recording->metadata != NULL) {
free(call->recording->metadata);
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);
}
call->recording->metadata = str_dup(&metadata);
} else if (!str_cmp(&recordcall, "no")) {
call->record_call = FALSE;
} else {
ilog(LOG_INFO, "\"record-call\" flag %s is invalid flag.", recordcall.s);
}
} else {
if (call->recording != NULL) {
g_slice_free1(sizeof(*(call->recording)), call->recording);
str *rec_metadata = call->recording->metadata;
if (rec_metadata != NULL) {
free(rec_metadata);
}
}
bencode_dictionary_get_str(input, "metadata", &metadata);
if (metadata.len > 0 && call->recording != NULL) {
if (call->recording->metadata != NULL) {
free(call->recording->metadata);
}
call->recording = NULL;
call->recording->metadata = str_dup(&metadata);
}
if (!call->created_from && addr) {


+ 1
- 1
daemon/media_socket.c View File

@ -1180,7 +1180,7 @@ loop_ok:
}
// If recording pcap dumper is set, then we record the call.
if (recording_pdumper != NULL) {
if (recording_pdumper != NULL && call->record_call) {
stream_pcap_dump(recording_pdumper, stream, s);
}


+ 2
- 0
daemon/recording.c View File

@ -186,6 +186,8 @@ int meta_finish_file(struct call *call) {
ilog(LOG_INFO, "Moved metadata file \"%s\" to \"%s/metadata\"",
recording->meta_filepath->s, spooldir);
}
} else {
ilog(LOG_INFO, "Trying to clean up recording meta file without a file pointer opened.");
}
if (recording != NULL && recording->meta_filepath != NULL) {
free(recording->meta_filepath->s);


Loading…
Cancel
Save