110static char *
app =
"Playback";
178 res = (
a->audiofd > -1 &&
a->ctrlfd > -1) ?
195 char *rule_head =
NULL;
200 ast_debug(2,
"string <%s> depth <%d>\n", s, depth);
210 if (
a->language ==
NULL)
212 ast_debug(2,
"try <%s> in <%s>\n", s,
a->language);
223 if ( (x = strchr(lang,
'_')) )
225 else if (strcmp(lang,
"en"))
234 if ( (x = strchr(s,
':')) )
236 if ( (x = strchr(s,
':')) )
250 const char *p, *fmt, *data;
261 fmt = strchr(fn,
':');
262 if (!fmt || fmt == fn) {
267 data = strchr(fmt,
':');
268 if (!data || data == fmt) {
273 for (p = fmt; p < data && ret <= 0; p++) {
274 char fn2[
sizeof(fn)];
275 if (*p ==
' ' || *p ==
'\t')
280 y = strchr(fn2,
'\'');
287 p = strchr(p+1,
'\'');
294 strcpy(fn2 + l, data);
309 const char *ints,
const char *lang,
const char *
options,
310 int audiofd,
int ctrlfd)
312 say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
317 const char *ints,
const char *lang,
const char *
options,
318 int audiofd,
int ctrlfd)
321 say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
322 snprintf(
buf,
sizeof(
buf),
"num:%d", num);
327 const char *ints,
const char *lang,
const char *
options,
328 int audiofd,
int ctrlfd)
331 say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
332 snprintf(
buf,
sizeof(
buf),
"enum:%d", num);
337 const char *ints,
const char *lang,
const char *format,
const char *timezonename,
const char *
prefix)
341 struct timeval when = { t, 0 };
347 snprintf(
buf,
sizeof(
buf),
"%s:%s:%04d%02d%02d%02d%02d.%02d-%d-%3d",
362 const char *ints,
const char *lang,
const char *format,
const char *timezonename)
364 return say_date_generic(chan, t, ints, lang, format, timezonename,
"datetime");
412 }
else if (strcmp(mode,
say_old)) {
426 e->
command =
"say load [new|old]";
428 "Usage: say load [new|old]\n"
430 " Report status of current say mode\n"
432 " Set say method, configured in say.conf\n"
434 " Set old say method, coded in asterisk core\n";
440 ast_cli(
a->fd,
"say mode is [%s]\n", old_mode);
442 }
else if (
a->argc != e->
args)
445 if (!strcmp(mode, old_mode))
446 ast_cli(
a->fd,
"say mode is %s already\n", mode);
449 ast_cli(
a->fd,
"setting say mode from %s to %s\n", old_mode, mode);
466 int option_noanswer = 0;
495 }
else if (!option_noanswer) {
501 char *back =
args.filenames;
508 else if (option_mix){
543 ast_log(
LOG_ERROR,
"Config file say.conf is in an invalid format. Aborting.\n");
static struct ast_config * say_cfg
static int say_time(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static void restore_say_mode(void *arg)
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 char * __say_cli_init(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int s_streamwait3(const say_args_t *a, const char *fn)
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 say_enumeration_full(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
static int say_full(struct ast_channel *chan, const char *string, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
static void save_say_mode(const void *arg)
static int say_number_full(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
static struct ast_cli_entry cli_playback[]
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.
static const char *const say_old
static int load_module(void)
static int say_datetime(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int unload_module(void)
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...
static const char *const say_new
static int say_date(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int say_init_mode(const char *mode)
remap the 'say' functions to use those in this file
static int playback_exec(struct ast_channel *chan, const char *data)
char * strsep(char **str, const char *delims)
char * strcasestr(const char *, const char *)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
const char * ast_channel_name(const struct ast_channel *chan)
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
const char * ast_channel_language(const struct ast_channel *chan)
int ast_answer(struct ast_channel *chan)
Answer a channel.
ast_channel_state
ast_channel states
#define ast_var_assign(name, value)
void ast_var_delete(struct ast_var_t *var)
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static char prefix[MAX_PREFIX]
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_config_load(filename, flags)
Load a config file.
@ CONFIG_FLAG_FILEUNCHANGED
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count)
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.
int ast_extension_match(const char *pattern, const char *extension)
Determine if a given extension matches a given pattern (in NXX format)
static int say_datetime_from_now(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int say_digit_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
static int say_phonetic_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
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)
Say numbers and dates (maybe words one day too)
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)
SAY_EXTERN int(* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date)
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.
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.
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)
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)
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.
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.
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_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)
SAY_EXTERN int(* ast_say_datetime)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime)
static force_inline int attribute_pure ast_strlen_zero(const char *s)
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
char * ast_strsep(char **s, const char sep, uint32_t flags)
Act like strsep but ignore separators inside quotes.
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
Structure used to handle boolean flags.
struct ast_var_t::@213 entries
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
Typical 'say' arguments in addition to the date or number or string to say. We do not include 'option...
struct ast_channel * chan