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, void *data) |
| static int | handle_stopplaytones (struct ast_channel *chan, void *data) |
| static int | load_module (void) |
| static int | unload_module (void) |
Variables | |
| static struct ast_module_info __MODULE_INFO_SECTION | __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Playtones Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static const char | playtones_app [] = "PlayTones" |
| static const char | stopplaytones_app [] = "StopPlayTones" |
Playtones application.
Definition in file app_playtones.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 129 of file app_playtones.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 129 of file app_playtones.c.
| static int handle_playtones | ( | struct ast_channel * | chan, |
| void * | data | ||
| ) | [static] |
Definition at line 75 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().
{
struct ast_tone_zone_sound *ts;
int res;
const char *str = data;
if (ast_strlen_zero(str)) {
ast_log(LOG_NOTICE,"Nothing to play\n");
return -1;
}
ts = ast_get_indication_tone(chan->zone, str);
if (ts) {
res = ast_playtones_start(chan, 0, ts->data, 0);
ts = ast_tone_zone_sound_unref(ts);
} else {
res = ast_playtones_start(chan, 0, str, 0);
}
if (res) {
ast_log(LOG_NOTICE, "Unable to start playtones\n");
}
return res;
}
| static int handle_stopplaytones | ( | struct ast_channel * | chan, |
| void * | data | ||
| ) | [static] |
Definition at line 102 of file app_playtones.c.
References ast_playtones_stop().
Referenced by load_module().
{
ast_playtones_stop(chan);
return 0;
}
| static int load_module | ( | void | ) | [static] |
Definition at line 119 of file app_playtones.c.
References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_application_xml, handle_playtones(), and handle_stopplaytones().
{
int res;
res = ast_register_application_xml(playtones_app, handle_playtones);
res |= ast_register_application_xml(stopplaytones_app, handle_stopplaytones);
return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
}
| static int unload_module | ( | void | ) | [static] |
Definition at line 109 of file app_playtones.c.
References ast_unregister_application().
{
int res;
res = ast_unregister_application(playtones_app);
res |= ast_unregister_application(stopplaytones_app);
return res;
}
struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Playtones Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
Definition at line 129 of file app_playtones.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 129 of file app_playtones.c.
const char playtones_app[] = "PlayTones" [static] |
Definition at line 37 of file app_playtones.c.
const char stopplaytones_app[] = "StopPlayTones" [static] |
Definition at line 38 of file app_playtones.c.