Asterisk - The Open Source Telephony Project  GIT-master-9ed6387
Data Structures | Macros | Functions | Variables
pbx_builtins.c File Reference

Core PBX builtin routines. More...

#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/pbx.h"
#include "asterisk/causes.h"
#include "asterisk/indications.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/say.h"
#include "asterisk/app.h"
#include "asterisk/module.h"
#include "pbx_private.h"

Go to the source code of this file.

Data Structures

struct  pbx_builtin
 Declaration of builtin applications. More...
 

Macros

#define BACKGROUND_MATCHEXTEN   (1 << 2)
 
#define BACKGROUND_NOANSWER   (1 << 1)
 
#define BACKGROUND_PLAYBACK   (1 << 3)
 
#define BACKGROUND_SKIP   (1 << 0)
 
#define WAITEXTEN_DIALTONE   (1 << 1)
 
#define WAITEXTEN_MOH   (1 << 0)
 

Functions

int indicate_busy (struct ast_channel *chan, const char *data)
 
int indicate_congestion (struct ast_channel *chan, const char *data)
 
int load_pbx_builtins (void)
 
static int pbx_builtin_answer (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_background (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_execiftime (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_goto (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_gotoif (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_gotoiftime (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_hangup (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_importvar (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_incomplete (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_noop (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_proceeding (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_progress (struct ast_channel *chan, const char *data)
 
int pbx_builtin_raise_exception (struct ast_channel *chan, const char *reason)
 
static int pbx_builtin_ringing (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_saycharacters (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_saycharacters_case (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_saydigits (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_saynumber (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_sayphonetic (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_setamaflags (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_wait (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_waitdigit (struct ast_channel *chan, const char *data)
 
static int pbx_builtin_waitexten (struct ast_channel *chan, const char *data)
 
static void unload_pbx_builtins (void)
 

Variables

static const struct ast_app_option background_opts [128] = { [ 's' ] = { .flag = (1 << 0) }, [ 'n' ] = { .flag = (1 << 1) }, [ 'm' ] = { .flag = (1 << 2) }, [ 'p' ] = { .flag = (1 << 3) }, }
 
struct pbx_builtin builtins []
 
static const struct ast_app_option waitexten_opts [128] = { [ 'm' ] = { .flag = (1 << 0) , .arg_index = 0 + 1 }, [ 'd' ] = { .flag = (1 << 1) , .arg_index = 0 + 1 }, }
 

Detailed Description

Core PBX builtin routines.

Author
George Joseph georg.nosp@m.e.jo.nosp@m.seph@.nosp@m.fair.nosp@m.view5.nosp@m..com

Definition in file pbx_builtins.c.

Macro Definition Documentation

◆ BACKGROUND_MATCHEXTEN

#define BACKGROUND_MATCHEXTEN   (1 << 2)

Definition at line 654 of file pbx_builtins.c.

Referenced by pbx_builtin_background().

◆ BACKGROUND_NOANSWER

#define BACKGROUND_NOANSWER   (1 << 1)

Definition at line 653 of file pbx_builtins.c.

Referenced by pbx_builtin_background().

◆ BACKGROUND_PLAYBACK

#define BACKGROUND_PLAYBACK   (1 << 3)

Definition at line 655 of file pbx_builtins.c.

Referenced by pbx_builtin_background().

◆ BACKGROUND_SKIP

#define BACKGROUND_SKIP   (1 << 0)

Definition at line 652 of file pbx_builtins.c.

Referenced by pbx_builtin_background().

◆ WAITEXTEN_DIALTONE

#define WAITEXTEN_DIALTONE   (1 << 1)

Definition at line 665 of file pbx_builtins.c.

Referenced by pbx_builtin_waitexten().

◆ WAITEXTEN_MOH

#define WAITEXTEN_MOH   (1 << 0)

Definition at line 664 of file pbx_builtins.c.

Referenced by pbx_builtin_waitexten().

Function Documentation

◆ load_pbx_builtins()

int load_pbx_builtins ( void  )

Provided by pbx_builtins.c

Definition at line 1504 of file pbx_builtins.c.

References ARRAY_LEN, ast_log, ast_register_application2(), ast_register_cleanup(), builtins, pbx_builtin::execute, LOG_ERROR, pbx_builtin::name, NULL, unload_pbx_builtins(), and ast_channel::x.

Referenced by asterisk_daemon().

1505 {
1506  int x;
1507 
1508  /* Register builtin applications */
1509  for (x = 0; x < ARRAY_LEN(builtins); x++) {
1511  ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);
1512  return -1;
1513  }
1514  }
1515 
1517 
1518  return 0;
1519 }
static SQLHSTMT execute(struct odbc_obj *obj, void *data, int silent)
Common execution function for SQL queries.
Definition: func_odbc.c:453
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
#define NULL
Definition: resample.c:96
#define ast_log
Definition: astobj2.c:42
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Definition: clicompat.c:19
struct pbx_builtin builtins[]
#define LOG_ERROR
Definition: logger.h:285
static void unload_pbx_builtins(void)
static const char name[]
Definition: cdr_mysql.c:74
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.
Definition: pbx_app.c:103

◆ pbx_builtin_gotoif()

static int pbx_builtin_gotoif ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 1238 of file pbx_builtins.c.

References ast_debug, ast_log, ast_strdupa, ast_strlen_zero, LOG_WARNING, pbx_builtin_goto(), pbx_checkcondition(), and strsep().

1239 {
1240  char *condition, *branch1, *branch2, *branch;
1241  char *stringp;
1242 
1243  if (ast_strlen_zero(data)) {
1244  ast_log(LOG_WARNING, "Ignoring, since there is no variable to check\n");
1245  return 0;
1246  }
1247 
1248  stringp = ast_strdupa(data);
1249  condition = strsep(&stringp,"?");
1250  branch1 = strsep(&stringp,":");
1251  branch2 = strsep(&stringp,"");
1252  branch = pbx_checkcondition(condition) ? branch1 : branch2;
1253 
1254  if (ast_strlen_zero(branch)) {
1255  ast_debug(1, "Not taking any branch\n");
1256  return 0;
1257  }
1258 
1259  return pbx_builtin_goto(chan, branch);
1260 }
#define LOG_WARNING
Definition: logger.h:274
int pbx_checkcondition(const char *condition)
Evaluate a condition.
Definition: pbx.c:8302
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:444
#define ast_log
Definition: astobj2.c:42
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
#define ast_strlen_zero(a)
Definition: muted.c:73
char * strsep(char **str, const char *delims)
static int pbx_builtin_goto(struct ast_channel *chan, const char *data)
Definition: pbx_builtins.c:863

◆ pbx_builtin_importvar()

static int pbx_builtin_importvar ( struct ast_channel chan,
const char *  data 
)
static
Todo:
XXX should do !ast_strlen_zero(..) of the args ?

Definition at line 1423 of file pbx_builtins.c.

References ast_alloca, ast_channel_get_by_name(), ast_channel_unref, ast_log, ast_strdupa, ast_strlen_zero, LOG_WARNING, name, pbx_builtin_setvar_helper(), pbx_substitute_variables_helper(), strsep(), tmp(), value, and VAR_BUF_SIZE.

1424 {
1425  char *name;
1426  char *value;
1427  char *channel;
1428  char tmp[VAR_BUF_SIZE];
1429  static int deprecation_warning = 0;
1430 
1431  if (ast_strlen_zero(data)) {
1432  ast_log(LOG_WARNING, "Ignoring, since there is no variable to set\n");
1433  return 0;
1434  }
1435  tmp[0] = 0;
1436  if (!deprecation_warning) {
1437  ast_log(LOG_WARNING, "ImportVar is deprecated. Please use Set(varname=${IMPORT(channel,variable)}) instead.\n");
1438  deprecation_warning = 1;
1439  }
1440 
1441  value = ast_strdupa(data);
1442  name = strsep(&value,"=");
1443  channel = strsep(&value,",");
1444  if (channel && value && name) { /*! \todo XXX should do !ast_strlen_zero(..) of the args ? */
1445  struct ast_channel *chan2 = ast_channel_get_by_name(channel);
1446  if (chan2) {
1447  char *s = ast_alloca(strlen(value) + 4);
1448  sprintf(s, "${%s}", value);
1449  pbx_substitute_variables_helper(chan2, s, tmp, sizeof(tmp) - 1);
1450  chan2 = ast_channel_unref(chan2);
1451  }
1452  pbx_builtin_setvar_helper(chan, name, tmp);
1453  }
1454 
1455  return(0);
1456 }
Main Channel structure associated with a channel.
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2873
#define LOG_WARNING
Definition: logger.h:274
static int tmp()
Definition: bt_open.c:389
Definition: muted.c:95
int value
Definition: syslog.c:37
#define ast_log
Definition: astobj2.c:42
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition: astmm.h:290
#define ast_strlen_zero(a)
Definition: muted.c:73
#define VAR_BUF_SIZE
Definition: pbx_private.h:68
static const char name[]
Definition: cdr_mysql.c:74
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...
char * strsep(char **str, const char *delims)
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
Definition: ael_main.c:211
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Definition: channel.c:1439

◆ pbx_builtin_incomplete()

static int pbx_builtin_incomplete ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 775 of file pbx_builtins.c.

References __ast_answer(), answer(), ast_check_hangup(), AST_CONTROL_INCOMPLETE, ast_indicate(), AST_PBX_INCOMPLETE, AST_STATE_UP, ast_strlen_zero, and options.

776 {
777  const char *options = data;
778  int answer = 1;
779 
780  /* Some channels can receive DTMF in unanswered state; some cannot */
781  if (!ast_strlen_zero(options) && strchr(options, 'n')) {
782  answer = 0;
783  }
784 
785  /* If the channel is hungup, stop waiting */
786  if (ast_check_hangup(chan)) {
787  return -1;
788  } else if (ast_channel_state(chan) != AST_STATE_UP && answer) {
789  __ast_answer(chan, 0);
790  }
791 
793 
794  return AST_PBX_INCOMPLETE;
795 }
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
Definition: channel.c:4271
ast_channel_state
ast_channel states
Definition: channelstate.h:35
const char * data
static int answer(void *data)
Definition: chan_pjsip.c:680
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
Definition: channel.c:441
#define AST_PBX_INCOMPLETE
Definition: pbx.h:51
int __ast_answer(struct ast_channel *chan, unsigned int delay)
Answer a channel, with a selectable delay before returning.
Definition: channel.c:2670
#define ast_strlen_zero(a)
Definition: muted.c:73
static struct test_options options

◆ pbx_builtin_noop()

static int pbx_builtin_noop ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 1233 of file pbx_builtins.c.

1234 {
1235  return 0;
1236 }

◆ pbx_builtin_raise_exception()

int pbx_builtin_raise_exception ( struct ast_channel chan,
const char *  reason 
)

Definition at line 672 of file pbx_builtins.c.

References raise_exception().

673 {
674  /* Priority will become 1, next time through the AUTOLOOP */
675  return raise_exception(chan, reason, 0);
676 }
int raise_exception(struct ast_channel *chan, const char *reason, int priority)
Definition: pbx.c:2806

◆ pbx_builtin_saycharacters()

static int pbx_builtin_saycharacters ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 1385 of file pbx_builtins.c.

References ast_channel_language(), ast_channel_lock, ast_channel_unlock, AST_DIGIT_ANY, AST_SAY_CASE_NONE, ast_say_character_str(), ast_true(), and pbx_builtin_getvar_helper().

1386 {
1387  int res = 0;
1388  int interrupt = 0;
1389  const char *interrupt_string;
1390 
1391  ast_channel_lock(chan);
1392  interrupt_string = pbx_builtin_getvar_helper(chan, "SAY_DTMF_INTERRUPT");
1393  if (ast_true(interrupt_string)) {
1394  interrupt = 1;
1395  }
1396  ast_channel_unlock(chan);
1397 
1398  if (data) {
1399  res = ast_say_character_str(chan, data, interrupt ? AST_DIGIT_ANY : "", ast_channel_language(chan), AST_SAY_CASE_NONE);
1400  }
1401 
1402  return res;
1403 }
#define ast_channel_lock(chan)
Definition: channel.h:2837
#define AST_DIGIT_ANY
Definition: file.h:48
const char * data
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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
Definition: channel.c:8200
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".
Definition: main/utils.c:1822
#define ast_channel_unlock(chan)
Definition: channel.h:2838
const char * ast_channel_language(const struct ast_channel *chan)

◆ pbx_builtin_saycharacters_case()

static int pbx_builtin_saycharacters_case ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 1329 of file pbx_builtins.c.

References args, AST_APP_ARG, ast_channel_language(), ast_channel_lock, ast_channel_unlock, AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, ast_log, AST_SAY_CASE_ALL, AST_SAY_CASE_LOWER, AST_SAY_CASE_NONE, AST_SAY_CASE_UPPER, ast_say_character_str(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero, ast_true(), LOG_WARNING, options, parse(), and pbx_builtin_getvar_helper().

1330 {
1331  int res = 0;
1332  int sensitivity = 0;
1333  char *parse;
1334  int interrupt = 0;
1335  const char *interrupt_string;
1336 
1339  AST_APP_ARG(characters);
1340  );
1341 
1342  ast_channel_lock(chan);
1343  interrupt_string = pbx_builtin_getvar_helper(chan, "SAY_DTMF_INTERRUPT");
1344  if (ast_true(interrupt_string)) {
1345  interrupt = 1;
1346  }
1347  ast_channel_unlock(chan);
1348 
1349  if (ast_strlen_zero(data)) {
1350  ast_log(LOG_WARNING, "SayAlphaCase requires two arguments (options, characters)\n");
1351  return 0;
1352  }
1353 
1354  parse = ast_strdupa(data);
1355  AST_STANDARD_APP_ARGS(args, parse);
1356 
1357  if (!args.options || strlen(args.options) != 1) {
1358  ast_log(LOG_WARNING, "SayAlphaCase options are mutually exclusive and required\n");
1359  return 0;
1360  }
1361 
1362  switch (args.options[0]) {
1363  case 'a':
1364  sensitivity = AST_SAY_CASE_ALL;
1365  break;
1366  case 'l':
1367  sensitivity = AST_SAY_CASE_LOWER;
1368  break;
1369  case 'n':
1370  sensitivity = AST_SAY_CASE_NONE;
1371  break;
1372  case 'u':
1373  sensitivity = AST_SAY_CASE_UPPER;
1374  break;
1375  default:
1376  ast_log(LOG_WARNING, "Invalid option: '%s'\n", args.options);
1377  return 0;
1378  }
1379 
1380  res = ast_say_character_str(chan, args.characters, interrupt ? AST_DIGIT_ANY : "", ast_channel_language(chan), sensitivity);
1381 
1382  return res;
1383 }
#define ast_channel_lock(chan)
Definition: channel.h:2837
#define AST_DIGIT_ANY
Definition: file.h:48
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
const char * args
const char * data
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
#define ast_log
Definition: astobj2.c:42
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
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
Definition: channel.c:8200
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".
Definition: main/utils.c:1822
#define ast_strlen_zero(a)
Definition: muted.c:73
#define ast_channel_unlock(chan)
Definition: channel.h:2838
static void parse(struct mgcp_request *req)
Definition: chan_mgcp.c:1872
const char * ast_channel_language(const struct ast_channel *chan)
static struct test_options options
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
#define AST_APP_ARG(name)
Define an application argument.

◆ pbx_builtin_saydigits()

static int pbx_builtin_saydigits ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 1309 of file pbx_builtins.c.

References ast_channel_language(), ast_channel_lock, ast_channel_unlock, AST_DIGIT_ANY, ast_say_digit_str(), ast_true(), and pbx_builtin_getvar_helper().

1310 {
1311  int res = 0;
1312  int interrupt = 0;
1313  const char *interrupt_string;
1314 
1315  ast_channel_lock(chan);
1316  interrupt_string = pbx_builtin_getvar_helper(chan, "SAY_DTMF_INTERRUPT");
1317  if (ast_true(interrupt_string)) {
1318  interrupt = 1;
1319  }
1320  ast_channel_unlock(chan);
1321 
1322  if (data) {
1323  res = ast_say_digit_str(chan, data, interrupt ? AST_DIGIT_ANY : "", ast_channel_language(chan));
1324  }
1325 
1326  return res;
1327 }
#define ast_channel_lock(chan)
Definition: channel.h:2837
#define AST_DIGIT_ANY
Definition: file.h:48
int ast_say_digit_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
says digits of a string
Definition: channel.c:8194
const char * data
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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".
Definition: main/utils.c:1822
#define ast_channel_unlock(chan)
Definition: channel.h:2838
const char * ast_channel_language(const struct ast_channel *chan)

◆ pbx_builtin_saynumber()

static int pbx_builtin_saynumber ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 1262 of file pbx_builtins.c.

References ast_channel_language(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), AST_DIGIT_ANY, ast_log, ast_say_number(), ast_strlen_zero, ast_true(), LOG_WARNING, options, pbx_builtin_getvar_helper(), strsep(), and tmp().

1263 {
1264  char tmp[256];
1265  char *number = tmp;
1266  int number_val;
1267  char *options;
1268  int res;
1269  int interrupt = 0;
1270  const char *interrupt_string;
1271 
1272  ast_channel_lock(chan);
1273  interrupt_string = pbx_builtin_getvar_helper(chan, "SAY_DTMF_INTERRUPT");
1274  if (ast_true(interrupt_string)) {
1275  interrupt = 1;
1276  }
1277  ast_channel_unlock(chan);
1278 
1279  if (ast_strlen_zero(data)) {
1280  ast_log(LOG_WARNING, "SayNumber requires an argument (number)\n");
1281  return -1;
1282  }
1283  ast_copy_string(tmp, data, sizeof(tmp));
1284  strsep(&number, ",");
1285 
1286  if (sscanf(tmp, "%d", &number_val) != 1) {
1287  ast_log(LOG_WARNING, "argument '%s' to SayNumber could not be parsed as a number.\n", tmp);
1288  return 0;
1289  }
1290 
1291  options = strsep(&number, ",");
1292  if (options) {
1293  if ( strcasecmp(options, "f") && strcasecmp(options, "m") &&
1294  strcasecmp(options, "c") && strcasecmp(options, "n") ) {
1295  ast_log(LOG_WARNING, "SayNumber gender option is either 'f', 'm', 'c' or 'n'\n");
1296  return -1;
1297  }
1298  }
1299 
1300  res = ast_say_number(chan, number_val, interrupt ? AST_DIGIT_ANY : "", ast_channel_language(chan), options);
1301 
1302  if (res < 0) {
1303  ast_log(LOG_WARNING, "We were unable to say the number %s, is it too large?\n", tmp);
1304  }
1305 
1306  return interrupt ? res : 0;
1307 }
#define ast_channel_lock(chan)
Definition: channel.h:2837
#define AST_DIGIT_ANY
Definition: file.h:48
#define LOG_WARNING
Definition: logger.h:274
static int tmp()
Definition: bt_open.c:389
const char * data
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
Number structure.
Definition: app_followme.c:154
#define ast_log
Definition: astobj2.c:42
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".
Definition: main/utils.c:1822
#define ast_strlen_zero(a)
Definition: muted.c:73
#define ast_channel_unlock(chan)
Definition: channel.h:2838
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
Definition: channel.c:8176
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
const char * ast_channel_language(const struct ast_channel *chan)
static struct test_options options

◆ pbx_builtin_sayphonetic()

static int pbx_builtin_sayphonetic ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 1405 of file pbx_builtins.c.

References ast_channel_language(), ast_channel_lock, ast_channel_unlock, AST_DIGIT_ANY, ast_say_phonetic_str(), ast_true(), and pbx_builtin_getvar_helper().

1406 {
1407  int res = 0;
1408  int interrupt = 0;
1409  const char *interrupt_string;
1410 
1411  ast_channel_lock(chan);
1412  interrupt_string = pbx_builtin_getvar_helper(chan, "SAY_DTMF_INTERRUPT");
1413  if (ast_true(interrupt_string)) {
1414  interrupt = 1;
1415  }
1416  ast_channel_unlock(chan);
1417 
1418  if (data)
1419  res = ast_say_phonetic_str(chan, data, interrupt ? AST_DIGIT_ANY : "", ast_channel_language(chan));
1420  return res;
1421 }
#define ast_channel_lock(chan)
Definition: channel.h:2837
#define AST_DIGIT_ANY
Definition: file.h:48
const char * data
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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".
Definition: main/utils.c:1822
#define ast_channel_unlock(chan)
Definition: channel.h:2838
int ast_say_phonetic_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
Definition: channel.c:8206
const char * ast_channel_language(const struct ast_channel *chan)

◆ unload_pbx_builtins()

static void unload_pbx_builtins ( void  )
static

Definition at line 1494 of file pbx_builtins.c.

References ARRAY_LEN, ast_unregister_application(), builtins, pbx_builtin::name, and ast_channel::x.

Referenced by load_pbx_builtins().

1495 {
1496  int x;
1497 
1498  /* Unregister builtin applications */
1499  for (x = 0; x < ARRAY_LEN(builtins); x++) {
1501  }
1502 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
struct pbx_builtin builtins[]
static const char name[]
Definition: cdr_mysql.c:74
char x
Definition: extconf.c:81

Variable Documentation

◆ background_opts

const struct ast_app_option background_opts[128] = { [ 's' ] = { .flag = (1 << 0) }, [ 'n' ] = { .flag = (1 << 1) }, [ 'm' ] = { .flag = (1 << 2) }, [ 'p' ] = { .flag = (1 << 3) }, }
static

Definition at line 662 of file pbx_builtins.c.

Referenced by pbx_builtin_background().

◆ builtins

struct pbx_builtin builtins[]

◆ waitexten_opts

const struct ast_app_option waitexten_opts[128] = { [ 'm' ] = { .flag = (1 << 0) , .arg_index = 0 + 1 }, [ 'd' ] = { .flag = (1 << 1) , .arg_index = 0 + 1 }, }
static

Definition at line 670 of file pbx_builtins.c.

Referenced by pbx_builtin_waitexten().