Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Functions | Variables
app_playtones.c File Reference

Playtones application. More...

#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/channel.h"
#include "asterisk/indications.h"
Include dependency graph for app_playtones.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int handle_playtones (struct ast_channel *chan, const char *data)
 
static int handle_stopplaytones (struct ast_channel *chan, const char *data)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Playtones Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static const char playtones_app [] = "PlayTones"
 
static const char stopplaytones_app [] = "StopPlayTones"
 

Detailed Description

Playtones application.

Author
Russell Bryant russe.nosp@m.ll@d.nosp@m.igium.nosp@m..com

Definition in file app_playtones.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 137 of file app_playtones.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 137 of file app_playtones.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 137 of file app_playtones.c.

◆ handle_playtones()

static int handle_playtones ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 83 of file app_playtones.c.

84{
85 struct ast_tone_zone_sound *ts;
86 int res;
87 const char *str = data;
88
89 if (ast_strlen_zero(str)) {
90 ast_log(LOG_NOTICE,"Nothing to play\n");
91 return -1;
92 }
93
95
96 if (ts) {
97 res = ast_playtones_start(chan, 0, ts->data, 0);
99 } else {
100 res = ast_playtones_start(chan, 0, str, 0);
101 }
102
103 if (res) {
104 ast_log(LOG_NOTICE, "Unable to start playtones\n");
105 }
106
107 return res;
108}
const char * str
Definition app_jack.c:150
#define ast_log
Definition astobj2.c:42
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
#define LOG_NOTICE
static struct ast_tone_zone_sound * ast_tone_zone_sound_unref(struct ast_tone_zone_sound *ts)
Release a reference to an ast_tone_zone_sound.
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition strings.h:65
Description of a tone.
Definition indications.h:35
const char * data
Description of a tone.
Definition indications.h:52

References ast_channel_zone(), ast_get_indication_tone(), ast_log, ast_playtones_start(), ast_strlen_zero(), ast_tone_zone_sound_unref(), ast_tone_zone_sound::data, LOG_NOTICE, and str.

Referenced by load_module().

◆ handle_stopplaytones()

static int handle_stopplaytones ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 110 of file app_playtones.c.

111{
112 ast_playtones_stop(chan);
113
114 return 0;
115}
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.

References ast_playtones_stop().

Referenced by load_module().

◆ load_module()

static int load_module ( void  )
static

Definition at line 127 of file app_playtones.c.

128{
129 int res;
130
133
135}
static const char playtones_app[]
static int handle_stopplaytones(struct ast_channel *chan, const char *data)
static int handle_playtones(struct ast_channel *chan, const char *data)
static const char stopplaytones_app[]
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition module.h:78
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition module.h:640

References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_application_xml, handle_playtones(), handle_stopplaytones(), playtones_app, and stopplaytones_app.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 117 of file app_playtones.c.

118{
119 int res;
120
123
124 return res;
125}
int ast_unregister_application(const char *app)
Unregister an application.
Definition pbx_app.c:392

References ast_unregister_application(), playtones_app, and stopplaytones_app.

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Playtones Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 137 of file app_playtones.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 137 of file app_playtones.c.

◆ playtones_app

const char playtones_app[] = "PlayTones"
static

Definition at line 39 of file app_playtones.c.

Referenced by load_module(), and unload_module().

◆ stopplaytones_app

const char stopplaytones_app[] = "StopPlayTones"
static

Definition at line 40 of file app_playtones.c.

Referenced by load_module(), and unload_module().