2 * Asterisk -- A telephony toolkit for Linux.
4 * Say numbers and dates (maybe words one day too)
6 * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
8 * Mark Spencer <markster@linux-support.net>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
14 #include <asterisk/file.h>
15 #include <asterisk/channel.h>
16 #include <asterisk/logger.h>
17 #include <asterisk/say.h>
20 int ast_say_digit_str(struct ast_channel *chan, char *fn2)
25 while(fn2[num] && !res) {
26 snprintf(fn, sizeof(fn), "digits/%c", fn2[num]);
27 res = ast_streamfile(chan, fn);
29 res = ast_waitstream(chan, AST_DIGIT_ANY);
36 int ast_say_digits(struct ast_channel *chan, int num)
39 snprintf(fn2, sizeof(fn2), "%d", num);
40 return ast_say_digit_str(chan, fn2);
42 int ast_say_number(struct ast_channel *chan, int num)
48 snprintf(fn, sizeof(fn), "digits/%d", num);
52 snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
53 num -= ((num / 10) * 10);
55 ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
59 res = ast_streamfile(chan, fn);
61 res = ast_waitstream(chan, AST_DIGIT_ANY);