94 static char *
app =
"Playback";
179 char *rule_head =
NULL;
184 ast_debug(2,
"string <%s> depth <%d>\n", s, depth);
188 }
else if (!say_cfg) {
207 if ( (x = strchr(lang,
'_')) )
209 else if (strcmp(lang,
"en"))
218 if ( (x = strchr(s,
':')) )
220 if ( (x = strchr(s,
':')) )
232 while ( !ret && (x =
strsep(&rule,
",")) ) {
234 const char *p, *fmt, *data;
245 fmt = strchr(fn,
':');
246 if (!fmt || fmt == fn) {
251 data = strchr(fmt,
':');
252 if (!data || data == fmt) {
253 ret =
do_say(a, fn, options, depth);
257 for (p = fmt; p < data && ret <= 0; p++) {
258 char fn2[
sizeof(fn)];
259 if (*p ==
' ' || *p ==
'\t')
264 y = strchr(fn2,
'\'');
271 p = strchr(p+1,
'\'');
278 strcpy(fn2 + l, data);
279 ret =
do_say(a, fn2, options, depth);
293 const char *ints,
const char *lang,
const char *
options,
294 int audiofd,
int ctrlfd)
296 say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
297 return do_say(&a,
string, options, 0);
301 const char *ints,
const char *lang,
const char *
options,
302 int audiofd,
int ctrlfd)
305 say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
306 snprintf(buf,
sizeof(buf),
"num:%d", num);
307 return do_say(&a, buf, options, 0);
311 const char *ints,
const char *lang,
const char *
options,
312 int audiofd,
int ctrlfd)
315 say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
316 snprintf(buf,
sizeof(buf),
"enum:%d", num);
317 return do_say(&a, buf, options, 0);
321 const char *ints,
const char *lang,
const char *
format,
const char *timezonename,
const char *
prefix)
325 struct timeval when = { t, 0 };
331 snprintf(buf,
sizeof(buf),
"%s:%s:%04d%02d%02d%02d%02d.%02d-%d-%3d",
346 const char *ints,
const char *lang,
const char *
format,
const char *timezonename)
348 return say_date_generic(chan, t, ints, lang, format, timezonename,
"datetime");
371 if (say_cfg ==
NULL) {
396 }
else if (strcmp(mode,
say_old)) {
410 e->
command =
"say load [new|old]";
412 "Usage: say load [new|old]\n" 414 " Report status of current say mode\n" 416 " Set say method, configured in say.conf\n" 418 " Set old say method, coded in asterisk core\n";
424 ast_cli(a->
fd,
"say mode is [%s]\n", old_mode);
429 if (!strcmp(mode, old_mode))
430 ast_cli(a->
fd,
"say mode is %s already\n", mode);
433 ast_cli(a->
fd,
"setting say mode from %s to %s\n", old_mode, mode);
449 int option_noanswer = 0;
476 }
else if (!option_noanswer) {
482 char *back =
args.filenames;
486 while (!res && (front =
strsep(&back,
"&"))) {
518 ast_log(
LOG_ERROR,
"Config file say.conf is in an invalid format. Aborting.\n");
struct ast_variable * next
static void save_say_mode(const void *arg)
static int say_character_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd)
Main Channel structure associated with a channel.
SAY_EXTERN int(* ast_say_number_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_number_full)
Same as ast_say_number() with audiofd for received audio and returns 1 on ctrlfd being readable...
#define AST_CLI_DEFINE(fn, txt,...)
static int unload_module(void)
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
Asterisk main include file. File version handling, generic pbx functions.
SAY_EXTERN int(* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time)
SAY_EXTERN int(* ast_say_enumeration_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_enumeration_full)
Same as ast_say_enumeration() with audiofd for received audio and returns 1 on ctrlfd being readable...
static int say_date_with_format(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezonename)
static int do_say(say_args_t *a, const char *s, const char *options, int depth)
the string is 'prefix:data' or prefix:fmt:data' with ':' being invalid in strings.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
static int say_number_full(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
descriptor for a cli entry.
#define CONFIG_STATUS_FILEINVALID
SAY_EXTERN int(* ast_say_datetime_from_now)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime_from_now)
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
int ast_say_digits_full(struct ast_channel *chan, int num, const char *ints, const char *lang, int audiofd, int ctrlfd)
Same as ast_say_digits() with audiofd for received audio and returns 1 on ctrlfd being readable...
Structure for variables, used for configurations and for channel variables.
static int say_datetime_from_now(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
ast_channel_state
ast_channel states
#define ast_cli_register_multiple(e, len)
Register multiple commands.
#define ast_strdup(str)
A wrapper for strdup()
static struct ast_cli_entry cli_playback[]
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
void ast_cli(int fd, const char *fmt,...)
int ast_unregister_application(const char *app)
Unregister an application.
int args
This gets set in ast_cli_register()
#define ast_strlen_zero(foo)
static int say_enumeration_full(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_config_load(filename, flags)
Load a config file.
SAY_EXTERN int(* ast_say_digit_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_digit_str_full)
Same as ast_say_digit_str() with audiofd for received audio and returns 1 on ctrlfd being readable...
static struct ast_config * say_cfg
void ast_config_destroy(struct ast_config *config)
Destroys a config.
static int say_full(struct ast_channel *chan, const char *string, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
#define ast_strdupa(s)
duplicate a string in memory from the stack
static int s_streamwait3(const say_args_t *a, const char *fn)
static int say_datetime(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
SAY_EXTERN int(* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date)
Core PBX routines and definitions.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
#define CONFIG_STATUS_FILEUNCHANGED
SAY_EXTERN int(* ast_say_date_with_format)(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezone) SAY_INIT(ast_say_date_with_format)
void ast_var_delete(struct ast_var_t *var)
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
char * strcasestr(const char *, const char *)
Typical 'say' arguments in addition to the date or number or string to say. We do not include 'option...
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
static const void * say_api_buf[40]
save the say' api calls. The first entry is NULL if we have the standard source, otherwise we are sou...
struct ast_var_t::@249 entries
int ast_extension_match(const char *pattern, const char *extension)
Determine if a given extension matches a given pattern (in NXX format)
#define ast_var_assign(name, value)
struct ast_channel * chan
static int say_time(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
SAY_EXTERN int(* ast_say_datetime)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime)
Structure used to handle boolean flags.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
static int say_date_generic(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezonename, const char *prefix)
static int say_date(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
char * strsep(char **str, const char *delims)
Standard Command Line Interface.
static int say_digit_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
const char * ast_channel_name(const struct ast_channel *chan)
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int say_phonetic_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
int ast_answer(struct ast_channel *chan)
Answer a channel.
const char * ast_channel_language(const struct ast_channel *chan)
static const char *const say_new
static int load_module(void)
SAY_EXTERN int(* ast_say_character_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd) SAY_INIT(ast_say_character_str_full)
static char * __say_cli_init(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Say numbers and dates (maybe words one day too)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static int playback_exec(struct ast_channel *chan, const char *data)
SAY_EXTERN int(* ast_say_phonetic_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_phonetic_str_full)
static snd_pcm_format_t format
static int say_init_mode(const char *mode)
remap the 'say' functions to use those in this file
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static const char *const say_old
static void restore_say_mode(void *arg)
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count)
static char prefix[MAX_PREFIX]
#define AST_APP_ARG(name)
Define an application argument.