| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
Routines implementing music on hold. More...
#include "asterisk.h"#include <ctype.h>#include <signal.h>#include <sys/time.h>#include <netinet/in.h>#include <sys/stat.h>#include <dirent.h>#include "asterisk/lock.h"#include "asterisk/file.h"#include "asterisk/channel.h"#include "asterisk/cel.h"#include "asterisk/pbx.h"#include "asterisk/app.h"#include "asterisk/module.h"#include "asterisk/translate.h"#include "asterisk/say.h"#include "asterisk/musiconhold.h"#include "asterisk/config.h"#include "asterisk/utils.h"#include "asterisk/cli.h"#include "asterisk/stringfields.h"#include "asterisk/linkedlists.h"#include "asterisk/stasis.h"#include "asterisk/stasis_channels.h"#include "asterisk/paths.h"#include "asterisk/astobj2.h"#include "asterisk/timing.h"#include "asterisk/time.h"#include "asterisk/poll-compat.h"
Go to the source code of this file.
| Data Structures | |
| struct | moh_files_state | 
| struct | mohclass | 
| struct | mohdata | 
| Macros | |
| #define | DONT_UNREF 0 | 
| #define | get_mohbyname(a, b, c) _get_mohbyname(a,b,c,__FILE__,__LINE__,__PRETTY_FUNCTION__) | 
| #define | HANDLE_REF 1 | 
| #define | INITIAL_NUM_FILES 8 | 
| #define | LOCAL_MPG_123 "/usr/local/bin/mpg123" | 
| #define | MAX_MP3S 256 | 
| #define | MOH_ANNOUNCEMENT (1 << 6) | 
| #define | MOH_CACHERTCLASSES (1 << 5) | 
| #define | moh_class_malloc() _moh_class_malloc(__FILE__,__LINE__,__PRETTY_FUNCTION__) | 
| #define | MOH_CUSTOM (1 << 2) | 
| #define | MOH_LOOPLAST (1 << 8) | 
| #define | MOH_MS_INTERVAL 100 | 
| #define | MOH_NOTDELETED (1 << 30) | 
| #define | MOH_PREFERCHANNELCLASS (1 << 7) | 
| #define | MOH_QUIET (1 << 0) | 
| #define | MOH_RANDOMIZE (1 << 3) | 
| #define | MOH_RANDSTART (MOH_RANDOMIZE | MOH_SORTALPHA) | 
| #define | MOH_REALTIME (1 << 31) | 
| #define | moh_register(moh, reload, unref) _moh_register(moh, reload, unref, __FILE__, __LINE__, __PRETTY_FUNCTION__) | 
| #define | MOH_SINGLE (1 << 1) | 
| #define | MOH_SORTALPHA (1 << 4) | 
| #define | MOH_SORTMODE (3 << 3) | 
| #define | moh_unregister(a) _moh_unregister(a,__FILE__,__LINE__,__PRETTY_FUNCTION__) | 
| #define | mohclass_ref(class, string) (ao2_t_ref((class), +1, (string)), class) | 
| #define | mohclass_unref(class, string) ({ ao2_t_ref((class), -1, (string)); (struct mohclass *) NULL; }) | 
| #define | MPG_123 "/usr/bin/mpg123" | 
| Enumerations | |
| enum | kill_methods { KILL_METHOD_PROCESS_GROUP = 0 , KILL_METHOD_PROCESS } | 
| Functions | |
| static void | __reg_module (void) | 
| static void | __unreg_module (void) | 
| static struct mohclass * | _get_mohbyname (const char *name, int warn, int flags, const char *file, int lineno, const char *funcname) | 
| static struct mohclass * | _moh_class_malloc (const char *file, int line, const char *funcname) | 
| static int | _moh_register (struct mohclass *moh, int reload, int unref, const char *file, int line, const char *funcname) | 
| static int | _moh_unregister (struct mohclass *moh, const char *file, int line, const char *funcname) | 
| struct ast_module * | AST_MODULE_SELF_SYM (void) | 
| static void | ast_moh_destroy (void) | 
| static char * | complete_mohclass_realtime (const char *line, const char *word, int pos, int state) | 
| Support routing for 'moh unregister class' CLI This is in charge of generating all strings that match a prefix in the given position. As many functions of this kind, each invokation has O(state) time complexity so be careful in using it. | |
| static struct mohclass * | get_mohbydigit (char digit) | 
| static char * | handle_cli_moh_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_moh_show_classes (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_moh_show_files (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_moh_unregister_class (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static int | init_app_class (struct mohclass *class) | 
| static int | init_files_class (struct mohclass *class) | 
| static int | killer (pid_t pid, int signum, enum kill_methods kill_method) | 
| static void | killpid (int pid, size_t delay, enum kill_methods kill_method) | 
| static int | load_module (void) | 
| Load the module. | |
| static int | load_moh_classes (int reload) | 
| static struct ast_variable * | load_realtime_musiconhold (const char *name) | 
| static void | local_ast_moh_cleanup (struct ast_channel *chan) | 
| static int | local_ast_moh_start (struct ast_channel *chan, const char *mclass, const char *interpclass) | 
| static void | local_ast_moh_stop (struct ast_channel *chan) | 
| static void * | moh_alloc (struct ast_channel *chan, void *params) | 
| static int | moh_class_cmp (void *obj, void *arg, int flags) | 
| static void | moh_class_destructor (void *obj) | 
| static int | moh_class_hash (const void *obj, const int flags) | 
| static int | moh_class_inuse (void *obj, void *arg, int flags) | 
| static int | moh_class_mark (void *obj, void *arg, int flags) | 
| static int | moh_classes_delete_marked (void *obj, void *arg, int flags) | 
| static int | moh_diff (struct mohclass *old, struct mohclass *new) | 
| static int | moh_digit_match (void *obj, void *arg, int flags) | 
| static struct ast_vector_string * | moh_file_vector_alloc (int initial_capacity) | 
| static void | moh_file_vector_destructor (void *obj) | 
| static int | moh_filename_strcasecmp (const void *a, const void *b) | 
| static void * | moh_files_alloc (struct ast_channel *chan, void *params) | 
| static int | moh_files_generator (struct ast_channel *chan, void *data, int len, int samples) | 
| static int | moh_files_next (struct ast_channel *chan) | 
| static struct ast_frame * | moh_files_readframe (struct ast_channel *chan) | 
| static void | moh_files_release (struct ast_channel *chan, void *data) | 
| static void | moh_files_write_format_change (struct ast_channel *chan, void *data) | 
| static int | moh_generate (struct ast_channel *chan, void *data, int len, int samples) | 
| static void | moh_handle_digit (struct ast_channel *chan, char digit) | 
| static void | moh_parse_options (struct ast_variable *var, struct mohclass *mohclass) | 
| static void | moh_post_start (struct ast_channel *chan, const char *moh_class_name) | 
| static void | moh_post_stop (struct ast_channel *chan) | 
| static void | moh_release (struct ast_channel *chan, void *data) | 
| static void | moh_rescan_files (void) | 
| static int | moh_scan_files (struct mohclass *class) | 
| static struct mohdata * | mohalloc (struct mohclass *cl) | 
| static void * | monmp3thread (void *data) | 
| static int | on_moh_file (const char *directory, const char *filename, void *obj) | 
| static int | play_moh_exec (struct ast_channel *chan, const char *data) | 
| static int | reload (void) | 
| static int | spawn_mp3 (struct mohclass *class) | 
| static int | start_moh_exec (struct ast_channel *chan, const char *data) | 
| static int | stop_moh_exec (struct ast_channel *chan, const char *data) | 
| static int | unload_module (void) | 
| Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Music On Hold Resource" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DEPEND, } | 
| static const struct ast_module_info * | ast_module_info = &__mod_info | 
| static struct ast_cli_entry | cli_moh [] | 
| static struct ast_flags | global_flags [1] = {{0}} | 
| static struct ast_generator | moh_file_stream | 
| static struct ao2_container * | mohclasses | 
| static struct ast_generator | mohgen | 
| static const char | play_moh [] = "MusicOnHold" | 
| static int | respawn_time = 20 | 
| static const char | start_moh [] = "StartMusicOnHold" | 
| static const char | stop_moh [] = "StopMusicOnHold" | 
Routines implementing music on hold.
Definition in file res_musiconhold.c.
| #define DONT_UNREF 0 | 
Definition at line 79 of file res_musiconhold.c.
Definition at line 998 of file res_musiconhold.c.
| #define HANDLE_REF 1 | 
Definition at line 78 of file res_musiconhold.c.
| #define INITIAL_NUM_FILES 8 | 
Definition at line 77 of file res_musiconhold.c.
| #define LOCAL_MPG_123 "/usr/local/bin/mpg123" | 
Definition at line 222 of file res_musiconhold.c.
| #define MAX_MP3S 256 | 
Definition at line 224 of file res_musiconhold.c.
| #define MOH_ANNOUNCEMENT (1 << 6) | 
Do we play announcement files between songs on this channel?
Definition at line 163 of file res_musiconhold.c.
| #define MOH_CACHERTCLASSES (1 << 5) | 
Should we use a separate instance of MOH for each user or not
Definition at line 162 of file res_musiconhold.c.
| #define moh_class_malloc | ( | ) | _moh_class_malloc(__FILE__,__LINE__,__PRETTY_FUNCTION__) | 
Definition at line 1660 of file res_musiconhold.c.
| #define MOH_CUSTOM (1 << 2) | 
Definition at line 156 of file res_musiconhold.c.
| #define MOH_LOOPLAST (1 << 8) | 
Whether to loop the last file in the music class when we reach the end, rather than starting over
Definition at line 166 of file res_musiconhold.c.
| #define MOH_MS_INTERVAL 100 | 
| #define MOH_NOTDELETED (1 << 30) | 
Find only records that aren't deleted?
Definition at line 169 of file res_musiconhold.c.
| #define MOH_PREFERCHANNELCLASS (1 << 7) | 
Should queue moh override channel moh
Definition at line 164 of file res_musiconhold.c.
| #define MOH_QUIET (1 << 0) | 
Definition at line 154 of file res_musiconhold.c.
| #define MOH_RANDOMIZE (1 << 3) | 
Definition at line 157 of file res_musiconhold.c.
| #define MOH_RANDSTART (MOH_RANDOMIZE | MOH_SORTALPHA) | 
Sorted but start at random position
Definition at line 159 of file res_musiconhold.c.
| #define MOH_REALTIME (1 << 31) | 
Find only records that are realtime
Definition at line 170 of file res_musiconhold.c.
| #define moh_register | ( | moh, | |
| reload, | |||
| unref | |||
| ) | _moh_register(moh, reload, unref, __FILE__, __LINE__, __PRETTY_FUNCTION__) | 
Definition at line 1481 of file res_musiconhold.c.
| #define MOH_SINGLE (1 << 1) | 
Definition at line 155 of file res_musiconhold.c.
| #define MOH_SORTALPHA (1 << 4) | 
Definition at line 158 of file res_musiconhold.c.
| #define MOH_SORTMODE (3 << 3) | 
Definition at line 160 of file res_musiconhold.c.
| #define moh_unregister | ( | a | ) | _moh_unregister(a,__FILE__,__LINE__,__PRETTY_FUNCTION__) | 
Definition at line 1549 of file res_musiconhold.c.
Definition at line 229 of file res_musiconhold.c.
| #define mohclass_unref | ( | class, | |
| string | |||
| ) | ({ ao2_t_ref((class), -1, (string)); (struct mohclass *) NULL; }) | 
Definition at line 232 of file res_musiconhold.c.
| #define MPG_123 "/usr/bin/mpg123" | 
Definition at line 223 of file res_musiconhold.c.
| enum kill_methods | 
| Enumerator | |
|---|---|
| KILL_METHOD_PROCESS_GROUP | |
| KILL_METHOD_PROCESS | |
Definition at line 174 of file res_musiconhold.c.
| 
 | static | 
Definition at line 2388 of file res_musiconhold.c.
| 
 | static | 
Definition at line 2388 of file res_musiconhold.c.
| 
 | static | 
Definition at line 1000 of file res_musiconhold.c.
References __ao2_find(), ast_copy_string(), ast_log, mohclass::flags, LOG_WARNING, mohclasses, name, NULL, and mohclass::start.
Referenced by _moh_register().
| 
 | static | 
Definition at line 1662 of file res_musiconhold.c.
References __ao2_alloc(), AO2_ALLOC_OPT_LOCK_MUTEX, ao2_bump, ao2_ref, ast_format_slin, mohclass::format, moh_class_destructor(), moh_file_vector_alloc(), and NULL.
| 
 | static | 
Definition at line 1482 of file res_musiconhold.c.
References _get_mohbyname(), ao2_lock, ao2_t_link, ao2_unlock, ast_log, AST_VECTOR_SIZE, mohclass::files, init_app_class(), init_files_class(), LOG_WARNING, mohclass::mode, moh_diff(), MOH_NOTDELETED, mohclass_unref, mohclasses, mohclass::name, NULL, respawn_time, and mohclass::start.
| 
 | static | 
Definition at line 1550 of file res_musiconhold.c.
References ao2_t_unlink, and mohclasses.
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) | 
Definition at line 2388 of file res_musiconhold.c.
| 
 | static | 
Definition at line 2156 of file res_musiconhold.c.
References ao2_ref, ao2_t_callback, ast_verb, mohclasses, NULL, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
Referenced by load_module(), and unload_module().
| 
 | static | 
Support routing for 'moh unregister class' CLI This is in charge of generating all strings that match a prefix in the given position. As many functions of this kind, each invokation has O(state) time complexity so be careful in using it.
Definition at line 1587 of file res_musiconhold.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_t_iterator_next, ast_strdup, c, mohclass_unref, mohclasses, mohclass::name, NULL, mohclass::realtime, and mohclass::start.
Referenced by handle_cli_moh_unregister_class().
| 
 | static | 
Definition at line 621 of file res_musiconhold.c.
References ao2_t_callback, digit, moh_digit_match(), and mohclasses.
Referenced by moh_handle_digit().
| 
 | static | 
Definition at line 2166 of file res_musiconhold.c.
References a, ast_cli_entry::args, ast_module_reload(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
| 
 | static | 
Definition at line 2232 of file res_musiconhold.c.
References a, ao2_iterator_destroy(), ao2_iterator_init(), ao2_t_iterator_next, ast_cli_entry::args, ast_cli(), ast_format_get_name(), ast_test_flag, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, KILL_METHOD_PROCESS, MOH_ANNOUNCEMENT, MOH_CUSTOM, mohclass_unref, mohclasses, test_val::name, NULL, S_OR, and ast_cli_entry::usage.
| 
 | static | 
Definition at line 2189 of file res_musiconhold.c.
References a, ao2_bump, ao2_iterator_destroy(), ao2_iterator_init(), ao2_lock, ao2_ref, ao2_t_iterator_next, ao2_unlock, ast_cli_entry::args, ast_cli(), AST_VECTOR_GET, AST_VECTOR_SIZE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, mohclass_unref, mohclasses, test_val::name, NULL, and ast_cli_entry::usage.
| 
 | static | 
Definition at line 1613 of file res_musiconhold.c.
References a, ao2_iterator_destroy(), ao2_iterator_init(), ao2_t_iterator_next, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_mohclass_realtime(), len(), moh_unregister, mohclass_unref, mohclasses, mohclass::name, NULL, mohclass::realtime, and ast_cli_entry::usage.
| 
 | static | 
Definition at line 1442 of file res_musiconhold.c.
References ast_log, ast_pthread_create_background, ast_set_flag, ast_timer_close(), ast_timer_open(), ast_timer_set_rate(), errno, LOG_WARNING, MOH_CUSTOM, MOH_QUIET, MOH_SINGLE, monmp3thread(), NULL, and mohclass::start.
Referenced by _moh_register().
| 
 | static | 
Definition at line 1388 of file res_musiconhold.c.
References ast_verb, and moh_scan_files().
Referenced by _moh_register().
| 
 | static | 
Definition at line 789 of file res_musiconhold.c.
References KILL_METHOD_PROCESS, and KILL_METHOD_PROCESS_GROUP.
Referenced by killpid().
| 
 | static | 
Definition at line 801 of file res_musiconhold.c.
References ast_debug, ast_log, errno, KILL_METHOD_PROCESS_GROUP, killer(), and LOG_WARNING.
Referenced by moh_class_destructor(), and monmp3thread().
| 
 | static | 
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 2307 of file res_musiconhold.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_t_container_alloc_hash, ARRAY_LEN, ast_check_realtime(), ast_cli_register_multiple, ast_install_music_functions(), ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_moh_destroy(), ast_register_application_xml, ast_register_atexit(), cli_moh, load_moh_classes(), local_ast_moh_cleanup(), local_ast_moh_start(), local_ast_moh_stop(), LOG_WARNING, moh_class_cmp(), moh_class_hash(), mohclasses, NULL, play_moh, play_moh_exec(), start_moh, start_moh_exec(), stop_moh, and stop_moh_exec().
| 
 | static | 
Definition at line 2062 of file res_musiconhold.c.
References ao2_t_callback, ast_category_browse(), ast_check_realtime(), ast_clear_flag, ast_config_destroy(), ast_config_load, ast_copy_string(), AST_FLAGS_ALL, ast_log, ast_set2_flag, ast_strlen_zero(), ast_true(), ast_variable_browse(), CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, CONFIG_STATUS_FILEUNCHANGED, global_flags, HANDLE_REF, LOG_WARNING, MOH_CACHERTCLASSES, moh_class_malloc, moh_class_mark(), moh_classes_delete_marked(), moh_parse_options(), MOH_PREFERCHANNELCLASS, MOH_REALTIME, moh_register, moh_rescan_files(), mohclass_unref, mohclasses, ast_variable::next, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, reload(), mohclass::start, and var.
Referenced by load_module(), and reload().
| 
 | static | 
Definition at line 1684 of file res_musiconhold.c.
References ast_category_browse(), ast_config_destroy(), ast_load_realtime(), ast_load_realtime_multientry(), ast_log, ast_strings_equal(), ast_variable_find_in_list(), ast_variable_list_append, ast_variable_new, ast_variable_retrieve(), ast_variables_destroy(), LOG_WARNING, name, NULL, SENTINEL, and var.
Referenced by local_ast_moh_start().
| 
 | static | 
Definition at line 1559 of file res_musiconhold.c.
References ao2_cleanup, ast_channel_lock, ast_channel_music_state(), ast_channel_music_state_set(), ast_channel_unlock, ast_free, ast_log, ast_module_unref, LOG_WARNING, mohclass_unref, NULL, and ast_module_info::self.
Referenced by load_module(), and reload().
| 
 | static | 
Definition at line 1731 of file res_musiconhold.c.
References mohclass::answeredonly, ao2_lock, ao2_unlock, mohclass::args, ARRAY_LEN, ast_activate_generator(), ast_channel_flags(), ast_channel_lock, ast_channel_music_state(), ast_channel_musicclass(), ast_channel_name(), ast_channel_unlock, ast_check_realtime(), AST_FLAG_MOH, ast_log, ast_pthread_create_background, ast_set_flag, AST_STATE_UP, ast_strlen_zero(), ast_test_flag, ast_timer_close(), ast_timer_open(), ast_timer_set_rate(), ast_variables_destroy(), AST_VECTOR_SIZE, ast_verb, mohclass::dir, DONT_UNREF, errno, mohclass::files, get_mohbyname, global_flags, load_realtime_musiconhold(), LOG_NOTICE, LOG_WARNING, mohclass::mode, MOH_CACHERTCLASSES, moh_class_malloc, MOH_CUSTOM, moh_file_stream, moh_parse_options(), MOH_PREFERCHANNELCLASS, MOH_QUIET, moh_register, moh_scan_files(), MOH_SINGLE, mohclass_ref, mohclass_unref, mohgen, monmp3thread(), mohclass::name, state::name, NULL, mohclass::realtime, respawn_time, mohclass::srcfd, mohclass::start, mohclass::thread, mohclass::timer, and var.
Referenced by load_module(), and reload().
| 
 | static | 
Definition at line 1968 of file res_musiconhold.c.
References ast_channel_flags(), ast_channel_lock, ast_channel_music_state(), ast_channel_stream(), ast_channel_stream_set(), ast_channel_unlock, ast_clear_flag, ast_closestream(), ast_deactivate_generator(), AST_FLAG_MOH, and NULL.
Referenced by load_module(), and reload().
| 
 | static | 
Definition at line 1088 of file res_musiconhold.c.
References ao2_bump, ao2_cleanup, ast_calloc, ast_channel_music_state(), ast_channel_music_state_set(), ast_channel_name(), ast_channel_writeformat(), ast_format_get_name(), ast_log, ast_module_ref, ast_set_write_format(), moh_files_state::class, mohclass::format, LOG_WARNING, moh_post_start(), moh_release(), mohalloc(), mohclass_ref, mohclass_unref, mohclass::name, NULL, mohdata::origwfmt, and ast_module_info::self.
| 
 | static | 
Definition at line 2288 of file res_musiconhold.c.
References CMP_MATCH, CMP_STOP, and MOH_NOTDELETED.
Referenced by load_module().
| 
 | static | 
Definition at line 1983 of file res_musiconhold.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_debug, ast_free, AST_LIST_REMOVE_HEAD, AST_PTHREADT_NULL, ast_timer_close(), ast_wait_for_input(), buff, killpid(), mohdata::list, and NULL.
Referenced by _moh_class_malloc().
| 
 | static | 
Definition at line 2281 of file res_musiconhold.c.
References ast_str_case_hash().
Referenced by load_module().
| 
 | static | 
Definition at line 2346 of file res_musiconhold.c.
References AST_LIST_EMPTY, CMP_MATCH, and CMP_STOP.
Referenced by unload_module().
| 
 | static | 
Definition at line 2044 of file res_musiconhold.c.
References mohclass::delete, and MOH_REALTIME.
Referenced by load_moh_classes().
| 
 | static | 
Definition at line 2055 of file res_musiconhold.c.
References CMP_MATCH, and mohclass::delete.
Referenced by load_moh_classes().
Definition at line 1423 of file res_musiconhold.c.
References mohclass::args, mohclass::dir, mohclass::flags, mohclass::mode, and mohclass::start.
Referenced by _moh_register().
| 
 | static | 
| 
 | static | 
Definition at line 1169 of file res_musiconhold.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, AST_VECTOR_INIT, and moh_file_vector_destructor().
Referenced by _moh_class_malloc(), moh_parse_options(), and moh_scan_files().
| 
 | static | 
Definition at line 1162 of file res_musiconhold.c.
References ast_free, AST_VECTOR_FREE, and AST_VECTOR_RESET.
Referenced by moh_file_vector_alloc().
| 
 | static | 
Definition at line 1343 of file res_musiconhold.c.
Referenced by moh_scan_files().
| 
 | static | 
Definition at line 564 of file res_musiconhold.c.
References ao2_cleanup, ao2_lock, ao2_replace, ao2_unlock, ast_calloc, ast_channel_music_state(), ast_channel_music_state_set(), ast_channel_writeformat(), ast_copy_string(), ast_log, ast_module_ref, ast_random(), ast_test_flag, AST_VECTOR_SIZE, LOG_WARNING, moh_post_start(), MOH_RANDOMIZE, mohclass_ref, mohclass_unref, state::name, NULL, and ast_module_info::self.
| 
 | static | 
Definition at line 507 of file res_musiconhold.c.
References ao2_replace, ast_channel_lock, ast_channel_music_state(), ast_channel_name(), ast_channel_unlock, ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_frfree, ast_log, ast_write(), errno, ast_frame_subclass::format, LOG_WARNING, moh_files_readframe(), NULL, ast_frame::samples, and ast_frame::subclass.
| 
 | static | 
Definition at line 353 of file res_musiconhold.c.
References ao2_bump, ao2_lock, ao2_ref, ao2_unlock, ast_channel_language(), ast_channel_music_state(), ast_channel_name(), ast_channel_stream(), ast_channel_stream_set(), ast_closestream(), ast_copy_string(), ast_debug, ast_fileexists(), ast_log, ast_openstream_full(), ast_random(), ast_seekstream(), ast_strlen_zero(), ast_tellstream(), ast_test_flag, AST_VECTOR_GET, AST_VECTOR_SIZE, errno, LOG_WARNING, MIN, MOH_ANNOUNCEMENT, MOH_LOOPLAST, MOH_RANDOMIZE, MOH_SORTMODE, state::name, and NULL.
Referenced by moh_files_readframe().
| 
 | static | 
Definition at line 456 of file res_musiconhold.c.
References ast_channel_stream(), ast_readframe(), and moh_files_next().
Referenced by moh_files_generator().
| 
 | static | 
Definition at line 318 of file res_musiconhold.c.
References ao2_cleanup, ao2_ref, ast_channel_music_state(), ast_channel_name(), ast_channel_stream(), ast_channel_stream_set(), ast_closestream(), ast_format_get_name(), ast_log, ast_set_write_format(), LOG_WARNING, moh_post_stop(), mohclass_unref, and NULL.
| 
 | static | 
Definition at line 488 of file res_musiconhold.c.
References ao2_bump, ao2_replace, ast_channel_music_state(), ast_channel_writeformat(), ast_set_write_format(), and NULL.
| 
 | static | 
Definition at line 1127 of file res_musiconhold.c.
References ast_channel_name(), ast_codec_samples_count(), ast_format_determine_length(), AST_FRIENDLY_OFFSET, ast_log, ast_write(), buf, ast_frame::data, ast_frame::datalen, errno, mohdata::f, mohclass::format, len(), LOG_WARNING, mohdata::parent, mohdata::pipe, ast_frame::ptr, and ast_frame::samples.
| 
 | static | 
Definition at line 626 of file res_musiconhold.c.
References ast_moh_start(), ast_moh_stop(), ast_strdupa, digit, get_mohbydigit(), mohclass_unref, NULL, and mohclass::start.
| 
 | static | 
Definition at line 1181 of file res_musiconhold.c.
References mohclass::announcement, mohclass::answeredonly, ao2_bump, ao2_cleanup, ao2_ref, mohclass::args, ast_begins_with(), ast_clear_flag, ast_copy_string(), ast_format_cache_get, ast_format_slin, ast_log, ast_set_flag, ast_strdup, ast_strlen_zero(), ast_true(), AST_VECTOR_APPEND, AST_VECTOR_COMPACT, mohclass::digit, mohclass::dir, mohclass::files, mohclass::format, mohclass::kill_delay, mohclass::kill_method, KILL_METHOD_PROCESS, KILL_METHOD_PROCESS_GROUP, LOG_ERROR, LOG_NOTICE, LOG_WARNING, mohclass::mode, MOH_ANNOUNCEMENT, moh_file_vector_alloc(), MOH_LOOPLAST, MOH_RANDOMIZE, MOH_RANDSTART, MOH_SORTALPHA, mohclass::name, NULL, and var.
Referenced by load_moh_classes(), and local_ast_moh_start().
| 
 | static | 
Definition at line 253 of file res_musiconhold.c.
References ao2_cleanup, ast_assert, ast_cel_publish_event(), AST_CEL_STREAM_BEGIN, ast_channel_blob_create_from_cache(), ast_channel_moh_start_type(), ast_channel_name(), ast_channel_topic(), ast_channel_uniqueid(), ast_json_pack(), ast_json_unref(), ast_log, ast_verb, LOG_WARNING, NULL, stasis_message_data(), and stasis_publish().
Referenced by moh_alloc(), and moh_files_alloc().
| 
 | static | 
Definition at line 291 of file res_musiconhold.c.
References ao2_cleanup, ast_assert, ast_cel_publish_event(), AST_CEL_STREAM_END, ast_channel_blob_create_from_cache(), ast_channel_moh_stop_type(), ast_channel_name(), ast_channel_topic(), ast_channel_uniqueid(), ast_json_pack(), ast_json_unref(), ast_verb, NULL, stasis_message_data(), and stasis_publish().
Referenced by moh_files_release(), and moh_release().
| 
 | static | 
Definition at line 1048 of file res_musiconhold.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_channel_music_state(), ast_channel_name(), ast_format_get_name(), ast_free, AST_LIST_REMOVE, ast_log, ast_set_write_format(), LOG_WARNING, mohclass::members, moh_post_stop(), mohclass_unref, mohdata::origwfmt, mohdata::parent, and mohdata::pipe.
Referenced by moh_alloc().
| 
 | static | 
Definition at line 1407 of file res_musiconhold.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, c, moh_scan_files(), mohclasses, and mohclass::start.
Referenced by load_moh_classes().
| 
 | static | 
Definition at line 1350 of file res_musiconhold.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_config_AST_DATA_DIR, ast_copy_string(), ast_debug, ast_file_read_dir, ast_test_flag, AST_VECTOR_COMPACT, AST_VECTOR_SIZE, AST_VECTOR_SORT, moh_file_vector_alloc(), moh_filename_strcasecmp(), MOH_SORTALPHA, on_moh_file(), and PATH_MAX.
Referenced by init_files_class(), local_ast_moh_start(), and moh_rescan_files().
Definition at line 1019 of file res_musiconhold.c.
References ao2_lock, ao2_unlock, ast_calloc, AST_FRAME_VOICE, ast_free, AST_FRIENDLY_OFFSET, AST_LIST_INSERT_HEAD, ast_log, ast_pipe_nonblock, errno, mohdata::f, ast_frame_subclass::format, mohclass::format, ast_frame::frametype, mohdata::list, LOG_WARNING, mohclass::members, mohclass_ref, NULL, ast_frame::offset, mohdata::parent, mohdata::pipe, and ast_frame::subclass.
Referenced by moh_alloc().
| 
 | static | 
Definition at line 834 of file res_musiconhold.c.
References ao2_lock, ao2_unlock, ast_debug, ast_format_determine_length(), ast_format_get_sample_rate(), AST_LIST_EMPTY, AST_LIST_TRAVERSE, ast_log, ast_poll, ast_samp2tv(), ast_timer_ack(), ast_timer_fd(), ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), errno, killpid(), len(), LOG_ERROR, LOG_NOTICE, LOG_WARNING, MOH_MS_INTERVAL, NULL, mohdata::pipe, and spawn_mp3().
Referenced by init_app_class(), and local_ast_moh_start().
| 
 | static | 
Definition at line 1288 of file res_musiconhold.c.
References ast_asprintf, ast_debug, ast_free, AST_VECTOR_APPEND, and AST_VECTOR_GET_CMP.
Referenced by moh_scan_files().
| 
 | static | 
Definition at line 932 of file res_musiconhold.c.
References args, AST_APP_ARG, ast_channel_name(), AST_DECLARE_APP_ARGS, ast_log, ast_moh_start(), ast_moh_stop(), ast_safe_sleep(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), LOG_WARNING, NULL, and S_OR.
Referenced by load_module().
| 
 | static | 
Definition at line 2336 of file res_musiconhold.c.
References ast_install_music_functions(), AST_MODULE_LOAD_SUCCESS, load_moh_classes(), local_ast_moh_cleanup(), local_ast_moh_start(), and local_ast_moh_stop().
Referenced by load_moh_classes().
| 
 | static | 
Definition at line 648 of file res_musiconhold.c.
References ast_close_fds_above_n(), ast_copy_string(), ast_log, ast_opt_high_priority, ast_safe_fork(), ast_set_priority(), ast_strlen_zero(), ast_test_flag, errno, LOCAL_MPG_123, LOG_WARNING, MAX_MP3S, MOH_CUSTOM, MOH_QUIET, MOH_SINGLE, MPG_123, NULL, respawn_time, and strsep().
Referenced by monmp3thread().
| 
 | static | 
Definition at line 972 of file res_musiconhold.c.
References args, AST_APP_ARG, ast_channel_name(), AST_DECLARE_APP_ARGS, ast_log, ast_moh_start(), AST_STANDARD_APP_ARGS, ast_strdupa, LOG_WARNING, NULL, and S_OR.
Referenced by load_module().
| 
 | static | 
Definition at line 991 of file res_musiconhold.c.
References ast_moh_stop().
Referenced by load_module().
| 
 | static | 
Definition at line 2353 of file res_musiconhold.c.
References ao2_t_callback, ARRAY_LEN, ast_cli_unregister_multiple(), ast_log, ast_moh_destroy(), ast_uninstall_music_functions(), ast_unregister_application(), ast_unregister_atexit(), cli_moh, LOG_WARNING, moh_class_inuse(), mohclass_unref, mohclasses, NULL, play_moh, start_moh, and stop_moh.
| 
 | static | 
Definition at line 2388 of file res_musiconhold.c.
| 
 | static | 
Definition at line 2388 of file res_musiconhold.c.
| 
 | static | 
Definition at line 2274 of file res_musiconhold.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
global MOH_ flags
Definition at line 172 of file res_musiconhold.c.
Referenced by load_moh_classes(), and local_ast_moh_start().
| 
 | static | 
Definition at line 640 of file res_musiconhold.c.
Referenced by local_ast_moh_start().
| 
 | static | 
Definition at line 220 of file res_musiconhold.c.
Referenced by _get_mohbyname(), _moh_register(), _moh_unregister(), ast_moh_destroy(), complete_mohclass_realtime(), get_mohbydigit(), handle_cli_moh_show_classes(), handle_cli_moh_show_files(), handle_cli_moh_unregister_class(), load_module(), load_moh_classes(), moh_rescan_files(), and unload_module().
| 
 | static | 
Definition at line 1155 of file res_musiconhold.c.
Referenced by local_ast_moh_start().
| 
 | static | 
Definition at line 133 of file res_musiconhold.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
Definition at line 137 of file res_musiconhold.c.
Referenced by _moh_register(), local_ast_moh_start(), and spawn_mp3().
| 
 | static | 
Definition at line 134 of file res_musiconhold.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
Definition at line 135 of file res_musiconhold.c.
Referenced by load_module(), and unload_module().