don't complain if no spool directory is configured

fixes #272

Change-Id: I035081d6f47a09c58fb9eaaaa37b38e726b378a5
changes/32/9332/1
Richard Fuchs 10 years ago
parent 303a40b2d0
commit 9aa4aec91a

@ -470,9 +470,9 @@ The options are described in more detail below.
* --recording-dir * --recording-dir
An optional argument to specify a path to a directory where PCAP recording An optional argument to specify a path to a directory where PCAP recording
files and recording metadata files should be stored. If not specified, the the files and recording metadata files should be stored. If not specified, support
rtpengine will default to placing recorded files in `/var/spool/rtpengine/` if for call recording will be disabled.
it exists. PCAP files will be stored within a "pcap" subdirectory and metadata PCAP files will be stored within a "pcap" subdirectory and metadata
within a "metadata" subdirectory. within a "metadata" subdirectory.
The format for a metadata file is (with a trailing newline): The format for a metadata file is (with a trailing newline):

@ -30,16 +30,14 @@ void recording_fs_init(char *spoolpath) {
curl = curl_easy_init(); curl = curl_easy_init();
// Whether or not to fail if the spool directory does not exist. // Whether or not to fail if the spool directory does not exist.
int dne_fail; int dne_fail;
if (spoolpath == NULL || spoolpath[0] == '\0') { if (spoolpath == NULL || spoolpath[0] == '\0')
spoolpath = "/var/spool/rtpengine"; return;
dne_fail = FALSE;
} else { dne_fail = TRUE;
dne_fail = TRUE; int path_len = strlen(spoolpath);
int path_len = strlen(spoolpath); // Get rid of trailing "/" if it exists. Other code adds that in when needed.
// Get rid of trailing "/" if it exists. Other code adds that in when needed. if (spoolpath[path_len-1] == '/') {
if (spoolpath[path_len-1] == '/') { spoolpath[path_len-1] = '\0';
spoolpath[path_len-1] = '\0';
}
} }
if (!maybe_create_spool_dir(spoolpath)) { if (!maybe_create_spool_dir(spoolpath)) {
fprintf(stderr, "Error while setting up spool directory \"%s\".\n", spoolpath); fprintf(stderr, "Error while setting up spool directory \"%s\".\n", spoolpath);
@ -129,6 +127,10 @@ int detect_setup_recording(struct call *call, str recordcall) {
int set_record_call(struct call *call, str recordcall) { int set_record_call(struct call *call, str recordcall) {
if (!str_cmp(&recordcall, "yes")) { if (!str_cmp(&recordcall, "yes")) {
if (call->record_call == FALSE) { if (call->record_call == FALSE) {
if (!spooldir) {
ilog(LOG_ERR, "Call recording requested, but no spool directory configured");
return FALSE;
}
ilog(LOG_NOTICE, "Turning on call recording."); ilog(LOG_NOTICE, "Turning on call recording.");
} }
call->record_call = TRUE; call->record_call = TRUE;

Loading…
Cancel
Save