Asterisk - The Open Source Telephony Project
21.4.1
|
Stored file operations for Stasis. More...
#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/paths.h"
#include "asterisk/stasis_app_recording.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | match_recording_data |
struct | stasis_app_stored_recording |
Functions | |
static char * | find_recording (const char *dir_name, const char *file) |
Finds a recording in the given directory. More... | |
static int | handle_find_recording (const char *dir_name, const char *filename, void *obj) |
static int | handle_scan_file (const char *dir_name, const char *filename, void *obj) |
static int | is_recording (const char *filename) |
static struct stasis_app_stored_recording * | recording_alloc (void) |
Allocate a recording object. | |
static int | recording_sort (const void *obj_left, const void *obj_right, int flags) |
static int | split_path (const char *path, char **dir, char **file) |
Split a path into directory and file, resolving canonical directory. More... | |
int | stasis_app_stored_recording_copy (struct stasis_app_stored_recording *src_recording, const char *dst, struct stasis_app_stored_recording **dst_recording) |
Copy a recording. More... | |
int | stasis_app_stored_recording_delete (struct stasis_app_stored_recording *recording) |
Delete a recording from disk. More... | |
struct ao2_container * | stasis_app_stored_recording_find_all (void) |
Find all stored recordings on disk. More... | |
struct stasis_app_stored_recording * | stasis_app_stored_recording_find_by_name (const char *name) |
Creates a stored recording object, with the given name. More... | |
const char * | stasis_app_stored_recording_get_extension (struct stasis_app_stored_recording *recording) |
Returns the extension for this recording. More... | |
const char * | stasis_app_stored_recording_get_file (struct stasis_app_stored_recording *recording) |
Returns the filename for this recording, for use with streamfile. More... | |
const char * | stasis_app_stored_recording_get_filename (struct stasis_app_stored_recording *recording) |
Returns the full filename, with extension, for this recording. More... | |
struct ast_json * | stasis_app_stored_recording_to_json (struct stasis_app_stored_recording *recording) |
Convert stored recording info to JSON. More... | |
static void | stored_recording_dtor (void *obj) |
Stored file operations for Stasis.
Definition in file stored.c.
|
static |
Finds a recording in the given directory.
This function searches for a file with the given file name, with a registered format that matches its extension.
dir_name | Directory to search (absolute path). |
file | File name, without extension. |
NULL | if recording is not found. |
Definition at line 187 of file stored.c.
References ast_file_read_dir.
|
static |
< Deprecated name
< Deprecated name
< Deprecated name
< Deprecated name
< Deprecated name
< Deprecated name
Definition at line 223 of file stored.c.
|
static |
Split a path into directory and file, resolving canonical directory.
The path is resolved relative to the recording directory. Both dir and file are allocated strings, which you must ast_free().
path | Path to split. | |
[out] | dir | Output parameter for directory portion. |
[out] | file | Output parameter for the file portion. |
Definition at line 92 of file stored.c.
References ast_asprintf, ast_strdup, and RAII_VAR.
int stasis_app_stored_recording_copy | ( | struct stasis_app_stored_recording * | src_recording, |
const char * | dst, | ||
struct stasis_app_stored_recording ** | dst_recording | ||
) |
Copy a recording.
src_recording | The recording to copy |
dst | The destination of the recording to make |
dst_recording | If successful, the stored recording created as a result of the copy |
0 | on success |
Non-zero | on error |
Definition at line 393 of file stored.c.
Referenced by ast_ari_recordings_copy_stored().
int stasis_app_stored_recording_delete | ( | struct stasis_app_stored_recording * | recording | ) |
Delete a recording from disk.
recording | Recording to delete. |
Definition at line 443 of file stored.c.
Referenced by ast_ari_recordings_delete_stored().
struct ao2_container* stasis_app_stored_recording_find_all | ( | void | ) |
Find all stored recordings on disk.
NULL | on error. |
Definition at line 294 of file stored.c.
Referenced by ast_ari_recordings_list_stored().
struct stasis_app_stored_recording* stasis_app_stored_recording_find_by_name | ( | const char * | name | ) |
Creates a stored recording object, with the given name.
name | Name of the recording. |
NULL | if recording is not found. errno is set to indicate why
|
Definition at line 314 of file stored.c.
Referenced by ast_ari_recordings_copy_stored(), ast_ari_recordings_delete_stored(), ast_ari_recordings_get_stored(), and ast_ari_recordings_get_stored_file().
const char* stasis_app_stored_recording_get_extension | ( | struct stasis_app_stored_recording * | recording | ) |
Returns the extension for this recording.
recording | Recording to query. |
NULL | on error |
Definition at line 71 of file stored.c.
References stasis_app_stored_recording::format.
Referenced by ast_ari_recordings_get_stored_file().
const char* stasis_app_stored_recording_get_file | ( | struct stasis_app_stored_recording * | recording | ) |
Returns the filename for this recording, for use with streamfile.
The returned string will be valid until the recording object is freed.
recording | Recording to query. |
NULL | on error. |
Definition at line 53 of file stored.c.
References stasis_app_stored_recording::file.
const char* stasis_app_stored_recording_get_filename | ( | struct stasis_app_stored_recording * | recording | ) |
Returns the full filename, with extension, for this recording.
recording | Recording to query. |
NULL | on error |
Definition at line 62 of file stored.c.
References stasis_app_stored_recording::file_with_ext.
Referenced by ast_ari_recordings_get_stored_file().
struct ast_json* stasis_app_stored_recording_to_json | ( | struct stasis_app_stored_recording * | recording | ) |
Convert stored recording info to JSON.
recording | Recording to convert. |
NULL | on error. |
Definition at line 450 of file stored.c.
References stasis_app_stored_recording::file_with_ext.
Referenced by ast_ari_recordings_copy_stored(), ast_ari_recordings_get_stored(), and ast_ari_recordings_list_stored().