42#include <netinet/in.h>
48#include <iso/limits_iso.h>
66 char fnbuf[10], asciibuf[20] =
"letters/ascii";
79 while (
str[num] && !res) {
89 fn =
"letters/exclaimation-point";
95 fn =
"letters/dollar";
104 fn =
"letters/equals";
110 fn =
"letters/slash";
113 fn =
"letters/space";
125 strcpy(fnbuf,
"digits/X");
131 if (
'A' <= ltr && ltr <=
'Z') {
133 switch (sensitivity) {
141 }
else if (
'a' <= ltr && ltr <=
'z') {
142 switch (sensitivity) {
153 strcpy(fnbuf,
"uppercase");
155 strcpy(fnbuf,
"lowercase");
157 strcpy(fnbuf,
"letters/X");
163 (snprintf(asciibuf + 13,
sizeof(asciibuf) - 13,
"%d",
str[num]) > 0 &&
ast_fileexists(asciibuf,
NULL, lang) > 0 && (fn = asciibuf))) {
166 if (upper || lower) {
193 while (!res && (fn =
strsep(&files,
"&"))) {
196 if ((audiofd > -1) && (ctrlfd > -1)) {
213 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
239 fn =
"letters/exclaimation-point";
245 fn =
"letters/dollar";
254 fn =
"letters/equals";
260 fn =
"letters/slash";
263 fn =
"letters/space";
274 strcpy(fnbuf,
"digits/X");
280 if (
'A' <= ltr && ltr <=
'Z') ltr +=
'a' -
'A';
281 strcpy(fnbuf,
"phonetic/X_p");
297 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
334 strcpy(fnbuf,
"digits/X");
351 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
357 int amt, dollars = 0, cents = 0;
374 if (sscanf(
str,
".%02u", ¢s) < 1) {
379 const char *period = strchr(
str,
'.');
380 if (period && !isdigit(*(period + 1))) {
385 int res = sscanf(
str,
"%d.%02u", &dollars, ¢s);
388 }
else if (res == 2) {
389 const char *period = strchr(
str,
'.');
390 if (period && !isdigit(*(period + 1))) {
395 amt = dollars * 100 + cents;
397 ast_debug(1,
"Amount is %d (%d dollar%s, %d cent%s)\n", amt, dollars,
ESS(dollars), cents,
ESS(cents));
410 ast_str_append(&filenames, 0,
"&%s", (cents > 0) ?
"letters/dollar_" :
"letters/dollar");
429 ast_str_append(&filenames, 0,
"&%s", (cents == 1) ?
"cent" :
"cents");
430 }
else if (amt == 0) {
451 if (!strncasecmp(lang,
"en", 2)) {
455 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to US Dollars\n", lang);
463 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
487 while (!res && (num || playh)) {
490 if ( num > INT_MIN ) {
498 }
else if (num < 20) {
499 snprintf(fn,
sizeof(fn),
"digits/%d", num);
501 }
else if (num < 100) {
502 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
506 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
520 snprintf(fn,
sizeof(fn),
"&digits/thousand");
522 if (num < 1000000000) {
568 if (!strncasecmp(lang,
"en", 2)) {
572 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to English\n", lang);
598 while (!res && (num || playh)) {
601 if ( num > INT_MIN ) {
607 ast_copy_string(fn, (num % 100 == 0) ?
"digits/h-hundred" :
"digits/hundred",
sizeof(fn));
609 }
else if (num < 20) {
611 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
616 }
else if (num < 100) {
617 int base = (num / 10) * 10;
619 snprintf(fn,
sizeof(fn),
"digits/%d", base);
621 snprintf(fn,
sizeof(fn),
"digits/h-%d", base);
626 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
640 snprintf(fn,
sizeof(fn), (num % 1000 == 0) ?
"&digits/h-thousand" :
"&digits/thousand");
642 if (num < 1000000000) {
651 ast_copy_string(fn, (num % 1000000 == 0) ?
"&digits/h-million" :
"&digits/million",
sizeof(fn));
662 ast_copy_string(fn, (num % 1000000000 == 0) ?
"&digits/h-billion" :
"&digits/billion",
sizeof(fn));
688 if (!strncasecmp(lang,
"en", 2)) {
692 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to English\n", lang);
877 if (!strncasecmp(
language,
"en_GB", 5)) {
879 }
else if (!strncasecmp(
language,
"en", 2)) {
881 }
else if (!strncasecmp(
language,
"cs", 2)) {
883 }
else if (!strncasecmp(
language,
"da", 2)) {
885 }
else if (!strncasecmp(
language,
"de", 2)) {
887 }
else if (!strncasecmp(
language,
"es", 2)) {
889 }
else if (!strncasecmp(
language,
"fr", 2)) {
891 }
else if (!strncasecmp(
language,
"gr", 2)) {
893 }
else if (!strncasecmp(
language,
"ja", 2)) {
895 }
else if (!strncasecmp(
language,
"he", 2)) {
897 }
else if (!strncasecmp(
language,
"hu", 2)) {
899 }
else if (!strncasecmp(
language,
"is", 2)) {
901 }
else if (!strncasecmp(
language,
"it", 2)) {
903 }
else if (!strncasecmp(
language,
"ka", 2)) {
905 }
else if (!strncasecmp(
language,
"nl", 2)) {
907 }
else if (!strncasecmp(
language,
"no", 2)) {
909 }
else if (!strncasecmp(
language,
"pl", 2)) {
911 }
else if (!strncasecmp(
language,
"pt", 2)) {
913 }
else if (!strncasecmp(
language,
"ru", 2)) {
915 }
else if (!strncasecmp(
language,
"se", 2)) {
917 }
else if (!strncasecmp(
language,
"th", 2)) {
919 }
else if (!strncasecmp(
language,
"zh", 2)) {
921 }
else if (!strncasecmp(
language,
"ur", 2)) {
923 }
else if (!strncasecmp(
language,
"vi", 2)) {
949 for (x=0;x<power;x++)
993 while (!res && (num || playh)) {
996 if ( num > INT_MIN ) {
1001 }
else if (num < 3 ) {
1002 snprintf(fn,
sizeof(fn),
"digits/%d%c", num,
options[0]);
1005 }
else if (num < 20) {
1006 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1009 }
else if (num < 100) {
1010 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1012 }
else if (num < 1000) {
1013 hundred = num / 100;
1014 if ( hundred == 1 ) {
1016 }
else if ( hundred == 2 ) {
1022 if (hundred == 3 || hundred == 4) {
1024 }
else if ( hundred > 4 ) {
1028 num -= (hundred * 100);
1030 length = (int)log10(num)+1;
1031 while ( (length % 3 ) != 1 ) {
1048 snprintf(fn,
sizeof(fn),
"digits/5_E%d", length - 1);
1049 }
else if ( left >= 2 && left <= 4 ) {
1050 snprintf(fn,
sizeof(fn),
"digits/2-4_E%d", length - 1);
1052 snprintf(fn,
sizeof(fn),
"digits/1_E%d", length - 1);
1058 if ((audiofd > -1) && (ctrlfd > -1)) {
1086 while (!res && (num || playh || playa )) {
1099 if ( num > INT_MIN ) {
1110 }
else if (num == 1 && cn == -1) {
1113 }
else if (num < 20) {
1114 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1116 }
else if (num < 100) {
1117 int ones = num % 10;
1119 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
1122 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1127 int hundreds = num / 100;
1131 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1134 num -= 100 * hundreds;
1139 if (num < 1000000) {
1146 if (num < 1000000000) {
1147 int millions = num / 1000000;
1155 num = num % 1000000;
1157 ast_debug(1,
"Number '%d' is too big for me\n", num);
1161 if (num && num < 100)
1167 if ((audiofd > -1) && (ctrlfd > -1))
1200 while (!res && num) {
1216 if ( num > INT_MIN ) {
1221 }
else if (num == 1 && mf == -1) {
1222 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1224 }
else if (num < 20) {
1225 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1227 }
else if (num < 100) {
1228 int ones = num % 10;
1230 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
1233 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1236 }
else if (num == 100 && t == 0) {
1239 }
else if (num < 1000) {
1240 int hundreds = num / 100;
1242 if (hundreds == 1) {
1245 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1248 }
else if (num == 1000 && t == 0) {
1251 }
else if (num < 1000000) {
1252 int thousands = num / 1000;
1255 if (thousands == 1) {
1264 }
else if (num < 1000000000) {
1265 int millions = num / 1000000;
1266 num = num % 1000000;
1268 if (millions == 1) {
1277 }
else if (num <= INT_MAX) {
1278 int billions = num / 1000000000;
1279 num = num % 1000000000;
1281 if (billions == 1) {
1292 ast_debug(1,
"Number '%d' is too big for me\n", num);
1297 if ((audiofd > -1) && (ctrlfd > -1))
1305 if ((audiofd > -1) && (ctrlfd > -1))
1331 while (!res && (num || playh || playa )) {
1334 if ( num > INT_MIN ) {
1345 }
else if (num < 20) {
1346 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1348 }
else if (num < 100) {
1349 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1351 }
else if (num < 1000) {
1352 int hundreds = num / 100;
1353 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1356 num -= 100 * hundreds;
1359 }
else if (num < 1000000) {
1365 if (num && num < 100)
1367 }
else if (num < 1000000000) {
1368 int millions = num / 1000000;
1374 if (num && num < 100)
1377 ast_debug(1,
"Number '%d' is too big for me\n", num);
1383 if ((audiofd > -1) && (ctrlfd > -1))
1411 if (!strncasecmp(
options,
"f", 1))
1413 else if (!strncasecmp(
options,
"m", 1))
1417 while (!res && num) {
1420 if ( num > INT_MIN ) {
1428 }
else if (num == 1) {
1430 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1432 snprintf(fn,
sizeof(fn),
"digits/%dM", num);
1434 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1436 }
else if (num < 31) {
1437 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1439 }
else if (num < 100) {
1440 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1444 }
else if (num == 100) {
1447 }
else if (num < 200) {
1452 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100)*100);
1454 }
else if (num < 2000) {
1458 if (num < 1000000) {
1465 if (num < 2147483640) {
1466 if ((num/1000000) == 1) {
1479 ast_debug(1,
"Number '%d' is too big for me\n", num);
1488 if ((audiofd > -1) && (ctrlfd > -1))
1518 while (!res && (num || playh || playa)) {
1521 if ( num > INT_MIN ) {
1532 }
else if (num == 1) {
1534 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1536 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1538 }
else if (num < 21) {
1539 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1541 }
else if (num < 70) {
1542 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1543 if ((num % 10) == 1) playa++;
1545 }
else if (num < 80) {
1547 if ((num % 10) == 1) playa++;
1549 }
else if (num < 100) {
1552 }
else if (num < 200) {
1555 }
else if (num < 1000) {
1556 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
1559 }
else if (num < 2000) {
1562 }
else if (num < 1000000) {
1568 }
else if (num < 1000000000) {
1573 num = num % 1000000;
1575 ast_debug(1,
"Number '%d' is too big for me\n", num);
1580 if ((audiofd > -1) && (ctrlfd > -1))
1596#define SAY_NUM_BUF_SIZE 256
1606 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num,
options);
1614 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d\n", num,
state,
options, mf);
1617 while (!res && (num || (
state > 0))) {
1625 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d, tmpnum=%d\n", num,
state,
options, mf, tmpnum);
1629 }
else if (
state == 2) {
1630 if ((num >= 11) && (num < 21)) {
1632 snprintf(fn,
sizeof(fn),
"digits/ve");
1634 snprintf(fn,
sizeof(fn),
"digits/uu");
1639 snprintf(fn,
sizeof(fn),
"digits/ve");
1642 snprintf(fn,
sizeof(fn),
"digits/uu");
1646 snprintf(fn,
sizeof(fn),
"digits/ve");
1648 snprintf(fn,
sizeof(fn),
"digits/uu");
1652 snprintf(fn,
sizeof(fn),
"digits/ve");
1655 snprintf(fn,
sizeof(fn),
"digits/ve");
1658 snprintf(fn,
sizeof(fn),
"digits/ve");
1661 snprintf(fn,
sizeof(fn),
"digits/ve");
1664 snprintf(fn,
sizeof(fn),
"digits/uu");
1667 snprintf(fn,
sizeof(fn),
"digits/ve");
1670 snprintf(fn,
sizeof(fn),
"digits/ve");
1675 }
else if (
state == 3) {
1676 snprintf(fn,
sizeof(fn),
"digits/1k");
1678 }
else if (num < 0) {
1679 snprintf(fn,
sizeof(fn),
"digits/minus");
1681 }
else if (num < 20) {
1683 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1685 snprintf(fn,
sizeof(fn),
"digits/%dm", num);
1688 }
else if ((num < 100) && (num >= 20)) {
1689 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
1694 }
else if ((num >= 100) && (num < 1000)) {
1696 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
1697 num = num - (tmpnum * 100);
1698 if ((num > 0) && (num < 11)) {
1701 }
else if ((num >= 1000) && (num < 10000)) {
1702 tmpnum = num / 1000;
1703 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
1704 num = num - (tmpnum * 1000);
1705 if ((num > 0) && (num < 11)) {
1708 }
else if (num < 20000) {
1709 snprintf(fn,
sizeof(fn),
"digits/%dm", (num / 1000));
1712 }
else if (num < 1000000) {
1717 snprintf(fn,
sizeof(fn),
"digits/1k");
1719 if ((num > 0) && (num < 11)) {
1722 }
else if (num < 2000000) {
1723 snprintf(fn,
sizeof(fn),
"digits/million");
1724 num = num % 1000000;
1725 if ((num > 0) && (num < 11)) {
1728 }
else if (num < 3000000) {
1729 snprintf(fn,
sizeof(fn),
"digits/twomillion");
1730 num = num - 2000000;
1731 if ((num > 0) && (num < 11)) {
1734 }
else if (num < 1000000000) {
1739 snprintf(fn,
sizeof(fn),
"digits/million");
1740 num = num % 1000000;
1741 if ((num > 0) && (num < 11)) {
1745 ast_debug(1,
"Number '%d' is too big for me\n", num);
1751 if ((audiofd > -1) && (ctrlfd > -1)) {
1783 while(!res && (num || playh)) {
1786 if ( num > INT_MIN ) {
1794 }
else if (num < 11 || num == 20) {
1795 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1797 }
else if (num < 20) {
1800 }
else if (num < 30) {
1803 }
else if (num < 100) {
1804 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1808 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
1812 if (num < 1000000) {
1819 if (num < 1000000000) {
1826 ast_debug(1,
"Number '%d' is too big for me\n", num);
1834 if ((audiofd > -1) && (ctrlfd > -1))
1865 while (!res && (num || playh || playa )) {
1868 if ( num > INT_MIN ) {
1882 }
else if (num < 5 && cn == 2) {
1883 snprintf(fn,
sizeof(fn),
"digits/%dkvk", num);
1885 }
else if (num < 5 && cn == 3) {
1886 snprintf(fn,
sizeof(fn),
"digits/%dhk", num);
1888 }
else if (num < 20) {
1889 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1891 }
else if (num < 100) {
1892 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1896 }
else if (num < 1000) {
1897 int hundreds = num / 100;
1900 snprintf(fn,
sizeof(fn),
"digits/%dhk", hundreds);
1902 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1905 num -= 100 * hundreds;
1906 if (num && num < 20)
1909 if (num && (num % 10) == 0)
1911 }
else if (num < 1000000) {
1914 if ((num % 100) == 0 && (num % 1000 != 0)) {
1921 if (num && (num < 20 || (num % 10 == 0)))
1923 }
else if (num < 1000000000) {
1924 int millions = num / 1000000;
1934 if (num && num < 100)
1936 }
else if (num < INT_MAX) {
1937 int milliards = num / 1000000000;
1947 if (num && num < 100)
1950 ast_debug(1,
"Number '%d' is too big for me\n", num);
1956 if ((audiofd > -1) && (ctrlfd > -1))
2003 while (!res && (num || playh)) {
2006 if ( num > INT_MIN ) {
2014 }
else if (num < 20) {
2015 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2017 }
else if (num == 21) {
2018 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2020 }
else if (num == 28) {
2021 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2023 }
else if (num == 31) {
2024 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2026 }
else if (num == 38) {
2027 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2029 }
else if (num == 41) {
2030 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2032 }
else if (num == 48) {
2033 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2035 }
else if (num == 51) {
2036 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2038 }
else if (num == 58) {
2039 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2041 }
else if (num == 61) {
2042 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2044 }
else if (num == 68) {
2045 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2047 }
else if (num == 71) {
2048 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2050 }
else if (num == 78) {
2051 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2053 }
else if (num == 81) {
2054 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2056 }
else if (num == 88) {
2057 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2059 }
else if (num == 91) {
2060 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2062 }
else if (num == 98) {
2063 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2065 }
else if (num < 100) {
2066 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2070 if ((num / 100) > 1) {
2071 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2078 if (num < 1000000) {
2085 if ((tempnum / 1000) < 2)
2090 if (num < 1000000000) {
2091 if ((num / 1000000) > 1)
2097 if ((tempnum / 1000000) < 2)
2102 ast_debug(1,
"Number '%d' is too big for me\n", num);
2110 if ((audiofd > -1) && (ctrlfd > -1))
2132 while (!res && (num || playh )) {
2135 if ( num > INT_MIN ) {
2143 }
else if (num < 20) {
2144 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2146 }
else if (num < 100) {
2155 snprintf(fn,
sizeof(fn),
"digits/%d", num - units);
2158 }
else if (num < 200) {
2162 }
else if (num < 1000) {
2163 snprintf(fn,
sizeof(fn),
"digits/%d", num / 100);
2171 }
else if (num < 10000) {
2178 if (num < 1000000) {
2185 if (num < 1000000000) {
2192 ast_debug(1,
"Number '%d' is too big for me\n", num);
2201 if ((audiofd > -1) && (ctrlfd > -1))
2235 while (!res && (num || playh || playa )) {
2238 if ( num > INT_MIN ) {
2249 }
else if (num == 1 && cn == -1) {
2252 }
else if (num < 20) {
2253 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2255 }
else if (num < 100) {
2256 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2258 }
else if (num < 1000) {
2259 int hundreds = num / 100;
2263 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2266 num -= 100 * hundreds;
2269 }
else if (num < 1000000) {
2275 if (num && num < 100)
2277 }
else if (num < 1000000000) {
2278 int millions = num / 1000000;
2284 if (num && num < 100)
2287 ast_debug(1,
"Number '%d' is too big for me\n", num);
2293 if ((audiofd > -1) && (ctrlfd > -1))
2309 char *dziesiatki[10];
2320 return odm->
rzedy[rzad - 1][0];
2321 if ((i > 21 || i < 11) && i%10 > 1 && i%10 < 5)
2322 return odm->
rzedy[rzad - 1][1];
2324 return odm->
rzedy[rzad - 1][2];
2329 strcpy(buffer,
str);
2330 buffer += strlen(
str);
2336 char file_name[255] =
"digits/";
2337 strcat(file_name, fn);
2338 ast_debug(1,
"Trying to play: %s\n", file_name);
2340 if ((audiofd > -1) && (ctrlfd > -1))
2360 if (i == 0 && rzad > 0) {
2368 m1000E6 = i % 1000000000;
2369 i1000E6 = i / 1000000000;
2373 m1000E3 = m1000E6 % 1000000;
2374 i1000E3 = m1000E6 / 1000000;
2378 m1000 = m1000E3 % 1000;
2379 i1000 = m1000E3 / 1000;
2389 if (m100 > 0 && m100 <= 9) {
2394 }
else if (m100 % 10 == 0 && m100 != 0) {
2396 }
else if (m100 > 10 && m100 <= 19) {
2398 }
else if (m100 > 20) {
2511 char *zenski_cyfry[] = {
"0",
"1z",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2513 char *zenski_cyfry2[] = {
"0",
"1",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2515 char *meski_cyfry[] = {
"0",
"1",
"2-1m",
"3-1m",
"4-1m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2517 char *meski_cyfry2[] = {
"0",
"1",
"2-2m",
"3-2m",
"4-2m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2519 char *meski_setki[] = {
"",
"100m",
"200m",
"300m",
"400m",
"500m",
"600m",
"700m",
"800m",
"900m"};
2521 char *meski_dziesiatki[] = {
"",
"10m",
"20m",
"30m",
"40m",
"50m",
"60m",
"70m",
"80m",
"90m"};
2523 char *meski_nastki[] = {
"",
"11m",
"12m",
"13m",
"14m",
"15m",
"16m",
"17m",
"18m",
"19m"};
2525 char *nijaki_cyfry[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2527 char *nijaki_cyfry2[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2529 char *nijaki_setki[] = {
"",
"100",
"200",
"300",
"400",
"500",
"600",
"700",
"800",
"900"};
2531 char *nijaki_dziesiatki[] = {
"",
"10",
"20",
"30",
"40",
"50",
"60",
"70",
"80",
"90"};
2533 char *nijaki_nastki[] = {
"",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19"};
2535 char *rzedy[][3] = { {
"1000",
"1000.2",
"1000.5"}, {
"1000000",
"1000000.2",
"1000000.5"}, {
"1000000000",
"1000000000.2",
"1000000000.5"}};
2544 if (odmiana_nieosobowa ==
NULL) {
2545 odmiana_nieosobowa =
ast_malloc(
sizeof(*odmiana_nieosobowa));
2549 memcpy(odmiana_nieosobowa->
cyfry, nijaki_cyfry,
sizeof(odmiana_nieosobowa->
cyfry));
2550 memcpy(odmiana_nieosobowa->
cyfry2, nijaki_cyfry2,
sizeof(odmiana_nieosobowa->
cyfry));
2551 memcpy(odmiana_nieosobowa->
setki, nijaki_setki,
sizeof(odmiana_nieosobowa->
setki));
2552 memcpy(odmiana_nieosobowa->
dziesiatki, nijaki_dziesiatki,
sizeof(odmiana_nieosobowa->
dziesiatki));
2553 memcpy(odmiana_nieosobowa->
nastki, nijaki_nastki,
sizeof(odmiana_nieosobowa->
nastki));
2554 memcpy(odmiana_nieosobowa->
rzedy, rzedy,
sizeof(odmiana_nieosobowa->
rzedy));
2557 if (odmiana_zenska ==
NULL) {
2558 odmiana_zenska =
ast_malloc(
sizeof(*odmiana_zenska));
2562 memcpy(odmiana_zenska->
cyfry, zenski_cyfry,
sizeof(odmiana_zenska->
cyfry));
2563 memcpy(odmiana_zenska->
cyfry2, zenski_cyfry2,
sizeof(odmiana_zenska->
cyfry));
2564 memcpy(odmiana_zenska->
setki, nijaki_setki,
sizeof(odmiana_zenska->
setki));
2566 memcpy(odmiana_zenska->
nastki, nijaki_nastki,
sizeof(odmiana_zenska->
nastki));
2567 memcpy(odmiana_zenska->
rzedy, rzedy,
sizeof(odmiana_zenska->
rzedy));
2570 if (odmiana_meska ==
NULL) {
2571 odmiana_meska =
ast_malloc(
sizeof(*odmiana_meska));
2575 memcpy(odmiana_meska->
cyfry, meski_cyfry,
sizeof(odmiana_meska->
cyfry));
2576 memcpy(odmiana_meska->
cyfry2, meski_cyfry2,
sizeof(odmiana_meska->
cyfry));
2577 memcpy(odmiana_meska->
setki, meski_setki,
sizeof(odmiana_meska->
setki));
2579 memcpy(odmiana_meska->
nastki, meski_nastki,
sizeof(odmiana_meska->
nastki));
2580 memcpy(odmiana_meska->
rzedy, rzedy,
sizeof(odmiana_meska->
rzedy));
2584 if (strncasecmp(
options,
"f", 1) == 0)
2586 else if (strncasecmp(
options,
"m", 1) == 0)
2589 o = odmiana_nieosobowa;
2591 o = odmiana_nieosobowa;
2618 while (!res && num ) {
2621 if ( num > INT_MIN ) {
2626 }
else if (num < 20) {
2627 if ((num == 1 || num == 2) && (mf < 0))
2628 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
2630 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2632 }
else if (num < 100) {
2633 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
2637 }
else if (num < 1000) {
2643 if (mf < 0 && num > 199)
2644 snprintf(fn,
sizeof(fn),
"digits/%dF", (num / 100) * 100);
2646 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100) * 100);
2651 }
else if (num < 1000000) {
2658 if ((num % 1000) && ((num % 1000) < 100 || !(num % 100)))
2661 }
else if (num < 1000000000) {
2670 if ((num % 1000000) &&
2672 ((!((num / 1000) % 1000) && ((num % 1000) < 100 || !(num % 100))) ||
2674 (!(num % 1000) && (((num / 1000) % 1000) < 100 || !((num / 1000) % 100))) ) )
2676 num = num % 1000000;
2684 if ((audiofd > -1) && (ctrlfd > -1))
2691 if (!res && playh) {
2718 while (num || playh) {
2721 if ( num > INT_MIN ) {
2729 }
else if (start && num < 200 && num > 99 && cn == -1) {
2731 snprintf(fn,
sizeof(fn),
"digits/hundred");
2733 }
else if (num == 1 && cn == -1) {
2736 }
else if (num < 20) {
2737 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2739 }
else if (num < 100) {
2740 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2742 }
else if (num < 1000) {
2744 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2747 }
else if (num < 1000000) {
2755 }
else if (num < 1000000000) {
2764 ast_debug(1,
"Number '%d' is too big for me\n", num);
2769 if ((audiofd > -1) && (ctrlfd > -1)) {
2791 int last_length = 0;
2797 while (!res && (num || playh || playt || playz)) {
2800 if ( num > INT_MIN ) {
2806 snprintf(fn,
sizeof(fn),
"digits/0");
2813 snprintf(fn,
sizeof(fn),
"digits/thousand");
2815 }
else if (num < 10) {
2816 snprintf(
buf, 12,
"%d", num);
2817 if (last_length - strlen(
buf) > 1 && last_length != 0) {
2818 last_length = strlen(
buf);
2822 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2824 }
else if (num < 100) {
2825 snprintf(
buf, 10,
"%d", num);
2826 if (last_length - strlen(
buf) > 1 && last_length != 0) {
2827 last_length = strlen(
buf);
2831 last_length = strlen(
buf);
2832 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
2836 snprintf(
buf, 10,
"%d", num);
2837 if (last_length - strlen(
buf) > 1 && last_length != 0) {
2838 last_length = strlen(
buf);
2842 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2844 snprintf(
buf, 10,
"%d", num);
2845 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
2846 last_length = strlen(
buf);
2847 num -= ((num / 100) * 100);
2848 }
else if (num < 10000){
2849 snprintf(
buf, 10,
"%d", num);
2850 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 1000));
2852 snprintf(
buf, 10,
"%d", num);
2853 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
2854 last_length = strlen(
buf);
2855 num -= ((num / 1000) * 1000);
2856 }
else if (num < 100000000) {
2860 snprintf(
buf, 10,
"%d", num);
2861 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
2862 num -= ((num / 10000) * 10000);
2863 last_length = strlen(
buf);
2864 snprintf(fn,
sizeof(fn),
"digits/wan");
2866 if (num < 1000000000) {
2870 snprintf(
buf, 10,
"%d", num);
2871 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
2872 last_length = strlen(
buf);
2873 num -= ((num / 100000000) * 100000000);
2874 snprintf(fn,
sizeof(fn),
"digits/yi");
2876 ast_debug(1,
"Number '%d' is too big for me\n", num);
2883 if ((audiofd > -1) && (ctrlfd > -1))
2908 while (!res && (num || playh)) {
2910 snprintf(fn,
sizeof(fn),
"digits/hundred");
2912 }
else if (num < 100) {
2913 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2915 }
else if (num < 1000) {
2916 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2918 num -= ((num / 100) * 100);
2919 }
else if (num < 100000) {
2924 snprintf(fn,
sizeof(fn),
"digits/thousand");
2925 }
else if (num < 10000000) {
2930 snprintf(fn,
sizeof(fn),
"digits/lac");
2931 }
else if (num < 1000000000) {
2935 num = num % 10000000;
2936 snprintf(fn,
sizeof(fn),
"digits/crore");
2938 ast_debug(1,
"Number '%d' is too big for me\n", num);
2944 if ((audiofd > -1) && (ctrlfd > -1)) {
2960 }
else if (num < 100) {
2962 }
else if (num < 1000) {
2992 while (!res && (num)) {
2995 if ( num > INT_MIN ) {
3000 }
else if (num < 20) {
3002 snprintf(fn,
sizeof(fn),
"digits/%d%s", num,
options);
3004 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3007 }
else if (num < 100) {
3008 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 10));
3010 }
else if (num < 1000){
3011 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 100));
3013 }
else if (num < 1000000) {
3016 if (lastdigits < 3) {
3023 if (lastdigits == 1) {
3025 }
else if (lastdigits > 1 && lastdigits < 5) {
3031 }
else if (num < 1000000000) {
3037 if (lastdigits == 1) {
3039 }
else if (lastdigits > 1 && lastdigits < 5) {
3046 ast_debug(1,
"Number '%d' is too big for me\n", num);
3051 if ((audiofd > -1) && (ctrlfd > -1))
3071 while(!res && (num || playh)) {
3074 if ( num > INT_MIN ) {
3082 }
else if (num < 100) {
3083 if ((num <= 20) || ((num % 10) == 1)) {
3084 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3087 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
3090 }
else if (num < 1000) {
3091 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
3094 }
else if (num < 10000) {
3100 }
else if (num < 100000) {
3106 }
else if (num < 1000000) {
3121 if ((audiofd > -1) && (ctrlfd > -1))
3144 while (!res && (num || playh)) {
3147 if ( num > INT_MIN ) {
3153 snprintf(fn,
sizeof(fn),
"digits/%da", num);
3162 }
else if (playoh) {
3165 }
else if (playohz) {
3168 }
else if (num < 20) {
3169 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3171 }
else if (num < 100) {
3172 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
3174 if ((num == 5) || (num == 4) || (num == 1)) playl++;
3177 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
3179 if (num && (num < 10)) {
3186 if (num < 1000000) {
3191 snprintf(fn,
sizeof(fn),
"digits/thousand");
3192 if (num && (num < 10)) {
3194 }
else if (num && (num < 100)){
3202 if (num < 1000000000) {
3216 if ((audiofd > -1) && (ctrlfd > -1))
3231 if (!strncasecmp(
language,
"en", 2)) {
3233 }
else if (!strncasecmp(
language,
"da", 2)) {
3235 }
else if (!strncasecmp(
language,
"de", 2)) {
3237 }
else if (!strncasecmp(
language,
"he", 2)) {
3239 }
else if (!strncasecmp(
language,
"is", 2)) {
3241 }
else if (!strncasecmp(
language,
"vi", 2)) {
3256 while (!res && num) {
3259 if ( num > INT_MIN ) {
3264 }
else if (num < 20) {
3265 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3267 }
else if (num < 100) {
3268 int tens = num / 10;
3271 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3273 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3275 }
else if (num < 1000) {
3276 int hundreds = num / 100;
3278 if (hundreds > 1 || t == 1) {
3288 }
else if (num < 1000000) {
3289 int thousands = num / 1000;
3291 if (thousands > 1 || t == 1) {
3302 }
else if (num < 1000000000) {
3303 int millions = num / 1000000;
3304 num = num % 1000000;
3314 }
else if (num < INT_MAX) {
3315 int billions = num / 1000000000;
3316 num = num % 1000000000;
3326 }
else if (num == INT_MAX) {
3330 ast_debug(1,
"Number '%d' is too big for me\n", num);
3336 if ((audiofd > -1) && (ctrlfd > -1)) {
3355 if ((audiofd > -1) && (ctrlfd > -1)) {
3372 char fn[256] =
"", fna[256] =
"";
3386 while (!res && num) {
3389 if ( num > INT_MIN ) {
3394 }
else if (num < 100 && t) {
3397 }
else if (num < 20) {
3398 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3400 }
else if (num < 100) {
3401 int ones = num % 10;
3403 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
3406 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3409 }
else if (num == 100 && t == 0) {
3410 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3412 }
else if (num < 1000) {
3413 int hundreds = num / 100;
3415 if (hundreds == 1) {
3418 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3423 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3426 }
else if (num < 1000000) {
3427 int thousands = num / 1000;
3429 if (thousands == 1) {
3436 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3438 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3449 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3453 }
else if (num < 1000000000) {
3454 int millions = num / 1000000;
3455 num = num % 1000000;
3456 if (millions == 1) {
3462 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3472 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3476 }
else if (num < INT_MAX) {
3477 int billions = num / 1000000000;
3478 num = num % 1000000000;
3479 if (billions == 1) {
3485 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3494 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3498 }
else if (num == INT_MAX) {
3499 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3502 ast_debug(1,
"Number '%d' is too big for me\n", num);
3508 if ((audiofd > -1) && (ctrlfd > -1))
3516 if ((audiofd > -1) && (ctrlfd > -1)) {
3535 char fn[256] =
"", fna[256] =
"";
3549 while (!res && num) {
3552 if ( num > INT_MIN ) {
3557 }
else if (num < 100 && t) {
3560 }
else if (num < 20) {
3561 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3563 }
else if (num < 100) {
3564 int ones = num % 10;
3566 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
3569 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3572 }
else if (num == 100 && t == 0) {
3573 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3575 }
else if (num < 1000) {
3576 int hundreds = num / 100;
3578 if (hundreds == 1) {
3581 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3586 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3589 }
else if (num < 1000000) {
3590 int thousands = num / 1000;
3592 if (thousands == 1) {
3599 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3601 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3612 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3616 }
else if (num < 1000000000) {
3617 int millions = num / 1000000;
3618 num = num % 1000000;
3619 if (millions == 1) {
3625 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3635 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3639 }
else if (num < INT_MAX) {
3640 int billions = num / 1000000000;
3641 num = num % 1000000000;
3642 if (billions == 1) {
3648 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3657 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3661 }
else if (num == INT_MAX) {
3662 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3665 ast_debug(1,
"Number '%d' is too big for me\n", num);
3671 if ((audiofd > -1) && (ctrlfd > -1))
3679 if ((audiofd > -1) && (ctrlfd > -1)) {
3698 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num,
options);
3704 ast_verb(3,
"ast_say_digits_full: num: %d, options=\"%s\", mf=%d\n", num,
options, mf);
3706 while (!res && num) {
3708 snprintf(fn,
sizeof(fn),
"digits/minus");
3709 if (num > INT_MIN) {
3714 }
else if (num < 21) {
3717 snprintf(fn,
sizeof(fn),
"digits/f-0%d", num);
3719 snprintf(fn,
sizeof(fn),
"digits/f-%d", num);
3723 snprintf(fn,
sizeof(fn),
"digits/m-0%d", num);
3725 snprintf(fn,
sizeof(fn),
"digits/m-%d", num);
3729 }
else if ((num < 100) && num >= 20) {
3730 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
3732 }
else if ((num >= 100) && (num < 1000)) {
3733 int tmpnum = num / 100;
3734 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
3735 num = num - (tmpnum * 100);
3736 }
else if ((num >= 1000) && (num < 10000)) {
3737 int tmpnum = num / 1000;
3738 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
3739 num = num - (tmpnum * 1000);
3740 }
else if (num < 20000) {
3741 snprintf(fn,
sizeof(fn),
"digits/m-%d", (num / 1000));
3743 }
else if (num < 1000000) {
3748 snprintf(fn,
sizeof(fn),
"digits/1k");
3750 }
else if (num < 2000000) {
3751 snprintf(fn,
sizeof(fn),
"digits/1m");
3752 num = num % 1000000;
3753 }
else if (num < 3000000) {
3754 snprintf(fn,
sizeof(fn),
"digits/2m");
3755 num = num - 2000000;
3756 }
else if (num < 1000000000) {
3761 snprintf(fn,
sizeof(fn),
"digits/1m");
3762 num = num % 1000000;
3764 ast_debug(1,
"Number '%d' is too big for me\n", num);
3769 if ((audiofd > -1) && (ctrlfd > -1)) {
3786 char fn[256] =
"", fna[256] =
"";
3800 while (!res && num) {
3803 if ( num > INT_MIN ) {
3808 }
else if (num < 100 && t) {
3811 }
else if (num < 20) {
3812 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3814 }
else if (num < 100) {
3815 int ones = num % 10;
3817 int tens = num - ones;
3818 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", tens, gender);
3823 snprintf(fn,
sizeof(fn),
"digits/and");
3827 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3831 }
else if (num == 100 && t == 0) {
3832 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3834 }
else if (num < 1000) {
3835 int hundreds = num / 100;
3837 if (hundreds == 1) {
3840 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3845 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3848 }
else if (num < 1000000) {
3849 int thousands = num / 1000;
3851 if (thousands == 1) {
3859 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3861 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3872 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3877 }
else if (num < 1000000000) {
3878 int millions = num / 1000000;
3879 num = num % 1000000;
3880 if (millions == 1) {
3887 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3897 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3902 }
else if (num < INT_MAX) {
3903 int billions = num / 1000000000;
3904 num = num % 1000000000;
3905 if (billions == 1) {
3911 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3920 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3925 }
else if (num == INT_MAX) {
3926 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3929 ast_debug(1,
"Number '%d' is too big for me\n", num);
3935 if ((audiofd > -1) && (ctrlfd > -1))
3943 if ((audiofd > -1) && (ctrlfd > -1)) {
3959 if (!strncasecmp(lang,
"en", 2)) {
3961 }
else if (!strncasecmp(lang,
"da", 2)) {
3963 }
else if (!strncasecmp(lang,
"de", 2)) {
3965 }
else if (!strncasecmp(lang,
"fr", 2)) {
3967 }
else if (!strncasecmp(lang,
"gr", 2)) {
3969 }
else if (!strncasecmp(lang,
"ja", 2)) {
3971 }
else if (!strncasecmp(lang,
"he", 2)) {
3973 }
else if (!strncasecmp(lang,
"hu", 2)) {
3975 }
else if (!strncasecmp(lang,
"is", 2)) {
3977 }
else if (!strncasecmp(lang,
"ka", 2)) {
3979 }
else if (!strncasecmp(lang,
"nl", 2)) {
3981 }
else if (!strncasecmp(lang,
"pt", 2)) {
3983 }
else if (!strncasecmp(lang,
"th", 2)) {
3995 struct timeval when = { t, 0 };
4000 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4006 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4023 struct timeval when = { t, 0 };
4029 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4039 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4055 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
4058 res =
wait_file(chan, ints,
"digits/hundred", lang);
4059 if (!res && year % 100 != 0) {
4072 struct timeval when = { t, 0 };
4078 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4088 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4105 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100) );
4108 res =
wait_file(chan, ints,
"digits/hundred", lang);
4109 if (!res && year % 100 != 0) {
4122 struct timeval when = { t, 0 };
4133 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4143 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4154 struct timeval when = { t, 0 };
4160 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4170 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4183 struct timeval when = { t, 0 };
4189 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4197 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4212 struct timeval when = { t, 0 };
4218 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4232 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4248 struct timeval when = { t, 0 };
4254 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4260 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4261 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4265 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4275 struct timeval when = { t, 0 };
4281 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4288 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4309 struct timeval when = { t, 0 };
4315 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4325 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4341 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
4344 res =
wait_file(chan, ints,
"digits/hundred", lang);
4345 if (!res && year % 100 != 0) {
4357 if (!strncasecmp(lang,
"en", 2)) {
4359 }
else if (!strncasecmp(lang,
"da", 2)) {
4361 }
else if (!strncasecmp(lang,
"de", 2)) {
4363 }
else if (!strncasecmp(lang,
"es", 2)) {
4365 }
else if (!strncasecmp(lang,
"he", 2)) {
4367 }
else if (!strncasecmp(lang,
"fr", 2)) {
4369 }
else if (!strncasecmp(lang,
"gr", 2)) {
4371 }
else if (!strncasecmp(lang,
"is", 2)) {
4373 }
else if (!strncasecmp(lang,
"ja", 2)) {
4375 }
else if (!strncasecmp(lang,
"it", 2)) {
4377 }
else if (!strncasecmp(lang,
"nl", 2)) {
4379 }
else if (!strncasecmp(lang,
"pl", 2)) {
4381 }
else if (!strncasecmp(lang,
"pt", 2)) {
4383 }
else if (!strncasecmp(lang,
"th", 2)) {
4385 }
else if (!strncasecmp(lang,
"zh", 2)) {
4387 }
else if (!strncasecmp(lang,
"vi", 2)) {
4398 struct timeval when = { t, 0 };
4400 int res=0, offset, sndoffset;
4401 char sndfile[256], nextmsg[256];
4404 format =
"ABdY 'digits/at' IMp";
4408 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4409 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4410 switch (format[offset]) {
4414 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4415 sndfile[sndoffset] = format[offset];
4417 sndfile[sndoffset] =
'\0';
4418 res =
wait_file(chan, ints, sndfile, lang);
4423 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4424 res =
wait_file(chan, ints, nextmsg, lang);
4430 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4431 res =
wait_file(chan, ints, nextmsg, lang);
4450 res =
wait_file(chan, ints,
"digits/19", lang);
4454 res =
wait_file(chan, ints,
"digits/oh", lang);
4467 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4469 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4470 res =
wait_file(chan, ints, nextmsg, lang);
4475 if (format[offset] ==
'H') {
4478 res =
wait_file(chan, ints,
"digits/oh", lang);
4483 res =
wait_file(chan, ints,
"digits/oh", lang);
4490 res =
wait_file(chan, ints,
"digits/20", lang);
4494 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
4495 res =
wait_file(chan, ints, nextmsg, lang);
4504 if (format[offset] ==
'M') {
4505 res =
wait_file(chan, ints,
"digits/oclock", lang);
4507 res =
wait_file(chan, ints,
"digits/hundred", lang);
4509 }
else if (tm.
tm_min < 10) {
4510 res =
wait_file(chan, ints,
"digits/oh", lang);
4512 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
4513 res =
wait_file(chan, ints, nextmsg, lang);
4526 res =
wait_file(chan, ints, nextmsg, lang);
4538 gettimeofday(&now,
NULL);
4543 if (beg_today + 15768000 < t) {
4546 }
else if (beg_today + 2628000 < t) {
4549 }
else if (beg_today + 86400 * 6 < t) {
4552 }
else if (beg_today + 172800 < t) {
4555 }
else if (beg_today + 86400 < t) {
4557 res =
wait_file(chan, ints,
"digits/tomorrow", lang);
4558 }
else if (beg_today < t) {
4560 res =
wait_file(chan, ints,
"digits/today", lang);
4561 }
else if (beg_today - 86400 < t) {
4563 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4564 }
else if (beg_today - 86400 * 6 < t) {
4567 }
else if (beg_today - 2628000 < t) {
4570 }
else if (beg_today - 15768000 < t) {
4594 if (beg_today + 15768000 < t) {
4597 }
else if (beg_today + 2628000 < t) {
4600 }
else if (beg_today + 86400 * 6 < t) {
4603 }
else if (beg_today + 172800 < t) {
4606 }
else if (beg_today + 86400 < t) {
4608 res =
wait_file(chan, ints,
"digits/tomorrow", lang);
4609 }
else if (beg_today < t) {
4611 res =
wait_file(chan, ints,
"digits/today", lang);
4612 }
else if (beg_today - 86400 < t) {
4614 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4615 }
else if (beg_today - 86400 * 6 < t) {
4618 }
else if (beg_today - 2628000 < t) {
4621 }
else if (beg_today - 15768000 < t) {
4636 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
4637 res =
wait_file(chan, ints, nextmsg, lang);
4638 }
else if (tm.
tm_sec < 10) {
4639 res =
wait_file(chan, ints,
"digits/oh", lang);
4641 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
4642 res =
wait_file(chan, ints, nextmsg, lang);
4657 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
4676 struct timeval when = { t, 0 };
4678 int res=0, offset, sndoffset;
4679 char sndfile[256], nextmsg[256];
4682 format =
"A dBY HMS";
4686 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4687 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4688 switch (format[offset]) {
4692 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4693 sndfile[sndoffset] = format[offset];
4695 sndfile[sndoffset] =
'\0';
4696 res =
wait_file(chan, ints, sndfile, lang);
4701 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4702 res =
wait_file(chan, ints, nextmsg, lang);
4708 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4709 res =
wait_file(chan, ints, nextmsg, lang);
4733 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
4734 res =
wait_file(chan, ints, nextmsg, lang);
4736 res =
wait_file(chan, ints,
"digits/hundred", lang);
4737 if (!res && year % 100 != 0) {
4748 res =
wait_file(chan, ints,
"digits/oclock", lang);
4752 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4754 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4756 res =
wait_file(chan, ints, nextmsg, lang);
4762 res =
wait_file(chan, ints,
"digits/0", lang);
4774 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
4776 res =
wait_file(chan, ints,
"minute", lang);
4778 res =
wait_file(chan, ints,
"minutes", lang);
4789 res =
wait_file(chan, ints, nextmsg, lang);
4805 if (beg_today < t) {
4807 res =
wait_file(chan, ints,
"digits/today", lang);
4808 }
else if (beg_today - 86400 < t) {
4810 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4830 if (beg_today < t) {
4832 }
else if ((beg_today - 86400) < t) {
4834 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4835 }
else if (beg_today - 86400 * 6 < t) {
4848 res =
wait_file(chan, ints,
"digits/and", lang);
4852 res =
wait_file(chan, ints,
"seconds", lang);
4865 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
4878 struct timeval when = { t, 0 };
4880 int res=0, offset, sndoffset;
4881 char sndfile[256], nextmsg[256];
4884 format =
"A dBY HMS";
4888 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4889 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4890 switch (format[offset]) {
4894 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4895 sndfile[sndoffset] = format[offset];
4897 sndfile[sndoffset] =
'\0';
4898 res =
wait_file(chan, ints, sndfile, lang);
4903 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4904 res =
wait_file(chan, ints, nextmsg, lang);
4910 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4911 res =
wait_file(chan, ints, nextmsg, lang);
4935 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
4936 res =
wait_file(chan, ints, nextmsg, lang);
4938 res =
wait_file(chan, ints,
"digits/hundred", lang);
4939 if (!res && year % 100 != 0) {