42 #include <netinet/in.h> 48 #include <iso/limits_iso.h> 65 char fnbuf[10], asciibuf[20] =
"letters/ascii";
75 while (str[num] && !res) {
85 fn =
"letters/exclaimation-point";
91 fn =
"letters/dollar";
100 fn =
"letters/equals";
106 fn =
"letters/slash";
109 fn =
"letters/space";
121 strcpy(fnbuf,
"digits/X");
127 if (
'A' <= ltr && ltr <=
'Z') {
129 switch (sensitivity) {
137 }
else if (
'a' <= ltr && ltr <=
'z') {
138 switch (sensitivity) {
149 strcpy(fnbuf,
"uppercase");
151 strcpy(fnbuf,
"lowercase");
153 strcpy(fnbuf,
"letters/X");
159 (snprintf(asciibuf + 13,
sizeof(asciibuf) - 13,
"%d", str[num]) > 0 &&
ast_fileexists(asciibuf,
NULL, lang) > 0 && (fn = asciibuf))) {
162 if (upper || lower) {
179 while ((fn =
strsep(&files,
"&"))) {
182 if ((audiofd > -1) && (ctrlfd > -1))
215 fn =
"letters/exclaimation-point";
221 fn =
"letters/dollar";
230 fn =
"letters/equals";
236 fn =
"letters/slash";
239 fn =
"letters/space";
250 strcpy(fnbuf,
"digits/X");
256 if (
'A' <= ltr && ltr <=
'Z') ltr +=
'a' -
'A';
257 strcpy(fnbuf,
"phonetic/X_p");
278 while ((fn =
strsep(&files,
"&"))) {
281 if ((audiofd > -1) && (ctrlfd > -1))
325 strcpy(fnbuf,
"digits/X");
347 while ((fn =
strsep(&files,
"&"))) {
350 if ((audiofd > -1) && (ctrlfd > -1))
374 if (sscanf(str,
"%30lf", &dollars) != 1) {
381 cents = amt - (((int) dollars) * 100);
382 ast_debug(1,
"Cents is %d, amount is %d\n", cents, amt);
391 ast_str_append(&filenames, 0,
"&%s", (cents > 0) ?
"letters/dollar_" :
"letters/dollar");
407 ast_str_append(&filenames, 0,
"&%s", (cents == 1) ?
"cent" :
"cents");
408 }
else if (amt == 0) {
421 if (!strncasecmp(lang,
"en", 2)) {
425 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to US Dollars\n", lang);
438 while ((fn =
strsep(&files,
"&"))) {
441 if ((audiofd > -1) && (ctrlfd > -1))
471 while (!res && (num || playh)) {
474 if ( num > INT_MIN ) {
482 }
else if (num < 20) {
483 snprintf(fn,
sizeof(fn),
"digits/%d", num);
485 }
else if (num < 100) {
486 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
490 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
500 snprintf(fn,
sizeof(fn),
"&digits/thousand");
502 if (num < 1000000000) {
527 if (!strncasecmp(lang,
"en", 2)) {
531 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to English\n", lang);
716 if (!strncasecmp(language,
"en_GB", 5)) {
718 }
else if (!strncasecmp(language,
"en", 2)) {
720 }
else if (!strncasecmp(language,
"cs", 2)) {
722 }
else if (!strncasecmp(language,
"da", 2)) {
724 }
else if (!strncasecmp(language,
"de", 2)) {
726 }
else if (!strncasecmp(language,
"es", 2)) {
728 }
else if (!strncasecmp(language,
"fr", 2)) {
730 }
else if (!strncasecmp(language,
"gr", 2)) {
732 }
else if (!strncasecmp(language,
"ja", 2)) {
734 }
else if (!strncasecmp(language,
"he", 2)) {
736 }
else if (!strncasecmp(language,
"hu", 2)) {
738 }
else if (!strncasecmp(language,
"is", 2)) {
740 }
else if (!strncasecmp(language,
"it", 2)) {
742 }
else if (!strncasecmp(language,
"ka", 2)) {
744 }
else if (!strncasecmp(language,
"nl", 2)) {
746 }
else if (!strncasecmp(language,
"no", 2)) {
748 }
else if (!strncasecmp(language,
"pl", 2)) {
750 }
else if (!strncasecmp(language,
"pt", 2)) {
752 }
else if (!strncasecmp(language,
"ru", 2)) {
754 }
else if (!strncasecmp(language,
"se", 2)) {
756 }
else if (!strncasecmp(language,
"th", 2)) {
758 }
else if (!strncasecmp(language,
"zh", 2)) {
760 }
else if (!strncasecmp(language,
"ur", 2)) {
762 }
else if (!strncasecmp(language,
"vi", 2)) {
780 while ((fn =
strsep(&files,
"&"))) {
783 if ((audiofd > -1) && (ctrlfd > -1))
799 for (x=0;x<power;x++)
843 while (!res && (num || playh)) {
846 if ( num > INT_MIN ) {
851 }
else if (num < 3 ) {
852 snprintf(fn,
sizeof(fn),
"digits/%d%c", num, options[0]);
855 }
else if (num < 20) {
856 snprintf(fn,
sizeof(fn),
"digits/%d", num);
859 }
else if (num < 100) {
860 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
862 }
else if (num < 1000) {
863 hundered = num / 100;
864 if ( hundered == 1 ) {
866 }
else if ( hundered == 2 ) {
872 if (hundered == 3 || hundered == 4) {
874 }
else if ( hundered > 4 ) {
878 num -= (hundered * 100);
880 length = (int)log10(num)+1;
881 while ( (length % 3 ) != 1 ) {
887 case 9: options =
"w";
889 default : options =
"m";
898 snprintf(fn,
sizeof(fn),
"digits/5_E%d", length - 1);
899 }
else if ( left >= 2 && left <= 4 ) {
900 snprintf(fn,
sizeof(fn),
"digits/2-4_E%d", length - 1);
902 snprintf(fn,
sizeof(fn),
"digits/1_E%d", length - 1);
908 if ((audiofd > -1) && (ctrlfd > -1)) {
934 if (options && !strncasecmp(options,
"n", 1)) cn = -1;
936 while (!res && (num || playh || playa )) {
949 if ( num > INT_MIN ) {
960 }
else if (num == 1 && cn == -1) {
963 }
else if (num < 20) {
964 snprintf(fn,
sizeof(fn),
"digits/%d", num);
966 }
else if (num < 100) {
969 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
972 snprintf(fn,
sizeof(fn),
"digits/%d", num);
977 int hundreds = num / 100;
981 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
984 num -= 100 * hundreds;
996 if (num < 1000000000) {
997 int millions = num / 1000000;
1005 num = num % 1000000;
1007 ast_debug(1,
"Number '%d' is too big for me\n", num);
1011 if (num && num < 100)
1017 if ((audiofd > -1) && (ctrlfd > -1))
1047 if (options && (!strncasecmp(options,
"f", 1)))
1050 while (!res && num) {
1066 if ( num > INT_MIN ) {
1071 }
else if (num == 1 && mf == -1) {
1072 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1074 }
else if (num < 20) {
1075 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1077 }
else if (num < 100) {
1078 int ones = num % 10;
1080 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
1083 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1086 }
else if (num == 100 && t == 0) {
1089 }
else if (num < 1000) {
1090 int hundreds = num / 100;
1092 if (hundreds == 1) {
1095 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1098 }
else if (num == 1000 && t == 0) {
1101 }
else if (num < 1000000) {
1102 int thousands = num / 1000;
1105 if (thousands == 1) {
1114 }
else if (num < 1000000000) {
1115 int millions = num / 1000000;
1116 num = num % 1000000;
1118 if (millions == 1) {
1127 }
else if (num <= INT_MAX) {
1128 int billions = num / 1000000000;
1129 num = num % 1000000000;
1131 if (billions == 1) {
1142 ast_debug(1,
"Number '%d' is too big for me\n", num);
1147 if ((audiofd > -1) && (ctrlfd > -1))
1155 if ((audiofd > -1) && (ctrlfd > -1))
1181 while (!res && (num || playh || playa )) {
1184 if ( num > INT_MIN ) {
1195 }
else if (num < 20) {
1196 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1198 }
else if (num < 100) {
1199 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1201 }
else if (num < 1000) {
1202 int hundreds = num / 100;
1203 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1206 num -= 100 * hundreds;
1209 }
else if (num < 1000000) {
1215 if (num && num < 100)
1217 }
else if (num < 1000000000) {
1218 int millions = num / 1000000;
1224 if (num && num < 100)
1227 ast_debug(1,
"Number '%d' is too big for me\n", num);
1233 if ((audiofd > -1) && (ctrlfd > -1))
1261 if (!strncasecmp(options,
"f", 1))
1263 else if (!strncasecmp(options,
"m", 1))
1267 while (!res && num) {
1270 if ( num > INT_MIN ) {
1278 }
else if (num == 1) {
1280 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1282 snprintf(fn,
sizeof(fn),
"digits/%dM", num);
1284 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1286 }
else if (num < 31) {
1287 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1289 }
else if (num < 100) {
1290 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1294 }
else if (num == 100) {
1297 }
else if (num < 200) {
1302 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100)*100);
1304 }
else if (num < 2000) {
1308 if (num < 1000000) {
1315 if (num < 2147483640) {
1316 if ((num/1000000) == 1) {
1329 ast_debug(1,
"Number '%d' is too big for me\n", num);
1338 if ((audiofd > -1) && (ctrlfd > -1))
1365 if (options && !strncasecmp(options,
"f", 1))
1368 while (!res && (num || playh || playa)) {
1371 if ( num > INT_MIN ) {
1382 }
else if (num == 1) {
1384 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1386 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1388 }
else if (num < 21) {
1389 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1391 }
else if (num < 70) {
1392 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1393 if ((num % 10) == 1) playa++;
1395 }
else if (num < 80) {
1397 if ((num % 10) == 1) playa++;
1399 }
else if (num < 100) {
1402 }
else if (num < 200) {
1405 }
else if (num < 1000) {
1406 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
1409 }
else if (num < 2000) {
1412 }
else if (num < 1000000) {
1418 }
else if (num < 1000000000) {
1423 num = num % 1000000;
1425 ast_debug(1,
"Number '%d' is too big for me\n", num);
1430 if ((audiofd > -1) && (ctrlfd > -1))
1446 #define SAY_NUM_BUF_SIZE 256 1456 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num, options);
1461 if (options && !strncasecmp(options,
"m", 1)) {
1464 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d\n", num, state, options, mf);
1467 while (!res && (num || (state > 0))) {
1475 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d, tmpnum=%d\n", num, state, options, mf, tmpnum);
1479 }
else if (state == 2) {
1480 if ((num >= 11) && (num < 21)) {
1482 snprintf(fn,
sizeof(fn),
"digits/ve");
1484 snprintf(fn,
sizeof(fn),
"digits/uu");
1489 snprintf(fn,
sizeof(fn),
"digits/ve");
1492 snprintf(fn,
sizeof(fn),
"digits/uu");
1496 snprintf(fn,
sizeof(fn),
"digits/ve");
1498 snprintf(fn,
sizeof(fn),
"digits/uu");
1502 snprintf(fn,
sizeof(fn),
"digits/ve");
1505 snprintf(fn,
sizeof(fn),
"digits/ve");
1508 snprintf(fn,
sizeof(fn),
"digits/ve");
1511 snprintf(fn,
sizeof(fn),
"digits/ve");
1514 snprintf(fn,
sizeof(fn),
"digits/uu");
1517 snprintf(fn,
sizeof(fn),
"digits/ve");
1520 snprintf(fn,
sizeof(fn),
"digits/ve");
1525 }
else if (state == 3) {
1526 snprintf(fn,
sizeof(fn),
"digits/1k");
1528 }
else if (num < 0) {
1529 snprintf(fn,
sizeof(fn),
"digits/minus");
1531 }
else if (num < 20) {
1533 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1535 snprintf(fn,
sizeof(fn),
"digits/%dm", num);
1538 }
else if ((num < 100) && (num >= 20)) {
1539 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
1544 }
else if ((num >= 100) && (num < 1000)) {
1546 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
1547 num = num - (tmpnum * 100);
1548 if ((num > 0) && (num < 11)) {
1551 }
else if ((num >= 1000) && (num < 10000)) {
1552 tmpnum = num / 1000;
1553 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
1554 num = num - (tmpnum * 1000);
1555 if ((num > 0) && (num < 11)) {
1558 }
else if (num < 20000) {
1559 snprintf(fn,
sizeof(fn),
"digits/%dm", (num / 1000));
1562 }
else if (num < 1000000) {
1567 snprintf(fn,
sizeof(fn),
"digits/1k");
1569 if ((num > 0) && (num < 11)) {
1572 }
else if (num < 2000000) {
1573 snprintf(fn,
sizeof(fn),
"digits/million");
1574 num = num % 1000000;
1575 if ((num > 0) && (num < 11)) {
1578 }
else if (num < 3000000) {
1579 snprintf(fn,
sizeof(fn),
"digits/twomillion");
1580 num = num - 2000000;
1581 if ((num > 0) && (num < 11)) {
1584 }
else if (num < 1000000000) {
1589 snprintf(fn,
sizeof(fn),
"digits/million");
1590 num = num % 1000000;
1591 if ((num > 0) && (num < 11)) {
1595 ast_debug(1,
"Number '%d' is too big for me\n", num);
1601 if ((audiofd > -1) && (ctrlfd > -1)) {
1633 while(!res && (num || playh)) {
1636 if ( num > INT_MIN ) {
1644 }
else if (num < 11 || num == 20) {
1645 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1647 }
else if (num < 20) {
1650 }
else if (num < 30) {
1653 }
else if (num < 100) {
1654 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1658 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
1662 if (num < 1000000) {
1669 if (num < 1000000000) {
1676 ast_debug(1,
"Number '%d' is too big for me\n", num);
1684 if ((audiofd > -1) && (ctrlfd > -1))
1710 if (options && !strncasecmp(options,
"f", 1)) cn = 2;
1711 if (options && !strncasecmp(options,
"c", 1)) cn = 3;
1713 if (options && !strncasecmp(options,
"n", 1)) cn = 3;
1715 while (!res && (num || playh || playa )) {
1718 if ( num > INT_MIN ) {
1732 }
else if (num < 5 && cn == 2) {
1733 snprintf(fn,
sizeof(fn),
"digits/%dkvk", num);
1735 }
else if (num < 5 && cn == 3) {
1736 snprintf(fn,
sizeof(fn),
"digits/%dhk", num);
1738 }
else if (num < 20) {
1739 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1741 }
else if (num < 100) {
1742 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1746 }
else if (num < 1000) {
1747 int hundreds = num / 100;
1750 snprintf(fn,
sizeof(fn),
"digits/%dhk", hundreds);
1752 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1755 num -= 100 * hundreds;
1756 if (num && num < 20)
1759 if (num && (num % 10) == 0)
1761 }
else if (num < 1000000) {
1764 if ((num % 100) == 0 && (num % 1000 != 0)) {
1771 if (num && (num < 20 || (num % 10 == 0)))
1773 }
else if (num < 1000000000) {
1774 int millions = num / 1000000;
1784 if (num && num < 100)
1786 }
else if (num < INT_MAX) {
1787 int milliards = num / 1000000000;
1797 if (num && num < 100)
1800 ast_debug(1,
"Number '%d' is too big for me\n", num);
1806 if ((audiofd > -1) && (ctrlfd > -1))
1853 while (!res && (num || playh)) {
1856 if ( num > INT_MIN ) {
1864 }
else if (num < 20) {
1865 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1867 }
else if (num == 21) {
1868 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1870 }
else if (num == 28) {
1871 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1873 }
else if (num == 31) {
1874 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1876 }
else if (num == 38) {
1877 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1879 }
else if (num == 41) {
1880 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1882 }
else if (num == 48) {
1883 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1885 }
else if (num == 51) {
1886 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1888 }
else if (num == 58) {
1889 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1891 }
else if (num == 61) {
1892 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1894 }
else if (num == 68) {
1895 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1897 }
else if (num == 71) {
1898 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1900 }
else if (num == 78) {
1901 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1903 }
else if (num == 81) {
1904 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1906 }
else if (num == 88) {
1907 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1909 }
else if (num == 91) {
1910 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1912 }
else if (num == 98) {
1913 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1915 }
else if (num < 100) {
1916 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1920 if ((num / 100) > 1) {
1921 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
1928 if (num < 1000000) {
1935 if ((tempnum / 1000) < 2)
1940 if (num < 1000000000) {
1941 if ((num / 1000000) > 1)
1947 if ((tempnum / 1000000) < 2)
1952 ast_debug(1,
"Number '%d' is too big for me\n", num);
1960 if ((audiofd > -1) && (ctrlfd > -1))
1982 while (!res && (num || playh )) {
1985 if ( num > INT_MIN ) {
1993 }
else if (num < 20) {
1994 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1996 }
else if (num < 100) {
2005 snprintf(fn,
sizeof(fn),
"digits/%d", num - units);
2008 }
else if (num < 200) {
2012 }
else if (num < 1000) {
2013 snprintf(fn,
sizeof(fn),
"digits/%d", num / 100);
2021 }
else if (num < 10000) {
2028 if (num < 1000000) {
2035 if (num < 1000000000) {
2042 ast_debug(1,
"Number '%d' is too big for me\n", num);
2051 if ((audiofd > -1) && (ctrlfd > -1))
2083 if (options && !strncasecmp(options,
"n", 1)) cn = -1;
2085 while (!res && (num || playh || playa )) {
2088 if ( num > INT_MIN ) {
2099 }
else if (num == 1 && cn == -1) {
2102 }
else if (num < 20) {
2103 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2105 }
else if (num < 100) {
2106 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2108 }
else if (num < 1000) {
2109 int hundreds = num / 100;
2113 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2116 num -= 100 * hundreds;
2119 }
else if (num < 1000000) {
2125 if (num && num < 100)
2127 }
else if (num < 1000000000) {
2128 int millions = num / 1000000;
2134 if (num && num < 100)
2137 ast_debug(1,
"Number '%d' is too big for me\n", num);
2143 if ((audiofd > -1) && (ctrlfd > -1))
2159 char *dziesiatki[10];
2170 return odm->
rzedy[rzad - 1][0];
2171 if ((i > 21 || i < 11) && i%10 > 1 && i%10 < 5)
2172 return odm->
rzedy[rzad - 1][1];
2174 return odm->
rzedy[rzad - 1][2];
2179 strcpy(buffer, str);
2180 buffer += strlen(str);
2186 char file_name[255] =
"digits/";
2187 strcat(file_name, fn);
2188 ast_debug(1,
"Trying to play: %s\n", file_name);
2190 if ((audiofd > -1) && (ctrlfd > -1))
2210 if (i == 0 && rzad > 0) {
2218 m1000E6 = i % 1000000000;
2219 i1000E6 = i / 1000000000;
2221 powiedz(chan, language, audiofd, ctrlfd, ints, odm, rzad+3, i1000E6);
2223 m1000E3 = m1000E6 % 1000000;
2224 i1000E3 = m1000E6 / 1000000;
2226 powiedz(chan, language, audiofd, ctrlfd, ints, odm, rzad+2, i1000E3);
2228 m1000 = m1000E3 % 1000;
2229 i1000 = m1000E3 / 1000;
2231 powiedz(chan, language, audiofd, ctrlfd, ints, odm, rzad+1, i1000);
2239 if (m100 > 0 && m100 <= 9) {
2244 }
else if (m100 % 10 == 0 && m100 != 0) {
2246 }
else if (m100 > 10 && m100 <= 19) {
2248 }
else if (m100 > 20) {
2361 char *zenski_cyfry[] = {
"0",
"1z",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2363 char *zenski_cyfry2[] = {
"0",
"1",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2365 char *meski_cyfry[] = {
"0",
"1",
"2-1m",
"3-1m",
"4-1m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2367 char *meski_cyfry2[] = {
"0",
"1",
"2-2m",
"3-2m",
"4-2m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2369 char *meski_setki[] = {
"",
"100m",
"200m",
"300m",
"400m",
"500m",
"600m",
"700m",
"800m",
"900m"};
2371 char *meski_dziesiatki[] = {
"",
"10m",
"20m",
"30m",
"40m",
"50m",
"60m",
"70m",
"80m",
"90m"};
2373 char *meski_nastki[] = {
"",
"11m",
"12m",
"13m",
"14m",
"15m",
"16m",
"17m",
"18m",
"19m"};
2375 char *nijaki_cyfry[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2377 char *nijaki_cyfry2[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2379 char *nijaki_setki[] = {
"",
"100",
"200",
"300",
"400",
"500",
"600",
"700",
"800",
"900"};
2381 char *nijaki_dziesiatki[] = {
"",
"10",
"20",
"30",
"40",
"50",
"60",
"70",
"80",
"90"};
2383 char *nijaki_nastki[] = {
"",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19"};
2385 char *rzedy[][3] = { {
"1000",
"1000.2",
"1000.5"}, {
"1000000",
"1000000.2",
"1000000.5"}, {
"1000000000",
"1000000000.2",
"1000000000.5"}};
2394 if (odmiana_nieosobowa ==
NULL) {
2395 odmiana_nieosobowa =
ast_malloc(
sizeof(*odmiana_nieosobowa));
2399 memcpy(odmiana_nieosobowa->
cyfry, nijaki_cyfry,
sizeof(odmiana_nieosobowa->
cyfry));
2400 memcpy(odmiana_nieosobowa->
cyfry2, nijaki_cyfry2,
sizeof(odmiana_nieosobowa->
cyfry));
2401 memcpy(odmiana_nieosobowa->
setki, nijaki_setki,
sizeof(odmiana_nieosobowa->
setki));
2402 memcpy(odmiana_nieosobowa->
dziesiatki, nijaki_dziesiatki,
sizeof(odmiana_nieosobowa->
dziesiatki));
2403 memcpy(odmiana_nieosobowa->
nastki, nijaki_nastki,
sizeof(odmiana_nieosobowa->
nastki));
2404 memcpy(odmiana_nieosobowa->
rzedy, rzedy,
sizeof(odmiana_nieosobowa->
rzedy));
2407 if (odmiana_zenska ==
NULL) {
2408 odmiana_zenska =
ast_malloc(
sizeof(*odmiana_zenska));
2412 memcpy(odmiana_zenska->
cyfry, zenski_cyfry,
sizeof(odmiana_zenska->
cyfry));
2413 memcpy(odmiana_zenska->
cyfry2, zenski_cyfry2,
sizeof(odmiana_zenska->
cyfry));
2414 memcpy(odmiana_zenska->
setki, nijaki_setki,
sizeof(odmiana_zenska->
setki));
2416 memcpy(odmiana_zenska->
nastki, nijaki_nastki,
sizeof(odmiana_zenska->
nastki));
2417 memcpy(odmiana_zenska->
rzedy, rzedy,
sizeof(odmiana_zenska->
rzedy));
2420 if (odmiana_meska ==
NULL) {
2421 odmiana_meska =
ast_malloc(
sizeof(*odmiana_meska));
2425 memcpy(odmiana_meska->
cyfry, meski_cyfry,
sizeof(odmiana_meska->
cyfry));
2426 memcpy(odmiana_meska->
cyfry2, meski_cyfry2,
sizeof(odmiana_meska->
cyfry));
2427 memcpy(odmiana_meska->
setki, meski_setki,
sizeof(odmiana_meska->
setki));
2429 memcpy(odmiana_meska->
nastki, meski_nastki,
sizeof(odmiana_meska->
nastki));
2430 memcpy(odmiana_meska->
rzedy, rzedy,
sizeof(odmiana_meska->
rzedy));
2434 if (strncasecmp(options,
"f", 1) == 0)
2436 else if (strncasecmp(options,
"m", 1) == 0)
2439 o = odmiana_nieosobowa;
2441 o = odmiana_nieosobowa;
2443 powiedz(chan, language, audiofd, ctrlfd, ints, o, 0, num);
2465 if (options && !strncasecmp(options,
"f", 1))
2468 while (!res && num ) {
2471 if ( num > INT_MIN ) {
2476 }
else if (num < 20) {
2477 if ((num == 1 || num == 2) && (mf < 0))
2478 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
2480 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2482 }
else if (num < 100) {
2483 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
2487 }
else if (num < 1000) {
2493 if (mf < 0 && num > 199)
2494 snprintf(fn,
sizeof(fn),
"digits/%dF", (num / 100) * 100);
2496 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100) * 100);
2501 }
else if (num < 1000000) {
2508 if ((num % 1000) && ((num % 1000) < 100 || !(num % 100)))
2511 }
else if (num < 1000000000) {
2520 if ((num % 1000000) &&
2522 ((!((num / 1000) % 1000) && ((num % 1000) < 100 || !(num % 100))) ||
2524 (!(num % 1000) && (((num / 1000) % 1000) < 100 || !((num / 1000) % 100))) ) )
2526 num = num % 1000000;
2534 if ((audiofd > -1) && (ctrlfd > -1))
2541 if (!res && playh) {
2542 res =
wait_file(chan, ints,
"digits/pt-e", language);
2566 if (options && !strncasecmp(options,
"n", 1)) cn = -1;
2568 while (num || playh) {
2571 if ( num > INT_MIN ) {
2579 }
else if (start && num < 200 && num > 99 && cn == -1) {
2581 snprintf(fn,
sizeof(fn),
"digits/hundred");
2583 }
else if (num == 1 && cn == -1) {
2586 }
else if (num < 20) {
2587 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2589 }
else if (num < 100) {
2590 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2592 }
else if (num < 1000) {
2594 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2597 }
else if (num < 1000000) {
2605 }
else if (num < 1000000000) {
2614 ast_debug(1,
"Number '%d' is too big for me\n", num);
2619 if ((audiofd > -1) && (ctrlfd > -1)) {
2641 int last_length = 0;
2647 while (!res && (num || playh || playt || playz)) {
2650 if ( num > INT_MIN ) {
2656 snprintf(fn,
sizeof(fn),
"digits/0");
2663 snprintf(fn,
sizeof(fn),
"digits/thousand");
2665 }
else if (num < 10) {
2666 snprintf(buf, 12,
"%d", num);
2667 if (last_length - strlen(buf) > 1 && last_length != 0) {
2668 last_length = strlen(buf);
2672 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2674 }
else if (num < 100) {
2675 snprintf(buf, 10,
"%d", num);
2676 if (last_length - strlen(buf) > 1 && last_length != 0) {
2677 last_length = strlen(buf);
2681 last_length = strlen(buf);
2682 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
2686 snprintf(buf, 10,
"%d", num);
2687 if (last_length - strlen(buf) > 1 && last_length != 0) {
2688 last_length = strlen(buf);
2692 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2694 snprintf(buf, 10,
"%d", num);
2695 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(buf), last_length);
2696 last_length = strlen(buf);
2697 num -= ((num / 100) * 100);
2698 }
else if (num < 10000){
2699 snprintf(buf, 10,
"%d", num);
2700 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 1000));
2702 snprintf(buf, 10,
"%d", num);
2703 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(buf), last_length);
2704 last_length = strlen(buf);
2705 num -= ((num / 1000) * 1000);
2706 }
else if (num < 100000000) {
2710 snprintf(buf, 10,
"%d", num);
2711 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(buf), last_length);
2712 num -= ((num / 10000) * 10000);
2713 last_length = strlen(buf);
2714 snprintf(fn,
sizeof(fn),
"digits/wan");
2716 if (num < 1000000000) {
2720 snprintf(buf, 10,
"%d", num);
2721 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(buf), last_length);
2722 last_length = strlen(buf);
2723 num -= ((num / 100000000) * 100000000);
2724 snprintf(fn,
sizeof(fn),
"digits/yi");
2726 ast_debug(1,
"Number '%d' is too big for me\n", num);
2733 if ((audiofd > -1) && (ctrlfd > -1))
2758 while (!res && (num || playh)) {
2760 snprintf(fn,
sizeof(fn),
"digits/hundred");
2762 }
else if (num < 100) {
2763 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2765 }
else if (num < 1000) {
2766 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2768 num -= ((num / 100) * 100);
2769 }
else if (num < 100000) {
2774 snprintf(fn,
sizeof(fn),
"digits/thousand");
2775 }
else if (num < 10000000) {
2780 snprintf(fn,
sizeof(fn),
"digits/lac");
2781 }
else if (num < 1000000000) {
2785 num = num % 10000000;
2786 snprintf(fn,
sizeof(fn),
"digits/crore");
2788 ast_debug(1,
"Number '%d' is too big for me\n", num);
2794 if ((audiofd > -1) && (ctrlfd > -1)) {
2810 }
else if (num < 100) {
2812 }
else if (num < 1000) {
2842 while (!res && (num)) {
2845 if ( num > INT_MIN ) {
2850 }
else if (num < 20) {
2851 if (options && strlen(options) == 1 && num < 3) {
2852 snprintf(fn,
sizeof(fn),
"digits/%d%s", num, options);
2854 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2857 }
else if (num < 100) {
2858 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 10));
2860 }
else if (num < 1000){
2861 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 100));
2863 }
else if (num < 1000000) {
2866 if (lastdigits < 3) {
2873 if (lastdigits == 1) {
2875 }
else if (lastdigits > 1 && lastdigits < 5) {
2881 }
else if (num < 1000000000) {
2887 if (lastdigits == 1) {
2889 }
else if (lastdigits > 1 && lastdigits < 5) {
2896 ast_debug(1,
"Number '%d' is too big for me\n", num);
2901 if ((audiofd > -1) && (ctrlfd > -1))
2921 while(!res && (num || playh)) {
2924 if ( num > INT_MIN ) {
2932 }
else if (num < 100) {
2933 if ((num <= 20) || ((num % 10) == 1)) {
2934 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2937 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
2940 }
else if (num < 1000) {
2941 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2944 }
else if (num < 10000) {
2950 }
else if (num < 100000) {
2956 }
else if (num < 1000000) {
2971 if ((audiofd > -1) && (ctrlfd > -1))
2994 while (!res && (num || playh)) {
2997 if ( num > INT_MIN ) {
3003 snprintf(fn,
sizeof(fn),
"digits/%da", num);
3012 }
else if (playoh) {
3015 }
else if (playohz) {
3018 }
else if (num < 20) {
3019 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3021 }
else if (num < 100) {
3022 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
3024 if ((num == 5) || (num == 4) || (num == 1)) playl++;
3027 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
3029 if (num && (num < 10)) {
3036 if (num < 1000000) {
3041 snprintf(fn,
sizeof(fn),
"digits/thousand");
3042 if (num && (num < 10)) {
3044 }
else if (num && (num < 100)){
3052 if (num < 1000000000) {
3066 if ((audiofd > -1) && (ctrlfd > -1))
3081 if (!strncasecmp(language,
"en", 2)) {
3083 }
else if (!strncasecmp(language,
"da", 2)) {
3085 }
else if (!strncasecmp(language,
"de", 2)) {
3087 }
else if (!strncasecmp(language,
"he", 2)) {
3089 }
else if (!strncasecmp(language,
"is", 2)) {
3091 }
else if (!strncasecmp(language,
"vi", 2)) {
3106 while (!res && num) {
3109 if ( num > INT_MIN ) {
3114 }
else if (num < 20) {
3115 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3117 }
else if (num < 100) {
3118 int tens = num / 10;
3121 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3123 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3125 }
else if (num < 1000) {
3126 int hundreds = num / 100;
3128 if (hundreds > 1 || t == 1) {
3138 }
else if (num < 1000000) {
3139 int thousands = num / 1000;
3141 if (thousands > 1 || t == 1) {
3152 }
else if (num < 1000000000) {
3153 int millions = num / 1000000;
3154 num = num % 1000000;
3164 }
else if (num < INT_MAX) {
3165 int billions = num / 1000000000;
3166 num = num % 1000000000;
3176 }
else if (num == INT_MAX) {
3180 ast_debug(1,
"Number '%d' is too big for me\n", num);
3186 if ((audiofd > -1) && (ctrlfd > -1)) {
3205 if ((audiofd > -1) && (ctrlfd > -1)) {
3222 char fn[256] =
"", fna[256] =
"";
3225 if (options && !strncasecmp(options,
"f", 1)) {
3227 }
else if (options && !strncasecmp(options,
"n", 1)) {
3236 while (!res && num) {
3239 if ( num > INT_MIN ) {
3244 }
else if (num < 100 && t) {
3247 }
else if (num < 20) {
3248 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3250 }
else if (num < 100) {
3251 int ones = num % 10;
3253 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
3256 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3259 }
else if (num == 100 && t == 0) {
3260 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3262 }
else if (num < 1000) {
3263 int hundreds = num / 100;
3265 if (hundreds == 1) {
3268 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3273 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3276 }
else if (num < 1000000) {
3277 int thousands = num / 1000;
3279 if (thousands == 1) {
3286 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3288 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3299 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3303 }
else if (num < 1000000000) {
3304 int millions = num / 1000000;
3305 num = num % 1000000;
3306 if (millions == 1) {
3312 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3322 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3326 }
else if (num < INT_MAX) {
3327 int billions = num / 1000000000;
3328 num = num % 1000000000;
3329 if (billions == 1) {
3335 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3344 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3348 }
else if (num == INT_MAX) {
3349 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3352 ast_debug(1,
"Number '%d' is too big for me\n", num);
3358 if ((audiofd > -1) && (ctrlfd > -1))
3366 if ((audiofd > -1) && (ctrlfd > -1)) {
3385 char fn[256] =
"", fna[256] =
"";
3388 if (options && !strncasecmp(options,
"f", 1)) {
3390 }
else if (options && !strncasecmp(options,
"n", 1)) {
3399 while (!res && num) {
3402 if ( num > INT_MIN ) {
3407 }
else if (num < 100 && t) {
3410 }
else if (num < 20) {
3411 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3413 }
else if (num < 100) {
3414 int ones = num % 10;
3416 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
3419 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3422 }
else if (num == 100 && t == 0) {
3423 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3425 }
else if (num < 1000) {
3426 int hundreds = num / 100;
3428 if (hundreds == 1) {
3431 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3436 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3439 }
else if (num < 1000000) {
3440 int thousands = num / 1000;
3442 if (thousands == 1) {
3449 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3451 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3462 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3466 }
else if (num < 1000000000) {
3467 int millions = num / 1000000;
3468 num = num % 1000000;
3469 if (millions == 1) {
3475 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3485 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3489 }
else if (num < INT_MAX) {
3490 int billions = num / 1000000000;
3491 num = num % 1000000000;
3492 if (billions == 1) {
3498 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3507 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3511 }
else if (num == INT_MAX) {
3512 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3515 ast_debug(1,
"Number '%d' is too big for me\n", num);
3521 if ((audiofd > -1) && (ctrlfd > -1))
3529 if ((audiofd > -1) && (ctrlfd > -1)) {
3548 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num, options);
3550 if (options && !strncasecmp(options,
"m", 1)) {
3554 ast_verb(3,
"ast_say_digits_full: num: %d, options=\"%s\", mf=%d\n", num, options, mf);
3556 while (!res && num) {
3558 snprintf(fn,
sizeof(fn),
"digits/minus");
3559 if (num > INT_MIN) {
3564 }
else if (num < 21) {
3567 snprintf(fn,
sizeof(fn),
"digits/f-0%d", num);
3569 snprintf(fn,
sizeof(fn),
"digits/f-%d", num);
3573 snprintf(fn,
sizeof(fn),
"digits/m-0%d", num);
3575 snprintf(fn,
sizeof(fn),
"digits/m-%d", num);
3579 }
else if ((num < 100) && num >= 20) {
3580 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
3582 }
else if ((num >= 100) && (num < 1000)) {
3583 int tmpnum = num / 100;
3584 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
3585 num = num - (tmpnum * 100);
3586 }
else if ((num >= 1000) && (num < 10000)) {
3587 int tmpnum = num / 1000;
3588 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
3589 num = num - (tmpnum * 1000);
3590 }
else if (num < 20000) {
3591 snprintf(fn,
sizeof(fn),
"digits/m-%d", (num / 1000));
3593 }
else if (num < 1000000) {
3598 snprintf(fn,
sizeof(fn),
"digits/1k");
3600 }
else if (num < 2000000) {
3601 snprintf(fn,
sizeof(fn),
"digits/1m");
3602 num = num % 1000000;
3603 }
else if (num < 3000000) {
3604 snprintf(fn,
sizeof(fn),
"digits/2m");
3605 num = num - 2000000;
3606 }
else if (num < 1000000000) {
3611 snprintf(fn,
sizeof(fn),
"digits/1m");
3612 num = num % 1000000;
3614 ast_debug(1,
"Number '%d' is too big for me\n", num);
3619 if ((audiofd > -1) && (ctrlfd > -1)) {
3636 char fn[256] =
"", fna[256] =
"";
3639 if (options && !strncasecmp(options,
"f", 1)) {
3641 }
else if (options && !strncasecmp(options,
"n", 1)) {
3650 while (!res && num) {
3653 if ( num > INT_MIN ) {
3658 }
else if (num < 100 && t) {
3661 }
else if (num < 20) {
3662 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3664 }
else if (num < 100) {
3665 int ones = num % 10;
3667 int tens = num - ones;
3668 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", tens, gender);
3673 snprintf(fn,
sizeof(fn),
"digits/and");
3677 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3681 }
else if (num == 100 && t == 0) {
3682 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3684 }
else if (num < 1000) {
3685 int hundreds = num / 100;
3687 if (hundreds == 1) {
3690 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3695 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3698 }
else if (num < 1000000) {
3699 int thousands = num / 1000;
3701 if (thousands == 1) {
3709 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3711 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3722 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3727 }
else if (num < 1000000000) {
3728 int millions = num / 1000000;
3729 num = num % 1000000;
3730 if (millions == 1) {
3737 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3747 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3752 }
else if (num < INT_MAX) {
3753 int billions = num / 1000000000;
3754 num = num % 1000000000;
3755 if (billions == 1) {
3761 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3770 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3775 }
else if (num == INT_MAX) {
3776 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3779 ast_debug(1,
"Number '%d' is too big for me\n", num);
3785 if ((audiofd > -1) && (ctrlfd > -1))
3793 if ((audiofd > -1) && (ctrlfd > -1)) {
3809 if (!strncasecmp(lang,
"en", 2)) {
3811 }
else if (!strncasecmp(lang,
"da", 2)) {
3813 }
else if (!strncasecmp(lang,
"de", 2)) {
3815 }
else if (!strncasecmp(lang,
"fr", 2)) {
3817 }
else if (!strncasecmp(lang,
"gr", 2)) {
3819 }
else if (!strncasecmp(lang,
"ja", 2)) {
3821 }
else if (!strncasecmp(lang,
"he", 2)) {
3823 }
else if (!strncasecmp(lang,
"hu", 2)) {
3825 }
else if (!strncasecmp(lang,
"is", 2)) {
3827 }
else if (!strncasecmp(lang,
"ka", 2)) {
3829 }
else if (!strncasecmp(lang,
"nl", 2)) {
3831 }
else if (!strncasecmp(lang,
"pt", 2)) {
3833 }
else if (!strncasecmp(lang,
"th", 2)) {
3845 struct timeval when = { t, 0 };
3850 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
3856 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
3873 struct timeval when = { t, 0 };
3879 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
3889 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
3905 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
3908 res =
wait_file(chan, ints,
"digits/hundred", lang);
3909 if (!res && year % 100 != 0) {
3910 res =
ast_say_number(chan, (year % 100), ints, lang, (
char *) NULL);
3922 struct timeval when = { t, 0 };
3928 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
3938 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
3955 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100) );
3958 res =
wait_file(chan, ints,
"digits/hundred", lang);
3959 if (!res && year % 100 != 0) {
3960 res =
ast_say_number(chan, (year % 100), ints, lang, (
char *) NULL);
3972 struct timeval when = { t, 0 };
3983 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
3993 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4004 struct timeval when = { t, 0 };
4010 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4020 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4033 struct timeval when = { t, 0 };
4039 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4047 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4062 struct timeval when = { t, 0 };
4068 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4082 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4098 struct timeval when = { t, 0 };
4104 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4110 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4111 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4115 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4125 struct timeval when = { t, 0 };
4131 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4138 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4159 struct timeval when = { t, 0 };
4165 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4175 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4191 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
4194 res =
wait_file(chan, ints,
"digits/hundred", lang);
4195 if (!res && year % 100 != 0) {
4196 res =
ast_say_number(chan, (year % 100), ints, lang, (
char *) NULL);
4207 if (!strncasecmp(lang,
"en", 2)) {
4209 }
else if (!strncasecmp(lang,
"da", 2)) {
4211 }
else if (!strncasecmp(lang,
"de", 2)) {
4213 }
else if (!strncasecmp(lang,
"es", 2)) {
4215 }
else if (!strncasecmp(lang,
"he", 2)) {
4217 }
else if (!strncasecmp(lang,
"fr", 2)) {
4219 }
else if (!strncasecmp(lang,
"gr", 2)) {
4221 }
else if (!strncasecmp(lang,
"is", 2)) {
4223 }
else if (!strncasecmp(lang,
"ja", 2)) {
4225 }
else if (!strncasecmp(lang,
"it", 2)) {
4227 }
else if (!strncasecmp(lang,
"nl", 2)) {
4229 }
else if (!strncasecmp(lang,
"pl", 2)) {
4231 }
else if (!strncasecmp(lang,
"pt", 2)) {
4233 }
else if (!strncasecmp(lang,
"th", 2)) {
4235 }
else if (!strncasecmp(lang,
"zh", 2)) {
4237 }
else if (!strncasecmp(lang,
"vi", 2)) {
4248 struct timeval when = { t, 0 };
4250 int res=0, offset, sndoffset;
4251 char sndfile[256], nextmsg[256];
4254 format =
"ABdY 'digits/at' IMp";
4258 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4259 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4260 switch (format[offset]) {
4264 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4265 sndfile[sndoffset] = format[offset];
4267 sndfile[sndoffset] =
'\0';
4268 res =
wait_file(chan, ints, sndfile, lang);
4273 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4274 res =
wait_file(chan, ints, nextmsg, lang);
4280 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4281 res =
wait_file(chan, ints, nextmsg, lang);
4300 res =
wait_file(chan, ints,
"digits/19", lang);
4304 res =
wait_file(chan, ints,
"digits/oh", lang);
4317 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4319 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4320 res =
wait_file(chan, ints, nextmsg, lang);
4325 if (format[offset] ==
'H') {
4328 res =
wait_file(chan, ints,
"digits/oh", lang);
4333 res =
wait_file(chan, ints,
"digits/oh", lang);
4340 res =
wait_file(chan, ints,
"digits/20", lang);
4344 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
4345 res =
wait_file(chan, ints, nextmsg, lang);
4354 if (format[offset] ==
'M') {
4355 res =
wait_file(chan, ints,
"digits/oclock", lang);
4357 res =
wait_file(chan, ints,
"digits/hundred", lang);
4359 }
else if (tm.
tm_min < 10) {
4360 res =
wait_file(chan, ints,
"digits/oh", lang);
4362 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
4363 res =
wait_file(chan, ints, nextmsg, lang);
4376 res =
wait_file(chan, ints, nextmsg, lang);
4388 gettimeofday(&now, NULL);
4393 if (beg_today < t) {
4395 res =
wait_file(chan, ints,
"digits/today", lang);
4396 }
else if (beg_today - 86400 < t) {
4398 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4399 }
else if (beg_today - 86400 * 6 < t) {
4402 }
else if (beg_today - 2628000 < t) {
4405 }
else if (beg_today - 15768000 < t) {
4429 if (beg_today < t) {
4431 }
else if ((beg_today - 86400) < t) {
4433 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4434 }
else if (beg_today - 86400 * 6 < t) {
4437 }
else if (beg_today - 2628000 < t) {
4440 }
else if (beg_today - 15768000 < t) {
4455 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
4456 res =
wait_file(chan, ints, nextmsg, lang);
4457 }
else if (tm.
tm_sec < 10) {
4458 res =
wait_file(chan, ints,
"digits/oh", lang);
4460 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
4461 res =
wait_file(chan, ints, nextmsg, lang);
4476 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
4495 struct timeval when = { t, 0 };
4497 int res=0, offset, sndoffset;
4498 char sndfile[256], nextmsg[256];
4501 format =
"A dBY HMS";
4505 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4506 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4507 switch (format[offset]) {
4511 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4512 sndfile[sndoffset] = format[offset];
4514 sndfile[sndoffset] =
'\0';
4515 res =
wait_file(chan, ints, sndfile, lang);
4520 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4521 res =
wait_file(chan, ints, nextmsg, lang);
4527 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4528 res =
wait_file(chan, ints, nextmsg, lang);
4552 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
4553 res =
wait_file(chan, ints, nextmsg, lang);
4555 res =
wait_file(chan, ints,
"digits/hundred", lang);
4556 if (!res && year % 100 != 0) {
4567 res =
wait_file(chan, ints,
"digits/oclock", lang);
4571 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4573 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4575 res =
wait_file(chan, ints, nextmsg, lang);
4581 res =
wait_file(chan, ints,
"digits/0", lang);
4593 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
4595 res =
wait_file(chan, ints,
"minute", lang);
4597 res =
wait_file(chan, ints,
"minutes", lang);
4608 res =
wait_file(chan, ints, nextmsg, lang);
4624 if (beg_today < t) {
4626 res =
wait_file(chan, ints,
"digits/today", lang);
4627 }
else if (beg_today - 86400 < t) {
4629 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4649 if (beg_today < t) {
4651 }
else if ((beg_today - 86400) < t) {
4653 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4654 }
else if (beg_today - 86400 * 6 < t) {
4667 res =
wait_file(chan, ints,
"digits/and", lang);
4671 res =
wait_file(chan, ints,
"seconds", lang);
4684 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
4697 struct timeval when = { t, 0 };
4699 int res=0, offset, sndoffset;
4700 char sndfile[256], nextmsg[256];
4703 format =
"A dBY HMS";
4707 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4708 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4709 switch (format[offset]) {
4713 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4714 sndfile[sndoffset] = format[offset];
4716 sndfile[sndoffset] =
'\0';
4717 res =
wait_file(chan, ints, sndfile, lang);
4722 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4723 res =
wait_file(chan, ints, nextmsg, lang);
4729 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4730 res =
wait_file(chan, ints, nextmsg, lang);
4754 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
4755 res =
wait_file(chan, ints, nextmsg, lang);
4757 res =
wait_file(chan, ints,
"digits/hundred", lang);
4758 if (!res && year % 100 != 0) {
4772 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4774 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4775 res =
wait_file(chan, ints, nextmsg, lang);
4777 res =
wait_file(chan, ints,
"digits/oclock", lang);
4785 res =
wait_file(chan, ints,
"digits/oclock", lang);
4790 if (
next_item(&format[offset + 1]) ==
'S') {
4792 }
else if (tm.
tm_min > 0) {
4796 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
4798 res =
wait_file(chan, ints,
"minute", lang);
4800 res =
wait_file(chan, ints,
"minutes", lang);
4811 res =
wait_file(chan, ints, nextmsg, lang);
4827 if (beg_today < t) {
4829 res =
wait_file(chan, ints,
"digits/today", lang);
4830 }
else if (beg_today - 86400 < t) {
4832 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4852 if (beg_today < t) {
4854 }
else if ((beg_today - 86400) < t) {
4856 res =
wait_file(chan, ints,
"digits/yesterday", lang);
4857 }
else if (beg_today - 86400 * 6 < t) {
4870 res =
wait_file(chan, ints,
"digits/and", lang);
4874 res =
wait_file(chan, ints, tm.
tm_sec == 1 ?
"second" :
"seconds", lang);
4887 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
4900 struct timeval when = { t, 0 };
4902 int res=0, offset, sndoffset;
4903 char sndfile[256], nextmsg[256];
4906 format =
"A dBY HMS";
4910 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4911 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4912 switch (format[offset]) {
4916 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4917 sndfile[sndoffset] = format[offset];
4919 sndfile[sndoffset] =
'\0';
4920 res =
wait_file(chan, ints, sndfile, lang);
4925 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4926 res =
wait_file(chan, ints, nextmsg, lang);
4932 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4933 res =
wait_file(chan, ints, nextmsg, lang);
4957 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
4958 res =
wait_file(chan, ints, nextmsg, lang);
4960 res =
wait_file(chan, ints,
"digits/hundred", lang);
4961 if (!res && year % 100 != 0) {
4972 res =
wait_file(chan, ints,
"digits/oclock", lang);
4976 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4978 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4980 res =
wait_file(chan, ints, nextmsg, lang);
4986 res =
wait_file(chan, ints,
"digits/0", lang);
4997 res =
wait_file(chan, ints,
"digits/0", lang);
4999 if (
next_item(&format[offset + 1]) ==
'S')
5004 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
5007 res =
wait_file(chan, ints,
"minute", lang);
5009 res =
wait_file(chan, ints,
"minutes", lang);
5020 res =
wait_file(chan, ints, nextmsg, lang);
5036 if (beg_today < t) {
5038 res =
wait_file(chan, ints,
"digits/today", lang);
5039 }
else if (beg_today - 86400 < t) {
5041 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5061 if (beg_today < t) {
5063 }
else if ((beg_today - 86400) < t) {
5065 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5066 }
else if (beg_today - 86400 * 6 < t) {
5079 res =
wait_file(chan, ints,
"digits/and", lang);
5083 if (!res && (tm.
tm_sec % 10 == 1) && (tm.
tm_sec != 11)) {
5084 res =
wait_file(chan, ints,
"second", lang);
5086 res =
wait_file(chan, ints,
"seconds", lang);
5099 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5112 struct timeval when = { t, 0 };
5114 int res=0, offset, sndoffset;
5115 char sndfile[256], nextmsg[256];
5118 format =
"a 'digits/tee' e 'digits/duan' hY I 'digits/naliga' M 'digits/natee'";
5122 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5123 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5124 switch (format[offset]) {
5128 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5129 sndfile[sndoffset] = format[offset];
5131 sndfile[sndoffset] =
'\0';
5132 res =
wait_file(chan, ints, sndfile, lang);
5137 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5138 res =
wait_file(chan, ints, nextmsg, lang);
5144 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5145 res =
wait_file(chan, ints, nextmsg, lang);
5165 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5166 res =
wait_file(chan, ints, nextmsg, lang);
5173 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5174 res =
wait_file(chan, ints, nextmsg, lang);
5197 if (beg_today < t) {
5199 res =
wait_file(chan, ints,
"digits/today", lang);
5200 }
else if (beg_today - 86400 < t) {
5202 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5203 }
else if (beg_today - 86400 * 6 < t) {
5206 }
else if (beg_today - 2628000 < t) {
5209 }
else if (beg_today - 15768000 < t) {
5232 if (beg_today < t) {
5234 }
else if ((beg_today - 86400) < t) {
5236 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5237 }
else if (beg_today - 86400 * 6 < t) {
5240 }
else if (beg_today - 2628000 < t) {
5243 }
else if (beg_today - 15768000 < t) {
5267 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5297 #define IL_DATE_STR "AdBY" 5298 #define IL_TIME_STR "HM" 5299 #define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " IL_TIME_STR 5303 struct timeval when = { t, 0 };
5305 int res = 0, offset, sndoffset;
5306 char sndfile[256], nextmsg[256];
5314 for (offset = 0; format[offset] !=
'\0'; offset++) {
5315 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5316 switch (format[offset]) {
5320 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5321 sndfile[sndoffset] = format[offset];
5323 sndfile[sndoffset] =
'\0';
5324 res =
wait_file(chan, ints, sndfile, lang);
5329 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5330 res =
wait_file(chan, ints, nextmsg, lang);
5336 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5337 res =
wait_file(chan, ints, nextmsg, lang);
5380 char todo = format[offset];
5386 if (beg_today < t) {
5389 res =
wait_file(chan, ints,
"digits/today", lang);
5391 }
else if (beg_today - 86400 < t) {
5393 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5394 }
else if ((todo !=
'Q') && (beg_today - 86400 * 6 < t)) {
5407 ints, lang,
"f", -1, -1
5430 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5444 struct timeval when = { t, 0 };
5446 int res=0, offset, sndoffset;
5447 char sndfile[256], nextmsg[256];
5450 format =
"'digits/es-el' Ad 'digits/es-de' B 'digits/es-de' Y 'digits/at' IMp";
5454 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5455 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5456 switch (format[offset]) {
5460 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5461 sndfile[sndoffset] = format[offset];
5463 sndfile[sndoffset] =
'\0';
5464 snprintf(nextmsg,
sizeof(nextmsg),
"%s", sndfile);
5465 res =
wait_file(chan, ints, nextmsg, lang);
5470 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5471 res =
wait_file(chan, ints, nextmsg, lang);
5477 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5478 res =
wait_file(chan, ints, nextmsg, lang);
5482 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
5483 res =
wait_file(chan, ints, nextmsg, lang);
5500 snprintf(nextmsg,
sizeof(nextmsg),
"digits/1F");
5502 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
5504 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5505 res =
wait_file(chan, ints, nextmsg, lang);
5520 res =
wait_file(chan, ints,
"digits/p-m", lang);
5522 res =
wait_file(chan, ints,
"digits/afternoon", lang);
5524 res =
wait_file(chan, ints,
"digits/a-m", lang);
5540 if (beg_today < t) {
5542 res =
wait_file(chan, ints,
"digits/today", lang);
5543 }
else if (beg_today - 86400 < t) {
5545 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5565 if (beg_today < t) {
5567 res =
wait_file(chan, ints,
"digits/today", lang);
5568 }
else if ((beg_today - 86400) < t) {
5570 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5571 }
else if (beg_today - 86400 * 6 < t) {
5585 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
5586 res =
wait_file(chan, ints, nextmsg, lang);
5587 }
else if (tm.
tm_sec < 10) {
5588 res =
wait_file(chan, ints,
"digits/oh", lang);
5590 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
5591 res =
wait_file(chan, ints, nextmsg, lang);
5593 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
5594 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
5595 res =
wait_file(chan, ints, nextmsg, lang);
5598 ten = (tm.
tm_sec / 10) * 10;
5600 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
5601 res =
wait_file(chan, ints, nextmsg, lang);
5605 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
5606 res =
wait_file(chan, ints, nextmsg, lang);
5620 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5635 struct timeval when = { t, 0 };
5637 int res=0, offset, sndoffset;
5638 char sndfile[256], nextmsg[256];
5641 format =
"AdBY 'digits/at' IMp";
5645 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5646 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5647 switch (format[offset]) {
5651 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5652 sndfile[sndoffset] = format[offset];
5654 sndfile[sndoffset] =
'\0';
5655 res =
wait_file(chan, ints, sndfile, lang);
5660 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5661 res =
wait_file(chan, ints, nextmsg, lang);
5667 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5668 res =
wait_file(chan, ints, nextmsg, lang);
5672 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
5673 res =
wait_file(chan, ints, nextmsg, lang);
5679 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mday);
5680 res =
wait_file(chan, ints, nextmsg, lang);
5688 res =
wait_file(chan, ints,
"digits/2", lang);
5690 res =
wait_file(chan, ints,
"digits/thousand", lang);
5702 res =
wait_file(chan, ints,
"digits/thousand", lang);
5704 wait_file(chan, ints,
"digits/9", lang);
5705 wait_file(chan, ints,
"digits/hundred", lang);