42#include <netinet/in.h>
48#include <iso/limits_iso.h>
62static int wait_file(
struct ast_channel *chan,
const char *ints,
const char *file,
const char *lang);
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);
881 if (!strncasecmp(
language,
"en_GB", 5)) {
883 }
else if (!strncasecmp(
language,
"en", 2)) {
885 }
else if (!strncasecmp(
language,
"cs", 2)) {
887 }
else if (!strncasecmp(
language,
"da", 2)) {
889 }
else if (!strncasecmp(
language,
"de", 2)) {
891 }
else if (!strncasecmp(
language,
"es", 2)) {
893 }
else if (!strncasecmp(
language,
"fr", 2)) {
895 }
else if (!strncasecmp(
language,
"gr", 2)) {
897 }
else if (!strncasecmp(
language,
"ja", 2)) {
899 }
else if (!strncasecmp(
language,
"he", 2)) {
901 }
else if (!strncasecmp(
language,
"hu", 2)) {
903 }
else if (!strncasecmp(
language,
"is", 2)) {
905 }
else if (!strncasecmp(
language,
"it", 2)) {
907 }
else if (!strncasecmp(
language,
"ka", 2)) {
909 }
else if (!strncasecmp(
language,
"nl", 2)) {
911 }
else if (!strncasecmp(
language,
"no", 2)) {
913 }
else if (!strncasecmp(
language,
"pl", 2)) {
915 }
else if (!strncasecmp(
language,
"pt", 2)) {
917 }
else if (!strncasecmp(
language,
"ru", 2)) {
919 }
else if (!strncasecmp(
language,
"se", 2)) {
921 }
else if (!strncasecmp(
language,
"th", 2)) {
923 }
else if (!strncasecmp(
language,
"zh", 2)) {
925 }
else if (!strncasecmp(
language,
"ur", 2)) {
927 }
else if (!strncasecmp(
language,
"vi", 2)) {
929 }
else if (!strncasecmp(
language,
"dr", 2)) {
931 }
else if (!strncasecmp(
language,
"ps", 2)) {
957 for (x=0;x<power;x++)
1001 while (!res && (num || playh)) {
1004 if ( num > INT_MIN ) {
1009 }
else if (num < 3 ) {
1010 snprintf(fn,
sizeof(fn),
"digits/%d%c", num,
options[0]);
1013 }
else if (num < 20) {
1014 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1017 }
else if (num < 100) {
1018 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1020 }
else if (num < 1000) {
1021 hundred = num / 100;
1022 if ( hundred == 1 ) {
1024 }
else if ( hundred == 2 ) {
1030 if (hundred == 3 || hundred == 4) {
1032 }
else if ( hundred > 4 ) {
1036 num -= (hundred * 100);
1038 length = (int)log10(num)+1;
1039 while ( (length % 3 ) != 1 ) {
1056 snprintf(fn,
sizeof(fn),
"digits/5_E%d", length - 1);
1057 }
else if ( left >= 2 && left <= 4 ) {
1058 snprintf(fn,
sizeof(fn),
"digits/2-4_E%d", length - 1);
1060 snprintf(fn,
sizeof(fn),
"digits/1_E%d", length - 1);
1066 if ((audiofd > -1) && (ctrlfd > -1)) {
1094 while (!res && (num || playh || playa )) {
1107 if ( num > INT_MIN ) {
1118 }
else if (num == 1 && cn == -1) {
1121 }
else if (num < 20) {
1122 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1124 }
else if (num < 100) {
1125 int ones = num % 10;
1127 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
1130 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1135 int hundreds = num / 100;
1139 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1142 num -= 100 * hundreds;
1147 if (num < 1000000) {
1154 if (num < 1000000000) {
1155 int millions = num / 1000000;
1163 num = num % 1000000;
1165 ast_debug(1,
"Number '%d' is too big for me\n", num);
1169 if (num && num < 100)
1175 if ((audiofd > -1) && (ctrlfd > -1))
1208 while (!res && num) {
1224 if ( num > INT_MIN ) {
1229 }
else if (num == 1 && mf == -1) {
1230 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1232 }
else if (num < 20) {
1233 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1235 }
else if (num < 100) {
1236 int ones = num % 10;
1238 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
1241 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1244 }
else if (num == 100 && t == 0) {
1247 }
else if (num < 1000) {
1248 int hundreds = num / 100;
1250 if (hundreds == 1) {
1253 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1256 }
else if (num == 1000 && t == 0) {
1259 }
else if (num < 1000000) {
1260 int thousands = num / 1000;
1263 if (thousands == 1) {
1272 }
else if (num < 1000000000) {
1273 int millions = num / 1000000;
1274 num = num % 1000000;
1276 if (millions == 1) {
1285 }
else if (num <= INT_MAX) {
1286 int billions = num / 1000000000;
1287 num = num % 1000000000;
1289 if (billions == 1) {
1300 ast_debug(1,
"Number '%d' is too big for me\n", num);
1305 if ((audiofd > -1) && (ctrlfd > -1))
1313 if ((audiofd > -1) && (ctrlfd > -1))
1344 while (!res && num) {
1356 if ( num > INT_MIN ) {
1361 }
else if (num < 20) {
1362 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1364 }
else if (num < 100) {
1365 int ones = num % 10;
1367 snprintf(fn,
sizeof(fn),
"digits/%d", ones);
1373 if (num == 20 && playWesht == 1){
1374 snprintf(fn,
sizeof(fn),
"digits/wesht");
1377 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1381 }
else if (num == 100 && t == 0) {
1384 }
else if (num < 1000) {
1385 int hundreds = num / 100;
1394 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1398 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1401 }
else if (num == 1000 && t == 0) {
1404 }
else if (num < 1000000) {
1405 int thousands = num / 1000;
1408 if (thousands == 1) {
1410 snprintf(fn,
sizeof(fn),
"digits/%d", thousands);
1419 }
else if (num < 1000000000) {
1420 int millions = num / 1000000;
1421 num = num % 1000000;
1423 if (millions == 1) {
1431 }
else if (num <= INT_MAX) {
1432 int billions = num / 1000000000;
1433 num = num % 1000000000;
1435 if (billions == 1) {
1445 ast_debug(1,
"Number '%d' is too big for me\n", num);
1450 if ((audiofd > -1) && (ctrlfd > -1))
1458 if ((audiofd > -1) && (ctrlfd > -1))
1484 while (!res && (num || playh || playa )) {
1487 if ( num > INT_MIN ) {
1498 }
else if (num < 20) {
1499 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1501 }
else if (num < 100) {
1502 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1504 }
else if (num < 1000) {
1505 int hundreds = num / 100;
1506 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1509 num -= 100 * hundreds;
1512 }
else if (num < 1000000) {
1518 if (num && num < 100)
1520 }
else if (num < 1000000000) {
1521 int millions = num / 1000000;
1527 if (num && num < 100)
1530 ast_debug(1,
"Number '%d' is too big for me\n", num);
1536 if ((audiofd > -1) && (ctrlfd > -1))
1561 while (!res && (num || playh || playa )) {
1564 if ( num > INT_MIN ) {
1575 }
else if (num < 20) {
1576 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1578 }
else if (num < 100) {
1579 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1583 }
else if (num < 1000) {
1584 int hundreds = num / 100;
1585 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1588 num -= 100 * hundreds;
1591 }
else if (num < 1000000) {
1599 }
else if (num < 1000000000) {
1600 int millions = num / 1000000;
1606 if (num && num < 100 && say_o)
1609 ast_debug(1,
"Number '%d' is too big for me\n", num);
1615 if ((audiofd > -1) && (ctrlfd > -1))
1643 if (!strncasecmp(
options,
"f", 1))
1645 else if (!strncasecmp(
options,
"m", 1))
1649 while (!res && num) {
1652 if ( num > INT_MIN ) {
1660 }
else if (num == 1) {
1662 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1664 snprintf(fn,
sizeof(fn),
"digits/%dM", num);
1666 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1668 }
else if (num < 31) {
1669 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1671 }
else if (num < 100) {
1672 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1676 }
else if (num == 100) {
1679 }
else if (num < 200) {
1684 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100)*100);
1686 }
else if (num < 2000) {
1690 if (num < 1000000) {
1697 if (num < 2147483640) {
1698 if ((num/1000000) == 1) {
1711 ast_debug(1,
"Number '%d' is too big for me\n", num);
1720 if ((audiofd > -1) && (ctrlfd > -1))
1750 while (!res && (num || playh || playa)) {
1753 if ( num > INT_MIN ) {
1764 }
else if (num == 1) {
1766 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1768 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1770 }
else if (num < 21) {
1771 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1773 }
else if (num < 70) {
1774 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1775 if ((num % 10) == 1) playa++;
1777 }
else if (num < 80) {
1779 if ((num % 10) == 1) playa++;
1781 }
else if (num < 100) {
1784 }
else if (num < 200) {
1787 }
else if (num < 1000) {
1788 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
1791 }
else if (num < 2000) {
1794 }
else if (num < 1000000) {
1800 }
else if (num < 1000000000) {
1805 num = num % 1000000;
1807 ast_debug(1,
"Number '%d' is too big for me\n", num);
1812 if ((audiofd > -1) && (ctrlfd > -1))
1828#define SAY_NUM_BUF_SIZE 256
1838 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num,
options);
1846 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d\n", num,
state,
options, mf);
1849 while (!res && (num || (
state > 0))) {
1857 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d, tmpnum=%d\n", num,
state,
options, mf, tmpnum);
1861 }
else if (
state == 2) {
1862 if ((num >= 11) && (num < 21)) {
1864 snprintf(fn,
sizeof(fn),
"digits/ve");
1866 snprintf(fn,
sizeof(fn),
"digits/uu");
1871 snprintf(fn,
sizeof(fn),
"digits/ve");
1874 snprintf(fn,
sizeof(fn),
"digits/uu");
1878 snprintf(fn,
sizeof(fn),
"digits/ve");
1880 snprintf(fn,
sizeof(fn),
"digits/uu");
1884 snprintf(fn,
sizeof(fn),
"digits/ve");
1887 snprintf(fn,
sizeof(fn),
"digits/ve");
1890 snprintf(fn,
sizeof(fn),
"digits/ve");
1893 snprintf(fn,
sizeof(fn),
"digits/ve");
1896 snprintf(fn,
sizeof(fn),
"digits/uu");
1899 snprintf(fn,
sizeof(fn),
"digits/ve");
1902 snprintf(fn,
sizeof(fn),
"digits/ve");
1907 }
else if (
state == 3) {
1908 snprintf(fn,
sizeof(fn),
"digits/1k");
1910 }
else if (num < 0) {
1911 snprintf(fn,
sizeof(fn),
"digits/minus");
1913 }
else if (num < 20) {
1915 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1917 snprintf(fn,
sizeof(fn),
"digits/%dm", num);
1920 }
else if ((num < 100) && (num >= 20)) {
1921 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
1926 }
else if ((num >= 100) && (num < 1000)) {
1928 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
1929 num = num - (tmpnum * 100);
1930 if ((num > 0) && (num < 11)) {
1933 }
else if ((num >= 1000) && (num < 10000)) {
1934 tmpnum = num / 1000;
1935 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
1936 num = num - (tmpnum * 1000);
1937 if ((num > 0) && (num < 11)) {
1940 }
else if (num < 20000) {
1941 snprintf(fn,
sizeof(fn),
"digits/%dm", (num / 1000));
1944 }
else if (num < 1000000) {
1949 snprintf(fn,
sizeof(fn),
"digits/1k");
1951 if ((num > 0) && (num < 11)) {
1954 }
else if (num < 2000000) {
1955 snprintf(fn,
sizeof(fn),
"digits/million");
1956 num = num % 1000000;
1957 if ((num > 0) && (num < 11)) {
1960 }
else if (num < 3000000) {
1961 snprintf(fn,
sizeof(fn),
"digits/twomillion");
1962 num = num - 2000000;
1963 if ((num > 0) && (num < 11)) {
1966 }
else if (num < 1000000000) {
1971 snprintf(fn,
sizeof(fn),
"digits/million");
1972 num = num % 1000000;
1973 if ((num > 0) && (num < 11)) {
1977 ast_debug(1,
"Number '%d' is too big for me\n", num);
1983 if ((audiofd > -1) && (ctrlfd > -1)) {
2015 while(!res && (num || playh)) {
2018 if ( num > INT_MIN ) {
2026 }
else if (num < 11 || num == 20) {
2027 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2029 }
else if (num < 20) {
2032 }
else if (num < 30) {
2035 }
else if (num < 100) {
2036 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2040 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2044 if (num < 1000000) {
2051 if (num < 1000000000) {
2058 ast_debug(1,
"Number '%d' is too big for me\n", num);
2066 if ((audiofd > -1) && (ctrlfd > -1))
2097 while (!res && (num || playh || playa )) {
2100 if ( num > INT_MIN ) {
2114 }
else if (num < 5 && cn == 2) {
2115 snprintf(fn,
sizeof(fn),
"digits/%dkvk", num);
2117 }
else if (num < 5 && cn == 3) {
2118 snprintf(fn,
sizeof(fn),
"digits/%dhk", num);
2120 }
else if (num < 20) {
2121 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2123 }
else if (num < 100) {
2124 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2128 }
else if (num < 1000) {
2129 int hundreds = num / 100;
2132 snprintf(fn,
sizeof(fn),
"digits/%dhk", hundreds);
2134 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2137 num -= 100 * hundreds;
2138 if (num && num < 20)
2141 if (num && (num % 10) == 0)
2143 }
else if (num < 1000000) {
2146 if ((num % 100) == 0 && (num % 1000 != 0)) {
2153 if (num && (num < 20 || (num % 10 == 0)))
2155 }
else if (num < 1000000000) {
2156 int millions = num / 1000000;
2166 if (num && num < 100)
2168 }
else if (num < INT_MAX) {
2169 int milliards = num / 1000000000;
2179 if (num && num < 100)
2182 ast_debug(1,
"Number '%d' is too big for me\n", num);
2188 if ((audiofd > -1) && (ctrlfd > -1))
2235 while (!res && (num || playh)) {
2238 if ( num > INT_MIN ) {
2246 }
else if (num < 20) {
2247 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2249 }
else if (num == 21) {
2250 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2252 }
else if (num == 28) {
2253 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2255 }
else if (num == 31) {
2256 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2258 }
else if (num == 38) {
2259 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2261 }
else if (num == 41) {
2262 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2264 }
else if (num == 48) {
2265 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2267 }
else if (num == 51) {
2268 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2270 }
else if (num == 58) {
2271 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2273 }
else if (num == 61) {
2274 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2276 }
else if (num == 68) {
2277 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2279 }
else if (num == 71) {
2280 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2282 }
else if (num == 78) {
2283 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2285 }
else if (num == 81) {
2286 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2288 }
else if (num == 88) {
2289 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2291 }
else if (num == 91) {
2292 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2294 }
else if (num == 98) {
2295 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2297 }
else if (num < 100) {
2298 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2302 if ((num / 100) > 1) {
2303 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2310 if (num < 1000000) {
2317 if ((tempnum / 1000) < 2)
2322 if (num < 1000000000) {
2323 if ((num / 1000000) > 1)
2329 if ((tempnum / 1000000) < 2)
2334 ast_debug(1,
"Number '%d' is too big for me\n", num);
2342 if ((audiofd > -1) && (ctrlfd > -1))
2364 while (!res && (num || playh )) {
2367 if ( num > INT_MIN ) {
2375 }
else if (num < 20) {
2376 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2378 }
else if (num < 100) {
2387 snprintf(fn,
sizeof(fn),
"digits/%d", num - units);
2390 }
else if (num < 200) {
2394 }
else if (num < 1000) {
2395 snprintf(fn,
sizeof(fn),
"digits/%d", num / 100);
2403 }
else if (num < 10000) {
2410 if (num < 1000000) {
2417 if (num < 1000000000) {
2424 ast_debug(1,
"Number '%d' is too big for me\n", num);
2433 if ((audiofd > -1) && (ctrlfd > -1))
2467 while (!res && (num || playh || playa )) {
2470 if ( num > INT_MIN ) {
2481 }
else if (num == 1 && cn == -1) {
2484 }
else if (num < 20) {
2485 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2487 }
else if (num < 100) {
2488 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2490 }
else if (num < 1000) {
2491 int hundreds = num / 100;
2495 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2498 num -= 100 * hundreds;
2501 }
else if (num < 1000000) {
2507 if (num && num < 100)
2509 }
else if (num < 1000000000) {
2510 int millions = num / 1000000;
2516 if (num && num < 100)
2519 ast_debug(1,
"Number '%d' is too big for me\n", num);
2525 if ((audiofd > -1) && (ctrlfd > -1))
2541 char *dziesiatki[10];
2552 return odm->
rzedy[rzad - 1][0];
2553 if ((i > 21 || i < 11) && i%10 > 1 && i%10 < 5)
2554 return odm->
rzedy[rzad - 1][1];
2556 return odm->
rzedy[rzad - 1][2];
2561 strcpy(buffer,
str);
2562 buffer += strlen(
str);
2568 char file_name[255] =
"digits/";
2569 strcat(file_name, fn);
2570 ast_debug(1,
"Trying to play: %s\n", file_name);
2572 if ((audiofd > -1) && (ctrlfd > -1))
2592 if (i == 0 && rzad > 0) {
2600 m1000E6 = i % 1000000000;
2601 i1000E6 = i / 1000000000;
2605 m1000E3 = m1000E6 % 1000000;
2606 i1000E3 = m1000E6 / 1000000;
2610 m1000 = m1000E3 % 1000;
2611 i1000 = m1000E3 / 1000;
2621 if (m100 > 0 && m100 <= 9) {
2626 }
else if (m100 % 10 == 0 && m100 != 0) {
2628 }
else if (m100 > 10 && m100 <= 19) {
2630 }
else if (m100 > 20) {
2743 char *zenski_cyfry[] = {
"0",
"1z",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2745 char *zenski_cyfry2[] = {
"0",
"1",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2747 char *meski_cyfry[] = {
"0",
"1",
"2-1m",
"3-1m",
"4-1m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2749 char *meski_cyfry2[] = {
"0",
"1",
"2-2m",
"3-2m",
"4-2m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2751 char *meski_setki[] = {
"",
"100m",
"200m",
"300m",
"400m",
"500m",
"600m",
"700m",
"800m",
"900m"};
2753 char *meski_dziesiatki[] = {
"",
"10m",
"20m",
"30m",
"40m",
"50m",
"60m",
"70m",
"80m",
"90m"};
2755 char *meski_nastki[] = {
"",
"11m",
"12m",
"13m",
"14m",
"15m",
"16m",
"17m",
"18m",
"19m"};
2757 char *nijaki_cyfry[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2759 char *nijaki_cyfry2[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2761 char *nijaki_setki[] = {
"",
"100",
"200",
"300",
"400",
"500",
"600",
"700",
"800",
"900"};
2763 char *nijaki_dziesiatki[] = {
"",
"10",
"20",
"30",
"40",
"50",
"60",
"70",
"80",
"90"};
2765 char *nijaki_nastki[] = {
"",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19"};
2767 char *rzedy[][3] = { {
"1000",
"1000.2",
"1000.5"}, {
"1000000",
"1000000.2",
"1000000.5"}, {
"1000000000",
"1000000000.2",
"1000000000.5"}};
2776 if (odmiana_nieosobowa ==
NULL) {
2777 odmiana_nieosobowa =
ast_malloc(
sizeof(*odmiana_nieosobowa));
2781 memcpy(odmiana_nieosobowa->
cyfry, nijaki_cyfry,
sizeof(odmiana_nieosobowa->
cyfry));
2782 memcpy(odmiana_nieosobowa->
cyfry2, nijaki_cyfry2,
sizeof(odmiana_nieosobowa->
cyfry));
2783 memcpy(odmiana_nieosobowa->
setki, nijaki_setki,
sizeof(odmiana_nieosobowa->
setki));
2784 memcpy(odmiana_nieosobowa->
dziesiatki, nijaki_dziesiatki,
sizeof(odmiana_nieosobowa->
dziesiatki));
2785 memcpy(odmiana_nieosobowa->
nastki, nijaki_nastki,
sizeof(odmiana_nieosobowa->
nastki));
2786 memcpy(odmiana_nieosobowa->
rzedy, rzedy,
sizeof(odmiana_nieosobowa->
rzedy));
2789 if (odmiana_zenska ==
NULL) {
2790 odmiana_zenska =
ast_malloc(
sizeof(*odmiana_zenska));
2794 memcpy(odmiana_zenska->
cyfry, zenski_cyfry,
sizeof(odmiana_zenska->
cyfry));
2795 memcpy(odmiana_zenska->
cyfry2, zenski_cyfry2,
sizeof(odmiana_zenska->
cyfry));
2796 memcpy(odmiana_zenska->
setki, nijaki_setki,
sizeof(odmiana_zenska->
setki));
2798 memcpy(odmiana_zenska->
nastki, nijaki_nastki,
sizeof(odmiana_zenska->
nastki));
2799 memcpy(odmiana_zenska->
rzedy, rzedy,
sizeof(odmiana_zenska->
rzedy));
2802 if (odmiana_meska ==
NULL) {
2803 odmiana_meska =
ast_malloc(
sizeof(*odmiana_meska));
2807 memcpy(odmiana_meska->
cyfry, meski_cyfry,
sizeof(odmiana_meska->
cyfry));
2808 memcpy(odmiana_meska->
cyfry2, meski_cyfry2,
sizeof(odmiana_meska->
cyfry));
2809 memcpy(odmiana_meska->
setki, meski_setki,
sizeof(odmiana_meska->
setki));
2811 memcpy(odmiana_meska->
nastki, meski_nastki,
sizeof(odmiana_meska->
nastki));
2812 memcpy(odmiana_meska->
rzedy, rzedy,
sizeof(odmiana_meska->
rzedy));
2816 if (strncasecmp(
options,
"f", 1) == 0)
2818 else if (strncasecmp(
options,
"m", 1) == 0)
2821 o = odmiana_nieosobowa;
2823 o = odmiana_nieosobowa;
2850 while (!res && num ) {
2853 if ( num > INT_MIN ) {
2858 }
else if (num < 20) {
2859 if ((num == 1 || num == 2) && (mf < 0))
2860 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
2862 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2864 }
else if (num < 100) {
2865 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
2869 }
else if (num < 1000) {
2875 if (mf < 0 && num > 199)
2876 snprintf(fn,
sizeof(fn),
"digits/%dF", (num / 100) * 100);
2878 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100) * 100);
2883 }
else if (num < 1000000) {
2890 if ((num % 1000) && ((num % 1000) < 100 || !(num % 100)))
2893 }
else if (num < 1000000000) {
2902 if ((num % 1000000) &&
2904 ((!((num / 1000) % 1000) && ((num % 1000) < 100 || !(num % 100))) ||
2906 (!(num % 1000) && (((num / 1000) % 1000) < 100 || !((num / 1000) % 100))) ) )
2908 num = num % 1000000;
2916 if ((audiofd > -1) && (ctrlfd > -1))
2923 if (!res && playh) {
2950 while (num || playh) {
2953 if ( num > INT_MIN ) {
2961 }
else if (start && num < 200 && num > 99 && cn == -1) {
2963 snprintf(fn,
sizeof(fn),
"digits/hundred");
2965 }
else if (num == 1 && cn == -1) {
2968 }
else if (num < 20) {
2969 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2971 }
else if (num < 100) {
2972 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2974 }
else if (num < 1000) {
2976 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2979 }
else if (num < 1000000) {
2987 }
else if (num < 1000000000) {
2996 ast_debug(1,
"Number '%d' is too big for me\n", num);
3001 if ((audiofd > -1) && (ctrlfd > -1)) {
3023 int last_length = 0;
3029 while (!res && (num || playh || playt || playz)) {
3032 if ( num > INT_MIN ) {
3038 snprintf(fn,
sizeof(fn),
"digits/0");
3045 snprintf(fn,
sizeof(fn),
"digits/thousand");
3047 }
else if (num < 10) {
3048 snprintf(
buf, 12,
"%d", num);
3049 if (last_length - strlen(
buf) > 1 && last_length != 0) {
3050 last_length = strlen(
buf);
3054 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3056 }
else if (num < 100) {
3057 snprintf(
buf, 10,
"%d", num);
3058 if (last_length - strlen(
buf) > 1 && last_length != 0) {
3059 last_length = strlen(
buf);
3063 last_length = strlen(
buf);
3064 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
3068 snprintf(
buf, 10,
"%d", num);
3069 if (last_length - strlen(
buf) > 1 && last_length != 0) {
3070 last_length = strlen(
buf);
3074 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
3076 snprintf(
buf, 10,
"%d", num);
3077 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3078 last_length = strlen(
buf);
3079 num -= ((num / 100) * 100);
3080 }
else if (num < 10000){
3081 snprintf(
buf, 10,
"%d", num);
3082 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 1000));
3084 snprintf(
buf, 10,
"%d", num);
3085 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3086 last_length = strlen(
buf);
3087 num -= ((num / 1000) * 1000);
3088 }
else if (num < 100000000) {
3092 snprintf(
buf, 10,
"%d", num);
3093 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3094 num -= ((num / 10000) * 10000);
3095 last_length = strlen(
buf);
3096 snprintf(fn,
sizeof(fn),
"digits/wan");
3098 if (num < 1000000000) {
3102 snprintf(
buf, 10,
"%d", num);
3103 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3104 last_length = strlen(
buf);
3105 num -= ((num / 100000000) * 100000000);
3106 snprintf(fn,
sizeof(fn),
"digits/yi");
3108 ast_debug(1,
"Number '%d' is too big for me\n", num);
3115 if ((audiofd > -1) && (ctrlfd > -1))
3140 while (!res && (num || playh)) {
3142 snprintf(fn,
sizeof(fn),
"digits/hundred");
3144 }
else if (num < 100) {
3145 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3147 }
else if (num < 1000) {
3148 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
3150 num -= ((num / 100) * 100);
3151 }
else if (num < 100000) {
3156 snprintf(fn,
sizeof(fn),
"digits/thousand");
3157 }
else if (num < 10000000) {
3162 snprintf(fn,
sizeof(fn),
"digits/lac");
3163 }
else if (num < 1000000000) {
3167 num = num % 10000000;
3168 snprintf(fn,
sizeof(fn),
"digits/crore");
3170 ast_debug(1,
"Number '%d' is too big for me\n", num);
3176 if ((audiofd > -1) && (ctrlfd > -1)) {
3192 }
else if (num < 100) {
3194 }
else if (num < 1000) {
3224 while (!res && (num)) {
3227 if ( num > INT_MIN ) {
3232 }
else if (num < 20) {
3234 snprintf(fn,
sizeof(fn),
"digits/%d%s", num,
options);
3236 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3239 }
else if (num < 100) {
3240 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 10));
3242 }
else if (num < 1000){
3243 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 100));
3245 }
else if (num < 1000000) {
3248 if (lastdigits < 3) {
3255 if (lastdigits == 1) {
3257 }
else if (lastdigits > 1 && lastdigits < 5) {
3263 }
else if (num < 1000000000) {
3269 if (lastdigits == 1) {
3271 }
else if (lastdigits > 1 && lastdigits < 5) {
3278 ast_debug(1,
"Number '%d' is too big for me\n", num);
3283 if ((audiofd > -1) && (ctrlfd > -1))
3303 while(!res && (num || playh)) {
3306 if ( num > INT_MIN ) {
3314 }
else if (num < 100) {
3315 if ((num <= 20) || ((num % 10) == 1)) {
3316 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3319 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
3322 }
else if (num < 1000) {
3323 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
3326 }
else if (num < 10000) {
3332 }
else if (num < 100000) {
3338 }
else if (num < 1000000) {
3353 if ((audiofd > -1) && (ctrlfd > -1))
3376 while (!res && (num || playh)) {
3379 if ( num > INT_MIN ) {
3385 snprintf(fn,
sizeof(fn),
"digits/%da", num);
3394 }
else if (playoh) {
3397 }
else if (playohz) {
3400 }
else if (num < 20) {
3401 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3403 }
else if (num < 100) {
3404 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
3406 if ((num == 5) || (num == 4) || (num == 1)) playl++;
3409 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
3411 if (num && (num < 10)) {
3418 if (num < 1000000) {
3423 snprintf(fn,
sizeof(fn),
"digits/thousand");
3424 if (num && (num < 10)) {
3426 }
else if (num && (num < 100)){
3434 if (num < 1000000000) {
3448 if ((audiofd > -1) && (ctrlfd > -1))
3463 if (!strncasecmp(
language,
"en", 2)) {
3465 }
else if (!strncasecmp(
language,
"da", 2)) {
3467 }
else if (!strncasecmp(
language,
"de", 2)) {
3469 }
else if (!strncasecmp(
language,
"he", 2)) {
3471 }
else if (!strncasecmp(
language,
"is", 2)) {
3473 }
else if (!strncasecmp(
language,
"vi", 2)) {
3475 }
else if (!strncasecmp(
language,
"ps", 2)) {
3477 }
else if (!strncasecmp(
language,
"dr", 2)) {
3492 while (!res && num) {
3495 if ( num > INT_MIN ) {
3500 }
else if (num < 20) {
3501 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3503 }
else if (num < 100) {
3504 int tens = num / 10;
3507 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3509 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3511 }
else if (num < 1000) {
3512 int hundreds = num / 100;
3514 if (hundreds > 1 || t == 1) {
3524 }
else if (num < 1000000) {
3525 int thousands = num / 1000;
3527 if (thousands > 1 || t == 1) {
3538 }
else if (num < 1000000000) {
3539 int millions = num / 1000000;
3540 num = num % 1000000;
3550 }
else if (num < INT_MAX) {
3551 int billions = num / 1000000000;
3552 num = num % 1000000000;
3562 }
else if (num == INT_MAX) {
3566 ast_debug(1,
"Number '%d' is too big for me\n", num);
3572 if ((audiofd > -1) && (ctrlfd > -1)) {
3591 while (!res && num) {
3594 if ( num > INT_MIN ) {
3599 }
else if (num <= 31) {
3600 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3602 }
else if (num < 100) {
3603 int tens = num / 10;
3606 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3608 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3610 }
else if (num < 1000) {
3611 int hundreds = num / 100;
3613 if (hundreds > 1 || t == 1) {
3623 }
else if (num < 1000000) {
3624 int thousands = num / 1000;
3626 if (thousands > 1 || t == 1) {
3637 }
else if (num < 1000000000) {
3638 int millions = num / 1000000;
3639 num = num % 1000000;
3649 }
else if (num < INT_MAX) {
3650 int billions = num / 1000000000;
3651 num = num % 1000000000;
3661 }
else if (num == INT_MAX) {
3665 ast_debug(1,
"Number '%d' is too big for me\n", num);
3671 if ((audiofd > -1) && (ctrlfd > -1)) {
3690 while (!res && num) {
3693 if ( num > INT_MIN ) {
3698 }
else if (num <= 31) {
3699 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3701 }
else if (num < 100) {
3702 int tens = num / 10;
3705 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3707 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3709 }
else if (num < 1000) {
3710 int hundreds = num / 100;
3712 if (hundreds > 1 || t == 1) {
3722 }
else if (num < 1000000) {
3723 int thousands = num / 1000;
3725 if (thousands > 1 || t == 1) {
3736 }
else if (num < 1000000000) {
3737 int millions = num / 1000000;
3738 num = num % 1000000;
3748 }
else if (num < INT_MAX) {
3749 int billions = num / 1000000000;
3750 num = num % 1000000000;
3760 }
else if (num == INT_MAX) {
3764 ast_debug(1,
"Number '%d' is too big for me\n", num);
3770 if ((audiofd > -1) && (ctrlfd > -1)) {
3789 if ((audiofd > -1) && (ctrlfd > -1)) {
3806 char fn[256] =
"", fna[256] =
"";
3820 while (!res && num) {
3823 if ( num > INT_MIN ) {
3828 }
else if (num < 100 && t) {
3831 }
else if (num < 20) {
3832 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3834 }
else if (num < 100) {
3835 int ones = num % 10;
3837 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
3840 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3843 }
else if (num == 100 && t == 0) {
3844 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3846 }
else if (num < 1000) {
3847 int hundreds = num / 100;
3849 if (hundreds == 1) {
3852 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3857 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3860 }
else if (num < 1000000) {
3861 int thousands = num / 1000;
3863 if (thousands == 1) {
3870 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3872 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3883 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3887 }
else if (num < 1000000000) {
3888 int millions = num / 1000000;
3889 num = num % 1000000;
3890 if (millions == 1) {
3896 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3906 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3910 }
else if (num < INT_MAX) {
3911 int billions = num / 1000000000;
3912 num = num % 1000000000;
3913 if (billions == 1) {
3919 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3928 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3932 }
else if (num == INT_MAX) {
3933 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3936 ast_debug(1,
"Number '%d' is too big for me\n", num);
3942 if ((audiofd > -1) && (ctrlfd > -1))
3950 if ((audiofd > -1) && (ctrlfd > -1)) {
3969 char fn[256] =
"", fna[256] =
"";
3983 while (!res && num) {
3986 if ( num > INT_MIN ) {
3991 }
else if (num < 100 && t) {
3994 }
else if (num < 20) {
3995 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3997 }
else if (num < 100) {
3998 int ones = num % 10;
4000 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
4003 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
4006 }
else if (num == 100 && t == 0) {
4007 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
4009 }
else if (num < 1000) {
4010 int hundreds = num / 100;
4012 if (hundreds == 1) {
4015 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
4020 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
4023 }
else if (num < 1000000) {
4024 int thousands = num / 1000;
4026 if (thousands == 1) {
4033 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
4035 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4046 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4050 }
else if (num < 1000000000) {
4051 int millions = num / 1000000;
4052 num = num % 1000000;
4053 if (millions == 1) {
4059 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
4069 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
4073 }
else if (num < INT_MAX) {
4074 int billions = num / 1000000000;
4075 num = num % 1000000000;
4076 if (billions == 1) {
4082 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
4091 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
4095 }
else if (num == INT_MAX) {
4096 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
4099 ast_debug(1,
"Number '%d' is too big for me\n", num);
4105 if ((audiofd > -1) && (ctrlfd > -1))
4113 if ((audiofd > -1) && (ctrlfd > -1)) {
4132 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num,
options);
4138 ast_verb(3,
"ast_say_digits_full: num: %d, options=\"%s\", mf=%d\n", num,
options, mf);
4140 while (!res && num) {
4142 snprintf(fn,
sizeof(fn),
"digits/minus");
4143 if (num > INT_MIN) {
4148 }
else if (num < 21) {
4151 snprintf(fn,
sizeof(fn),
"digits/f-0%d", num);
4153 snprintf(fn,
sizeof(fn),
"digits/f-%d", num);
4157 snprintf(fn,
sizeof(fn),
"digits/m-0%d", num);
4159 snprintf(fn,
sizeof(fn),
"digits/m-%d", num);
4163 }
else if ((num < 100) && num >= 20) {
4164 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
4166 }
else if ((num >= 100) && (num < 1000)) {
4167 int tmpnum = num / 100;
4168 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
4169 num = num - (tmpnum * 100);
4170 }
else if ((num >= 1000) && (num < 10000)) {
4171 int tmpnum = num / 1000;
4172 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
4173 num = num - (tmpnum * 1000);
4174 }
else if (num < 20000) {
4175 snprintf(fn,
sizeof(fn),
"digits/m-%d", (num / 1000));
4177 }
else if (num < 1000000) {
4182 snprintf(fn,
sizeof(fn),
"digits/1k");
4184 }
else if (num < 2000000) {
4185 snprintf(fn,
sizeof(fn),
"digits/1m");
4186 num = num % 1000000;
4187 }
else if (num < 3000000) {
4188 snprintf(fn,
sizeof(fn),
"digits/2m");
4189 num = num - 2000000;
4190 }
else if (num < 1000000000) {
4195 snprintf(fn,
sizeof(fn),
"digits/1m");
4196 num = num % 1000000;
4198 ast_debug(1,
"Number '%d' is too big for me\n", num);
4203 if ((audiofd > -1) && (ctrlfd > -1)) {
4220 char fn[256] =
"", fna[256] =
"";
4234 while (!res && num) {
4237 if ( num > INT_MIN ) {
4242 }
else if (num < 100 && t) {
4245 }
else if (num < 20) {
4246 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
4248 }
else if (num < 100) {
4249 int ones = num % 10;
4251 int tens = num - ones;
4252 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", tens, gender);
4257 snprintf(fn,
sizeof(fn),
"digits/and");
4261 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
4265 }
else if (num == 100 && t == 0) {
4266 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
4268 }
else if (num < 1000) {
4269 int hundreds = num / 100;
4271 if (hundreds == 1) {
4274 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
4279 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
4282 }
else if (num < 1000000) {
4283 int thousands = num / 1000;
4285 if (thousands == 1) {
4293 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
4295 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4306 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4311 }
else if (num < 1000000000) {
4312 int millions = num / 1000000;
4313 num = num % 1000000;
4314 if (millions == 1) {
4321 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
4331 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
4336 }
else if (num < INT_MAX) {
4337 int billions = num / 1000000000;
4338 num = num % 1000000000;
4339 if (billions == 1) {
4345 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
4354 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
4359 }
else if (num == INT_MAX) {
4360 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
4363 ast_debug(1,
"Number '%d' is too big for me\n", num);
4369 if ((audiofd > -1) && (ctrlfd > -1))
4377 if ((audiofd > -1) && (ctrlfd > -1)) {
4393 if (!strncasecmp(lang,
"en", 2)) {
4395 }
else if (!strncasecmp(lang,
"da", 2)) {
4397 }
else if (!strncasecmp(lang,
"de", 2)) {
4399 }
else if (!strncasecmp(lang,
"fr", 2)) {
4401 }
else if (!strncasecmp(lang,
"gr", 2)) {
4403 }
else if (!strncasecmp(lang,
"ja", 2)) {
4405 }
else if (!strncasecmp(lang,
"he", 2)) {
4407 }
else if (!strncasecmp(lang,
"hu", 2)) {
4409 }
else if (!strncasecmp(lang,
"is", 2)) {
4411 }
else if (!strncasecmp(lang,
"ka", 2)) {
4413 }
else if (!strncasecmp(lang,
"nl", 2)) {
4415 }
else if (!strncasecmp(lang,
"pt", 2)) {
4417 }
else if (!strncasecmp(lang,
"th", 2)) {
4419 }
else if (!strncasecmp(lang,
"ps", 2)) {
4421 }
else if (!strncasecmp(lang,
"dr", 2)) {
4433 struct timeval when = { t, 0 };
4438 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4444 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4461 struct timeval when = { t, 0 };
4467 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4477 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4493 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
4496 res =
wait_file(chan, ints,
"digits/hundred", lang);
4497 if (!res && year % 100 != 0) {
4510 struct timeval when = { t, 0 };
4516 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4526 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4543 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100) );
4546 res =
wait_file(chan, ints,
"digits/hundred", lang);
4547 if (!res && year % 100 != 0) {
4560 struct timeval when = { t, 0 };
4571 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4581 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4592 struct timeval when = { t, 0 };
4598 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4608 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4621 struct timeval when = { t, 0 };
4627 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4635 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4650 struct timeval when = { t, 0 };
4656 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4670 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4686 struct timeval when = { t, 0 };
4692 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4698 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4699 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4703 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4713 struct timeval when = { t, 0 };
4719 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4726 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4747 struct timeval when = { t, 0 };
4753 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4763 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4779 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
4782 res =
wait_file(chan, ints,
"digits/hundred", lang);
4783 if (!res && year % 100 != 0) {
4795 if (!strncasecmp(lang,
"en", 2)) {
4797 }
else if (!strncasecmp(lang,
"da", 2)) {
4799 }
else if (!strncasecmp(lang,
"de", 2)) {
4801 }
else if (!strncasecmp(lang,
"es", 2)) {
4803 }
else if (!strncasecmp(lang,
"he", 2)) {
4805 }
else if (!strncasecmp(lang,
"fr", 2)) {
4807 }
else if (!strncasecmp(lang,
"gr", 2)) {
4809 }
else if (!strncasecmp(lang,
"is", 2)) {
4811 }
else if (!strncasecmp(lang,
"ja", 2)) {
4813 }
else if (!strncasecmp(lang,
"it", 2)) {
4815 }
else if (!strncasecmp(lang,
"nl", 2)) {
4817 }
else if (!strncasecmp(lang,
"pl", 2)) {
4819 }
else if (!strncasecmp(lang,
"pt", 2)) {
4821 }
else if (!strncasecmp(lang,
"th", 2)) {
4823 }
else if (!strncasecmp(lang,
"zh", 2)) {
4825 }
else if (!strncasecmp(lang,
"vi", 2)) {
4836 struct timeval when = { t, 0 };
4838 int res=0, offset, sndoffset;
4839 char sndfile[256], nextmsg[256];
4842 format =
"ABdY 'digits/at' IMp";
4846 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4847 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4848 switch (format[offset]) {
4852 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4853 sndfile[sndoffset] = format[offset];
4855 sndfile[sndoffset] =
'\0';
4856 res =
wait_file(chan, ints, sndfile, lang);
4861 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4862 res =
wait_file(chan, ints, nextmsg, lang);
4868 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4869 res =
wait_file(chan, ints, nextmsg, lang);
4888 res =
wait_file(chan, ints,
"digits/19", lang);
4892 res =
wait_file(chan, ints,
"digits/oh", lang);
4905 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4907 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4908 res =
wait_file(chan, ints, nextmsg, lang);
4913 if (format[offset] ==
'H') {
4916 res =
wait_file(chan, ints,
"digits/oh", lang);
4921 res =
wait_file(chan, ints,
"digits/oh", lang);
4928 res =
wait_file(chan, ints,
"digits/20", lang);
4932 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
4933 res =
wait_file(chan, ints, nextmsg, lang);
4942 if (format[offset] ==
'M') {
4943 res =
wait_file(chan, ints,
"digits/oclock", lang);
4945 res =
wait_file(chan, ints,
"digits/hundred", lang);
4947 }
else if (tm.
tm_min < 10) {
4948 res =
wait_file(chan, ints,
"digits/oh", lang);
4950 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
4951 res =
wait_file(chan, ints, nextmsg, lang);
4964 res =
wait_file(chan, ints, nextmsg, lang);
4976 gettimeofday(&now,
NULL);
4981 if (beg_today + 15768000 < t) {
4984 }
else if (beg_today + 2628000 < t) {
4987 }
else if (beg_today + 86400 * 6 < t) {
4990 }
else if (beg_today + 172800 < t) {
4993 }
else if (beg_today + 86400 < t) {
4995 res =
wait_file(chan, ints,
"digits/tomorrow", lang);
4996 }
else if (beg_today < t) {
4998 res =
wait_file(chan, ints,
"digits/today", lang);
4999 }
else if (beg_today - 86400 < t) {
5001 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5002 }
else if (beg_today - 86400 * 6 < t) {
5005 }
else if (beg_today - 2628000 < t) {
5008 }
else if (beg_today - 15768000 < t) {
5032 if (beg_today + 15768000 < t) {
5035 }
else if (beg_today + 2628000 < t) {
5038 }
else if (beg_today + 86400 * 6 < t) {
5041 }
else if (beg_today + 172800 < t) {
5044 }
else if (beg_today + 86400 < t) {
5046 res =
wait_file(chan, ints,
"digits/tomorrow", lang);
5047 }
else if (beg_today < t) {
5049 res =
wait_file(chan, ints,
"digits/today", lang);
5050 }
else if (beg_today - 86400 < t) {
5052 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5053 }
else if (beg_today - 86400 * 6 < t) {
5056 }
else if (beg_today - 2628000 < t) {
5059 }
else if (beg_today - 15768000 < t) {
5074 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
5075 res =
wait_file(chan, ints, nextmsg, lang);
5076 }
else if (tm.
tm_sec < 10) {
5077 res =
wait_file(chan, ints,
"digits/oh", lang);
5079 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
5080 res =
wait_file(chan, ints, nextmsg, lang);
5095 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5114 struct timeval when = { t, 0 };
5116 int res=0, offset, sndoffset;
5117 char sndfile[256], nextmsg[256];
5120 format =
"A dBY HMS";
5124 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5125 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5126 switch (format[offset]) {
5130 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5131 sndfile[sndoffset] = format[offset];
5133 sndfile[sndoffset] =
'\0';
5134 res =
wait_file(chan, ints, sndfile, lang);
5139 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5140 res =
wait_file(chan, ints, nextmsg, lang);
5146 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5147 res =
wait_file(chan, ints, nextmsg, lang);
5171 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
5172 res =
wait_file(chan, ints, nextmsg, lang);
5174 res =
wait_file(chan, ints,
"digits/hundred", lang);
5175 if (!res && year % 100 != 0) {
5186 res =
wait_file(chan, ints,
"digits/oclock", lang);
5190 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
5192 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5194 res =
wait_file(chan, ints, nextmsg, lang);
5200 res =
wait_file(chan, ints,
"digits/0", lang);
5212 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
5214 res =
wait_file(chan, ints,
"minute", lang);
5216 res =
wait_file(chan, ints,
"minutes", lang);
5227 res =
wait_file(chan, ints, nextmsg, lang);
5243 if (beg_today < t) {
5245 res =
wait_file(chan, ints,
"digits/today", lang);
5246 }
else if (beg_today - 86400 < t) {
5248 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5268 if (beg_today < t) {
5270 }
else if ((beg_today - 86400) < t) {
5272 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5273 }
else if (beg_today - 86400 * 6 < t) {
5286 res =
wait_file(chan, ints,
"digits/and", lang);
5290 res =
wait_file(chan, ints,
"seconds", lang);
5303 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5316 struct timeval when = { t, 0 };
5318 int res=0, offset, sndoffset;
5319 char sndfile[256], nextmsg[256];
5322 format =
"A dBY HMS";
5326 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5327 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5328 switch (format[offset]) {
5332 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5333 sndfile[sndoffset] = format[offset];
5335 sndfile[sndoffset] =
'\0';
5336 res =
wait_file(chan, ints, sndfile, lang);
5341 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5342 res =
wait_file(chan, ints, nextmsg, lang);
5348 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5349 res =
wait_file(chan, ints, nextmsg, lang);
5373 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
5374 res =
wait_file(chan, ints, nextmsg, lang);
5376 res =
wait_file(chan, ints,
"digits/hundred", lang);
5377 if (!res && year % 100 != 0) {
5393 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
5395 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5396 res =
wait_file(chan, ints, nextmsg, lang);
5398 res =
wait_file(chan, ints,
"digits/oclock", lang);
5405 res =
wait_file(chan, ints,
"digits/1N", lang);
5410 res =
wait_file(chan, ints,
"digits/oclock", lang);
5415 if (
next_item(&format[offset + 1]) ==
'S') {
5417 }
else if (tm.
tm_min > 0) {
5421 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
5423 res =
wait_file(chan, ints,
"minute", lang);
5425 res =
wait_file(chan, ints,
"minutes", lang);
5436 res =
wait_file(chan, ints, nextmsg, lang);
5452 if (beg_today < t) {
5454 res =
wait_file(chan, ints,
"digits/today", lang);
5455 }
else if (beg_today - 86400 < t) {
5457 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5477 if (beg_today < t) {
5479 }
else if ((beg_today - 86400) < t) {
5481 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5482 }
else if (beg_today - 86400 * 6 < t) {
5495 res =
wait_file(chan, ints,
"digits/and", lang);
5499 res =
wait_file(chan, ints, tm.
tm_sec == 1 ?
"second" :
"seconds", lang);
5512 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5525 struct timeval when = { t, 0 };
5527 int res=0, offset, sndoffset;
5528 char sndfile[256], nextmsg[256];
5531 format =
"A dBY HMS";
5535 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5536 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5537 switch (format[offset]) {
5541 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5542 sndfile[sndoffset] = format[offset];
5544 sndfile[sndoffset] =
'\0';
5545 res =
wait_file(chan, ints, sndfile, lang);
5550 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5551 res =
wait_file(chan, ints, nextmsg, lang);
5557 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5558 res =
wait_file(chan, ints, nextmsg, lang);
5582 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
5583 res =
wait_file(chan, ints, nextmsg, lang);
5585 res =
wait_file(chan, ints,
"digits/hundred", lang);
5586 if (!res && year % 100 != 0) {
5597 res =
wait_file(chan, ints,
"digits/oclock", lang);
5601 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
5603 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5605 res =
wait_file(chan, ints, nextmsg, lang);
5611 res =
wait_file(chan, ints,
"digits/0", lang);
5622 res =
wait_file(chan, ints,
"digits/0", lang);
5624 if (
next_item(&format[offset + 1]) ==
'S')
5629 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
5632 res =
wait_file(chan, ints,
"minute", lang);
5634 res =
wait_file(chan, ints,
"minutes", lang);
5645 res =
wait_file(chan, ints, nextmsg, lang);
5661 if (beg_today < t) {
5663 res =
wait_file(chan, ints,
"digits/today", lang);
5664 }
else if (beg_today - 86400 < t) {
5666 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5686 if (beg_today < t) {
5688 }
else if ((beg_today - 86400) < t) {
5690 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5691 }
else if (beg_today - 86400 * 6 < t) {
5704 res =
wait_file(chan, ints,
"digits/and", lang);
5708 if (!res && (tm.
tm_sec % 10 == 1) && (tm.
tm_sec != 11)) {
5709 res =
wait_file(chan, ints,
"second", lang);
5711 res =
wait_file(chan, ints,
"seconds", lang);
5724 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5737 struct timeval when = { t, 0 };
5739 int res=0, offset, sndoffset;
5740 char sndfile[256], nextmsg[256];
5743 format =
"a 'digits/tee' e 'digits/duan' hY I 'digits/naliga' M 'digits/natee'";
5747 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5748 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5749 switch (format[offset]) {
5753 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5754 sndfile[sndoffset] = format[offset];
5756 sndfile[sndoffset] =
'\0';
5757 res =
wait_file(chan, ints, sndfile, lang);
5762 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5763 res =
wait_file(chan, ints, nextmsg, lang);
5769 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5770 res =
wait_file(chan, ints, nextmsg, lang);
5790 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5791 res =
wait_file(chan, ints, nextmsg, lang);
5798 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5799 res =
wait_file(chan, ints, nextmsg, lang);
5822 if (beg_today < t) {
5824 res =
wait_file(chan, ints,
"digits/today", lang);
5825 }
else if (beg_today - 86400 < t) {
5827 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5828 }
else if (beg_today - 86400 * 6 < t) {
5831 }
else if (beg_today - 2628000 < t) {
5834 }
else if (beg_today - 15768000 < t) {
5857 if (beg_today < t) {
5859 }
else if ((beg_today - 86400) < t) {
5861 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5862 }
else if (beg_today - 86400 * 6 < t) {
5865 }
else if (beg_today - 2628000 < t) {
5868 }
else if (beg_today - 15768000 < t) {
5892 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5922#define IL_DATE_STR "AdBY"
5923#define IL_TIME_STR "HM"
5924#define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " IL_TIME_STR
5928 struct timeval when = { t, 0 };
5930 int res = 0, offset, sndoffset;
5931 char sndfile[256], nextmsg[256];
5939 for (offset = 0; format[offset] !=
'\0'; offset++) {
5940 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5941 switch (format[offset]) {
5945 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5946 sndfile[sndoffset] = format[offset];
5948 sndfile[sndoffset] =
'\0';
5949 res =
wait_file(chan, ints, sndfile, lang);
5954 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5955 res =
wait_file(chan, ints, nextmsg, lang);
5961 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5962 res =
wait_file(chan, ints, nextmsg, lang);
6005 char todo = format[offset];
6011 if (beg_today < t) {
6014 res =
wait_file(chan, ints,
"digits/today", lang);
6016 }
else if (beg_today - 86400 < t) {
6018 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6019 }
else if ((todo !=
'Q') && (beg_today - 86400 * 6 < t)) {
6032 ints, lang,
"f", -1, -1
6055 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6069 struct timeval when = { t, 0 };
6071 int res=0, offset, sndoffset;
6072 char sndfile[256], nextmsg[256];
6075 format =
"'digits/es-el' Ad 'digits/es-de' B 'digits/es-de' Y 'digits/at' IMp";
6079 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6080 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6081 switch (format[offset]) {
6085 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6086 sndfile[sndoffset] = format[offset];
6088 sndfile[sndoffset] =
'\0';
6089 snprintf(nextmsg,
sizeof(nextmsg),
"%s", sndfile);
6090 res =
wait_file(chan, ints, nextmsg, lang);
6095 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6096 res =
wait_file(chan, ints, nextmsg, lang);
6102 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6103 res =
wait_file(chan, ints, nextmsg, lang);
6107 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6108 res =
wait_file(chan, ints, nextmsg, lang);
6125 snprintf(nextmsg,
sizeof(nextmsg),
"digits/1F");
6127 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6129 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6130 res =
wait_file(chan, ints, nextmsg, lang);
6145 res =
wait_file(chan, ints,
"digits/p-m", lang);
6147 res =
wait_file(chan, ints,
"digits/afternoon", lang);
6149 res =
wait_file(chan, ints,
"digits/a-m", lang);
6165 if (beg_today < t) {
6167 res =
wait_file(chan, ints,
"digits/today", lang);
6168 }
else if (beg_today - 86400 < t) {
6170 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6190 if (beg_today < t) {
6192 res =
wait_file(chan, ints,
"digits/today", lang);
6193 }
else if ((beg_today - 86400) < t) {
6195 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6196 }
else if (beg_today - 86400 * 6 < t) {
6210 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6211 res =
wait_file(chan, ints, nextmsg, lang);
6212 }
else if (tm.
tm_sec < 10) {
6213 res =
wait_file(chan, ints,
"digits/oh", lang);
6215 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6216 res =
wait_file(chan, ints, nextmsg, lang);
6218 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
6219 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6220 res =
wait_file(chan, ints, nextmsg, lang);
6223 ten = (tm.
tm_sec / 10) * 10;
6225 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
6226 res =
wait_file(chan, ints, nextmsg, lang);
6230 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6231 res =
wait_file(chan, ints, nextmsg, lang);
6245 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6260 struct timeval when = { t, 0 };
6262 int res=0, offset, sndoffset;
6263 char sndfile[256], nextmsg[256];
6266 format =
"AdBY 'digits/at' IMp";
6270 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6271 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6272 switch (format[offset]) {
6276 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6277 sndfile[sndoffset] = format[offset];
6279 sndfile[sndoffset] =
'\0';
6280 res =
wait_file(chan, ints, sndfile, lang);
6285 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6286 res =
wait_file(chan, ints, nextmsg, lang);
6292 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6293 res =
wait_file(chan, ints, nextmsg, lang);
6297 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6298 res =
wait_file(chan, ints, nextmsg, lang);
6304 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mday);
6305 res =
wait_file(chan, ints, nextmsg, lang);
6313 res =
wait_file(chan, ints,
"digits/2", lang);
6315 res =
wait_file(chan, ints,
"digits/thousand", lang);
6327 res =
wait_file(chan, ints,
"digits/thousand", lang);
6329 wait_file(chan, ints,
"digits/9", lang);
6330 wait_file(chan, ints,
"digits/hundred", lang);
6342 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6344 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6345 res =
wait_file(chan, ints, nextmsg, lang);
6347 res =
wait_file(chan, ints,
"digits/oclock", lang);
6354 res =
wait_file(chan, ints,
"digits/oclock", lang);
6370 res =
wait_file(chan, ints, nextmsg, lang);
6386 if (beg_today < t) {
6388 res =
wait_file(chan, ints,
"digits/today", lang);
6389 }
else if (beg_today - 86400 < t) {
6391 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6411 if (beg_today < t) {
6413 }
else if ((beg_today - 86400) < t) {
6415 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6416 }
else if (beg_today - 86400 * 6 < t) {
6431 res =
wait_file(chan, ints,
"second", lang);
6443 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6456 struct timeval when = { t, 0 };
6458 int res=0, offset, sndoffset;
6459 char sndfile[256], nextmsg[256];
6462 format =
"AdB 'digits/at' IMp";
6466 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6467 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6468 switch (format[offset]) {
6472 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6473 sndfile[sndoffset] = format[offset];
6475 sndfile[sndoffset] =
'\0';
6476 res =
wait_file(chan, ints, sndfile, lang);
6481 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6482 res =
wait_file(chan, ints, nextmsg, lang);
6488 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6489 res =
wait_file(chan, ints, nextmsg, lang);
6493 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6494 res =
wait_file(chan, ints, nextmsg, lang);
6500 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mday);
6501 res =
wait_file(chan, ints, nextmsg, lang);
6511 res =
wait_file(chan, ints,
"digits/ore-2000", lang);
6515 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year - 100);
6516 res =
wait_file(chan, ints, nextmsg, lang);
6524 res =
wait_file(chan, ints,
"digits/ore-1900", lang);
6525 if ((!res) && (tm.
tm_year != 0)) {
6528 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
6529 res =
wait_file(chan, ints, nextmsg, lang);
6535 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten * 10);
6536 res =
wait_file(chan, ints, nextmsg, lang);
6539 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6540 res =
wait_file(chan, ints, nextmsg, lang);
6554 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6556 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6558 res =
wait_file(chan, ints, nextmsg, lang);
6564 res =
wait_file(chan, ints,
"digits/ore-mezzanotte", lang);
6566 res =
wait_file(chan, ints,
"digits/ore-una", lang);
6583 res =
wait_file(chan, ints, nextmsg, lang);
6599 if (beg_today < t) {
6601 res =
wait_file(chan, ints,
"digits/today", lang);
6602 }
else if (beg_today - 86400 < t) {
6604 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6621 if (beg_today < t) {
6623 }
else if ((beg_today - 86400) < t) {
6625 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6626 }
else if (beg_today - 86400 * 6 < t) {
6640 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6641 res =
wait_file(chan, ints, nextmsg, lang);
6642 }
else if (tm.
tm_sec < 10) {
6643 res =
wait_file(chan, ints,
"digits/oh", lang);
6645 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6646 res =
wait_file(chan, ints, nextmsg, lang);
6648 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
6649 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6650 res =
wait_file(chan, ints, nextmsg, lang);
6653 ten = (tm.
tm_sec / 10) * 10;
6655 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
6656 res =
wait_file(chan, ints, nextmsg, lang);
6660 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6661 res =
wait_file(chan, ints, nextmsg, lang);
6675 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6688 struct timeval when = { t, 0 };
6690 int res=0, offset, sndoffset;
6691 char sndfile[256], nextmsg[256];
6694 format =
"AdBY 'digits/at' IMp";
6698 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6699 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6700 switch (format[offset]) {
6704 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6705 sndfile[sndoffset] = format[offset];
6707 sndfile[sndoffset] =
'\0';
6708 res =
wait_file(chan, ints, sndfile, lang);
6713 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6714 res =
wait_file(chan, ints, nextmsg, lang);
6720 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6721 res =
wait_file(chan, ints, nextmsg, lang);
6725 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6726 res =
wait_file(chan, ints, nextmsg, lang);
6736 res =
wait_file(chan, ints,
"digits/2", lang);
6738 res =
wait_file(chan, ints,
"digits/thousand", lang);
6750 res =
wait_file(chan, ints,
"digits/19", lang);
6754 res =
wait_file(chan, ints,
"digits/oh", lang);
6756 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
6757 res =
wait_file(chan, ints, nextmsg, lang);
6759 }
else if (tm.
tm_year <= 20) {
6761 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
6762 res =
wait_file(chan, ints, nextmsg, lang);
6768 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten * 10);
6769 res =
wait_file(chan, ints, nextmsg, lang);
6772 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6773 res =
wait_file(chan, ints, nextmsg, lang);
6787 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6789 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6790 res =
wait_file(chan, ints, nextmsg, lang);
6797 res =
wait_file(chan, ints,
"digits/nl-uur", lang);
6811 res =
wait_file(chan, ints, nextmsg, lang);
6827 if (beg_today < t) {
6829 res =
wait_file(chan, ints,
"digits/today", lang);
6830 }
else if (beg_today - 86400 < t) {
6832 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6849 if (beg_today < t) {
6851 }
else if ((beg_today - 86400) < t) {
6853 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6854 }
else if (beg_today - 86400 * 6 < t) {
6878 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6891 struct timeval when = { thetime, 0 };
6893 int res=0, offset, sndoffset;
6894 char sndfile[256], nextmsg[256];
6898 for (offset = 0 ; format[offset] !=
'\0' ; offset++) {
6900 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6901 switch (format[offset]) {
6905 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6906 sndfile[sndoffset] = format[offset];
6908 sndfile[sndoffset] =
'\0';
6909 res =
wait_file(chan, ints, sndfile, lang);
6914 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6915 res =
wait_file(chan, ints, nextmsg, lang);
6921 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6922 res =
wait_file(chan, ints, nextmsg, lang);
6933 res =
wait_file(chan, ints,
"digits/h-30", lang);
6937 res =
wait_file(chan, ints,
"digits/h-20", lang);
6941 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", remaining);
6942 res =
wait_file(chan, ints, nextmsg, lang);
6948 res =
wait_file(chan, ints,
"digits/2", lang);
6950 res =
wait_file(chan, ints,
"digits/1000.2", lang);
6955 }
else if (tm.
tm_year == 100) {
6956 res =
wait_file(chan, ints,
"digits/h-2000", lang);
6963 res =
wait_file(chan, ints,
"digits/1000", lang);
6965 wait_file(chan, ints,
"digits/900", lang);
6971 wait_file(chan, ints,
"digits/year", lang);
6979 snprintf(nextmsg,
sizeof(nextmsg),
"digits/t-%d", tm.
tm_hour - 12);
6981 snprintf(nextmsg,
sizeof(nextmsg),
"digits/t-%d", tm.
tm_hour);
6983 res =
wait_file(chan, ints, nextmsg, lang);
6989 snprintf(nextmsg,
sizeof(nextmsg),
"digits/t-%d", tm.
tm_hour);
6990 res =
wait_file(chan, ints, nextmsg, lang);
6992 res =
wait_file(chan, ints,
"digits/t-24", lang);
6998 if (format[offset] ==
'M') {
6999 res =
wait_file(chan, ints,
"digits/oclock", lang);
7001 res =
wait_file(chan, ints,
"digits/100", lang);
7013 res =
wait_file(chan, ints, nextmsg, lang);
7026 if (beg_today < thetime) {
7028 res =
wait_file(chan, ints,
"digits/today", lang);
7029 }
else if (beg_today - 86400 < thetime) {
7031 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7048 if (beg_today < thetime) {
7050 }
else if ((beg_today - 86400) < thetime) {
7052 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7053 }
else if (beg_today - 86400 * 6 < thetime) {
7066 res =
wait_file(chan, ints,
"digits/and", lang);
7069 res =
wait_file(chan, ints,
"digits/1z", lang);
7071 res =
wait_file(chan, ints,
"digits/second-a", lang);
7079 if (one > 1 && one < 5 && ten != 1)
7080 res =
wait_file(chan, ints,
"seconds", lang);
7082 res =
wait_file(chan, ints,
"second", lang);
7096 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7108 struct timeval when = { t, 0 };
7110 int res=0, offset, sndoffset;
7111 char sndfile[256], nextmsg[256];
7114 format =
"Ad 'digits/pt-de' B 'digits/pt-de' Y I 'digits/pt-e' Mp";
7118 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
7119 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
7120 switch (format[offset]) {
7124 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
7125 sndfile[sndoffset] = format[offset];
7127 sndfile[sndoffset] =
'\0';
7128 snprintf(nextmsg,
sizeof(nextmsg),
"%s", sndfile);
7129 res =
wait_file(chan, ints, nextmsg, lang);
7134 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
7135 res =
wait_file(chan, ints, nextmsg, lang);
7141 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
7142 res =
wait_file(chan, ints, nextmsg, lang);
7146 if (!strcasecmp(lang,
"pt_BR")) {
7149 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
7150 res =
wait_file(chan, ints, nextmsg, lang);
7165 if (!strcasecmp(lang,
"pt_BR")) {
7167 if (format[offset] ==
'I')
7168 res =
wait_file(chan, ints,
"digits/pt-a", lang);
7170 res =
wait_file(chan, ints,
"digits/pt-meianoite", lang);
7171 }
else if (tm.
tm_hour == 12) {
7172 if (format[offset] ==
'I')
7173 res =
wait_file(chan, ints,
"digits/pt-ao", lang);
7175 res =
wait_file(chan, ints,
"digits/pt-meiodia", lang);
7177 if (format[offset] ==
'I') {
7179 res =
wait_file(chan, ints,
"digits/pt-as", lang);
7181 res =
wait_file(chan, ints,
"digits/pt-a", lang);
7188 if (format[offset] ==
'I')
7189 res =
wait_file(chan, ints,
"digits/pt-ah", lang);
7191 res =
wait_file(chan, ints,
"digits/pt-meianoite", lang);
7194 if (format[offset] ==
'I')
7195 res =
wait_file(chan, ints,
"digits/pt-ao", lang);
7197 res =
wait_file(chan, ints,
"digits/pt-meiodia", lang);
7200 if (format[offset] ==
'I') {
7201 res =
wait_file(chan, ints,
"digits/pt-ah", lang);
7204 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
7214 if (!strcasecmp(lang,
"pt_BR")) {
7216 if ((!res) && (format[offset] ==
'H')) {
7218 res =
wait_file(chan, ints,
"digits/hours", lang);
7220 res =
wait_file(chan, ints,
"digits/hour", lang);
7229 res =
wait_file(chan, ints,
"digits/20", lang);
7233 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
7234 res =
wait_file(chan, ints, nextmsg, lang);
7242 if (!strcasecmp(lang,
"pt_BR")) {
7246 res =
wait_file(chan, ints,
"minutes", lang);
7248 res =
wait_file(chan, ints,
"minute", lang);
7253 res =
wait_file(chan, ints,
"digits/pt-hora", lang);
7256 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
7265 if (!strcasecmp(lang,
"pt_BR")) {
7267 res =
wait_file(chan, ints,
"digits/pt-da", lang);
7270 res =
wait_file(chan, ints,
"digits/morning", lang);
7272 res =
wait_file(chan, ints,
"digits/afternoon", lang);
7273 else res =
wait_file(chan, ints,
"digits/night", lang);
7278 res =
wait_file(chan, ints,
"digits/p-m", lang);
7280 res =
wait_file(chan, ints,
"digits/a-m", lang);
7297 if (beg_today < t) {
7299 res =
wait_file(chan, ints,
"digits/today", lang);
7300 }
else if (beg_today - 86400 < t) {
7302 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7322 if (beg_today < t) {
7324 }
else if ((beg_today - 86400) < t) {
7326 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7327 }
else if (beg_today - 86400 * 6 < t) {
7340 if (!strcasecmp(lang,
"pt_BR")) {
7344 res =
wait_file(chan, ints,
"seconds", lang);
7346 res =
wait_file(chan, ints,
"second", lang);
7351 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7352 res =
wait_file(chan, ints, nextmsg, lang);
7353 }
else if (tm.
tm_sec < 10) {
7354 res =
wait_file(chan, ints,
"digits/oh", lang);
7356 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7357 res =
wait_file(chan, ints, nextmsg, lang);
7359 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
7360 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7361 res =
wait_file(chan, ints, nextmsg, lang);
7364 ten = (tm.
tm_sec / 10) * 10;
7366 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
7367 res =
wait_file(chan, ints, nextmsg, lang);
7371 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
7372 res =
wait_file(chan, ints, nextmsg, lang);
7387 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7400 struct timeval when = { t, 0 };
7402 int res=0, offset, sndoffset;
7403 char sndfile[256], nextmsg[256];
7410 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
7411 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
7412 switch (format[offset]) {
7416 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
7417 sndfile[sndoffset] = format[offset];
7419 sndfile[sndoffset] =
'\0';
7420 res =
wait_file(chan, ints, sndfile, lang);
7425 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
7426 res =
wait_file(chan, ints, nextmsg, lang);
7433 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
7434 res =
wait_file(chan, ints, nextmsg, lang);
7440 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday);
7441 res =
wait_file(chan, ints, nextmsg, lang);
7443 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday - (tm.
tm_mday % 10));
7444 res =
wait_file(chan, ints, nextmsg, lang);
7446 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday % 10);
7447 res =
wait_file(chan, ints, nextmsg, lang);
7450 if (!res) res =
wait_file(chan, ints,
"digits/day", lang);
7455 res =
wait_file(chan, ints,
"digits/2", lang);
7457 res =
wait_file(chan, ints,
"digits/thousand", lang);
7461 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (tm.
tm_year - 100) / 10);
7462 res =
wait_file(chan, ints, nextmsg, lang);
7464 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (tm.
tm_year - 100) % 10);
7465 res =
wait_file(chan, ints, nextmsg, lang);
7470 res =
wait_file(chan, ints,
"digits/year", lang);
7477 res =
wait_file(chan, ints,
"digits/1", lang);
7479 res =
wait_file(chan, ints,
"digits/9", lang);
7484 res =
wait_file(chan, ints,
"digits/0", lang);
7486 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
7487 res =
wait_file(chan, ints, nextmsg, lang);
7491 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year / 10);
7492 res =
wait_file(chan, ints, nextmsg, lang);
7494 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year % 10);
7495 res =
wait_file(chan, ints, nextmsg, lang);
7501 res =
wait_file(chan, ints,
"digits/year", lang);
7511 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
7513 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
7514 res =
wait_file(chan, ints, nextmsg, lang);
7516 res =
wait_file(chan, ints,
"digits/oclock", lang);
7521 res =
wait_file(chan, ints,
"digits/0", lang);
7529 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
7530 res =
wait_file(chan, ints, nextmsg, lang);
7532 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - (tm.
tm_hour % 10));
7533 res =
wait_file(chan, ints, nextmsg, lang);
7535 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour % 10);
7536 res =
wait_file(chan, ints, nextmsg, lang);
7540 res =
wait_file(chan, ints,
"digits/oclock", lang);
7547 res =
wait_file(chan, ints,
"digits/0", lang);
7549 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
7550 res =
wait_file(chan, ints, nextmsg, lang);
7552 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min - (tm.
tm_min % 10));
7553 res =
wait_file(chan, ints, nextmsg, lang);
7555 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min % 10);
7556 res =
wait_file(chan, ints, nextmsg, lang);
7560 res =
wait_file(chan, ints,
"minute", lang);
7570 res =
wait_file(chan, ints, nextmsg, lang);
7586 if (beg_today < t) {
7588 res =
wait_file(chan, ints,
"digits/today", lang);
7589 }
else if (beg_today - 86400 < t) {
7591 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7611 if (beg_today < t) {
7613 }
else if ((beg_today - 86400) < t) {
7615 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7616 }
else if (beg_today - 86400 * 6 < t) {
7631 res =
wait_file(chan, ints,
"digits/0", lang);
7633 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7634 res =
wait_file(chan, ints, nextmsg, lang);
7636 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec - (tm.
tm_sec % 10));
7637 res =
wait_file(chan, ints, nextmsg, lang);
7639 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec % 10);
7640 res =
wait_file(chan, ints, nextmsg, lang);
7644 res =
wait_file(chan, ints,
"second", lang);
7656 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7668 if (!strncasecmp(lang,
"en", 2)) {
7670 }
else if (!strncasecmp(lang,
"de", 2)) {
7672 }
else if (!strncasecmp(lang,
"fr", 2)) {
7674 }
else if (!strncasecmp(lang,
"gr", 2)) {
7676 }
else if (!strncasecmp(lang,
"ja", 2)) {
7678 }
else if (!strncasecmp(lang,
"he", 2)) {
7680 }
else if (!strncasecmp(lang,
"hu", 2)) {
7682 }
else if (!strncasecmp(lang,
"ka", 2)) {
7684 }
else if (!strncasecmp(lang,
"nl", 2)) {
7686 }
else if (!strncasecmp(lang,
"pt_BR", 5)) {
7688 }
else if (!strncasecmp(lang,
"pt", 2)) {
7690 }
else if (!strncasecmp(lang,
"th", 2)) {
7692 }
else if (!strncasecmp(lang,
"zh", 2)) {
7694 }
else if (!strncasecmp(lang,
"ps", 2)) {
7696 }
else if (!strncasecmp(lang,
"dr", 2)) {
7707 struct timeval when = { t, 0 };
7716 else if (hour == 12)
7718 else if (hour > 12) {
7756 struct timeval when = { t, 0 };
7776 struct timeval when = { t, 0 };
7799 struct timeval when = { t, 0 };
7823 struct timeval when = { t, 0 };
7843 struct timeval when = { t, 0 };
7854 res =
wait_file(chan, ints,
"digits/pt-e", lang);
7859 res =
wait_file(chan, ints,
"digits/pt-hora", lang);
7862 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
7872 struct timeval when = { t, 0 };
7881 res =
wait_file(chan, ints,
"digits/hours", lang);
7883 res =
wait_file(chan, ints,
"digits/hour", lang);
7885 if ((!res) && (tm.
tm_min)) {
7886 res =
wait_file(chan, ints,
"digits/pt-e", lang);
7891 res =
wait_file(chan, ints,
"minutes", lang);
7893 res =
wait_file(chan, ints,
"minute", lang);
7902 struct timeval when = { t, 0 };
7920 struct timeval when = { t, 0 };
7929 else if (hour == 12)
7931 else if (hour > 12) {
7962 struct timeval when = { t, 0 };
7998 if (!strncasecmp(lang,
"en", 2)) {
8000 }
else if (!strncasecmp(lang,
"de", 2)) {
8002 }
else if (!strncasecmp(lang,
"fr", 2)) {
8004 }
else if (!strncasecmp(lang,
"gr", 2)) {
8006 }
else if (!strncasecmp(lang,
"ja", 2)) {
8008 }
else if (!strncasecmp(lang,
"he", 2)) {
8010 }
else if (!strncasecmp(lang,
"hu", 2)) {
8012 }
else if (!strncasecmp(lang,
"ka", 2)) {
8014 }
else if (!strncasecmp(lang,
"nl", 2)) {
8016 }
else if (!strncasecmp(lang,
"pt_BR", 5)) {
8018 }
else if (!strncasecmp(lang,
"pt", 2)) {
8020 }
else if (!strncasecmp(lang,
"th", 2)) {
8022 }
else if (!strncasecmp(lang,
"zh", 2)) {
8033 struct timeval when = { t, 0 };
8041 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8047 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8058 else if (hour == 12)
8060 else if (hour > 12) {
8100 struct timeval when = { t, 0 };
8115 struct timeval when = { t, 0 };
8129 struct timeval when = { t, 0 };
8140 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8146 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8170 struct timeval when = { t, 0 };
8189 struct timeval when = { t, 0 };
8197 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8203 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8214 else if (hour == 12)
8216 else if (hour > 12) {
8256 struct timeval when = { t, 0 };
8270 struct timeval when = { t, 0 };
8277 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8283 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8313 struct timeval when = { t, 0 };
8323 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8331 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8340 else if (hour == 12)
8342 else if (hour > 12) {
8373 struct timeval when = { t, 0 };
8381 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8388 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8438 if (!strncasecmp(lang,
"en", 2)) {
8440 }
else if (!strncasecmp(lang,
"fr", 2)) {
8442 }
else if (!strncasecmp(lang,
"he", 2)) {
8444 }
else if (!strncasecmp(lang,
"ka", 2)) {
8446 }
else if (!strncasecmp(lang,
"pt", 2)) {
8458 struct timeval nowtv =
ast_tvnow(), when = { t, 0 };
8467 if ((daydiff < 0) || (daydiff > 6)) {
8470 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8478 }
else if (daydiff) {
8481 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8496 struct timeval nowtv =
ast_tvnow(), when = { t, 0 };
8505 if ((daydiff < 0) || (daydiff > 6)) {
8508 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8516 }
else if (daydiff) {
8519 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8537 struct timeval nowtv =
ast_tvnow(), when = { t, 0 };
8543 if ((daydiff < 0) || (daydiff > 6)) {
8548 res =
wait_file(chan, ints,
"digits/pt-de", lang);
8549 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8553 }
else if (daydiff) {
8555 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8559 if (!strcasecmp(lang,
"pt_BR")) {
8573 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
8584 struct timeval nowt =
ast_tvnow(), when = { t, 0 };
8593 if ((daydiff < 0) || (daydiff > 6)) {
8596 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8604 }
else if (daydiff) {
8607 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8633 snprintf(fn,
sizeof(fn),
"digits/female-%d", num);
8635 }
else if (num < 13) {
8637 }
else if (num <100 ) {
8638 tmp = (num/10) * 10;
8640 snprintf(fn,
sizeof(fn),
"digits/%d", tmp);
8684 while (!res && num ) {
8687 snprintf(fn,
sizeof(fn),
"digits/%d", num);
8689 }
else if (num <= 100) {
8691 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
8693 }
else if (num < 200) {
8695 snprintf(fn,
sizeof(fn),
"digits/hundred-100");
8697 }
else if (num < 1000) {
8699 snprintf(fn,
sizeof(fn),
"digits/hundred-%d", (num/100)*100);
8701 }
else if (num < 2000){
8702 snprintf(fn,
sizeof(fn),
"digits/xilia");
8706 if (num < 1000000) {
8711 snprintf(fn,
sizeof(fn),
"digits/thousands");
8713 if (num < 1000000000) {
8718 snprintf(fn,
sizeof(fn),
"digits/millions");
8720 ast_debug(1,
"Number '%d' is too big for me\n", num);
8727 if ((audiofd > -1) && (ctrlfd > -1))
8748 while (!res && (num || playh)) {
8751 if ( num > INT_MIN ) {
8759 }
else if (num < 20) {
8760 snprintf(fn,
sizeof(fn),
"digits/%d", num);
8762 }
else if (num < 100) {
8763 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
8767 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
8771 if (num < 1000000) {
8776 snprintf(fn,
sizeof(fn),
"digits/thousand");
8778 if (num < 1000000000) {
8785 ast_debug(1,
"Number '%d' is too big for me\n", num);
8793 if ((audiofd > -1) && (ctrlfd > -1))
8817 struct timeval when = { t, 0 };
8826 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8837 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8853 struct timeval tv = { t, 0 };
8866 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8876 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8897 struct timeval when = { t, 0 };
8907 else if (hour == 12)
8909 else if (hour > 12) {
8944 struct timeval tv = { t, 0 };
8954 else if (hour == 12)
8956 else if (hour > 12) {
8968 if (hour == 9 || hour == 21) {
8991 struct timeval when = { t, 0 };
9000 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
9011 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
9024 struct timeval tv = { t, 0 };
9037 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
9047 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
9056 else if (hour == 12)
9058 else if (hour > 12) {
9069 if (hour == 9 || hour == 21) {
9091 struct timeval when = { t, 0 };
9093 int res=0, offset, sndoffset;
9094 char sndfile[256], nextmsg[256];
9097 format =
"AdBY 'digits/at' IMp";
9101 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
9102 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9103 switch (format[offset]) {
9107 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
9108 sndfile[sndoffset] = format[offset];
9110 sndfile[sndoffset] =
'\0';
9111 res =
wait_file(chan, ints, sndfile, lang);
9116 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
9117 res =
wait_file(chan, ints, nextmsg, lang);
9123 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
9124 res =
wait_file(chan, ints, nextmsg, lang);
9174 res =
wait_file(chan, ints, nextmsg, lang);
9190 if (beg_today < t) {
9192 res =
wait_file(chan, ints,
"digits/today", lang);
9193 }
else if (beg_today - 86400 < t) {
9195 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9215 if (beg_today < t) {
9217 }
else if ((beg_today - 86400) < t) {
9219 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9220 }
else if (beg_today - 86400 * 6 < t) {
9234 res =
wait_file(chan, ints, nextmsg, lang);
9239 res =
wait_file(chan, ints, nextmsg, lang);
9250 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9263 struct timeval tv = { time, 0 };
9265 int res = 0, offset, sndoffset;
9266 char sndfile[256], nextmsg[256];
9269 format =
"YbdAPIMS";
9273 for (offset = 0; format[offset] !=
'\0'; offset++) {
9274 ast_log(
LOG_DEBUG,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9275 switch (format[offset]) {
9279 for (sndoffset = 0; (format[++offset] !=
'\'') && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
9280 sndfile[sndoffset] = format[offset];
9282 sndfile[sndoffset] =
'\0';
9283 res =
wait_file(chan,ints,sndfile,lang);
9288 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
9289 res =
wait_file(chan,ints,nextmsg,lang);
9295 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
9296 res =
wait_file(chan,ints,nextmsg,lang);
9302 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d_2", tm.
tm_mday);
9303 res =
wait_file(chan,ints,nextmsg,lang);
9306 res =
wait_file(chan,ints,
"digits/20",lang);
9308 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday - 20);
9309 res =
wait_file(chan,ints,nextmsg,lang);
9311 res =
wait_file(chan,ints,
"digits/nichi",lang);
9312 }
else if (tm.
tm_mday == 30) {
9314 res =
wait_file(chan,ints,
"digits/h-30_2",lang);
9317 res =
wait_file(chan,ints,
"digits/30",lang);
9318 res =
wait_file(chan,ints,
"digits/1",lang);
9319 res =
wait_file(chan,ints,
"digits/nichi",lang);
9325 res =
wait_file(chan,ints,
"digits/2",lang);
9327 res =
wait_file(chan,ints,
"digits/thousand",lang);
9332 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year - 100);
9333 res =
wait_file(chan,ints,nextmsg,lang);
9341 res =
wait_file(chan,ints,
"digits/19",lang);
9345 res =
wait_file(chan,ints,
"digits/oh",lang);
9347 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
9348 res =
wait_file(chan,ints,nextmsg,lang);
9350 }
else if (tm.
tm_year <= 20) {
9352 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
9353 res =
wait_file(chan,ints,nextmsg,lang);
9359 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten * 10);
9360 res =
wait_file(chan,ints,nextmsg,lang);
9363 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
9364 res =
wait_file(chan,ints,nextmsg,lang);
9371 res =
wait_file(chan,ints,
"digits/nen",lang);
9377 snprintf(nextmsg,
sizeof(nextmsg),
"digits/p-m");
9379 snprintf(nextmsg,
sizeof(nextmsg),
"digits/a-m");
9380 res =
wait_file(chan,ints,nextmsg,lang);
9386 snprintf(nextmsg,
sizeof(nextmsg),
"digits/12");
9388 snprintf(nextmsg,
sizeof(nextmsg),
"digits/9_2");
9390 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
9392 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
9393 res =
wait_file(chan,ints,nextmsg,lang);
9394 if(!res) res =
wait_file(chan,ints,
"digits/ji",lang);
9402 res =
wait_file(chan,ints,
"digits/20",lang);
9406 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remainder);
9407 res =
wait_file(chan,ints,nextmsg,lang);
9411 res =
wait_file(chan,ints,
"digits/ji",lang);
9416 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
9417 res =
wait_file(chan,ints,nextmsg,lang);
9420 ten = (tm.
tm_min / 10) * 10;
9422 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
9423 res =
wait_file(chan,ints,nextmsg,lang);
9427 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
9428 res =
wait_file(chan,ints,nextmsg,lang);
9432 res =
wait_file(chan,ints,
"digits/fun",lang);
9441 gettimeofday(&now,
NULL);
9446 if (beg_today < time) {
9448 res =
wait_file(chan,ints,
"digits/today",lang);
9449 }
else if (beg_today - 86400 < time) {
9451 res =
wait_file(chan,ints,
"digits/yesterday",lang);
9464 gettimeofday(&now,
NULL);
9469 if (beg_today < time) {
9471 }
else if ((beg_today - 86400) < time) {
9473 res =
wait_file(chan,ints,
"digits/yesterday",lang);
9474 }
else if (beg_today - 86400 * 6 < time) {
9488 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
9489 res =
wait_file(chan,ints,nextmsg,lang);
9490 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
9491 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
9492 res =
wait_file(chan,ints,nextmsg,lang);
9495 ten = (tm.
tm_sec / 10) * 10;
9497 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
9498 res =
wait_file(chan,ints,nextmsg,lang);
9502 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
9503 res =
wait_file(chan,ints,nextmsg,lang);
9507 res =
wait_file(chan,ints,
"digits/byou",lang);
9518 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9531 struct timeval when = { t, 0 };
9533 int res = 0, offset, sndoffset;
9534 char sndfile[256], nextmsg[256];
9537 format =
"A 'digits/day' eB 'digits/year' Y 'digits/at' k 'hours' M 'minutes' p";
9541 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
9542 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9543 switch (format[offset]) {
9547 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
9548 sndfile[sndoffset] = format[offset];
9550 sndfile[sndoffset] =
'\0';
9551 res =
wait_file(chan, ints, sndfile, lang);
9556 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
9557 res =
wait_file(chan, ints, nextmsg, lang);
9563 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
9564 res =
wait_file(chan, ints, nextmsg, lang);
9583 res =
wait_file(chan, ints,
"digits/19", lang);
9587 res =
wait_file(chan, ints,
"digits/odd", lang);
9600 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
9602 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
9603 res =
wait_file(chan, ints, nextmsg, lang);
9608 if (format[offset] ==
'H') {
9611 res =
wait_file(chan, ints,
"digits/0", lang);
9616 res =
wait_file(chan, ints,
"digits/0", lang);
9623 res =
wait_file(chan, ints,
"digits/20", lang);
9627 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
9628 res =
wait_file(chan, ints, nextmsg, lang);
9645 res =
wait_file(chan, ints, nextmsg, lang);
9657 gettimeofday(&now,
NULL);
9662 if (beg_today < t) {
9664 res =
wait_file(chan, ints,
"digits/today", lang);
9665 }
else if (beg_today - 86400 < t) {
9667 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9668 }
else if (beg_today - 86400 * 6 < t) {
9671 }
else if (beg_today - 2628000 < t) {
9674 }
else if (beg_today - 15768000 < t) {
9698 if (beg_today < t) {
9700 }
else if ((beg_today - 86400) < t) {
9702 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9703 }
else if (beg_today - 86400 * 6 < t) {
9706 }
else if (beg_today - 2628000 < t) {
9709 }
else if (beg_today - 15768000 < t) {
9734 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9773 strncat(res,
"minus ", res_len - strlen(res) - 1);
9774 if ( num > INT_MIN ) {
9783 if (num <= 20 || num == 40 || num == 60 || num == 80 || num == 100) {
9784 snprintf(
buf,
sizeof(
buf),
"%d", num);
9785 strncat(res,
buf, res_len - strlen(res) - 1);
9791 strncat(res,
"20_ ", res_len - strlen(res) - 1);
9796 strncat(res,
"40_ ", res_len - strlen(res) - 1);
9801 strncat(res,
"60_ ", res_len - strlen(res) - 1);
9806 strncat(res,
"80_ ", res_len - strlen(res) - 1);
9812 remaining = num % 100;
9813 digit = (num - remaining) / 100;
9815 if (remaining == 0) {
9816 snprintf(
buf,
sizeof(
buf),
"%d", num);
9817 strncat(res,
buf, res_len - strlen(res) - 1);
9821 strncat(res,
buf, res_len - strlen(res) - 1);
9828 strncat(res,
"1000", res_len - strlen(res) - 1);
9833 if (num < 1000000) {
9834 remaining = num % 1000;
9835 digit = (num - remaining) / 1000;
9837 if (remaining == 0) {
9839 strncat(res,
" 1000", res_len - strlen(res) - 1);
9844 strncat(res,
"1000_ ", res_len - strlen(res) - 1);
9849 strncat(res,
" 1000_ ", res_len - strlen(res) - 1);
9854 if (num == 1000000) {
9855 strncat(res,
"1 1000000", res_len - strlen(res) - 1);
9860 if (num < 1000000000) {
9861 remaining = num % 1000000;
9862 digit = (num - remaining) / 1000000;
9864 if (remaining == 0) {
9866 strncat(res,
" 1000000", res_len - strlen(res) - 1);
9871 strncat(res,
" 1000000_ ", res_len - strlen(res) - 1);
9876 if (num == 1000000000) {
9877 strncat(res,
"1 1000000000", res_len - strlen(res) - 1);
9882 if (num > 1000000000) {
9883 remaining = num % 1000000000;
9884 digit = (num - remaining) / 1000000000;
9886 if (remaining == 0) {
9888 strncat(res,
" 1000000000", res_len - strlen(res) - 1);
9893 strncat(res,
" 1000000000_ ", res_len - strlen(res) - 1);
9909 const char* remaining = fn;
9920 while (res == 0 && (s = strstr(remaining,
" "))) {
9921 size_t len = s - remaining;
9924 sprintf(new_string,
"digits/");
9925 strncat(new_string, remaining,
len);
9929 if ((audiofd > -1) && (ctrlfd > -1)) {
9940 while (*remaining ==
' ') {
9947 if (res == 0 && *remaining) {
9949 char* new_string =
ast_malloc(strlen(remaining) + 1 + strlen(
"digits/"));
9950 sprintf(new_string,
"digits/%s", remaining);
9953 if ((audiofd > -1) && (ctrlfd > -1)) {
9984 struct timeval when = { t, 0 };
9995 snprintf(fn,
sizeof(fn),
"digits/tslis %d", tm.
tm_wday);
10010 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
10027 struct timeval when = { t, 0 };
10061 struct timeval when = { t, 0 };
10084 struct timeval when = { t, 0 }, nowt =
ast_tvnow();
10090 if ((daydiff < 0) || (daydiff > 6)) {
10096 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
10103 }
else if (daydiff) {
10106 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
10133 if (num == 1 || num == -1) {
10162 if (num > 0 && num < 5) {
10173 const char *ending;
10183 temp =
ast_alloca((temp_len = (strlen(noun) + strlen(ending) + 1)));
10184 snprintf(temp, temp_len,
"%s%s", noun, ending);
10205 return gender ? gender :
"";
10215 const char *ending;
10225 temp =
ast_alloca((temp_len = (strlen(adjective) + strlen(ending) + 1)));
10226 snprintf(temp, temp_len,
"%s%s", adjective, ending);
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_malloc(len)
A wrapper for malloc()
static char language[MAX_LANGUAGE]
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
const char * ast_channel_language(const struct ast_channel *chan)
Standard Command Line Interface.
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
int ast_play_and_wait(struct ast_channel *chan, const char *fn)
Play a stream and wait for a digit, returning the digit that was pressed.
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
Custom localtime functions for multiple timezones.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Asterisk locking-related definitions:
static struct ast_str * get_ordinal_str_en(int num, const char *lang)
static int ast_say_date_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
static int ast_say_date_with_format_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
French syntax oclock = heure.
static int ast_say_number_full_dr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_en_dr: Dari syntax New files:
static int ast_say_enumeration_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_enumeration_full_en: English syntax
static int ast_say_date_with_format_es(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Spanish syntax.
static int gr_say_number_female(int num, struct ast_channel *chan, const char *ints, const char *lang)
Greek digits/female-[1..4] : "Mia, dyo , treis, tessereis".
static int ast_say_number_full_vi(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_vi: Vietnamese syntax
static struct ast_str * get_number_str_en(int num, const char *lang)
static int exp10_int(int power)
static int ast_say_number_full_it(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_it: Italian
static int say_datetime_from_now(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int ast_say_datetime_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Brazilian Portuguese syntax.
static int say_time(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int ast_say_date_with_format_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Dutch syntax.
static int ast_say_datetime_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Dutch syntax.
static int ast_say_time_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Thai syntax.
static int ast_say_enumeration_full_is(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full_is: Icelandic syntax
static int get_lastdigits_ru(int num)
determine last digits for thousands/millions (ru)
static int ast_say_datetime_from_now_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
static int ast_say_time_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
German syntax.
static int ast_say_datetime_from_now_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax.
static int ast_say_datetime_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
static int say_digit_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
static int ast_say_number_full_pt(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
static char * pl_append(char *buffer, char *str)
static int ast_say_number_full_ja(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
static int ast_say_datetime_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax. Say date, then say time.
static int say_phonetic_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
static int say_date_with_format(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
static void __say_init(void)
remap the 'say' functions to use those in this file
static int ast_say_number_full_ur(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
struct ast_str * ast_get_ordinal_str(int num, const char *lang)
ast_get_ordinal_str: call language-specific functions
static int ast_say_number_full_nl(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_nl: dutch syntax New files: digits/nl-en
static int ast_say_datetime_from_now_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
static int ast_say_number_full_cs(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_cs: Czech syntax
static int ast_say_date_with_format_vi(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Vietnamese syntax.
static int ast_say_time_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
static int ast_say_enumeration_full_he(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
static int ast_say_number_full_ru(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_ru: Russian syntax
static char * pl_rzad_na_tekst(odmiana *odm, int i, int rzad)
static int ast_say_datetime_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int ast_say_number_full_de(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_de: German syntax
static int ast_say_date_with_format_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
static int ast_say_date_with_format_pl(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Polish syntax.
static const char * counted_adjective_ending_ru(int num, const char gender[])
In slavic languages such as Russian and Ukrainian the rules for declining adjectives are simpler than...
static int ast_say_date_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Greek support.
static int ast_say_date_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
static int ast_say_enumeration_full_vi(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
static int ast_say_number_full_is(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_is: Icelandic syntax
static int ast_say_number_full_ps(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_ps: Pashto syntax
static int ast_say_date_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang)
static int ast_say_date_da(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Danish syntax.
static int ast_say_date_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
German syntax.
int ast_say_counted_adjective(struct ast_channel *chan, int num, const char adjective[], const char gender[])
static int ast_say_date_with_format_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Thai syntax.
struct ast_str * ast_get_character_str(const char *str, const char *lang, enum ast_say_case_sensitivity sensitivity)
Returns an ast_str of files for SayAlpha playback.
static int ast_say_datetime_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Greek support.
static int ast_say_number_full_es(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_es: Spanish syntax
static int ast_say_date_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Dutch syntax.
static int ast_say_date_with_format_da(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Danish syntax.
static int ast_say_datetime_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
static int ast_say_number_full_ka(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_ka: Georgian syntax
static int ast_say_time_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Dutch syntax.
struct ast_str * ast_get_number_str(int num, const char *lang)
ast_get_number_str: call language-specific functions
static int ast_say_date_with_format_is(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
static int say_character_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd)
static int ast_say_datetime_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_en_GB: British syntax New files:
static int ast_say_date_with_format_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
German syntax.
static int ast_say_number_full_he(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
static int say_ordinal_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
say_ordinal_full
struct ast_str * ast_get_phonetic_str(const char *str, const char *lang)
Returns an ast_str of files for SayPhonetic playback.
static int ast_say_number_full_hu(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_hu: Hungarian syntax
static int ast_say_number_full_no(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_no: Norwegian syntax New files: In addition to American English,...
static int ast_say_time_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Greek support.
static int ast_say_time_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hungarian syntax.
static int ast_say_date_is(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int ast_say_number_full_fr(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_fr: French syntax Extra sounds needed: 1F: feminin 'une' et: 'and'
static int ast_say_datetime_from_now_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
static int ast_say_time_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
static int ast_say_date_with_format_it(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Italian syntax.
static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_zh: Taiwanese / Chinese syntax
static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Greek support.
static int ast_say_time_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int ast_say_datetime_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hungarian syntax.
static int ast_say_date_with_format_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
ast_say_date_with_format_he Say formatted date in Hebrew
struct ast_str * ast_get_money_str(const char *str, const char *lang)
ast_get_money_str: call language-specific functions
static int ast_say_number_full_th(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
Thai syntax.
static int ast_say_datetime_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
static int ast_say_time_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Taiwanese / Chinese syntax.
static int ast_say_time_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
French syntax.
static int ast_say_date_hu(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hungarian syntax.
static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
Greek support A list of the files that you need to create -> digits/xilia = "xilia" -> digits/myrio =...
static int say_datetime(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int ast_say_number_full_se(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_se: Swedish syntax
static int ast_say_date_with_format_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Taiwanese / Chinese syntax.
static struct ast_str * ast_get_money_en_dollars_str(const char *str, const char *lang)
static int ast_say_number_full_da(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full_da: Danish syntax New files:
static int ast_say_date_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int ast_say_datetime_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
German syntax.
static int ast_say_time_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Portuguese syntax.
static int ast_say_number_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_number_full_en: English syntax
static int ast_say_date_he(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Hebrew syntax.
static void pl_odtworz_plik(struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, char *fn)
static int ast_say_datetime_zh(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Taiwanese / Chinese syntax.
static const char * counted_noun_ending_slavic(int num)
Counting of objects in slavic languages such as Russian and Ukrainian the rules are more complicated....
static int ast_say_time_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax. e.g. "otxi saati da eqvsi tsuti".
static char next_item(const char *format)
struct ast_str * ast_get_digit_str(const char *str, const char *lang)
Returns an ast_str of files for SayDigits playback.
static int ast_say_date_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Thai syntax.
static int say_money_str_full(struct ast_channel *chan, const char *str, const char *ints, const char *lang, int audiofd, int ctrlfd)
int ast_say_counted_noun(struct ast_channel *chan, int num, const char noun[])
static int ast_say_datetime_from_now_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
English syntax.
static char * ast_translate_number_ka(int num, char *res, int res_len)
Georgian support.
static int say_date(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
static int say_number_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_number_full: call language-specific functions
static int ast_say_number_full_pl(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
static int ast_say_enumeration_full_da(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full_da: Danish syntax
static void powiedz(struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, odmiana *odm, int rzad, int i)
static int ast_say_time_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Brazilian Portuguese syntax.
static int say_filenames(struct ast_channel *chan, const char *ints, const char *lang, int audiofd, int ctrlfd, struct ast_str *filenames)
static const char * counted_noun_ending_en(int num)
In English, we use the plural for everything but one. For example:
static int ast_say_date_with_format_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
Portuguese syntax.
static int ast_say_date_with_format_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *tzone)
English syntax.
static int ast_say_datetime_th(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Thai syntax.
static int ast_say_enumeration_full_ps(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_enumeration_full_ps: Pashto syntax
static int say_enumeration_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full: call language-specific functions
static int ast_say_enumeration_full_dr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
ast_say_enumeration_full_dr: Dari syntax
static int ast_say_enumeration_full_de(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd)
ast_say_enumeration_full_de: German syntax
static int ast_say_date_ka(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
Georgian syntax. e.g. "oriatas xuti tslis 5 noemberi".
Say numbers and dates (maybe words one day too)
SAY_EXTERN int(* ast_say_money_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_money_str_full)
SAY_EXTERN int(* ast_say_datetime_from_now)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime_from_now)
SAY_EXTERN int(* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date)
SAY_EXTERN int(* ast_say_number_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_number_full)
Same as ast_say_number() with audiofd for received audio and returns 1 on ctrlfd being readable.
SAY_EXTERN int(* ast_say_enumeration_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_enumeration_full)
Same as ast_say_enumeration() with audiofd for received audio and returns 1 on ctrlfd being readable.
SAY_EXTERN int(* ast_say_ordinal_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_ordinal_full)
Same as ast_say_number() with audiofd for received audio and returns 1 on ctrlfd being readable.
SAY_EXTERN int(* ast_say_character_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd) SAY_INIT(ast_say_character_str_full)
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
SAY_EXTERN int(* ast_say_date_with_format)(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezone) SAY_INIT(ast_say_date_with_format)
SAY_EXTERN int(* ast_say_digit_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_digit_str_full)
Same as ast_say_digit_str() with audiofd for received audio and returns 1 on ctrlfd being readable.
int ast_say_enumeration(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says an enumeration
ast_say_case_sensitivity
Controls how ast_say_character_str denotes the case of characters in a string.
int ast_say_digits_full(struct ast_channel *chan, int num, const char *ints, const char *lang, int audiofd, int ctrlfd)
Same as ast_say_digits() with audiofd for received audio and returns 1 on ctrlfd being readable.
SAY_EXTERN int(* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time)
SAY_EXTERN int(* ast_say_phonetic_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_phonetic_str_full)
SAY_EXTERN int(* ast_say_datetime)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_datetime)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
size_t attribute_pure ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char *attribute_pure ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
Main Channel structure associated with a channel.
Support for dynamic strings.
char * separator_dziesiatek
#define ast_test_suite_event_notify(s, f,...)
Time-related functions and macros.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().