Asterisk - The Open Source Telephony Project
21.4.1
|
Indication Tone Handling. More...
#include "asterisk.h"
#include <math.h>
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/indications.h"
#include "asterisk/frame.h"
#include "asterisk/format_cache.h"
#include "asterisk/channel.h"
#include "asterisk/utils.h"
#include "asterisk/cli.h"
#include "asterisk/module.h"
#include "asterisk/astobj2.h"
#include "asterisk/_private.h"
Go to the source code of this file.
Data Structures | |
struct | playtones_def |
struct | playtones_item |
struct | playtones_state |
Macros | |
#define | NUM_TONE_ZONE_BUCKETS 53 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_tone_zone_sound * | ast_get_indication_tone (const struct ast_tone_zone *_zone, const char *indication) |
Locate a tone zone sound. More... | |
struct ast_tone_zone * | ast_get_indication_zone (const char *country) |
locate ast_tone_zone, given the country. if country == NULL, use the default country More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
int | ast_playtones_start (struct ast_channel *chan, int vol, const char *playlst, int interruptible) |
Start playing a list of tones on a channel. More... | |
void | ast_playtones_stop (struct ast_channel *chan) |
Stop playing tones on a channel. More... | |
static int | ast_register_indication (struct ast_tone_zone *zone, const char *indication, const char *tonelist) |
static int | ast_register_indication_country (struct ast_tone_zone *zone) |
add a new country, if country exists, it will be replaced. | |
static int | ast_set_indication_country (const char *country) |
Set global indication country If no country is specified or we are unable to find the zone, then return not found. | |
static struct ast_tone_zone * | ast_tone_zone_alloc (void) |
static int | ast_tone_zone_cmp (void *obj, void *arg, int flags) |
int | ast_tone_zone_count (void) |
Get the number of registered tone zones. More... | |
static void | ast_tone_zone_destructor (void *obj) |
deallocate the passed tone zone | |
static int | ast_tone_zone_hash (const void *obj, const int flags) |
struct ao2_iterator | ast_tone_zone_iterator_init (void) |
Get an iterator for the available tone zones. More... | |
int | ast_tone_zone_part_parse (const char *s, struct ast_tone_zone_part *tone_data) |
Parse a tone part. More... | |
static void | ast_tone_zone_sound_destructor (void *obj) |
static int | ast_unregister_indication (struct ast_tone_zone *zone, const char *indication) |
remove an existing country's indication. Both country and indication must exist | |
static int | ast_unregister_indication_country (const char *country) |
remove an existing country and all its indications, country must exist. | |
static char * | complete_country (struct ast_cli_args *a) |
static char * | complete_indications (struct ast_cli_args *a) |
static char * | handle_cli_indication_add (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_indication_remove (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_indication_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | is_valid_tone_zone (struct ast_tone_zone *zone) |
static int | load_indications (int reload) |
load indications module | |
static int | load_module (void) |
Load indications module. | |
static int | parse_tone_zone (struct ast_config *cfg, const char *country) |
static void * | playtones_alloc (struct ast_channel *chan, void *params) |
static int | playtones_generator (struct ast_channel *chan, void *data, int len, int samples) |
static void | playtones_release (struct ast_channel *chan, void *params) |
static int | prune_tone_zone (void *obj, void *arg, int flags) |
Prune tones no longer in the configuration, and have the tone zone unlinked if it is no longer in the configuration at all. | |
static int | reload_module (void) |
Reload indications module. | |
static void | reset_tone_zone (struct ast_tone_zone *zone) |
static void | store_config_tone_zone (struct ast_tone_zone *zone, const char *var, const char *value) |
static void | store_tone_zone_ring_cadence (struct ast_tone_zone *zone, const char *val) |
static int | tone_zone_mark (void *obj, void *arg, int flags) |
Mark the zone and its tones before parsing configuration. We will use this to know what to remove after configuration is parsed. | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Indication Tone Handling" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_CORE, .requires = "extconfig", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ao2_container * | ast_tone_zones |
static struct ast_cli_entry | cli_indications [] |
CLI entries for commands provided by this module. More... | |
static const char | config [] = "indications.conf" |
static struct ast_tone_zone * | default_tone_zone |
static const int | midi_tohz [128] |
static struct ast_generator | playtones |
Indication Tone Handling.
Definition in file indications.c.
struct ast_tone_zone_sound* ast_get_indication_tone | ( | const struct ast_tone_zone * | zone, |
const char * | indication | ||
) |
Locate a tone zone sound.
zone | Zone to look in for a sound, if NULL, the default will be used |
indication | Sound to look for, such as "busy" |
Definition at line 461 of file indications.c.
References AST_LIST_TRAVERSE, ast_tone_zone_lock, ast_tone_zone_ref(), ast_tone_zone_sound_ref(), ast_tone_zone_unlock, ast_tone_zone_unref(), ast_tone_zone_sound::name, and ast_tone_zone::tones.
Referenced by ast_app_dtget(), ast_control_tone(), and indicate_data_internal().
struct ast_tone_zone* ast_get_indication_zone | ( | const char * | country | ) |
locate ast_tone_zone, given the country. if country == NULL, use the default country
locate ast_tone_zone
Definition at line 439 of file indications.c.
References ast_copy_string(), ast_tone_zone_ref(), ast_tone_zone::country, ast_tone_zone::nrringcadence, and OBJ_POINTER.
Referenced by ast_control_tone(), ast_set_indication_country(), and chan_pjsip_new().
int ast_playtones_start | ( | struct ast_channel * | chan, |
int | vol, | ||
const char * | tonelist, | ||
int | interruptible | ||
) |
Start playing a list of tones on a channel.
chan | the channel to play tones on |
vol | volume |
tonelist | the list of tones to play, comma separated |
interruptible | whether or not this tone can be interrupted |
0 | success |
non-zero | failure |
Definition at line 302 of file indications.c.
References ast_activate_generator(), ast_realloc, ast_strdupa, ast_strip(), and ast_tone_zone_part_parse().
Referenced by ast_app_dtget(), ast_control_tone(), ast_senddigit_begin(), ast_senddigit_mf_begin(), indicate_data_internal(), and send_tone_burst().
void ast_playtones_stop | ( | struct ast_channel * | chan | ) |
Stop playing tones on a channel.
chan | the channel to stop tones on |
Definition at line 393 of file indications.c.
References ast_deactivate_generator().
Referenced by ast_app_dtget(), ast_senddigit_end(), ast_senddigit_mf_end(), indicate_data_internal(), and send_tone_burst().
|
static |
Definition at line 579 of file indications.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_strdup, ast_tone_zone_sound_unref(), ast_tone_zone_sound::data, ast_tone_zone_sound::name, and ast_tone_zone::tones.
int ast_tone_zone_count | ( | void | ) |
Get the number of registered tone zones.
Definition at line 398 of file indications.c.
References ao2_container_count().
struct ao2_iterator ast_tone_zone_iterator_init | ( | void | ) |
Get an iterator for the available tone zones.
Definition at line 403 of file indications.c.
References ao2_iterator_init().
int ast_tone_zone_part_parse | ( | const char * | s, |
struct ast_tone_zone_part * | tone_data | ||
) |
Parse a tone part.
s | The part of a tone to parse. This should be in the form described for the data part of ast_tone_zone_sound. '!' should be removed if present. |
tone_data | An output parameter that contains the result of the parsing. |
0 | success |
-1 | failure, and the contents of tone_data are undefined |
Definition at line 245 of file indications.c.
Referenced by ast_playtones_start().
|
static |
Definition at line 918 of file indications.c.
References ast_copy_string(), ast_realloc, ast_strip(), ast_tone_zone::nrringcadence, and ast_tone_zone::ringcadence.
|
static |
CLI entries for commands provided by this module.
Definition at line 1118 of file indications.c.
|
static |
Definition at line 73 of file indications.c.
|
static |
Definition at line 239 of file indications.c.