Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Generic File Format Support. More...
#include "asterisk.h"
#include <dirent.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <math.h>
#include "asterisk/_private.h"
#include "asterisk/paths.h"
#include "asterisk/mod_format.h"
#include "asterisk/cli.h"
#include "asterisk/channel.h"
#include "asterisk/sched.h"
#include "asterisk/translate.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/pbx.h"
#include "asterisk/linkedlists.h"
#include "asterisk/module.h"
#include "asterisk/astobj2.h"
#include "asterisk/test.h"
#include "asterisk/stasis.h"
#include "asterisk/json.h"
#include "asterisk/stasis_system.h"
#include "asterisk/media_cache.h"
Go to the source code of this file.
Data Structures | |
struct | formats |
Macros | |
#define | exts_compare(list, type) (type_in_list((list), (type), strcmp)) |
#define | FORMAT "%-10s %-10s %-20s\n" |
#define | FORMAT2 "%-10s %-10s %-20s\n" |
Enumerations | |
enum | file_action { ACTION_EXISTS = 1 , ACTION_DELETE , ACTION_RENAME , ACTION_OPEN , ACTION_COPY } |
enum | fsread_res { FSREAD_FAILURE , FSREAD_SUCCESS_SCHED , FSREAD_SUCCESS_NOSCHED } |
enum | wrap_fn { WRAP_OPEN , WRAP_REWRITE } |
Functions | |
static int | __ast_file_read_dirs (const char *path, ast_file_on_file on_file, void *obj, int max_depth) |
int | __ast_format_def_register (const struct ast_format_def *f, struct ast_module *mod) |
Register a new file format capability. Adds a format to Asterisk's format abilities. More... | |
int | ast_applystream (struct ast_channel *chan, struct ast_filestream *s) |
Applies a open stream to a channel. More... | |
int | ast_closestream (struct ast_filestream *f) |
Closes a stream. More... | |
int | ast_file_fdtemp (const char *path, char **filename, const char *template_name) |
Create a temporary file located at path. More... | |
int | ast_file_init (void) |
FILE * | ast_file_mkftemp (char *template_name, mode_t mode) |
same as mkstemp, but return a FILE More... | |
int | ast_file_read_dirs (const char *dir_name, ast_file_on_file on_file, void *obj, int max_depth) |
Recursively iterate through files and directories up to max_depth. More... | |
int | ast_filecopy (const char *filename, const char *filename2, const char *fmt) |
Copies a file. More... | |
int | ast_filedelete (const char *filename, const char *fmt) |
Deletes a file. More... | |
int | ast_fileexists (const char *filename, const char *fmt, const char *preflang) |
Checks for the existence of a given file. More... | |
int | ast_filerename (const char *filename, const char *filename2, const char *fmt) |
Renames a file. More... | |
int | ast_format_def_unregister (const char *name) |
Unregisters a file format. More... | |
char * | ast_format_str_reduce (char *fmts) |
static int | ast_fsread_audio (const void *data) |
static int | ast_fsread_video (const void *data) |
int | ast_get_extension_for_mime_type (const char *mime_type, char *buffer, size_t capacity) |
Get a suitable filename extension for the given MIME type. More... | |
struct ast_format * | ast_get_format_for_file_ext (const char *file_ext) |
Get the ast_format associated with the given file extension. More... | |
struct ast_filestream * | ast_openstream (struct ast_channel *chan, const char *filename, const char *preflang) |
Opens stream for use in seeking, playing. More... | |
struct ast_filestream * | ast_openstream_full (struct ast_channel *chan, const char *filename, const char *preflang, int asis) |
Opens stream for use in seeking, playing. More... | |
struct ast_filestream * | ast_openvstream (struct ast_channel *chan, const char *filename, const char *preflang) |
Opens stream for use in seeking, playing. More... | |
int | ast_playstream (struct ast_filestream *s) |
Play a open stream on a channel. More... | |
int | ast_ratestream (struct ast_filestream *fs) |
Return the sample rate of the stream's format. More... | |
static enum fsread_res | ast_readaudio_callback (struct ast_filestream *s) |
struct ast_filestream * | ast_readfile (const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode) |
Starts reading from a file. More... | |
struct ast_frame * | ast_readframe (struct ast_filestream *s) |
Read a frame from a filestream. More... | |
static enum fsread_res | ast_readvideo_callback (struct ast_filestream *s) |
int | ast_seekstream (struct ast_filestream *fs, off_t sample_offset, int whence) |
Seeks into stream. More... | |
int | ast_stopstream (struct ast_channel *tmp) |
Stops a stream. More... | |
int | ast_stream_and_wait (struct ast_channel *chan, const char *file, const char *digits) |
stream file until digit If the file name is non-empty, try to play it. More... | |
int | ast_stream_fastforward (struct ast_filestream *fs, off_t ms) |
Fast forward stream ms. More... | |
int | ast_stream_rewind (struct ast_filestream *fs, off_t ms) |
Rewind stream ms. More... | |
int | ast_streamfile (struct ast_channel *chan, const char *filename, const char *preflang) |
Streams a file. More... | |
off_t | ast_tellstream (struct ast_filestream *fs) |
Tell where we are in a stream. More... | |
int | ast_truncstream (struct ast_filestream *fs) |
Trunc stream at current location. More... | |
int | ast_waitstream (struct ast_channel *c, const char *breakon) |
Waits for a stream to stop or digit to be pressed. More... | |
int | ast_waitstream_exten (struct ast_channel *c, const char *context) |
Waits for a stream to stop or digit matching a valid one digit exten to be pressed. More... | |
int | ast_waitstream_fr (struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int ms) |
Same as waitstream but allows stream to be forwarded or rewound. More... | |
int | ast_waitstream_fr_w_cb (struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int ms, ast_waitstream_fr_cb cb) |
Same as waitstream_fr but allows a callback to be alerted when a user fastforwards or rewinds the file. More... | |
int | ast_waitstream_full (struct ast_channel *c, const char *breakon, int audiofd, int cmdfd) |
struct ast_filestream * | ast_writefile (const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode) |
Starts writing a file. More... | |
int | ast_writestream (struct ast_filestream *fs, struct ast_frame *f) |
Writes a frame to a stream. More... | |
static char * | build_filename (const char *filename, const char *ext) |
construct a filename. Absolute pathnames are preserved, relative names are prefixed by the sounds/ directory. The wav49 suffix is replaced by 'WAV'. Returns a malloc'ed string to be freed by the caller. More... | |
static int | copy (const char *infile, const char *outfile) |
static void | file_shutdown (void) |
static int | fileexists_core (const char *filename, const char *fmt, const char *preflang, char *buf, int buflen, struct ast_format_cap *result_cap) |
helper routine to locate a file with a given format and language preference. More... | |
static int | fileexists_test (const char *filename, const char *fmt, const char *lang, char *buf, int buflen, struct ast_format_cap *result_cap) |
test if a file exists for a given format. More... | |
static int | filehelper (const char *filename, const void *arg2, const char *fmt, const enum file_action action) |
static void | filestream_close (struct ast_filestream *f) |
static void | filestream_destructor (void *arg) |
static int | fn_wrapper (struct ast_filestream *s, const char *comment, enum wrap_fn mode) |
static struct ast_filestream * | get_filestream (struct ast_format_def *fmt, FILE *bfile) |
static char * | handle_cli_core_show_file_formats (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | is_absolute_path (const char *filename) |
static int | is_remote_path (const char *filename) |
static struct ast_json * | json_array_from_list (const char *list, const char *sep) |
static int | open_wrapper (struct ast_filestream *s) |
static int | publish_format_update (const struct ast_format_def *f, struct stasis_message_type *type) |
static struct ast_frame * | read_frame (struct ast_filestream *s, int *whennext) |
static int | rewrite_wrapper (struct ast_filestream *s, const char *comment) |
static int | sanitize_waitstream_return (int return_value) |
STASIS_MESSAGE_TYPE_DEFN (ast_format_register_type) | |
STASIS_MESSAGE_TYPE_DEFN (ast_format_unregister_type) | |
static int | type_in_list (const char *list, const char *type, int(*cmp)(const char *s1, const char *s2)) |
static void | waitstream_control (struct ast_channel *c, enum ast_waitstream_fr_cb_values type, ast_waitstream_fr_cb cb, int skip_ms) |
static int | waitstream_core (struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int skip_ms, int audiofd, int cmdfd, const char *context, ast_waitstream_fr_cb cb) |
the core of all waitstream() functions More... | |
Variables | |
int | ast_language_is_prefix = 1 |
The following variable controls the layout of localized sound files. If 0, use the historical layout with prefix just before the filename (i.e. digits/en/1.gsm , digits/it/1.gsm or default to digits/1.gsm), if 1 put the prefix at the beginning of the filename (i.e. en/digits/1.gsm, it/digits/1.gsm or default to digits/1.gsm). The latter permits a language to be entirely in one directory. More... | |
static struct ast_cli_entry | cli_file [] |
static struct formats | formats = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static ast_mutex_t | read_dirs_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
Lock to hold when iterating over directories. More... | |
Generic File Format Support.
Definition in file file.c.
#define exts_compare | ( | list, | |
type | |||
) | (type_in_list((list), (type), strcmp)) |
#define FORMAT "%-10s %-10s %-20s\n" |
#define FORMAT2 "%-10s %-10s %-20s\n" |
enum file_action |
Enumerator | |
---|---|
ACTION_EXISTS | |
ACTION_DELETE | |
ACTION_RENAME | |
ACTION_OPEN | |
ACTION_COPY |
enum fsread_res |
Enumerator | |
---|---|
FSREAD_FAILURE | |
FSREAD_SUCCESS_SCHED | |
FSREAD_SUCCESS_NOSCHED |
|
static |
Definition at line 1156 of file file.c.
References __ast_file_read_dirs(), ast_debug, ast_free, ast_log, ast_malloc, errno, LOG_ERROR, NULL, and RAII_VAR.
Referenced by __ast_file_read_dirs(), and ast_file_read_dirs().
int __ast_format_def_register | ( | const struct ast_format_def * | f, |
struct ast_module * | mod | ||
) |
Register a new file format capability. Adds a format to Asterisk's format abilities.
0 | on success |
-1 | on failure |
Definition at line 124 of file file.c.
References a, ast_calloc, ast_format_register_type(), ast_log, AST_RWLIST_INSERT_HEAD, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, b, ast_format_def::buf_size, ast_format_def::exts, ast_format_def::list, LOG_WARNING, ast_format_def::name, publish_format_update(), and tmp().
int ast_applystream | ( | struct ast_channel * | chan, |
struct ast_filestream * | s | ||
) |
Applies a open stream to a channel.
chan | channel to work |
s | ast_filestream to apply |
0 | on success. |
-1 | on failure. |
Definition at line 1057 of file file.c.
References ast_filestream::owner.
Referenced by ast_streamfile(), handle_getoption(), handle_recordfile(), handle_streamfile(), and speech_streamfile().
int ast_closestream | ( | struct ast_filestream * | f | ) |
Closes a stream.
f | filestream to close Close a playback or recording stream |
0 | on success. |
-1 | on failure. |
Definition at line 1111 of file file.c.
References ao2_ref, ast_filestream::f, filestream_close(), and NULL.
Referenced by __ast_play_and_record(), ast_hangup(), ast_moh_files_next(), ast_readfile(), ast_stopstream(), ast_writefile(), dictate_exec(), filehelper(), filestream_destructor(), gen_closestream(), handle_cli_file_convert(), handle_recordfile(), local_ast_moh_stop(), mixmonitor_ds_close_fs(), moh_files_release(), msg_create_from_file(), record_exec(), and recordthread().
int ast_file_fdtemp | ( | const char * | path, |
char ** | filename, | ||
const char * | template_name | ||
) |
Create a temporary file located at path.
path | The directory path to create the file in |
filename | Function allocates memory and stores full filename (including path) here |
template_name | mkstemp template to use. Must end with XXXXXX. |
-1 | on failure |
Definition at line 202 of file file.c.
References ast_asprintf, ast_free, ast_log, ast_mkdir(), LOG_ERROR, and LOG_NOTICE.
int ast_file_init | ( | void | ) |
Provided by file.c
Definition at line 2051 of file file.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_format_register_type(), ast_format_unregister_type(), ast_register_cleanup(), cli_file, file_shutdown(), and STASIS_MESSAGE_TYPE_INIT.
Referenced by asterisk_daemon().
FILE * ast_file_mkftemp | ( | char * | template_name, |
mode_t | mode | ||
) |
same as mkstemp, but return a FILE
template_name | The template for the unique file name to generate. Modified in place to return the file name. |
mode | The mode for file permissions |
Definition at line 187 of file file.c.
References ast_format_def::close, and NULL.
Referenced by AST_TEST_DEFINE(), sendmail(), and sendpage().
int ast_file_read_dirs | ( | const char * | dir_name, |
ast_file_on_file | on_file, | ||
void * | obj, | ||
int | max_depth | ||
) |
Recursively iterate through files and directories up to max_depth.
dir_name | the name of the directory to search |
on_file | callback called on each file |
obj | user data object |
max_depth | re-curse into sub-directories up to a given maximum (-1 = infinite) |
-1 | on failure |
errno | on failure |
0 | otherwise |
Definition at line 1274 of file file.c.
References __ast_file_read_dirs(), ast_mutex_lock, ast_mutex_unlock, errno, and read_dirs_lock.
Referenced by _crypto_load_cert_store(), _crypto_load_crl_store(), ast_media_index_update_for_file(), AST_TEST_DEFINE(), crypto_load(), module_load_helper(), and stasis_app_stored_recording_find_all().
int ast_filecopy | ( | const char * | oldname, |
const char * | newname, | ||
const char * | fmt | ||
) |
Copies a file.
oldname | name of the file you wish to copy (minus extension) |
newname | name you wish the file to be copied to (minus extension) |
fmt | the format of the file Copy a given file in a given format, or if fmt is NULL, then do so for all |
Definition at line 1151 of file file.c.
References ACTION_COPY, filehelper(), ast_filestream::filename, and ast_filestream::fmt.
Referenced by copy_plain_file(), msg_create_from_file(), stasis_app_stored_recording_copy(), and vm_forwardoptions().
int ast_filedelete | ( | const char * | filename, |
const char * | fmt | ||
) |
Deletes a file.
filename | name of the file you wish to delete (minus the extension) |
fmt | of the file Delete a given file in a given format, or if fmt is NULL, then do so for all |
Definition at line 1141 of file file.c.
References ACTION_DELETE, filehelper(), ast_filestream::filename, ast_filestream::fmt, and NULL.
Referenced by __ast_play_and_record(), announce_thread(), async_delete_name_rec_task(), conf_free(), conf_rec_name(), conf_run(), confbridge_exec(), dial_exec_full(), handle_cli_file_convert(), leave_voicemail(), mixmonitor_thread(), msg_create_from_file(), play_record_review(), record_exec(), recording_cancel(), setup_privacy_args(), and vm_delete().
int ast_fileexists | ( | const char * | filename, |
const char * | fmt, | ||
const char * | preflang | ||
) |
Checks for the existence of a given file.
filename | name of the file you wish to check, minus the extension |
fmt | the format you wish to check (the extension) |
preflang | (the preferred language you wisht to find the file in) See if a given file exists in a given format. If fmt is NULL, any format is accepted. |
0 | The file does not exist |
1 | The file does exist. |
Definition at line 1129 of file file.c.
References ast_alloca, buf, fileexists_core(), ast_filestream::filename, ast_filestream::fmt, and NULL.
Referenced by announce_thread(), app_exec(), ast_get_character_str(), ast_get_digit_str(), ast_get_phonetic_str(), ast_moh_files_next(), common_exec(), conf_run(), dial_exec_full(), eivr_comm(), forward_message(), get_folder(), invent_message(), leave_voicemail(), meetme_menu_admin_extended(), minivm_delete_exec(), msg_create_from_file(), page_exec(), play_file(), play_message(), play_message_by_id_helper(), play_message_callerid(), readexten_exec(), record_exec(), retrydial_exec(), sayname(), setup_privacy_args(), sound_file_exists(), stasis_app_control_record(), vm_intro(), vm_msg_play(), vm_newuser_setup(), vm_options(), and vm_tempgreeting().
int ast_filerename | ( | const char * | oldname, |
const char * | newname, | ||
const char * | fmt | ||
) |
Renames a file.
oldname | the name of the file you wish to act upon (minus the extension) |
newname | the name you wish to rename the file to (minus the extension) |
fmt | the format of the file Rename a given file in a given format, or if fmt is NULL, then do so for all |
-1 | on failure |
Definition at line 1146 of file file.c.
References ACTION_RENAME, filehelper(), ast_filestream::filename, and ast_filestream::fmt.
Referenced by __ast_play_and_record(), forward_message(), leave_voicemail(), msg_create_from_file(), play_record_review(), rename_file(), and vm_forwardoptions().
int ast_format_def_unregister | ( | const char * | name | ) |
Unregisters a file format.
name | the name of the format you wish to unregister Unregisters a format based on the name of the format. |
0 | on success |
-1 | on failure to unregister |
Definition at line 162 of file file.c.
References ast_format_unregister_type(), ast_free, ast_log, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_format_def::list, LOG_WARNING, name, publish_format_update(), and tmp().
Referenced by unload_module().
char * ast_format_str_reduce | ( | char * | fmts | ) |
Remove duplicate formats from a format string.
fmts | a format string, this string will be modified |
NULL | error |
Definition at line 1894 of file file.c.
References ast_log, AST_MAX_FORMATS, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdupa, ast_format_def::exts, exts_compare, first, len(), ast_format_def::list, LOG_WARNING, NULL, strsep(), and type.
Referenced by actual_load_config(), and AST_TEST_DEFINE().
|
static |
Definition at line 999 of file file.c.
References ast_readaudio_callback(), and FSREAD_SUCCESS_SCHED.
Referenced by ast_readaudio_callback().
|
static |
Definition at line 1044 of file file.c.
References ast_readvideo_callback(), and FSREAD_SUCCESS_SCHED.
Referenced by ast_readvideo_callback().
int ast_get_extension_for_mime_type | ( | const char * | mime_type, |
char * | buffer, | ||
size_t | capacity | ||
) |
Get a suitable filename extension for the given MIME type.
mime_type | The MIME type for which to find extensions |
buffer | A pointer to a buffer to receive the extension |
capacity | The size of 'buffer' in bytes |
1 | if an extension was found for the provided MIME type |
0 | if the MIME type was not found |
Definition at line 2019 of file file.c.
References ast_assert, AST_RWLIST_TRAVERSE, ast_format_def::exts, ast_format_def::list, lock, formats::lock, ast_format_def::mime_types, SCOPED_RDLOCK, and type_in_list().
Referenced by derive_extension_from_mime_type().
struct ast_format * ast_get_format_for_file_ext | ( | const char * | file_ext | ) |
Get the ast_format associated with the given file extension.
file_ext | The file extension for which to find the format |
NULL | if not found |
Definition at line 2006 of file file.c.
References AST_RWLIST_TRAVERSE, ast_format_def::exts, exts_compare, ast_format_def::format, ast_format_def::list, lock, formats::lock, NULL, and SCOPED_RDLOCK.
Referenced by ast_ari_bridges_record(), ast_ari_channels_record(), ast_ari_recordings_get_stored_file(), file_extension_from_string(), is_recording(), and process_media_file().
struct ast_filestream * ast_openstream | ( | struct ast_channel * | chan, |
const char * | filename, | ||
const char * | preflang | ||
) |
Opens stream for use in seeking, playing.
chan | channel to work with |
filename | to use |
preflang | prefered language to use |
NULL | on error. |
Definition at line 790 of file file.c.
References ast_openstream_full(), and ast_filestream::filename.
Referenced by ast_streamfile(), dictate_exec(), handle_getoption(), handle_streamfile(), and speech_streamfile().
struct ast_filestream * ast_openstream_full | ( | struct ast_channel * | chan, |
const char * | filename, | ||
const char * | preflang, | ||
int | asis | ||
) |
Opens stream for use in seeking, playing.
chan | channel to work with |
filename | to use |
preflang | prefered language to use |
asis | if set, don't clear generators |
a | ast_filestream pointer if it opens the file. |
NULL | on error. |
Definition at line 795 of file file.c.
References ACTION_OPEN, ao2_ref, ast_alloca, ast_channel_generator(), ast_channel_lock, ast_channel_set_oldwriteformat(), ast_channel_stream(), ast_channel_unlock, ast_channel_writeformat(), ast_deactivate_generator(), ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_has_type(), ast_log, AST_MEDIA_TYPE_AUDIO, ast_set_write_format_from_cap(), ast_stopstream(), buf, fileexists_core(), filehelper(), LOG_WARNING, and NULL.
Referenced by ast_moh_files_next(), ast_openstream(), and gen_nextfile().
struct ast_filestream * ast_openvstream | ( | struct ast_channel * | chan, |
const char * | filename, | ||
const char * | preflang | ||
) |
Opens stream for use in seeking, playing.
chan | channel to work with |
filename | to use |
preflang | prefered language to use |
NULL | on error. |
Definition at line 848 of file file.c.
References ACTION_OPEN, ao2_bump, ao2_cleanup, ao2_ref, ast_alloca, ast_channel_lock, ast_channel_nativeformats(), ast_channel_unlock, ast_channel_vstream(), ast_format_cap_alloc, ast_format_cap_count(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_format(), ast_format_cap_has_type(), ast_format_cap_iscompatible(), ast_format_get_name(), ast_format_get_type(), ast_log, AST_MEDIA_TYPE_VIDEO, buf, fileexists_core(), filehelper(), LOG_WARNING, and NULL.
Referenced by ast_streamfile(), handle_getoption(), and handle_streamfile().
int ast_playstream | ( | struct ast_filestream * | s | ) |
Play a open stream on a channel.
s | filestream to play |
0 | on success. |
-1 | on failure. |
Definition at line 1063 of file file.c.
References ast_format_get_type(), AST_MEDIA_TYPE_AUDIO, ast_readaudio_callback(), ast_readvideo_callback(), ast_filestream::fmt, ast_format_def::format, and FSREAD_FAILURE.
Referenced by ast_streamfile(), handle_getoption(), handle_streamfile(), and speech_streamfile().
int ast_ratestream | ( | struct ast_filestream * | fs | ) |
Return the sample rate of the stream's format.
fs | fs to act on |
Definition at line 1090 of file file.c.
References ast_format_get_sample_rate(), ast_filestream::fmt, and ast_format_def::format.
Referenced by msg_create_from_file().
|
static |
Definition at line 951 of file file.c.
References ast_channel_name(), ast_channel_sched(), ast_channel_streamid_set(), ast_channel_timingfd(), ast_debug, ast_format_get_sample_rate(), ast_frfree, ast_fsread_audio(), ast_sched_add(), ast_settimeout(), ast_settimeout_full(), ast_write(), ast_filestream::fmt, ast_format_def::format, FSREAD_FAILURE, FSREAD_SUCCESS_NOSCHED, FSREAD_SUCCESS_SCHED, ast_filestream::lasttimeout, NULL, ast_filestream::orig_chan_name, ast_filestream::owner, read_frame(), and roundf().
Referenced by ast_fsread_audio(), and ast_playstream().
struct ast_filestream * ast_readfile | ( | const char * | filename, |
const char * | type, | ||
const char * | comment, | ||
int | flags, | ||
int | check, | ||
mode_t | mode | ||
) |
Starts reading from a file.
filename | the name of the file to read from |
type | format of file you wish to read from |
comment | comment to go with |
flags | file flags |
check | (unimplemented, hence negligible) |
mode | Open mode Open an incoming file stream. flags are flags for the open() command, and if check is non-zero, then it will not read a file if there are any files that start with that name and have an extension Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution. |
NULL | on failure. |
Definition at line 1371 of file file.c.
References ast_closestream(), ast_free, ast_log, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdup, build_filename(), errno, exts_compare, ast_filestream::f, ast_filestream::filename, ast_filestream::flags, ast_filestream::fmt, get_filestream(), LOG_WARNING, ast_filestream::mode, NULL, open_wrapper(), ast_filestream::trans, type, and ast_filestream::vfs.
Referenced by __ast_play_and_record(), handle_cli_file_convert(), and msg_create_from_file().
struct ast_frame * ast_readframe | ( | struct ast_filestream * | s | ) |
Read a frame from a filestream.
s | ast_filestream to act on |
NULL | if read failed. |
Definition at line 936 of file file.c.
References read_frame().
Referenced by __ast_play_and_record(), dictate_exec(), gen_readframe(), handle_cli_file_convert(), and moh_files_readframe().
|
static |
Definition at line 1014 of file file.c.
References ast_channel_sched(), ast_channel_vstreamid_set(), ast_debug, ast_format_get_sample_rate(), ast_frfree, ast_fsread_video(), ast_sched_add(), ast_write(), ast_filestream::fmt, ast_format_def::format, FSREAD_FAILURE, FSREAD_SUCCESS_NOSCHED, FSREAD_SUCCESS_SCHED, ast_filestream::lasttimeout, ast_filestream::owner, and read_frame().
Referenced by ast_fsread_video(), and ast_playstream().
int ast_seekstream | ( | struct ast_filestream * | fs, |
off_t | sample_offset, | ||
int | whence | ||
) |
Seeks into stream.
fs | ast_filestream to perform seek on |
sample_offset | numbers of samples to seek |
whence | SEEK_SET, SEEK_CUR, SEEK_END |
0 | on success. |
-1 | on failure. |
Definition at line 1075 of file file.c.
References ast_filestream::fmt, and ast_format_def::seek.
Referenced by ast_moh_files_next(), ast_stream_fastforward(), ast_stream_rewind(), ast_streamfile(), control_streamfile(), dictate_exec(), handle_getoption(), handle_recordfile(), handle_streamfile(), msg_create_from_file(), and speech_streamfile().
int ast_stopstream | ( | struct ast_channel * | c | ) |
Stops a stream.
c | The channel you wish to stop playback on |
Stop playback of a stream
0 | always |
Definition at line 222 of file file.c.
References ast_channel_lock, ast_channel_oldwriteformat(), ast_channel_stream(), ast_channel_stream_set(), ast_channel_unlock, ast_channel_vstream(), ast_channel_vstream_set(), ast_closestream(), ast_format_get_name(), ast_log, ast_set_write_format(), LOG_WARNING, NULL, and tmp().
Referenced by action_playback_and_continue(), adsi_transmit_message_full(), agent_alert(), announce_to_dial(), ast_openstream_full(), ast_play_and_wait(), ast_readstring_full(), ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_en(), ast_say_enumeration_full_he(), ast_say_enumeration_full_is(), ast_say_enumeration_full_vi(), ast_say_number_full_cs(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_en_GB(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_gr(), ast_say_number_full_he(), ast_say_number_full_hu(), ast_say_number_full_is(), ast_say_number_full_it(), ast_say_number_full_ja(), ast_say_number_full_ka(), ast_say_number_full_nl(), ast_say_number_full_no(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_th(), ast_say_number_full_ur(), ast_say_number_full_vi(), ast_say_number_full_zh(), ast_stream_and_wait(), background_detect_exec(), conf_exec(), conf_run(), control_streamfile(), dial_exec_full(), directory_exec(), grab_transfer(), handle_getoption(), handle_speechrecognize(), handle_streamfile(), isAnsweringMachine(), ivr_dispatch(), leave_voicemail(), meetme_menu_admin(), meetme_menu_admin_extended(), minivm_greet_exec(), mp3_exec(), pbx_builtin_background(), pl_odtworz_plik(), play_file(), play_files_helper(), play_mailbox_owner(), playback_exec(), queue_exec(), read_exec(), readexten_exec(), record_exec(), recordthread(), s_streamwait3(), say_filenames(), select_item_seq(), send_waveform_to_channel(), speech_background(), vm_authenticate(), vm_execmain(), wait_for_winner(), waitstream_core(), and zapateller_exec().
int ast_stream_and_wait | ( | struct ast_channel * | chan, |
const char * | file, | ||
const char * | digits | ||
) |
stream file until digit If the file name is non-empty, try to play it.
0 | if success. |
-1 | if error. |
digit | if interrupted by a digit. |
Definition at line 1878 of file file.c.
References ast_channel_language(), ast_stopstream(), ast_streamfile(), ast_strlen_zero(), ast_waitstream(), and make_ari_stubs::file.
Referenced by __ast_play_and_record(), action_playback(), action_toggle_mute_participants(), agent_alert(), agent_login_exec(), announce_user_count(), app_exec(), ast_bridge_channel_playfile(), ast_pickup_call(), ast_record_review(), bridge_features_duration_callback(), confbridge_exec(), directory_exec(), forward_message(), grab_transfer(), invent_message(), ivr_dispatch(), join_conference_bridge(), leave_voicemail(), limits_interval_playback(), mixmonitor_thread(), park_app_exec(), parked_call_app_exec(), play_file(), play_files_helper(), play_mailbox_owner(), play_message_callerid(), play_prompt_to_user(), play_record_review(), playback_common(), sayname(), select_item_seq(), setup_mixmonitor_ds(), stream_failsound(), vm_forwardoptions(), vmsayname_exec(), and wait_file2().
int ast_stream_fastforward | ( | struct ast_filestream * | fs, |
off_t | ms | ||
) |
Fast forward stream ms.
fs | filestream to act on |
ms | milliseconds to move |
0 | on success. |
-1 | on failure. |
Definition at line 1095 of file file.c.
References ast_seekstream(), and DEFAULT_SAMPLES_PER_MS.
Referenced by waitstream_control().
int ast_stream_rewind | ( | struct ast_filestream * | fs, |
off_t | ms | ||
) |
Rewind stream ms.
fs | filestream to act on |
ms | milliseconds to move |
0 | on success. |
-1 | on failure. |
Definition at line 1100 of file file.c.
References ast_debug, ast_seekstream(), ast_tellstream(), and DEFAULT_SAMPLES_PER_MS.
Referenced by __ast_play_and_record(), handle_recordfile(), record_exec(), and waitstream_control().
int ast_streamfile | ( | struct ast_channel * | c, |
const char * | filename, | ||
const char * | preflang | ||
) |
Streams a file.
c | channel to stream the file to |
filename | the name of the file you wish to stream, minus the extension |
preflang | the preferred language you wish to have the file streamed to you in Prepares a channel for the streaming of a file. To start the stream, afterward do a ast_waitstream() on the channel Also, it will stop any existing streams on the channel. |
0 | on success. |
-1 | on failure. |
Definition at line 1293 of file file.c.
References ast_applystream(), ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_nativeformats(), ast_channel_unlock, ast_channel_writeformat(), ast_debug, AST_FLAG_MASQ_NOSTREAM, ast_format_cap_get_names(), AST_FORMAT_CAP_NAMES_LEN, ast_format_get_name(), ast_log, ast_openstream(), ast_openvstream(), ast_opt_sounds_search_custom, ast_playstream(), ast_seekstream(), ast_str_alloca, ast_strdup, ast_test_flag, ast_test_suite_event_notify, ast_verb, errno, ast_filestream::f, ast_filestream::filename, ast_filestream::fmt, ast_format_def::format, is_absolute_path(), LOG_WARNING, NULL, ast_filestream::orig_chan_name, VERBOSITY_ATLEAST, and ast_filestream::vfs.
Referenced by __analog_ss_thread(), action_playback_and_continue(), analog_ss_thread(), announce_thread(), announce_to_dial(), app_exec(), ast_app_getdata_full(), ast_app_getdata_terminator(), ast_play_and_wait(), ast_say_date_da(), ast_say_date_de(), ast_say_date_en(), ast_say_date_fr(), ast_say_date_gr(), ast_say_date_he(), ast_say_date_hu(), ast_say_date_is(), ast_say_date_ja(), ast_say_date_ka(), ast_say_date_nl(), ast_say_date_th(), ast_say_date_with_format_gr(), ast_say_datetime_en(), ast_say_datetime_fr(), ast_say_datetime_from_now_en(), ast_say_datetime_from_now_fr(), ast_say_datetime_from_now_he(), ast_say_datetime_from_now_ka(), ast_say_datetime_gr(), ast_say_datetime_he(), ast_say_datetime_ja(), ast_say_datetime_nl(), ast_say_datetime_pt(), ast_say_datetime_th(), ast_say_datetime_zh(), ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_en(), ast_say_enumeration_full_he(), ast_say_enumeration_full_is(), ast_say_enumeration_full_vi(), ast_say_number_full_cs(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_en_GB(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_gr(), ast_say_number_full_he(), ast_say_number_full_hu(), ast_say_number_full_is(), ast_say_number_full_it(), ast_say_number_full_ja(), ast_say_number_full_ka(), ast_say_number_full_nl(), ast_say_number_full_no(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_th(), ast_say_number_full_ur(), ast_say_number_full_vi(), ast_say_number_full_zh(), ast_say_time_de(), ast_say_time_en(), ast_say_time_fr(), ast_say_time_gr(), ast_say_time_hu(), ast_say_time_ja(), ast_say_time_ka(), ast_say_time_nl(), ast_say_time_zh(), ast_stream_and_wait(), auth_exec(), background_detect_exec(), common_exec(), conf_exec(), conf_get_pin(), conf_run(), control_streamfile(), dial_exec_full(), do_directory(), find_conf_realtime(), forward_message(), gr_say_number_female(), handle_recordfile(), invent_message(), isAnsweringMachine(), leave_voicemail(), meetme_menu_admin(), meetme_menu_admin_extended(), meetme_menu_normal(), minivm_greet_exec(), page_exec(), pbx_builtin_background(), pl_odtworz_plik(), play_and_wait(), play_file(), play_record_review(), playback_exec(), privacy_exec(), readexten_exec(), record_exec(), retrydial_exec(), s_streamwait3(), say_filenames(), select_item_menu(), setup_privacy_args(), vm_authenticate(), wait_file(), and wait_for_winner().
off_t ast_tellstream | ( | struct ast_filestream * | fs | ) |
Tell where we are in a stream.
fs | fs to act on |
Definition at line 1085 of file file.c.
References ast_filestream::fmt, and ast_format_def::tell.
Referenced by __ast_play_and_record(), ast_moh_files_next(), ast_stream_rewind(), control_streamfile(), handle_getoption(), handle_recordfile(), handle_speechrecognize(), handle_streamfile(), msg_create_from_file(), waitstream_control(), and waitstream_core().
int ast_truncstream | ( | struct ast_filestream * | fs | ) |
Trunc stream at current location.
fs | filestream to act on |
0 | on success. |
-1 | on failure. |
Definition at line 1080 of file file.c.
References ast_filestream::fmt, and ast_format_def::trunc.
Referenced by __ast_play_and_record(), handle_recordfile(), and record_exec().
int ast_waitstream | ( | struct ast_channel * | c, |
const char * | breakon | ||
) |
Waits for a stream to stop or digit to be pressed.
c | channel to waitstream on |
breakon | string of DTMF digits to break upon Begins playback of a stream... Wait for a stream to stop or for any one of a given digit to arrive, |
0 | if the stream finishes |
character | if it was interrupted by the channel. |
-1 | on error |
Definition at line 1840 of file file.c.
References c, NULL, sanitize_waitstream_return(), and waitstream_core().
Referenced by __analog_ss_thread(), action_playback_and_continue(), analog_ss_thread(), announce_thread(), announce_to_dial(), app_exec(), ast_play_and_wait(), ast_say_date_da(), ast_say_date_de(), ast_say_date_en(), ast_say_date_fr(), ast_say_date_gr(), ast_say_date_he(), ast_say_date_hu(), ast_say_date_is(), ast_say_date_ja(), ast_say_date_ka(), ast_say_date_nl(), ast_say_date_th(), ast_say_date_with_format_gr(), ast_say_datetime_en(), ast_say_datetime_fr(), ast_say_datetime_from_now_en(), ast_say_datetime_from_now_fr(), ast_say_datetime_from_now_he(), ast_say_datetime_from_now_ka(), ast_say_datetime_gr(), ast_say_datetime_he(), ast_say_datetime_ja(), ast_say_datetime_nl(), ast_say_datetime_pt(), ast_say_datetime_th(), ast_say_datetime_zh(), ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_en(), ast_say_enumeration_full_he(), ast_say_enumeration_full_is(), ast_say_enumeration_full_vi(), ast_say_number_full_cs(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_en_GB(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_gr(), ast_say_number_full_he(), ast_say_number_full_hu(), ast_say_number_full_is(), ast_say_number_full_it(), ast_say_number_full_ja(), ast_say_number_full_ka(), ast_say_number_full_nl(), ast_say_number_full_no(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_th(), ast_say_number_full_ur(), ast_say_number_full_vi(), ast_say_number_full_zh(), ast_say_time_de(), ast_say_time_en(), ast_say_time_fr(), ast_say_time_gr(), ast_say_time_he(), ast_say_time_hu(), ast_say_time_ja(), ast_say_time_ka(), ast_say_time_nl(), ast_say_time_zh(), ast_stream_and_wait(), auth_exec(), common_exec(), conf_exec(), conf_get_pin(), conf_run(), directory_exec(), find_conf_realtime(), gr_say_number_female(), handle_recordfile(), invent_message(), leave_voicemail(), meetme_menu_admin(), meetme_menu_admin_extended(), meetme_menu_normal(), minivm_greet_exec(), page_exec(), pbx_builtin_background(), pl_odtworz_plik(), play_and_wait(), play_file(), play_record_review(), playback_exec(), privacy_exec(), record_exec(), retrydial_exec(), s_streamwait3(), say_filenames(), select_item_menu(), setup_privacy_args(), vm_authenticate(), and wait_file().
int ast_waitstream_exten | ( | struct ast_channel * | c, |
const char * | context | ||
) |
Waits for a stream to stop or digit matching a valid one digit exten to be pressed.
c | channel to waitstream on |
context | string of context to match digits to break upon Begins playback of a stream... Wait for a stream to stop or for any one of a valid extension digit to arrive, |
0 | if the stream finishes. |
character | if it was interrupted. |
-1 | on error. |
Definition at line 1859 of file file.c.
References ast_channel_context(), c, voicemailpwcheck::context, NULL, sanitize_waitstream_return(), and waitstream_core().
Referenced by pbx_builtin_background().
int ast_waitstream_fr | ( | struct ast_channel * | c, |
const char * | breakon, | ||
const char * | forward, | ||
const char * | rewind, | ||
int | ms | ||
) |
Same as waitstream but allows stream to be forwarded or rewound.
c | channel to waitstream on |
breakon | string of DTMF digits to break upon |
forward | DTMF digit to fast forward upon |
rewind | DTMF digit to rewind upon |
ms | How many miliseconds to skip forward/back Begins playback of a stream... Wait for a stream to stop or for any one of a given digit to arrive, |
0 | if the stream finishes. |
character | if it was interrupted, |
-1 | on error. |
Definition at line 1809 of file file.c.
References c, NULL, and waitstream_core().
Referenced by control_streamfile().
int ast_waitstream_fr_w_cb | ( | struct ast_channel * | c, |
const char * | breakon, | ||
const char * | forward, | ||
const char * | rewind, | ||
int | ms, | ||
ast_waitstream_fr_cb | cb | ||
) |
Same as waitstream_fr but allows a callback to be alerted when a user fastforwards or rewinds the file.
c | channel to waitstream on |
breakon | string of DTMF digits to break upon |
forward | DTMF digit to fast forward upon |
rewind | DTMF digit to rewind upon |
ms | How many milliseconds to skip forward/back |
cb | to call when rewind or fastforward occurs. Begins playback of a stream... Wait for a stream to stop or for any one of a given digit to arrive, |
0 | if the stream finishes. |
character | if it was interrupted, |
-1 | on error. |
Definition at line 1798 of file file.c.
References c, NULL, and waitstream_core().
Referenced by control_streamfile().
int ast_waitstream_full | ( | struct ast_channel * | c, |
const char * | breakon, | ||
int | audiofd, | ||
int | monfd | ||
) |
Same as waitstream, but with audio output to fd and monitored fd checking.
1 | if monfd is ready for reading |
Definition at line 1849 of file file.c.
References c, NULL, sanitize_waitstream_return(), and waitstream_core().
Referenced by ast_readstring_full(), ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_en(), ast_say_enumeration_full_he(), ast_say_enumeration_full_is(), ast_say_enumeration_full_vi(), ast_say_number_full_cs(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_en_GB(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_gr(), ast_say_number_full_he(), ast_say_number_full_hu(), ast_say_number_full_is(), ast_say_number_full_it(), ast_say_number_full_ja(), ast_say_number_full_ka(), ast_say_number_full_nl(), ast_say_number_full_no(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_th(), ast_say_number_full_ur(), ast_say_number_full_vi(), ast_say_number_full_zh(), handle_getoption(), handle_streamfile(), pl_odtworz_plik(), s_streamwait3(), and say_filenames().
struct ast_filestream * ast_writefile | ( | const char * | filename, |
const char * | type, | ||
const char * | comment, | ||
int | flags, | ||
int | check, | ||
mode_t | mode | ||
) |
Starts writing a file.
filename | the name of the file to write to |
type | format of file you wish to write out to |
comment | comment to go with |
flags | output file flags |
check | (unimplemented, hence negligible) |
mode | Open mode Create an outgoing file stream. oflags are flags for the open() command, and if check is non-zero, then it will not write a file if there are any files that start with that name and have an extension Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution. |
NULL | on failure. |
Definition at line 1423 of file file.c.
References ast_closestream(), ast_free, ast_log, ast_malloc, ast_opt_cache_record_files, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdup, buf, build_filename(), c, comment, errno, exts_compare, ast_filestream::f, ast_filestream::filename, ast_filestream::flags, ast_filestream::fmt, get_filestream(), LOG_WARNING, ast_filestream::mode, NULL, ast_filestream::realfilename, record_cache_dir, rewrite_wrapper(), ast_filestream::trans, type, ast_filestream::vfs, and ast_filestream::write_buffer.
Referenced by __ast_play_and_record(), ast_writestream(), dictate_exec(), handle_cli_file_convert(), handle_recordfile(), mixmonitor_save_prep(), record_exec(), and recordthread().
int ast_writestream | ( | struct ast_filestream * | fs, |
struct ast_frame * | f | ||
) |
Writes a frame to a stream.
fs | filestream to write to |
f | frame to write to the filestream Send a frame to a filestream – note: does NOT free the frame, call ast_frfree manually |
0 | on success. |
-1 | on failure. |
Definition at line 244 of file file.c.
References ao2_replace, ast_debug, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_name(), ast_format_get_type(), AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_frfree, AST_LIST_NEXT, ast_log, AST_MEDIA_TYPE_AUDIO, ast_translate(), ast_translator_build_path(), ast_translator_free_path(), ast_writefile(), ast_writestream(), ast_filestream::filename, ast_filestream::flags, ast_filestream::fmt, ast_frame_subclass::format, ast_format_def::format, ast_frame::frametype, ast_filestream::lastwriteformat, LOG_WARNING, ast_filestream::mode, ast_format_def::name, NULL, ast_frame::subclass, ast_filestream::trans, type, ast_filestream::vfs, and ast_format_def::write.
Referenced by __ast_play_and_record(), ast_writestream(), dictate_exec(), handle_cli_file_convert(), handle_recordfile(), mixmonitor_thread(), record_exec(), and recordthread().
|
static |
construct a filename. Absolute pathnames are preserved, relative names are prefixed by the sounds/ directory. The wav49 suffix is replaced by 'WAV'. Returns a malloc'ed string to be freed by the caller.
Definition at line 349 of file file.c.
References ast_asprintf, ast_config_AST_DATA_DIR, ext, and NULL.
Referenced by ast_readfile(), ast_writefile(), and filehelper().
|
static |
Definition at line 306 of file file.c.
References AST_FILE_MODE, ast_log, buf, errno, len(), and LOG_WARNING.
Referenced by filehelper().
|
static |
Definition at line 2044 of file file.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), ast_format_register_type(), ast_format_unregister_type(), cli_file, and STASIS_MESSAGE_TYPE_CLEANUP.
Referenced by ast_file_init().
|
static |
helper routine to locate a file with a given format and language preference.
filename | Name of the file. |
fmt | Format to look for the file in. OPTIONAL |
preflang | The perfered language |
buf | Returns the matching filename |
buflen | Size of the buf |
result_cap | OPTIONAL format capabilities result structure returns what formats the file was found in. |
1 | true. file exists and result format is set |
0 | false. file does not exist. |
Definition at line 741 of file file.c.
References ast_strdupa, ast_strlen_zero(), buf, DEFAULT_LANGUAGE, end, fileexists_test(), ast_filestream::filename, ast_filestream::fmt, and NULL.
Referenced by ast_fileexists(), ast_openstream_full(), and ast_openvstream().
|
static |
test if a file exists for a given format.
1 | true and result_cap represents format capabilities file exists in. |
0 | false |
Definition at line 691 of file file.c.
References ACTION_EXISTS, ast_language_is_prefix, ast_media_cache_retrieve(), buf, c, filehelper(), ast_filestream::filename, ast_filestream::fmt, is_absolute_path(), is_remote_path(), and NULL.
Referenced by fileexists_core().
|
static |
Definition at line 549 of file file.c.
References ACTION_COPY, ACTION_DELETE, ACTION_EXISTS, ACTION_OPEN, ACTION_RENAME, ast_channel_stream(), ast_channel_stream_set(), ast_channel_vstream(), ast_channel_vstream_set(), ast_channel_writeformat(), ast_closestream(), ast_format_cap_append, ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_type(), ast_free, ast_log, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_VIDEO, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, build_filename(), copy(), errno, ext, ast_format_def::exts, exts_compare, ast_filestream::f, ast_filestream::filename, ast_filestream::fmt, ast_format_def::format, get_filestream(), ast_filestream::lasttimeout, ast_format_def::list, LOG_WARNING, NULL, open_wrapper(), strsep(), and ast_filestream::trans.
Referenced by ast_filecopy(), ast_filedelete(), ast_filerename(), ast_openstream_full(), ast_openvstream(), and fileexists_test().
|
static |
Definition at line 392 of file file.c.
References ast_channel_sched(), ast_channel_stream_set(), ast_channel_streamid(), ast_channel_streamid_set(), ast_channel_vstream_set(), ast_channel_vstreamid(), ast_channel_vstreamid_set(), ast_format_get_type(), ast_log, AST_LOG_WARNING, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_VIDEO, AST_SCHED_DEL_ACCESSOR, ast_settimeout(), ast_filestream::fmt, ast_format_def::format, ast_format_def::name, NULL, and ast_filestream::owner.
Referenced by ast_closestream(), and filestream_destructor().
|
static |
Definition at line 418 of file file.c.
References ao2_cleanup, ast_closestream(), ast_free, ast_module_unref, ast_safe_fork(), ast_translator_free_path(), ast_filestream::f, filestream_close(), SENTINEL, and status.
Referenced by get_filestream().
|
static |
Definition at line 503 of file file.c.
References ast_log, comment, ast_filestream::f, ast_filestream::fmt, LOG_WARNING, ast_filestream::mode, WRAP_OPEN, and WRAP_REWRITE.
Referenced by open_wrapper(), and rewrite_wrapper().
|
static |
Definition at line 463 of file file.c.
References ast_filestream::_private, ao2_alloc, ao2_bump, ast_format_get_type(), AST_FRAME_VIDEO, AST_FRAME_VOICE, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_VIDEO, ast_module_running_ref, ast_module_unref, ast_filestream::buf, ast_format_def::buf_size, ast_format_def::desc_size, ast_filestream::f, filestream_destructor(), ast_filestream::fmt, ast_frame_subclass::format, ast_format_def::format, ast_filestream::fr, ast_frame::frametype, if(), ast_frame::mallocd, ast_format_def::module, ast_format_def::name, NULL, ast_frame::src, and ast_frame::subclass.
Referenced by ast_readfile(), ast_writefile(), and filehelper().
|
static |
Definition at line 1970 of file file.c.
References a, ast_cli(), ast_format_get_name(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_format_def::exts, ast_format_def::format, FORMAT, FORMAT2, ast_format_def::list, ast_format_def::name, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 675 of file file.c.
References ast_filestream::filename.
Referenced by ast_streamfile(), and fileexists_test().
|
static |
Definition at line 680 of file file.c.
References ast_filestream::filename.
Referenced by fileexists_test().
|
static |
Definition at line 74 of file file.c.
References array(), ast_json_array_append(), ast_json_array_create(), ast_json_ref(), ast_json_string_create(), ast_json_unref(), ast_strdupa, ext, NULL, RAII_VAR, and strsep().
Referenced by publish_format_update().
|
static |
Definition at line 525 of file file.c.
References fn_wrapper(), NULL, and WRAP_OPEN.
Referenced by ast_readfile(), and filehelper().
|
static |
Definition at line 93 of file file.c.
References ao2_cleanup, ast_json_pack(), ast_json_payload_create(), ast_json_unref(), ast_system_topic(), ast_format_def::exts, json_array_from_list(), ast_format_def::name, NULL, RAII_VAR, stasis_message_create(), stasis_publish(), and type.
Referenced by __ast_format_def_register(), and ast_format_def_unregister().
|
static |
Definition at line 911 of file file.c.
References ast_frfree, ast_frisolate, ast_filestream::fmt, NULL, and ast_format_def::read.
Referenced by ast_audiohook_read_frame_all(), ast_readaudio_callback(), ast_readframe(), ast_readvideo_callback(), and audiohook_read_frame_helper().
|
static |
Definition at line 520 of file file.c.
References comment, fn_wrapper(), and WRAP_REWRITE.
Referenced by ast_writefile().
|
static |
Definition at line 1823 of file file.c.
References AST_CONTROL_STREAM_RESTART, AST_CONTROL_STREAM_STOP, and AST_CONTROL_STREAM_SUSPEND.
Referenced by ast_waitstream(), ast_waitstream_exten(), and ast_waitstream_full().
STASIS_MESSAGE_TYPE_DEFN | ( | ast_format_register_type | ) |
STASIS_MESSAGE_TYPE_DEFN | ( | ast_format_unregister_type | ) |
|
static |
Definition at line 373 of file file.c.
References ast_strdupa, item, strsep(), and type.
Referenced by ast_get_extension_for_mime_type().
|
static |
Definition at line 1571 of file file.c.
References ast_channel_name(), ast_channel_stream(), ast_format_get_sample_rate(), ast_stream_fastforward(), ast_stream_rewind(), ast_tellstream(), ast_test_suite_event_notify, AST_WAITSTREAM_CB_FASTFORWARD, AST_WAITSTREAM_CB_REWIND, c, ast_filestream::f, ast_filestream::fmt, ast_format_def::format, and type.
Referenced by waitstream_core().
|
static |
the core of all waitstream() functions
Definition at line 1613 of file file.c.
References ast_channel_caller(), ast_channel_clear_flag(), ast_channel_flags(), ast_channel_name(), ast_channel_sched(), ast_channel_set_flag(), ast_channel_softhangup_internal_flag(), ast_channel_stream(), ast_channel_timingfunc(), AST_CONTROL_ANSWER, AST_CONTROL_AOC, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_PROGRESS, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_STREAM_FORWARD, AST_CONTROL_STREAM_RESTART, AST_CONTROL_STREAM_REVERSE, AST_CONTROL_STREAM_STOP, AST_CONTROL_STREAM_SUSPEND, AST_CONTROL_UNHOLD, AST_CONTROL_UPDATE_RTP_PEER, AST_CONTROL_VIDUPDATE, AST_CONTROL_WINK, ast_exists_extension(), AST_FLAG_END_DTMF_ONLY, AST_FLAG_MASQ_NOSTREAM, ast_format_get_sample_rate(), AST_FRAME_CONTROL, AST_FRAME_DTMF_END, AST_FRAME_VOICE, ast_frfree, ast_log, ast_read(), ast_sched_runq(), ast_sched_wait(), ast_stopstream(), ast_strdupa, ast_tellstream(), ast_test_flag, ast_test_suite_event_notify, ast_waitfor(), ast_waitfor_nandfds(), AST_WAITSTREAM_CB_FASTFORWARD, AST_WAITSTREAM_CB_REWIND, AST_WAITSTREAM_CB_START, c, voicemailpwcheck::context, ast_frame::data, ast_frame::datalen, errno, ast_filestream::fmt, ast_format_def::format, ast_frame::frametype, ast_frame_subclass::integer, LOG_WARNING, NULL, ast_filestream::orig_chan_name, ast_frame::ptr, S_COR, ast_frame::subclass, and waitstream_control().
Referenced by ast_waitstream(), ast_waitstream_exten(), ast_waitstream_fr(), ast_waitstream_fr_w_cb(), and ast_waitstream_full().
int ast_language_is_prefix = 1 |
The following variable controls the layout of localized sound files. If 0, use the historical layout with prefix just before the filename (i.e. digits/en/1.gsm , digits/it/1.gsm or default to digits/1.gsm), if 1 put the prefix at the beginning of the filename (i.e. en/digits/1.gsm, it/digits/1.gsm or default to digits/1.gsm). The latter permits a language to be entirely in one directory.
This is settable in asterisk.conf.
Definition at line 67 of file file.c.
Referenced by fileexists_test(), handle_show_settings(), load_asterisk_conf(), and main().
|
static |
Definition at line 2040 of file file.c.
Referenced by ast_file_init(), and file_shutdown().
|
static |
Referenced by load_engine().
|
static |
Lock to hold when iterating over directories.
Currently, 'readdir' is not required to be thread-safe. In most modern implementations it should be safe to make concurrent calls into 'readdir' that specify different directory streams (glibc would be one of these). However, since it is potentially unsafe for some implementations we'll use our own locking in order to achieve synchronization for those.
Definition at line 1271 of file file.c.
Referenced by ast_file_read_dirs().