683 #define BACKGROUND_SKIP (1 << 0) 684 #define BACKGROUND_NOANSWER (1 << 1) 685 #define BACKGROUND_MATCHEXTEN (1 << 2) 686 #define BACKGROUND_PLAYBACK (1 << 3) 695 #define WAITEXTEN_MOH (1 << 0) 696 #define WAITEXTEN_DIALTONE (1 << 1) 800 ast_log(
AST_LOG_WARNING,
"The nocdr option for the Answer application has been removed and is no longer supported.\n");
833 ast_log(
AST_LOG_WARNING,
"The SetAMAFlags application is deprecated. Please use the CHANNEL function instead.\n");
841 if (isdigit(data[0])) {
843 if (sscanf(data,
"%30d", &amaflags) != 1) {
868 if (sscanf(data,
"%30d", &cause) != 1 || cause <= 0) {
907 char *s, *ts, *branch1, *branch2, *branch;
919 ast_log(
LOG_WARNING,
"GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n");
927 tv.tv_sec = timesecs;
937 branch1 =
strsep(&ts,
":");
964 static const char *
const usage =
"ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]";
973 s =
strsep(&appname,
"?");
992 if ((s = strchr(appname,
'('))) {
995 if ((e = strrchr(s,
')')))
1057 snprintf(key,
sizeof(key),
"%c", res);
1072 char *opts[1] = {
NULL };
1089 ast_log(
LOG_WARNING,
"The 'm' option has been specified for WaitExten without a class.\n");
1181 if (!strcasecmp(
args.options,
"skip"))
1183 else if (!strcasecmp(
args.options,
"noanswer"))
1204 while (!res && (front =
strsep(&back,
"&")) ) {
1252 char buf[2] = { 0, };
1253 snprintf(buf,
sizeof(buf),
"%c", res);
1271 char *condition, *branch1, *branch2, *branch;
1280 condition =
strsep(&stringp,
"?");
1281 branch1 =
strsep(&stringp,
":");
1282 branch2 =
strsep(&stringp,
"");
1286 ast_debug(1,
"Not taking any branch\n");
1301 const char *interrupt_string;
1317 if (sscanf(tmp,
"%d", &number_val) != 1) {
1318 ast_log(
LOG_WARNING,
"argument '%s' to SayNumber could not be parsed as a number.\n", tmp);
1322 options =
strsep(&number,
",");
1324 if ( strcasecmp(options,
"f") && strcasecmp(options,
"m") &&
1325 strcasecmp(options,
"c") && strcasecmp(options,
"n") ) {
1334 ast_log(
LOG_WARNING,
"We were unable to say the number %s, is it too large?\n", tmp);
1337 return interrupt ? res : 0;
1344 const char *interrupt_string;
1364 const char *interrupt_string;
1383 int sensitivity = 0;
1386 const char *interrupt_string;
1408 if (!
args.options || strlen(
args.options) != 1) {
1413 switch (
args.options[0]) {
1440 const char *interrupt_string;
1460 const char *interrupt_string;
1480 static int deprecation_warning = 0;
1487 if (!deprecation_warning) {
1488 ast_log(
LOG_WARNING,
"ImportVar is deprecated. Please use Set(varname=${IMPORT(channel,variable)}) instead.\n");
1489 deprecation_warning = 1;
1493 name =
strsep(&value,
"=");
1494 channel =
strsep(&value,
",");
1495 if (channel && value && name) {
1499 sprintf(s,
"${%s}", value);
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch) ...
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
static int pbx_builtin_saynumber(struct ast_channel *chan, const char *data)
int ast_check_timing2(const struct ast_timing *i, const struct timeval tv)
Evaluate a pre-constructed bitmap as to whether a particular time falls within the range specified...
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
static int pbx_builtin_progress(struct ast_channel *chan, const char *data)
Asterisk main include file. File version handling, generic pbx functions.
#define BACKGROUND_MATCHEXTEN
int pbx_builtin_raise_exception(struct ast_channel *chan, const char *reason)
Private include file for pbx.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_test_flag(p, flag)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
static int pbx_builtin_hangup(struct ast_channel *chan, const char *data)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_check_hangup_locked(struct ast_channel *chan)
static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data)
static int pbx_builtin_importvar(struct ast_channel *chan, const char *data)
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
static int pbx_builtin_ringing(struct ast_channel *chan, const char *data)
int pbx_checkcondition(const char *condition)
Evaluate a condition.
int ast_say_digit_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
says digits of a string
static int pbx_builtin_saycharacters(struct ast_channel *chan, const char *data)
ast_channel_state
ast_channel states
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
static int pbx_builtin_background(struct ast_channel *chan, const char *data)
static int pbx_builtin_saycharacters_case(struct ast_channel *chan, const char *data)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int ast_say_money_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
function to pronounce monetary amounts
static int pbx_builtin_saymoney(struct ast_channel *chan, const char *data)
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
static int pbx_builtin_sayphonetic(struct ast_channel *chan, const char *data)
int ast_unregister_application(const char *app)
Unregister an application.
int ast_channel_priority(const struct ast_channel *chan)
int load_pbx_builtins(void)
#define ast_verb(level,...)
static int pbx_builtin_gotoiftime(struct ast_channel *chan, const char *data)
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
void wait_for_hangup(struct ast_channel *chan, const void *data)
#define ast_strlen_zero(foo)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
int indicate_congestion(struct ast_channel *chan, const char *data)
#define ast_debug(level,...)
Log a DEBUG message.
static int pbx_builtin_execiftime(struct ast_channel *chan, const char *data)
int raise_exception(struct ast_channel *chan, const char *reason, int priority)
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define AST_CAUSE_NORMAL_CLEARING
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static int pbx_builtin_wait(struct ast_channel *chan, const char *data)
static int pbx_builtin_incomplete(struct ast_channel *chan, const char *data)
#define ast_strdupa(s)
duplicate a string in memory from the stack
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.
int indicate_busy(struct ast_channel *chan, const char *data)
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
static int pbx_builtin_setamaflags(struct ast_channel *chan, const char *data)
static const struct ast_app_option background_opts[128]
int ast_say_character_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity)
function to pronounce character and phonetic strings
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
static int answer(void *data)
struct pbx_builtin builtins[]
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
int(* execute)(struct ast_channel *chan, const char *data)
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
static int pbx_builtin_gotoif(struct ast_channel *chan, const char *data)
#define BACKGROUND_PLAYBACK
#define AST_PBX_INCOMPLETE
void set_ext_pri(struct ast_channel *c, const char *exten, int pri)
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
static int pbx_builtin_answer(struct ast_channel *chan, const char *data)
int ast_check_timing(const struct ast_timing *i)
Evaluate a pre-constructed bitmap as to whether the current time falls within the range specified...
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
static const struct ast_app_option waitexten_opts[128]
int __ast_answer(struct ast_channel *chan, unsigned int delay)
Answer a channel, with a selectable delay before returning.
static void unload_pbx_builtins(void)
static int pbx_builtin_proceeding(struct ast_channel *chan, const char *data)
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
int ast_destroy_timing(struct ast_timing *i)
Deallocates memory structures associated with a timing bitmap.
#define ast_channel_unlock(chan)
static void parse(struct mgcp_request *req)
Prototypes for public functions only of internal interest,.
Structure used to handle boolean flags.
int ast_build_timing(struct ast_timing *i, const char *info)
Construct a timing bitmap, for use in time-based conditionals.
int ast_say_phonetic_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
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_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
char * strsep(char **str, const char *delims)
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
ast_app: A registered application
static int pbx_builtin_goto(struct ast_channel *chan, const char *data)
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.
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
int ast_answer(struct ast_channel *chan)
Answer a channel.
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
static int pbx_builtin_noop(struct ast_channel *chan, const char *data)
Internal Asterisk hangup causes.
const char * ast_channel_language(const struct ast_channel *chan)
int ast_register_application2(const char *app, int(*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod)
Register an application.
#define BACKGROUND_NOANSWER
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
int ast_tonepair_start(struct ast_channel *chan, int freq1, int freq2, int duration, int vol)
const char * ast_channel_context(const struct ast_channel *chan)
const char * data
Description of a tone.
int ast_str2cause(const char *name) attribute_pure
Convert the string form of a cause code to a number.
static char context[AST_MAX_CONTEXT]
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_parse_timelen(const char *timestr, int *result, enum ast_timelen defunit)
Common routine to parse time lengths, with optional time unit specifier.
static int pbx_builtin_saydigits(struct ast_channel *chan, const char *data)
struct ast_app * pbx_findapp(const char *app)
Look up an application.
Say numbers and dates (maybe words one day too)
static int pbx_builtin_waitdigit(struct ast_channel *chan, const char *data)
void ast_channel_priority_set(struct ast_channel *chan, int value)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Asterisk module definitions.
#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...
#define AST_CAUSE_CONGESTION
int ast_waitfordigit_full(struct ast_channel *c, int ms, const char *breakon, int audiofd, int ctrlfd)
Wait for a digit Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to mon...
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define WAITEXTEN_DIALTONE
Declaration of builtin applications.
int ast_waitstream_exten(struct ast_channel *c, const char *context)
Waits for a stream to stop or digit matching a valid one digit exten to be pressed.
#define AST_APP_ARG(name)
Define an application argument.