Browse Source

feat: notify-purge removes a file if notify success

Closes #1675

Change-Id: I5edd20efabcf94a19932a7066e80d77e6d99f0d2
pull/1682/head
Sewan R&D 3 years ago
committed by Richard Fuchs
parent
commit
6fd79f5206
5 changed files with 17 additions and 1 deletions
  1. +5
    -0
      docs/rtpengine-recording.md
  2. +1
    -0
      etc/rtpengine-recording.conf
  3. +3
    -1
      recording-daemon/main.c
  4. +1
    -0
      recording-daemon/main.h
  5. +7
    -0
      recording-daemon/notify.c

+ 5
- 0
docs/rtpengine-recording.md View File

@ -328,6 +328,11 @@ sufficient for a standard installation of rtpengine.
is incompatible with DB-only storage as no recording file exists on storage
(see __output-storage__).
- __\-\-notify-purge__
Remove the local file if the HTTP request was successful. Note that this
option is only useful if __\-\-notify-record__ is also enabled.
## EXIT STATUS
- __0__


+ 1
- 0
etc/rtpengine-recording.conf View File

@ -59,5 +59,6 @@ table = 0
# notify-uri = https://example.com/rec/finished
# notify-post = false
# notify-no-verify = false
# notify-purge = false
# notify-concurrency = 5
# notify-retries = 10

+ 3
- 1
recording-daemon/main.c View File

@ -65,6 +65,7 @@ int notify_nverify;
int notify_threads = 5;
int notify_retries = 10;
int notify_record;
int notify_purge;
static GQueue threads = G_QUEUE_INIT; // only accessed from main thread
@ -221,7 +222,8 @@ static void options(int *argc, char ***argv) {
{ "notify-concurrency", 0, 0, G_OPTION_ARG_INT, &notify_threads,"How many simultaneous requests", "INT" },
{ "notify-retries", 0, 0, G_OPTION_ARG_INT, &notify_retries,"How many times to retry failed requesets","INT" },
#if CURL_AT_LEAST_VERSION(7,56,0)
{ "notify-record", 0, 0, G_OPTION_ARG_NONE, &notify_record, "Also attach recorded file to request", NULL },
{ "notify-record", 0, 0, G_OPTION_ARG_NONE, &notify_record, "Also attach recorded file to request", NULL },
{ "notify-purge", 0, 0, G_OPTION_ARG_NONE, &notify_purge, "Remove the local file if notify success", NULL },
#endif
{ NULL, }
};


+ 1
- 0
recording-daemon/main.h View File

@ -47,6 +47,7 @@ extern int notify_nverify;
extern int notify_threads;
extern int notify_retries;
extern int notify_record;
extern int notify_purge;
extern volatile int shutdown_flag;


+ 7
- 0
recording-daemon/notify.c View File

@ -125,6 +125,13 @@ static void do_notify(void *p, void *u) {
/* success */
ilog(LOG_NOTICE, "HTTP notification for '%s%s%s' was successful", FMT_M(req->name));
if (notify_record && notify_purge) {
if (unlink(req->full_filename_path) == 0)
ilog(LOG_NOTICE, "File '%s%s%s' deleted successfully.", FMT_M(req->full_filename_path));
else
ilog(LOG_ERR, "File '%s%s%s' could not be deleted.", FMT_M(req->full_filename_path));
}
goto cleanup;
fail:


Loading…
Cancel
Save