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 | |
| AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Playtones Application") | |
| 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 const char | playtones_app [] = "PlayTones" |
| static const char | stopplaytones_app [] = "StopPlayTones" |
Playtones application.
Definition in file app_playtones.c.
| AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
| "Playtones Application" | ||||
| ) |
| 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().
00076 { 00077 struct ast_tone_zone_sound *ts; 00078 int res; 00079 const char *str = data; 00080 00081 if (ast_strlen_zero(str)) { 00082 ast_log(LOG_NOTICE,"Nothing to play\n"); 00083 return -1; 00084 } 00085 00086 ts = ast_get_indication_tone(chan->zone, str); 00087 00088 if (ts) { 00089 res = ast_playtones_start(chan, 0, ts->data, 0); 00090 ts = ast_tone_zone_sound_unref(ts); 00091 } else { 00092 res = ast_playtones_start(chan, 0, str, 0); 00093 } 00094 00095 if (res) { 00096 ast_log(LOG_NOTICE, "Unable to start playtones\n"); 00097 } 00098 00099 return res; 00100 }
| 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().
00103 { 00104 ast_playtones_stop(chan); 00105 00106 return 0; 00107 }
| 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().
00120 { 00121 int res; 00122 00123 res = ast_register_application_xml(playtones_app, handle_playtones); 00124 res |= ast_register_application_xml(stopplaytones_app, handle_stopplaytones); 00125 00126 return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; 00127 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 109 of file app_playtones.c.
References ast_unregister_application().
00110 { 00111 int res; 00112 00113 res = ast_unregister_application(playtones_app); 00114 res |= ast_unregister_application(stopplaytones_app); 00115 00116 return res; 00117 }
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.
1.6.1