Asterisk - The Open Source Telephony Project  18.5.0
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 = "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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .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 131 of file app_playtones.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 131 of file app_playtones.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 131 of file app_playtones.c.

◆ handle_playtones()

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

Definition at line 77 of file app_playtones.c.

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().

78 {
79  struct ast_tone_zone_sound *ts;
80  int res;
81  const char *str = data;
82 
83  if (ast_strlen_zero(str)) {
84  ast_log(LOG_NOTICE,"Nothing to play\n");
85  return -1;
86  }
87 
89 
90  if (ts) {
91  res = ast_playtones_start(chan, 0, ts->data, 0);
93  } else {
94  res = ast_playtones_start(chan, 0, str, 0);
95  }
96 
97  if (res) {
98  ast_log(LOG_NOTICE, "Unable to start playtones\n");
99  }
100 
101  return res;
102 }
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
const char * str
Definition: app_jack.c:147
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ast_log
Definition: astobj2.c:42
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.
Definition: indications.h:227
Description of a tone.
Definition: indications.h:35
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
Definition: indications.c:455
#define LOG_NOTICE
Definition: logger.h:263
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
Definition: indications.c:302
const char * data
Description of a tone.
Definition: indications.h:52

◆ handle_stopplaytones()

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

Definition at line 104 of file app_playtones.c.

References ast_playtones_stop().

Referenced by load_module().

105 {
106  ast_playtones_stop(chan);
107 
108  return 0;
109 }
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
Definition: indications.c:393

◆ load_module()

static int load_module ( void  )
static

Definition at line 121 of file app_playtones.c.

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

122 {
123  int res;
124 
127 
129 }
static const char stopplaytones_app[]
Definition: app_playtones.c:40
static int handle_playtones(struct ast_channel *chan, const char *data)
Definition: app_playtones.c:77
static const char playtones_app[]
Definition: app_playtones.c:39
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
static int handle_stopplaytones(struct ast_channel *chan, const char *data)
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:626

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 111 of file app_playtones.c.

References ast_unregister_application(), playtones_app, and stopplaytones_app.

112 {
113  int res;
114 
117 
118  return res;
119 }
static const char stopplaytones_app[]
Definition: app_playtones.c:40
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
static const char playtones_app[]
Definition: app_playtones.c:39

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Playtones Application" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 131 of file app_playtones.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 131 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().