| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
Audiohooks Architecture. More...
#include "asterisk.h"#include <signal.h>#include "asterisk/channel.h"#include "asterisk/utils.h"#include "asterisk/lock.h"#include "asterisk/audiohook.h"#include "asterisk/slinfactory.h"#include "asterisk/frame.h"#include "asterisk/translate.h"#include "asterisk/format_cache.h"#include "asterisk/test.h"
Go to the source code of this file.
| Data Structures | |
| struct | ast_audiohook_list | 
| struct | ast_audiohook_translate | 
| struct | audiohook_volume | 
| Audiohook volume adjustment structure.  More... | |
| Macros | |
| #define | AST_AUDIOHOOK_LONG_QUEUE_TOLERANCE 500 | 
| #define | AST_AUDIOHOOK_SMALL_QUEUE_TOLERANCE 100 | 
| #define | AST_AUDIOHOOK_SYNC_TOLERANCE 100 | 
| #define | DEFAULT_INTERNAL_SAMPLE_RATE 8000 | 
| #define | SHOULD_MUTE(hook, dir) | 
| Functions | |
| int | ast_audiohook_attach (struct ast_channel *chan, struct ast_audiohook *audiohook) | 
| Attach audiohook to channel. | |
| int | ast_audiohook_destroy (struct ast_audiohook *audiohook) | 
| Destroys an audiohook structure. | |
| int | ast_audiohook_detach (struct ast_audiohook *audiohook) | 
| Detach audiohook from channel. | |
| void | ast_audiohook_detach_list (struct ast_audiohook_list *audiohook_list) | 
| Detach audiohooks from list and destroy said list. | |
| int | ast_audiohook_detach_source (struct ast_channel *chan, const char *source) | 
| Detach specified source audiohook from channel. | |
| int | ast_audiohook_init (struct ast_audiohook *audiohook, enum ast_audiohook_type type, const char *source, enum ast_audiohook_init_flags init_flags) | 
| Initialize an audiohook structure. | |
| void | ast_audiohook_move_all (struct ast_channel *old_chan, struct ast_channel *new_chan) | 
| Move all audiohooks from one channel to another. | |
| void | ast_audiohook_move_by_source (struct ast_channel *old_chan, struct ast_channel *new_chan, const char *source) | 
| Move an audiohook from one channel to a new one. | |
| struct ast_frame * | ast_audiohook_read_frame (struct ast_audiohook *audiohook, size_t samples, enum ast_audiohook_direction direction, struct ast_format *format) | 
| Reads a frame in from the audiohook structure. | |
| struct ast_frame * | ast_audiohook_read_frame_all (struct ast_audiohook *audiohook, size_t samples, struct ast_format *format, struct ast_frame **read_frame, struct ast_frame **write_frame) | 
| Reads a frame in from the audiohook structure in mixed audio mode and copies read and write frame data to provided arguments. | |
| int | ast_audiohook_remove (struct ast_channel *chan, struct ast_audiohook *audiohook) | 
| Remove an audiohook from a specified channel. | |
| int | ast_audiohook_set_frame_feed_direction (struct ast_audiohook *audiohook, enum ast_audiohook_direction direction) | 
| Sets direction on audiohook. | |
| int | ast_audiohook_set_mute (struct ast_channel *chan, const char *source, enum ast_audiohook_flags flag, int clear) | 
| Mute frames read from or written to a channel. | |
| int | ast_audiohook_set_mute_all (struct ast_channel *chan, const char *source, enum ast_audiohook_flags flag, int clearmute) | 
| Mute frames read from or written for all audiohooks on a channel. | |
| void | ast_audiohook_trigger_wait (struct ast_audiohook *audiohook) | 
| Wait for audiohook trigger to be triggered. | |
| void | ast_audiohook_update_status (struct ast_audiohook *audiohook, enum ast_audiohook_status status) | 
| Update audiohook's status. | |
| int | ast_audiohook_volume_adjust (struct ast_channel *chan, enum ast_audiohook_direction direction, int volume) | 
| Adjust the volume on frames read from or written to a channel. | |
| int | ast_audiohook_volume_adjust_float (struct ast_channel *chan, enum ast_audiohook_direction direction, float volume) | 
| Adjust the volume on frames read from or written to a channel. | |
| int | ast_audiohook_volume_get (struct ast_channel *chan, enum ast_audiohook_direction direction) | 
| Retrieve the volume adjustment value on frames read from or written to a channel. | |
| float | ast_audiohook_volume_get_float (struct ast_channel *chan, enum ast_audiohook_direction direction) | 
| Retrieve the volume adjustment value on frames read from or written to a channel. | |
| int | ast_audiohook_volume_set (struct ast_channel *chan, enum ast_audiohook_direction direction, int volume) | 
| Adjust the volume on frames read from or written to a channel. | |
| int | ast_audiohook_volume_set_float (struct ast_channel *chan, enum ast_audiohook_direction direction, float volume) | 
| Adjust the volume on frames read from or written to a channel. | |
| int | ast_audiohook_write_frame (struct ast_audiohook *audiohook, enum ast_audiohook_direction direction, struct ast_frame *frame) | 
| Writes a frame into the audiohook structure. | |
| struct ast_frame * | ast_audiohook_write_list (struct ast_channel *chan, struct ast_audiohook_list *audiohook_list, enum ast_audiohook_direction direction, struct ast_frame *frame) | 
| Pass a frame off to be handled by the audiohook core. | |
| int | ast_audiohook_write_list_empty (struct ast_audiohook_list *audiohook_list) | 
| Determine if a audiohook_list is empty or not. | |
| int | ast_channel_audiohook_count_by_source (struct ast_channel *chan, const char *source, enum ast_audiohook_type type) | 
| Find out how many audiohooks from a certain source exist on a given channel, regardless of status. | |
| int | ast_channel_audiohook_count_by_source_running (struct ast_channel *chan, const char *source, enum ast_audiohook_type type) | 
| Find out how many spies of a certain type exist on a given channel, and are in state running. | |
| static struct ast_frame * | audio_audiohook_write_list (struct ast_channel *chan, struct ast_audiohook_list *audiohook_list, enum ast_audiohook_direction direction, struct ast_frame *frame) | 
| Pass an AUDIO frame off to be handled by the audiohook core. | |
| static void | audiohook_list_set_hook_rate (struct ast_audiohook_list *audiohook_list, struct ast_audiohook *audiohook, int *rate) | 
| Set the audiohook's internal sample rate to the audiohook_list's rate, but only when native slin compatibility is turned on. | |
| static void | audiohook_list_set_samplerate_compatibility (struct ast_audiohook_list *audiohook_list) | 
| static struct ast_frame * | audiohook_list_translate_to_native (struct ast_audiohook_list *audiohook_list, enum ast_audiohook_direction direction, struct ast_frame *slin_frame, struct ast_format *outformat) | 
| static struct ast_frame * | audiohook_list_translate_to_slin (struct ast_audiohook_list *audiohook_list, enum ast_audiohook_direction direction, struct ast_frame *frame) | 
| static void | audiohook_move (struct ast_channel *old_chan, struct ast_channel *new_chan, struct ast_audiohook *audiohook) | 
| static struct ast_frame * | audiohook_read_frame_both (struct ast_audiohook *audiohook, size_t samples, struct ast_frame **read_reference, struct ast_frame **write_reference) | 
| static struct ast_frame * | audiohook_read_frame_helper (struct ast_audiohook *audiohook, size_t samples, enum ast_audiohook_direction direction, struct ast_format *format, struct ast_frame **read_reference, struct ast_frame **write_reference) | 
| static struct ast_frame * | audiohook_read_frame_single (struct ast_audiohook *audiohook, size_t samples, enum ast_audiohook_direction direction) | 
| static int | audiohook_set_internal_rate (struct ast_audiohook *audiohook, int rate, int reset) | 
| static int | audiohook_volume_callback (struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction) | 
| Helper function which actually gets called by audiohooks to perform the adjustment. | |
| static void | audiohook_volume_destroy (void *data) | 
| Callback used to destroy the audiohook volume datastore. | |
| static struct audiohook_volume * | audiohook_volume_get (struct ast_channel *chan, int create) | 
| Helper function which finds and optionally creates an audiohook_volume_datastore datastore on a channel. | |
| static struct ast_frame * | dtmf_audiohook_write_list (struct ast_channel *chan, struct ast_audiohook_list *audiohook_list, enum ast_audiohook_direction direction, struct ast_frame *frame) | 
| Pass a DTMF frame off to be handled by the audiohook core. | |
| static struct ast_audiohook * | find_audiohook_by_source (struct ast_audiohook_list *audiohook_list, const char *source) | 
| find an audiohook based on its source | |
| Variables | |
| static const struct ast_datastore_info | audiohook_volume_datastore | 
| Datastore used to store audiohook volume information. | |
Audiohooks Architecture.
Definition in file audiohook.c.
| #define AST_AUDIOHOOK_LONG_QUEUE_TOLERANCE 500 | 
Otheriwise we still don't want the queue to grow indefinitely
Definition at line 46 of file audiohook.c.
| #define AST_AUDIOHOOK_SMALL_QUEUE_TOLERANCE 100 | 
When small queue is enabled, this is the maximum amount of audio that can remain queued at a time.
Definition at line 45 of file audiohook.c.
| #define AST_AUDIOHOOK_SYNC_TOLERANCE 100 | 
Tolerance in milliseconds for audiohooks synchronization
Definition at line 44 of file audiohook.c.
| #define DEFAULT_INTERNAL_SAMPLE_RATE 8000 | 
Definition at line 48 of file audiohook.c.
| #define SHOULD_MUTE | ( | hook, | |
| dir | |||
| ) | 
Definition at line 162 of file audiohook.c.
| int ast_audiohook_attach | ( | struct ast_channel * | chan, | 
| struct ast_audiohook * | audiohook | ||
| ) | 
Attach audiohook to channel.
| chan | |
| audiohook | 
| -1 | on failure | 
Definition at line 521 of file audiohook.c.
References AST_AUDIOHOOK_STATUS_RUNNING, AST_AUDIOHOOK_TYPE_MANIPULATE, AST_AUDIOHOOK_TYPE_SPY, AST_AUDIOHOOK_TYPE_WHISPER, ast_audiohook_update_status(), ast_calloc, ast_channel_audiohooks(), ast_channel_audiohooks_set(), ast_channel_flags(), ast_channel_is_bridged(), ast_channel_lock, ast_channel_set_unbridged_nolock(), ast_channel_unlock, AST_FLAG_ZOMBIE, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, ast_test_flag, audiohook_list_set_samplerate_compatibility(), audiohook_set_internal_rate(), DEFAULT_INTERNAL_SAMPLE_RATE, ast_audiohook_list::list_internal_samp_rate, ast_audiohook_list::manipulate_list, ast_audiohook_list::spy_list, ast_audiohook::type, and ast_audiohook_list::whisper_list.
Referenced by audiohook_move(), audiohook_volume_get(), detect_write(), enable_jack_hook(), init_hook(), pitchshift_helper(), scramble_write(), set_talk_detect(), snoop_setup_audiohook(), speex_write(), start_spying(), start_spying(), start_whispering(), start_whispering(), startmon(), and volume_write().
| int ast_audiohook_destroy | ( | struct ast_audiohook * | audiohook | ) | 
Destroys an audiohook structure.
| audiohook | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 124 of file audiohook.c.
References ao2_cleanup, AST_AUDIOHOOK_TYPE_SPY, AST_AUDIOHOOK_TYPE_WHISPER, ast_cond_destroy, ast_mutex_destroy, ast_slinfactory_destroy(), ast_translator_free_path(), ast_audiohook::format, ast_audiohook::lock, ast_audiohook::read_factory, ast_audiohook::trans_pvt, ast_audiohook::trigger, ast_audiohook::type, and ast_audiohook::write_factory.
Referenced by audiohook_volume_destroy(), channel_spy(), datastore_destroy_cb(), destroy_callback(), destroy_callback(), destroy_callback(), destroy_callback(), destroy_callback(), destroy_jack_data(), destroy_monitor_audiohook(), hook_datastore_destroy_callback(), launch_monitor_thread(), multi_autochan_free(), and snoop_destroy().
| int ast_audiohook_detach | ( | struct ast_audiohook * | audiohook | ) | 
Detach audiohook from channel.
| audiohook | 
Definition at line 587 of file audiohook.c.
References AST_AUDIOHOOK_STATUS_DONE, AST_AUDIOHOOK_STATUS_NEW, AST_AUDIOHOOK_STATUS_SHUTDOWN, ast_audiohook_trigger_wait(), ast_audiohook_update_status(), and ast_audiohook::status.
Referenced by channel_spy(), destroy_callback(), destroy_callback(), destroy_callback(), destroy_monitor_audiohook(), disable_jack_hook(), hook_datastore_destroy_callback(), multi_autochan_free(), snoop_hangup(), and speex_write().
| void ast_audiohook_detach_list | ( | struct ast_audiohook_list * | audiohook_list | ) | 
Detach audiohooks from list and destroy said list.
| audiohook_list | List of audiohooks (NULL tolerant) | 
Definition at line 602 of file audiohook.c.
References ao2_cleanup, AST_AUDIOHOOK_STATUS_DONE, ast_audiohook_update_status(), ast_free, AST_LIST_REMOVE_HEAD, ast_translator_free_path(), ast_audiohook_translate::format, ast_audiohook_list::in_translate, ast_audiohook::list, ast_audiohook::manipulate_callback, ast_audiohook_list::manipulate_list, NULL, ast_audiohook_list::out_translate, ast_audiohook_list::spy_list, ast_audiohook_translate::trans_pvt, and ast_audiohook_list::whisper_list.
Referenced by __ast_read(), ast_write_stream(), and destroy_hooks().
| int ast_audiohook_detach_source | ( | struct ast_channel * | chan, | 
| const char * | source | ||
| ) | 
Detach specified source audiohook from channel.
| chan | Channel to detach from | 
| source | Name of source to detach | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 735 of file audiohook.c.
References AST_AUDIOHOOK_STATUS_DONE, AST_AUDIOHOOK_STATUS_SHUTDOWN, ast_audiohook_update_status(), ast_channel_audiohooks(), ast_channel_lock, ast_channel_unlock, find_audiohook_by_source(), NULL, ast_audiohook::source, and ast_audiohook::status.
| int ast_audiohook_init | ( | struct ast_audiohook * | audiohook, | 
| enum ast_audiohook_type | type, | ||
| const char * | source, | ||
| enum ast_audiohook_init_flags | flags | ||
| ) | 
Initialize an audiohook structure.
| audiohook | |
| type | Type of audiohook to initialize this as | 
| source | Who is initializing this audiohook | 
| flags | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 100 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_BOTH, AST_AUDIOHOOK_STATUS_NEW, ast_audiohook_update_status(), ast_cond_init, ast_mutex_init, audiohook_set_internal_rate(), DEFAULT_INTERNAL_SAMPLE_RATE, ast_audiohook::direction, ast_audiohook::init_flags, ast_audiohook::lock, NULL, ast_audiohook::source, ast_audiohook::trigger, type, and ast_audiohook::type.
Referenced by attach_barge(), attach_barge(), audiohook_volume_get(), channel_spy(), detect_write(), do_broadcast(), enable_jack_hook(), hook_state_alloc(), launch_monitor_thread(), pitchshift_helper(), scramble_write(), set_talk_detect(), snoop_setup_audiohook(), speex_write(), and volume_write().
| void ast_audiohook_move_all | ( | struct ast_channel * | old_chan, | 
| struct ast_channel * | new_chan | ||
| ) | 
Move all audiohooks from one channel to another.
| old_chan | The source of the audiohooks being moved | 
| new_chan | The destination channel for the audiohooks to be moved to | 
Definition at line 709 of file audiohook.c.
References ast_channel_audiohooks(), AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, audiohook_move(), ast_audiohook_list::manipulate_list, ast_audiohook_list::spy_list, and ast_audiohook_list::whisper_list.
Referenced by channel_do_masquerade().
| void ast_audiohook_move_by_source | ( | struct ast_channel * | old_chan, | 
| struct ast_channel * | new_chan, | ||
| const char * | source | ||
| ) | 
Move an audiohook from one channel to a new one.
| old_chan | The source of the audiohook to move | 
| new_chan | The destination to which we want the audiohook to move | 
| source | The source of the audiohook we want to move | 
Definition at line 693 of file audiohook.c.
References ast_channel_audiohooks(), audiohook_move(), find_audiohook_by_source(), and ast_audiohook::source.
| struct ast_frame * ast_audiohook_read_frame | ( | struct ast_audiohook * | audiohook, | 
| size_t | samples, | ||
| enum ast_audiohook_direction | direction, | ||
| struct ast_format * | format | ||
| ) | 
Reads a frame in from the audiohook structure.
| audiohook | |
| samples | Number of samples wanted | 
| direction | Direction the audio frame came from | 
| format | Format of frame remote side wants back | 
| NULL | on failure | 
Definition at line 483 of file audiohook.c.
References audiohook_read_frame_helper(), NULL, and ast_frame::samples.
Referenced by snoop_read(), spy_generate(), and spy_generate().
| struct ast_frame * ast_audiohook_read_frame_all | ( | struct ast_audiohook * | audiohook, | 
| size_t | samples, | ||
| struct ast_format * | format, | ||
| struct ast_frame ** | read_frame, | ||
| struct ast_frame ** | write_frame | ||
| ) | 
Reads a frame in from the audiohook structure in mixed audio mode and copies read and write frame data to provided arguments.
| audiohook | |
| samples | Number of samples wanted | 
| format | Format of frame remote side wants back | 
| read_frame | if available, we'll copy the read buffer to this. | 
| write_frame | if available, we'll copy the write buffer to this. | 
| NULL | on failure | 
Definition at line 488 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_BOTH, audiohook_read_frame_helper(), read_frame(), and ast_frame::samples.
Referenced by mixmonitor_thread(), and spy_generate().
| int ast_audiohook_remove | ( | struct ast_channel * | chan, | 
| struct ast_audiohook * | audiohook | ||
| ) | 
Remove an audiohook from a specified channel.
| chan | Channel to remove from | 
| audiohook | Audiohook to remove | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 758 of file audiohook.c.
References AST_AUDIOHOOK_STATUS_DONE, AST_AUDIOHOOK_TYPE_MANIPULATE, AST_AUDIOHOOK_TYPE_SPY, AST_AUDIOHOOK_TYPE_WHISPER, ast_audiohook_update_status(), ast_channel_audiohooks(), ast_channel_is_bridged(), ast_channel_lock, ast_channel_set_unbridged_nolock(), ast_channel_unlock, AST_LIST_REMOVE, audiohook_list_set_samplerate_compatibility(), ast_audiohook::list, and ast_audiohook::type.
Referenced by audiohook_move(), remove_detect(), remove_scrambler(), remove_talk_detect(), and speex_write().
| int ast_audiohook_set_frame_feed_direction | ( | struct ast_audiohook * | audiohook, | 
| enum ast_audiohook_direction | direction | ||
| ) | 
Sets direction on audiohook.
| audiohook | |
| direction | In which direction should the audiohook feed frames, ie if we are snooping 'in', set direction to READ so that only the 'in' frames are fed to the slin factory | 
| 0 | on success | 
| -1 | on failure due to audiohook already in use or in shutdown. Can only set direction on NEW audiohooks | 
Definition at line 150 of file audiohook.c.
References AST_AUDIOHOOK_STATUS_NEW, ast_debug, ast_audiohook::direction, and ast_audiohook::status.
Referenced by snoop_setup_audiohook(), start_spying(), and start_spying().
| int ast_audiohook_set_mute | ( | struct ast_channel * | chan, | 
| const char * | source, | ||
| enum ast_audiohook_flags | flag, | ||
| int | clear | ||
| ) | 
Mute frames read from or written to a channel.
| chan | Channel to muck with | 
| source | Type of audiohook | 
| flag | which direction to set / clear | 
| clear | set or clear muted frames on direction based on flag parameter | 
| 0 | success | 
| -1 | failure | 
Definition at line 1405 of file audiohook.c.
References ast_channel_audiohooks(), ast_channel_lock, ast_channel_unlock, ast_clear_flag, ast_set_flag, find_audiohook_by_source(), NULL, and ast_audiohook::source.
| int ast_audiohook_set_mute_all | ( | struct ast_channel * | chan, | 
| const char * | source, | ||
| enum ast_audiohook_flags | flag, | ||
| int | clear | ||
| ) | 
Mute frames read from or written for all audiohooks on a channel.
| chan | Channel to muck with | 
| source | Type of audiohooks | 
| flag | which direction to set / clear | 
| clear | set or clear muted frames on direction based on flag parameter | 
| >=0 | number of muted audiohooks | 
| -1 | failure | 
Definition at line 1432 of file audiohook.c.
References ast_channel_audiohooks(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_clear_flag, AST_LIST_TRAVERSE, ast_set_flag, ast_test_suite_event_notify, ast_audiohook::list, NULL, and ast_audiohook::source.
Referenced by manager_mute_mixmonitor().
| void ast_audiohook_trigger_wait | ( | struct ast_audiohook * | audiohook | ) | 
Wait for audiohook trigger to be triggered.
| audiohook | Audiohook to wait on | 
Definition at line 1131 of file audiohook.c.
References ast_cond_timedwait, ast_samp2tv(), ast_tvadd(), ast_tvnow(), ast_audiohook::lock, and ast_audiohook::trigger.
Referenced by ast_audiohook_detach(), and mixmonitor_thread().
| void ast_audiohook_update_status | ( | struct ast_audiohook * | audiohook, | 
| enum ast_audiohook_status | status | ||
| ) | 
Update audiohook's status.
| audiohook | |
| status | 
Definition at line 577 of file audiohook.c.
References ast_audiohook_lock, AST_AUDIOHOOK_STATUS_DONE, ast_audiohook_unlock, ast_cond_signal, status, ast_audiohook::status, and ast_audiohook::trigger.
Referenced by ast_audiohook_attach(), ast_audiohook_detach(), ast_audiohook_detach_list(), ast_audiohook_detach_source(), ast_audiohook_init(), ast_audiohook_remove(), audio_audiohook_write_list(), dtmf_audiohook_write_list(), and stop_mixmonitor_full().
| int ast_audiohook_volume_adjust | ( | struct ast_channel * | chan, | 
| enum ast_audiohook_direction | direction, | ||
| int | volume | ||
| ) | 
Adjust the volume on frames read from or written to a channel.
| chan | Channel to muck with | 
| direction | Direction to increase | 
| volume | Value to adjust the adjustment by | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 1380 of file audiohook.c.
References ast_audiohook_volume_adjust_float().
Referenced by execute_menu_entry().
| int ast_audiohook_volume_adjust_float | ( | struct ast_channel * | chan, | 
| enum ast_audiohook_direction | direction, | ||
| float | volume | ||
| ) | 
Adjust the volume on frames read from or written to a channel.
| chan | Channel to muck with | 
| direction | Direction to increase | 
| volume | Value to adjust the adjustment by | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 1385 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_BOTH, AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_DIRECTION_WRITE, audiohook_volume_get(), NULL, audiohook_volume::read_adjustment, and audiohook_volume::write_adjustment.
Referenced by ast_audiohook_volume_adjust(), and ast_audiohook_volume_set().
| int ast_audiohook_volume_get | ( | struct ast_channel * | chan, | 
| enum ast_audiohook_direction | direction | ||
| ) | 
Retrieve the volume adjustment value on frames read from or written to a channel.
| chan | Channel to retrieve volume adjustment from | 
| direction | Direction to retrieve | 
Definition at line 1355 of file audiohook.c.
References ast_audiohook_volume_get_float().
Referenced by confbridge_exec().
| float ast_audiohook_volume_get_float | ( | struct ast_channel * | chan, | 
| enum ast_audiohook_direction | direction | ||
| ) | 
Retrieve the volume adjustment value on frames read from or written to a channel.
| chan | Channel to retrieve volume adjustment from | 
| direction | Direction to retrieve | 
Definition at line 1360 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_DIRECTION_WRITE, audiohook_volume_get(), NULL, audiohook_volume::read_adjustment, and audiohook_volume::write_adjustment.
Referenced by ast_audiohook_volume_get().
| int ast_audiohook_volume_set | ( | struct ast_channel * | chan, | 
| enum ast_audiohook_direction | direction, | ||
| int | volume | ||
| ) | 
Adjust the volume on frames read from or written to a channel.
| chan | Channel to muck with | 
| direction | Direction to set on | 
| volume | Value to adjust the volume by | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 1330 of file audiohook.c.
References ast_audiohook_volume_adjust_float().
Referenced by confbridge_exec(), and execute_menu_entry().
| int ast_audiohook_volume_set_float | ( | struct ast_channel * | chan, | 
| enum ast_audiohook_direction | direction, | ||
| float | volume | ||
| ) | 
Adjust the volume on frames read from or written to a channel.
| chan | Channel to muck with | 
| direction | Direction to set on | 
| volume | Value to adjust the volume by | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 1335 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_BOTH, AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_DIRECTION_WRITE, audiohook_volume_get(), NULL, audiohook_volume::read_adjustment, and audiohook_volume::write_adjustment.
| int ast_audiohook_write_frame | ( | struct ast_audiohook * | audiohook, | 
| enum ast_audiohook_direction | direction, | ||
| struct ast_frame * | frame | ||
| ) | 
Writes a frame into the audiohook structure.
| audiohook | |
| direction | Direction the audio frame came from | 
| frame | Frame to write in | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 167 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_BOTH, AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_DIRECTION_WRITE, AST_AUDIOHOOK_LONG_QUEUE_TOLERANCE, AST_AUDIOHOOK_SMALL_QUEUE, AST_AUDIOHOOK_SMALL_QUEUE_TOLERANCE, AST_AUDIOHOOK_SYNC_TOLERANCE, AST_AUDIOHOOK_TRIGGER_MODE, AST_AUDIOHOOK_TRIGGER_READ, AST_AUDIOHOOK_TRIGGER_SYNC, AST_AUDIOHOOK_TRIGGER_WRITE, ast_cond_signal, ast_debug, ast_slinfactory_available(), ast_slinfactory_feed(), ast_slinfactory_flush(), ast_test_flag, ast_tvdiff_ms(), ast_tvnow(), ast_audiohook::direction, ast_audiohook::hook_internal_samp_rate, ast_audiohook::read_factory, ast_audiohook::read_time, ast_audiohook::trigger, ast_audiohook::write_factory, and ast_audiohook::write_time.
Referenced by audio_audiohook_write_list(), channel_spy(), do_broadcast(), and snoop_write().
| struct ast_frame * ast_audiohook_write_list | ( | struct ast_channel * | chan, | 
| struct ast_audiohook_list * | audiohook_list, | ||
| enum ast_audiohook_direction | direction, | ||
| struct ast_frame * | frame | ||
| ) | 
Pass a frame off to be handled by the audiohook core.
| chan | Channel that the list is coming off of | 
| audiohook_list | List of audiohooks | 
| direction | Direction frame is coming in from | 
| frame | The frame itself | 
| NULL | on failure | 
Definition at line 1116 of file audiohook.c.
References AST_FRAME_DTMF, AST_FRAME_VOICE, audio_audiohook_write_list(), dtmf_audiohook_write_list(), and ast_frame::frametype.
Referenced by __ast_read(), and ast_write_stream().
| int ast_audiohook_write_list_empty | ( | struct ast_audiohook_list * | audiohook_list | ) | 
Determine if a audiohook_list is empty or not.
| audiohook_list | Audiohook to check. (NULL also means empty) | 
| 0 | false | 
| 1 | true | 
Definition at line 1108 of file audiohook.c.
References AST_LIST_EMPTY, ast_audiohook_list::manipulate_list, ast_audiohook_list::spy_list, and ast_audiohook_list::whisper_list.
Referenced by __ast_read(), ast_channel_has_audio_frame_or_monitor(), ast_channel_has_hook_requiring_audio(), and ast_write_stream().
| int ast_channel_audiohook_count_by_source | ( | struct ast_channel * | chan, | 
| const char * | source, | ||
| enum ast_audiohook_type | type | ||
| ) | 
Find out how many audiohooks from a certain source exist on a given channel, regardless of status.
| chan | The channel on which to find the spies | 
| source | The audiohook's source | 
| type | The type of audiohook | 
Note: Function performs nlocking.
Definition at line 1146 of file audiohook.c.
References AST_AUDIOHOOK_TYPE_MANIPULATE, AST_AUDIOHOOK_TYPE_SPY, AST_AUDIOHOOK_TYPE_WHISPER, ast_channel_audiohooks(), ast_debug, AST_LIST_TRAVERSE, ast_audiohook::list, NULL, ast_audiohook::source, and type.
Referenced by feature_automixmonitor().
| int ast_channel_audiohook_count_by_source_running | ( | struct ast_channel * | chan, | 
| const char * | source, | ||
| enum ast_audiohook_type | type | ||
| ) | 
Find out how many spies of a certain type exist on a given channel, and are in state running.
| chan | The channel on which to find the spies | 
| source | The source of the audiohook | 
| type | The type of spy to look for | 
Note: Function performs no locking.
Definition at line 1186 of file audiohook.c.
References AST_AUDIOHOOK_STATUS_RUNNING, AST_AUDIOHOOK_TYPE_MANIPULATE, AST_AUDIOHOOK_TYPE_SPY, AST_AUDIOHOOK_TYPE_WHISPER, ast_channel_audiohooks(), ast_debug, AST_LIST_TRAVERSE, ast_audiohook::list, NULL, ast_audiohook::source, ast_audiohook::status, and type.
| 
 | static | 
Pass an AUDIO frame off to be handled by the audiohook core.
This function has 3 ast_frames and 3 parts to handle each. At the beginning of this function all 3 frames, start_frame, middle_frame, and end_frame point to the initial input frame.
Part_1: Translate the start_frame into SLINEAR audio if it is not already in that format. The result of this part is middle_frame is guaranteed to be in SLINEAR format for Part_2. Part_2: Send middle_frame off to spies and manipulators. At this point middle_frame is either a new frame as result of the translation, or points directly to the start_frame because no translation to SLINEAR audio was required. Part_3: Translate end_frame's audio back into the format of start frame if necessary. This is only necessary if manipulation of middle_frame occurred.
| chan | Channel that the list is coming off of | 
| audiohook_list | List of audiohooks | 
| direction | Direction frame is coming in from | 
| frame | The frame itself | 
| NULL | on failure | 
Definition at line 951 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_READ, ast_audiohook_lock, AST_AUDIOHOOK_STATUS_DONE, AST_AUDIOHOOK_STATUS_RUNNING, ast_audiohook_unlock, ast_audiohook_update_status(), ast_audiohook_write_frame(), ast_channel_is_bridged(), ast_channel_set_unbridged_nolock(), ast_frfree, AST_LIST_EMPTY, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_slinear_saturated_add(), ast_slinfactory_available(), ast_slinfactory_read(), audiohook_list_set_hook_rate(), audiohook_list_set_samplerate_compatibility(), audiohook_list_translate_to_native(), audiohook_list_translate_to_slin(), ast_frame_subclass::format, ast_audiohook::list, ast_audiohook_list::list_internal_samp_rate, ast_audiohook::manipulate_callback, ast_audiohook_list::manipulate_list, NULL, ast_audiohook::read_factory, ast_frame::samples, ast_audiohook_list::spy_list, ast_audiohook::status, ast_frame::subclass, ast_audiohook_list::whisper_list, and ast_audiohook::write_factory.
Referenced by ast_audiohook_write_list().
| 
 | static | 
Set the audiohook's internal sample rate to the audiohook_list's rate, but only when native slin compatibility is turned on.
| audiohook_list | audiohook_list data object | 
| audiohook | the audiohook to update | 
| rate | the current max internal sample rate | 
Definition at line 905 of file audiohook.c.
References AST_AUDIOHOOK_COMPATIBLE, ast_clear_flag, ast_set_flag, audiohook_set_internal_rate(), ast_audiohook::hook_internal_samp_rate, ast_audiohook_list::list_internal_samp_rate, and ast_audiohook_list::native_slin_compatible.
Referenced by audio_audiohook_write_list().
| 
 | static | 
Definition at line 493 of file audiohook.c.
References AST_AUDIOHOOK_MANIPULATE_ALL_RATES, AST_LIST_TRAVERSE, DEFAULT_INTERNAL_SAMPLE_RATE, ast_audiohook::init_flags, ast_audiohook::list, ast_audiohook_list::list_internal_samp_rate, ast_audiohook_list::manipulate_list, ast_audiohook_list::native_slin_compatible, and NULL.
Referenced by ast_audiohook_attach(), ast_audiohook_remove(), audio_audiohook_write_list(), and dtmf_audiohook_write_list().
| 
 | static | 
Definition at line 873 of file audiohook.c.
References ao2_replace, AST_AUDIOHOOK_DIRECTION_READ, ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_translate(), ast_translator_build_path(), ast_translator_free_path(), ast_frame_subclass::format, ast_audiohook_translate::format, NULL, ast_audiohook_list::out_translate, ast_frame::subclass, and ast_audiohook_translate::trans_pvt.
Referenced by audio_audiohook_write_list().
| 
 | static | 
Definition at line 827 of file audiohook.c.
References ao2_replace, AST_AUDIOHOOK_DIRECTION_READ, ast_format_cache_get_slin_by_rate(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_get_sample_rate(), ast_translate(), ast_translator_build_path(), ast_translator_free_path(), ast_frame_subclass::format, ast_audiohook_translate::format, ast_audiohook_list::in_translate, ast_audiohook_list::list_internal_samp_rate, MAX, NULL, ast_frame::subclass, and ast_audiohook_translate::trans_pvt.
Referenced by audio_audiohook_write_list().
| 
 | static | 
Definition at line 674 of file audiohook.c.
References ast_audiohook_attach(), ast_audiohook_lock, ast_audiohook_remove(), ast_audiohook_unlock, and ast_audiohook::status.
Referenced by ast_audiohook_move_all(), and ast_audiohook_move_by_source().
| 
 | static | 
Definition at line 257 of file audiohook.c.
References abs, AST_AUDIOHOOK_MUTE_READ, AST_AUDIOHOOK_MUTE_WRITE, AST_AUDIOHOOK_SUBSTITUTE_SILENCE, ast_debug, ast_format_cache_get_slin_by_rate(), AST_FRAME_VOICE, ast_frdup, ast_slinear_saturated_add(), ast_slinear_saturated_divide(), ast_slinear_saturated_multiply(), ast_slinfactory_available(), ast_slinfactory_read(), ast_test_flag, ast_tvdiff_ms(), ast_tvnow(), ast_frame::data, ast_frame_subclass::format, ast_frame::frametype, ast_audiohook::hook_internal_samp_rate, NULL, ast_audiohook::options, ast_frame::ptr, ast_audiohook::read_factory, ast_audiohook::read_time, ast_audiohook_options::read_volume, ast_frame::samples, ast_frame::subclass, write_buf(), ast_audiohook::write_factory, ast_audiohook::write_time, and ast_audiohook_options::write_volume.
Referenced by audiohook_read_frame_helper().
| 
 | static | 
Definition at line 421 of file audiohook.c.
References ao2_replace, AST_AUDIOHOOK_COMPATIBLE, AST_AUDIOHOOK_DIRECTION_BOTH, ast_format_cache_get_slin_by_rate(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_sample_rate(), ast_frfree, ast_test_flag, ast_translate(), ast_translator_build_path(), ast_translator_free_path(), audiohook_read_frame_both(), audiohook_read_frame_single(), audiohook_set_internal_rate(), ast_audiohook::format, ast_audiohook::hook_internal_samp_rate, NULL, read_frame(), and ast_audiohook::trans_pvt.
Referenced by ast_audiohook_read_frame(), and ast_audiohook_read_frame_all().
| 
 | static | 
Definition at line 223 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_READ, ast_format_cache_get_slin_by_rate(), ast_frame_adjust_volume(), ast_frame_clear(), AST_FRAME_VOICE, ast_frdup, ast_slinfactory_available(), ast_slinfactory_read(), buf, ast_frame::frametype, ast_audiohook::hook_internal_samp_rate, NULL, ast_audiohook::options, ast_audiohook::read_factory, ast_audiohook_options::read_volume, ast_frame::samples, SHOULD_MUTE, ast_audiohook::write_factory, and ast_audiohook_options::write_volume.
Referenced by audiohook_read_frame_helper().
| 
 | static | 
Definition at line 70 of file audiohook.c.
References AST_AUDIOHOOK_TYPE_SPY, AST_AUDIOHOOK_TYPE_WHISPER, ast_format_cache_get_slin_by_rate(), ast_slinfactory_destroy(), ast_slinfactory_init_with_format(), ast_audiohook::hook_internal_samp_rate, ast_audiohook::read_factory, ast_audiohook::type, and ast_audiohook::write_factory.
Referenced by ast_audiohook_attach(), ast_audiohook_init(), audiohook_list_set_hook_rate(), and audiohook_read_frame_helper().
| 
 | static | 
Helper function which actually gets called by audiohooks to perform the adjustment.
| audiohook | Audiohook attached to the channel | 
| chan | Channel we are attached to | 
| frame | Frame of audio we want to manipulate | 
| direction | Direction the audio came in from | 
| 0 | on success | 
| -1 | on failure | 
Definition at line 1256 of file audiohook.c.
References AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_DIRECTION_WRITE, AST_AUDIOHOOK_STATUS_DONE, ast_channel_datastore_find(), ast_frame_adjust_volume_float(), audiohook_volume::audiohook, audiohook_volume_datastore, ast_datastore::data, NULL, audiohook_volume::read_adjustment, ast_audiohook::status, and audiohook_volume::write_adjustment.
Referenced by audiohook_volume_get().
| 
 | static | 
Callback used to destroy the audiohook volume datastore.
| data | Volume information structure | 
Definition at line 1229 of file audiohook.c.
References ast_audiohook_destroy(), ast_free, and audiohook_volume::audiohook.
| 
 | static | 
Helper function which finds and optionally creates an audiohook_volume_datastore datastore on a channel.
| chan | Channel to look on | 
| create | Whether to create the datastore if not found | 
| NULL | on failure | 
Definition at line 1295 of file audiohook.c.
References ast_audiohook_attach(), ast_audiohook_init(), AST_AUDIOHOOK_MANIPULATE_ALL_RATES, AST_AUDIOHOOK_TYPE_MANIPULATE, ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_datastore_alloc, ast_datastore_free(), audiohook_volume::audiohook, audiohook_volume_callback(), audiohook_volume_datastore, ast_datastore::data, ast_audiohook::manipulate_callback, and NULL.
Referenced by ast_audiohook_volume_adjust_float(), ast_audiohook_volume_get_float(), and ast_audiohook_volume_set_float().
| 
 | static | 
Pass a DTMF frame off to be handled by the audiohook core.
| chan | Channel that the list is coming off of | 
| audiohook_list | List of audiohooks | 
| direction | Direction frame is coming in from | 
| frame | The frame itself | 
| NULL | on failure | 
Definition at line 795 of file audiohook.c.
References ast_audiohook_lock, AST_AUDIOHOOK_STATUS_DONE, AST_AUDIOHOOK_STATUS_RUNNING, ast_audiohook_unlock, ast_audiohook_update_status(), AST_AUDIOHOOK_WANTS_DTMF, ast_channel_is_bridged(), ast_channel_set_unbridged_nolock(), AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_test_flag, audiohook_list_set_samplerate_compatibility(), ast_audiohook::list, ast_audiohook::manipulate_callback, ast_audiohook_list::manipulate_list, NULL, and ast_audiohook::status.
Referenced by ast_audiohook_write_list().
| 
 | static | 
find an audiohook based on its source
| audiohook_list | The list of audiohooks to search in | 
| source | The source of the audiohook we wish to find | 
| NULL | if it cannot be found | 
Definition at line 649 of file audiohook.c.
References AST_LIST_TRAVERSE, ast_audiohook::list, ast_audiohook_list::manipulate_list, NULL, ast_audiohook::source, ast_audiohook_list::spy_list, and ast_audiohook_list::whisper_list.
Referenced by ast_audiohook_detach_source(), ast_audiohook_move_by_source(), and ast_audiohook_set_mute().
| 
 | static | 
Datastore used to store audiohook volume information.
Definition at line 1243 of file audiohook.c.
Referenced by audiohook_volume_callback(), and audiohook_volume_get().