120 if (!strcmp(
type,
"alpha")) {
122 }
else if (!strcmp(
type,
"phonetic")) {
124 }
else if (!strcmp(
type,
"digits")) {
126 }
else if (!strcmp(
type,
"number")) {
133 }
else if (!strcmp(
type,
"ordinal")) {
140 }
else if (!strcmp(
type,
"money")) {
151 snprintf(
buf,
len,
"%s", files);
170 info->name =
"test_SAYFILES_function";
171 info->category =
"/funcs/func_sayfiles/";
172 info->summary =
"Test SAYFILES function substitution";
174 "Executes a series of variable substitutions using the SAYFILES function and ensures that the expected results are received.";
190 ast_str_set(&expr, 0,
"${SAYFILES(hi Th3re,alpha)}");
192 if (strcmp(
ast_str_buffer(
result),
"letters/h&letters/i&letters/space&letters/t&letters/h&digits/3&letters/r&letters/e") != 0) {
198 ast_str_set(&expr, 0,
"${SAYFILES(phreak,phonetic)}");
200 if (strcmp(
ast_str_buffer(
result),
"phonetic/p_p&phonetic/h_p&phonetic/r_p&phonetic/e_p&phonetic/a_p&phonetic/k_p") != 0) {
215 ast_str_set(&expr, 0,
"${SAYFILES(+18005551212,digits)}");
217 if (strcmp(
ast_str_buffer(
result),
"digits/1&digits/8&digits/0&digits/0&digits/5&digits/5&digits/5&digits/1&digits/2&digits/1&digits/2") != 0) {
255 ast_str_set(&expr, 0,
"${SAYFILES(2001000001,number)}");
257 if (strcmp(
ast_str_buffer(
result),
"digits/2&digits/billion&digits/1&digits/million&digits/1") != 0) {
279 ast_str_set(&expr, 0,
"${SAYFILES(1042,ordinal)}");
287 ast_str_set(&expr, 0,
"${SAYFILES(11042,ordinal)}");
295 ast_str_set(&expr, 0,
"${SAYFILES(40000,ordinal)}");
303 ast_str_set(&expr, 0,
"${SAYFILES(43638,ordinal)}");
305 if (strcmp(
ast_str_buffer(
result),
"digits/40&digits/3&digits/thousand&digits/6&digits/hundred&digits/30&digits/h-8") != 0) {
311 ast_str_set(&expr, 0,
"${SAYFILES(1000000,ordinal)}");
319 ast_str_set(&expr, 0,
"${SAYFILES(1000001,ordinal)}");
327 ast_str_set(&expr, 0,
"${SAYFILES(2001000001,ordinal)}");
329 if (strcmp(
ast_str_buffer(
result),
"digits/2&digits/billion&digits/1&digits/million&digits/h-1") != 0) {
377 if (strcmp(
ast_str_buffer(
result),
"digits/1&letters/dollar_&and&digits/40&digits/2¢s") != 0) {
432 ast_str_set(&expr, 0,
"${SAYFILES(2blah.05,money)}");
Asterisk main include file. File version handling, generic pbx functions.
General Asterisk PBX channel definitions.
const char * ast_channel_language(const struct ast_channel *chan)
Conversion utility functions.
int ast_str_to_int(const char *str, int *res)
Convert the given string to a signed integer.
Generic File Format Support. Should be included by clients of the file handling routines....
static struct ast_custom_function sayfiles
static int sayfile_exec(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int load_module(void)
static int unload_module(void)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
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.
Custom localtime functions for multiple timezones.
Asterisk locking-related definitions:
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Core PBX routines and definitions.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
Say numbers and dates (maybe words one day too)
struct ast_str * ast_get_ordinal_str(int num, const char *lang)
Returns an ast_str of files for SayOrdinal playback.
struct ast_str * ast_get_character_str(const char *str, const char *lang, enum ast_say_case_sensitivity sensitivity)
Returns an ast_str of files for SayAlpha playback.
struct ast_str * ast_get_number_str(int num, const char *lang)
Returns an ast_str of files for SayNumber playback.
struct ast_str * ast_get_phonetic_str(const char *str, const char *lang)
Returns an ast_str of files for SayPhonetic playback.
struct ast_str * ast_get_money_str(const char *str, const char *lang)
Returns an ast_str of files for SayMoney playback.
struct ast_str * ast_get_digit_str(const char *str, const char *lang)
Returns an ast_str of files for SayDigits playback.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Support for dynamic strings.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
#define AST_TEST_DEFINE(hdr)