Wed Jan 8 2020 09:49:54

Asterisk developer's documentation


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"

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
 
static 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

static void __reg_module ( void  )
static

Definition at line 133 of file app_playtones.c.

static void __unreg_module ( void  )
static

Definition at line 133 of file app_playtones.c.

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

Definition at line 79 of file app_playtones.c.

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

Referenced by load_module().

80 {
81  struct ast_tone_zone_sound *ts;
82  int res;
83  const char *str = data;
84 
85  if (ast_strlen_zero(str)) {
86  ast_log(LOG_NOTICE,"Nothing to play\n");
87  return -1;
88  }
89 
90  ts = ast_get_indication_tone(chan->zone, str);
91 
92  if (ts) {
93  res = ast_playtones_start(chan, 0, ts->data, 0);
95  } else {
96  res = ast_playtones_start(chan, 0, str, 0);
97  }
98 
99  if (res) {
100  ast_log(LOG_NOTICE, "Unable to start playtones\n");
101  }
102 
103  return res;
104 }
struct ast_tone_zone * zone
Definition: channel.h:767
const char * str
Definition: app_jack.c:144
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
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:226
Description of a tone.
Definition: indications.h:36
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:473
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
#define LOG_NOTICE
Definition: logger.h:133
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:319
const char * data
Description of a tone.
Definition: indications.h:53
static int handle_stopplaytones ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 106 of file app_playtones.c.

References ast_playtones_stop().

Referenced by load_module().

107 {
108  ast_playtones_stop(chan);
109 
110  return 0;
111 }
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
Definition: indications.c:411
static int load_module ( void  )
static

Definition at line 123 of file app_playtones.c.

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

124 {
125  int res;
126 
129 
131 }
static const char stopplaytones_app[]
Definition: app_playtones.c:42
static int handle_playtones(struct ast_channel *chan, const char *data)
Definition: app_playtones.c:79
static const char playtones_app[]
Definition: app_playtones.c:41
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:437
static int unload_module ( void  )
static

Definition at line 113 of file app_playtones.c.

References ast_unregister_application().

114 {
115  int res;
116 
119 
120  return res;
121 }
static const char stopplaytones_app[]
Definition: app_playtones.c:42
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx.c:7705
static const char playtones_app[]
Definition: app_playtones.c:41

Variable Documentation

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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static

Definition at line 133 of file app_playtones.c.

Definition at line 133 of file app_playtones.c.

const char playtones_app[] = "PlayTones"
static

Definition at line 41 of file app_playtones.c.

const char stopplaytones_app[] = "StopPlayTones"
static

Definition at line 42 of file app_playtones.c.