diff --git a/README.md b/README.md index 41c05efa2..bc6ff087b 100644 --- a/README.md +++ b/README.md @@ -470,9 +470,9 @@ The options are described in more detail below. * --recording-dir 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 - rtpengine will default to placing recorded files in `/var/spool/rtpengine/` if - it exists. PCAP files will be stored within a "pcap" subdirectory and metadata + files and recording metadata files should be stored. If not specified, support + for call recording will be disabled. + PCAP files will be stored within a "pcap" subdirectory and metadata within a "metadata" subdirectory. The format for a metadata file is (with a trailing newline): diff --git a/daemon/recording.c b/daemon/recording.c index d57b91b4c..9dd82866e 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -30,16 +30,14 @@ void recording_fs_init(char *spoolpath) { curl = curl_easy_init(); // Whether or not to fail if the spool directory does not exist. int dne_fail; - if (spoolpath == NULL || spoolpath[0] == '\0') { - spoolpath = "/var/spool/rtpengine"; - dne_fail = FALSE; - } else { - dne_fail = TRUE; - int path_len = strlen(spoolpath); - // Get rid of trailing "/" if it exists. Other code adds that in when needed. - if (spoolpath[path_len-1] == '/') { - spoolpath[path_len-1] = '\0'; - } + if (spoolpath == NULL || spoolpath[0] == '\0') + return; + + dne_fail = TRUE; + int path_len = strlen(spoolpath); + // Get rid of trailing "/" if it exists. Other code adds that in when needed. + if (spoolpath[path_len-1] == '/') { + spoolpath[path_len-1] = '\0'; } if (!maybe_create_spool_dir(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) { if (!str_cmp(&recordcall, "yes")) { 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."); } call->record_call = TRUE;