--- asterisk-1.8.15.0-CLEAN/main/pbx.c 2012-07-10 09:33:53.000000000 -0400 +++ asterisk-1.8.15.0-0.2.0/main/pbx.c 2013-01-15 12:22:42.000000000 -0500 @@ -518,10 +518,24 @@ + + + + + + This application will play the sounds that correspond to the letters of the - given string. + given string. Optionally, a casetype may be + specified. This will is used for case-insensitive or case-sensitive pronunciations. + No option given wil default to normal operation of case insensitive. SayDigits @@ -806,6 +820,14 @@ AST_APP_OPTION('p', BACKGROUND_PLAYBACK), }); +#define SAYALPHA_CASE_INSENSITIVE (1 << 0) +#define SAYALPHA_CASE_SENSITIVE (1 << 1) + +AST_APP_OPTIONS(sayalpha_opts, { + AST_APP_OPTION('i', SAYALPHA_CASE_INSENSITIVE), + AST_APP_OPTION('s', SAYALPHA_CASE_SENSITIVE), +}); + #define WAITEXTEN_MOH (1 << 0) #define WAITEXTEN_DIALTONE (1 << 1) @@ -10222,10 +10244,33 @@ static int pbx_builtin_saycharacters(struct ast_channel *chan, const char *data) { - int res = 0; + int res = 0, casesensitive = 0; + char *parse; + AST_DECLARE_APP_ARGS(args, + AST_APP_ARG(characters); + AST_APP_ARG(options); + ); + + if (ast_strlen_zero(data)) { + ast_log(LOG_WARNING, "SayAlpha requires an argument (characters)\n"); + return 0; + } + + parse = ast_strdupa(data); + AST_STANDARD_APP_ARGS(args, parse); + + if (args.options) { + if (strcasecmp(args.options, "i") && strcasecmp(args.options, "s")) { + ast_log(LOG_WARNING, "SayAlpha case sensitive option is either 'i' or 's'\n"); + return 0; + } + if (!strcasecmp(args.options, "s")) { + casesensitive = 1; + } + } + + res = ast_say_character_str(chan, args.characters, "", chan->language, casesensitive); - if (data) - res = ast_say_character_str(chan, data, "", chan->language); return res; }