42#include <netinet/in.h>
48#include <iso/limits_iso.h>
63static int wait_file(
struct ast_channel *chan,
const char *ints,
const char *file,
const char *lang);
67 char fnbuf[10], asciibuf[20] =
"letters/ascii";
80 while (
str[num] && !res) {
90 fn =
"letters/exclaimation-point";
96 fn =
"letters/dollar";
105 fn =
"letters/equals";
111 fn =
"letters/slash";
114 fn =
"letters/space";
126 strcpy(fnbuf,
"digits/X");
132 if (
'A' <= ltr && ltr <=
'Z') {
134 switch (sensitivity) {
142 }
else if (
'a' <= ltr && ltr <=
'z') {
143 switch (sensitivity) {
154 strcpy(fnbuf,
"uppercase");
156 strcpy(fnbuf,
"lowercase");
158 strcpy(fnbuf,
"letters/X");
164 (snprintf(asciibuf + 13,
sizeof(asciibuf) - 13,
"%d",
str[num]) > 0 &&
ast_fileexists(asciibuf,
NULL, lang) > 0 && (fn = asciibuf))) {
167 if (upper || lower) {
194 while (!res && (fn =
strsep(&files,
"&"))) {
197 if ((audiofd > -1) && (ctrlfd > -1)) {
214 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
240 fn =
"letters/exclaimation-point";
246 fn =
"letters/dollar";
255 fn =
"letters/equals";
261 fn =
"letters/slash";
264 fn =
"letters/space";
275 strcpy(fnbuf,
"digits/X");
281 if (
'A' <= ltr && ltr <=
'Z') ltr +=
'a' -
'A';
282 strcpy(fnbuf,
"phonetic/X_p");
298 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
335 strcpy(fnbuf,
"digits/X");
352 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
358 int amt, dollars = 0, cents = 0;
375 if (sscanf(
str,
".%02u", ¢s) < 1) {
380 const char *period = strchr(
str,
'.');
381 if (period && !isdigit(*(period + 1))) {
386 int res = sscanf(
str,
"%d.%02u", &dollars, ¢s);
389 }
else if (res == 2) {
390 const char *period = strchr(
str,
'.');
391 if (period && !isdigit(*(period + 1))) {
396 amt = dollars * 100 + cents;
398 ast_debug(1,
"Amount is %d (%d dollar%s, %d cent%s)\n", amt, dollars,
ESS(dollars), cents,
ESS(cents));
411 ast_str_append(&filenames, 0,
"&%s", (cents > 0) ?
"letters/dollar_" :
"letters/dollar");
430 ast_str_append(&filenames, 0,
"&%s", (cents == 1) ?
"cent" :
"cents");
431 }
else if (amt == 0) {
452 if (!strncasecmp(lang,
"en", 2)) {
456 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to US Dollars\n", lang);
464 return say_filenames(chan, ints, lang, audiofd, ctrlfd, filenames);
488 while (!res && (num || playh)) {
491 if ( num > INT_MIN ) {
499 }
else if (num < 20) {
500 snprintf(fn,
sizeof(fn),
"digits/%d", num);
502 }
else if (num < 100) {
503 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
507 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
521 snprintf(fn,
sizeof(fn),
"&digits/thousand");
523 if (num < 1000000000) {
569 if (!strncasecmp(lang,
"en", 2)) {
573 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to English\n", lang);
599 while (!res && (num || playh)) {
602 if ( num > INT_MIN ) {
608 ast_copy_string(fn, (num % 100 == 0) ?
"digits/h-hundred" :
"digits/hundred",
sizeof(fn));
610 }
else if (num < 20) {
612 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
617 }
else if (num < 100) {
618 int base = (num / 10) * 10;
620 snprintf(fn,
sizeof(fn),
"digits/%d", base);
622 snprintf(fn,
sizeof(fn),
"digits/h-%d", base);
627 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
641 snprintf(fn,
sizeof(fn), (num % 1000 == 0) ?
"&digits/h-thousand" :
"&digits/thousand");
643 if (num < 1000000000) {
652 ast_copy_string(fn, (num % 1000000 == 0) ?
"&digits/h-million" :
"&digits/million",
sizeof(fn));
663 ast_copy_string(fn, (num % 1000000000 == 0) ?
"&digits/h-billion" :
"&digits/billion",
sizeof(fn));
689 if (!strncasecmp(lang,
"en", 2)) {
693 ast_log(
LOG_WARNING,
"Language %s not currently supported, defaulting to English\n", lang);
893 if (!strncasecmp(
language,
"en_GB", 5)) {
895 }
else if (!strncasecmp(
language,
"en", 2)) {
897 }
else if (!strncasecmp(
language,
"cs", 2)) {
899 }
else if (!strncasecmp(
language,
"da", 2)) {
901 }
else if (!strncasecmp(
language,
"de", 2)) {
903 }
else if (!strncasecmp(
language,
"es", 2)) {
905 }
else if (!strncasecmp(
language,
"fr", 2)) {
907 }
else if (!strncasecmp(
language,
"gr", 2)) {
909 }
else if (!strncasecmp(
language,
"ja", 2)) {
911 }
else if (!strncasecmp(
language,
"he", 2)) {
913 }
else if (!strncasecmp(
language,
"hu", 2)) {
915 }
else if (!strncasecmp(
language,
"is", 2)) {
917 }
else if (!strncasecmp(
language,
"it", 2)) {
919 }
else if (!strncasecmp(
language,
"ka", 2)) {
921 }
else if (!strncasecmp(
language,
"nl", 2)) {
923 }
else if (!strncasecmp(
language,
"no", 2)) {
925 }
else if (!strncasecmp(
language,
"pl", 2)) {
927 }
else if (!strncasecmp(
language,
"pt", 2)) {
929 }
else if (!strncasecmp(
language,
"ru", 2)) {
931 }
else if (!strncasecmp(
language,
"se", 2)) {
933 }
else if (!strncasecmp(
language,
"th", 2)) {
935 }
else if (!strncasecmp(
language,
"zh", 2)) {
937 }
else if (!strncasecmp(
language,
"ur", 2)) {
939 }
else if (!strncasecmp(
language,
"vi", 2)) {
941 }
else if (!strncasecmp(
language,
"dr", 2)) {
943 }
else if (!strncasecmp(
language,
"ps", 2)) {
969 for (x=0;x<power;x++)
1013 while (!res && (num || playh)) {
1016 if ( num > INT_MIN ) {
1021 }
else if (num < 3 ) {
1022 snprintf(fn,
sizeof(fn),
"digits/%d%c", num,
options[0]);
1025 }
else if (num < 20) {
1026 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1029 }
else if (num < 100) {
1030 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1032 }
else if (num < 1000) {
1033 hundred = num / 100;
1034 if ( hundred == 1 ) {
1036 }
else if ( hundred == 2 ) {
1042 if (hundred == 3 || hundred == 4) {
1044 }
else if ( hundred > 4 ) {
1048 num -= (hundred * 100);
1050 length = (int)log10(num)+1;
1051 while ( (length % 3 ) != 1 ) {
1068 snprintf(fn,
sizeof(fn),
"digits/5_E%d", length - 1);
1069 }
else if ( left >= 2 && left <= 4 ) {
1070 snprintf(fn,
sizeof(fn),
"digits/2-4_E%d", length - 1);
1072 snprintf(fn,
sizeof(fn),
"digits/1_E%d", length - 1);
1078 if ((audiofd > -1) && (ctrlfd > -1)) {
1106 while (!res && (num || playh || playa )) {
1119 if ( num > INT_MIN ) {
1130 }
else if (num == 1 && cn == -1) {
1133 }
else if (num < 20) {
1134 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1136 }
else if (num < 100) {
1137 int ones = num % 10;
1139 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
1142 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1147 int hundreds = num / 100;
1151 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1154 num -= 100 * hundreds;
1159 if (num < 1000000) {
1166 if (num < 1000000000) {
1167 int millions = num / 1000000;
1175 num = num % 1000000;
1177 ast_debug(1,
"Number '%d' is too big for me\n", num);
1181 if (num && num < 100)
1187 if ((audiofd > -1) && (ctrlfd > -1))
1220 while (!res && num) {
1236 if ( num > INT_MIN ) {
1241 }
else if (num == 1 && mf == -1) {
1242 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1244 }
else if (num < 20) {
1245 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1247 }
else if (num < 100) {
1248 int ones = num % 10;
1250 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
1253 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1256 }
else if (num == 100 && t == 0) {
1259 }
else if (num < 1000) {
1260 int hundreds = num / 100;
1262 if (hundreds == 1) {
1265 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1268 }
else if (num == 1000 && t == 0) {
1271 }
else if (num < 1000000) {
1272 int thousands = num / 1000;
1275 if (thousands == 1) {
1284 }
else if (num < 1000000000) {
1285 int millions = num / 1000000;
1286 num = num % 1000000;
1288 if (millions == 1) {
1297 }
else if (num <= INT_MAX) {
1298 int billions = num / 1000000000;
1299 num = num % 1000000000;
1301 if (billions == 1) {
1312 ast_debug(1,
"Number '%d' is too big for me\n", num);
1317 if ((audiofd > -1) && (ctrlfd > -1))
1325 if ((audiofd > -1) && (ctrlfd > -1))
1356 while (!res && num) {
1368 if ( num > INT_MIN ) {
1373 }
else if (num < 20) {
1374 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1376 }
else if (num < 100) {
1377 int ones = num % 10;
1379 snprintf(fn,
sizeof(fn),
"digits/%d", ones);
1385 if (num == 20 && playWesht == 1){
1386 snprintf(fn,
sizeof(fn),
"digits/wesht");
1389 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1393 }
else if (num == 100 && t == 0) {
1396 }
else if (num < 1000) {
1397 int hundreds = num / 100;
1406 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1410 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
1413 }
else if (num == 1000 && t == 0) {
1416 }
else if (num < 1000000) {
1417 int thousands = num / 1000;
1420 if (thousands == 1) {
1422 snprintf(fn,
sizeof(fn),
"digits/%d", thousands);
1431 }
else if (num < 1000000000) {
1432 int millions = num / 1000000;
1433 num = num % 1000000;
1435 if (millions == 1) {
1443 }
else if (num <= INT_MAX) {
1444 int billions = num / 1000000000;
1445 num = num % 1000000000;
1447 if (billions == 1) {
1457 ast_debug(1,
"Number '%d' is too big for me\n", num);
1462 if ((audiofd > -1) && (ctrlfd > -1))
1470 if ((audiofd > -1) && (ctrlfd > -1))
1496 while (!res && (num || playh || playa )) {
1499 if ( num > INT_MIN ) {
1510 }
else if (num < 20) {
1511 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1513 }
else if (num < 100) {
1514 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1516 }
else if (num < 1000) {
1517 int hundreds = num / 100;
1518 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1521 num -= 100 * hundreds;
1524 }
else if (num < 1000000) {
1530 if (num && num < 100)
1532 }
else if (num < 1000000000) {
1533 int millions = num / 1000000;
1539 if (num && num < 100)
1542 ast_debug(1,
"Number '%d' is too big for me\n", num);
1548 if ((audiofd > -1) && (ctrlfd > -1))
1573 while (!res && (num || playh || playa )) {
1576 if ( num > INT_MIN ) {
1587 }
else if (num < 20) {
1588 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1590 }
else if (num < 100) {
1591 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
1595 }
else if (num < 1000) {
1596 int hundreds = num / 100;
1597 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
1600 num -= 100 * hundreds;
1603 }
else if (num < 1000000) {
1611 }
else if (num < 1000000000) {
1612 int millions = num / 1000000;
1618 if (num && num < 100 && say_o)
1621 ast_debug(1,
"Number '%d' is too big for me\n", num);
1627 if ((audiofd > -1) && (ctrlfd > -1))
1655 if (!strncasecmp(
options,
"f", 1))
1657 else if (!strncasecmp(
options,
"m", 1))
1661 while (!res && num) {
1664 if ( num > INT_MIN ) {
1672 }
else if (num == 1) {
1674 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1676 snprintf(fn,
sizeof(fn),
"digits/%dM", num);
1678 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1680 }
else if (num < 31) {
1681 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1683 }
else if (num < 100) {
1684 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1688 }
else if (num == 100) {
1691 }
else if (num < 200) {
1696 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100)*100);
1698 }
else if (num < 2000) {
1702 if (num < 1000000) {
1709 if (num < 2147483640) {
1710 if ((num/1000000) == 1) {
1723 ast_debug(1,
"Number '%d' is too big for me\n", num);
1732 if ((audiofd > -1) && (ctrlfd > -1))
1762 while (!res && (num || playh || playa)) {
1765 if ( num > INT_MIN ) {
1776 }
else if (num == 1) {
1778 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
1780 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1782 }
else if (num < 21) {
1783 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1785 }
else if (num < 70) {
1786 snprintf(fn,
sizeof(fn),
"digits/%d", (num/10)*10);
1787 if ((num % 10) == 1) playa++;
1789 }
else if (num < 80) {
1791 if ((num % 10) == 1) playa++;
1793 }
else if (num < 100) {
1796 }
else if (num < 200) {
1799 }
else if (num < 1000) {
1800 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
1803 }
else if (num < 2000) {
1806 }
else if (num < 1000000) {
1812 }
else if (num < 1000000000) {
1817 num = num % 1000000;
1819 ast_debug(1,
"Number '%d' is too big for me\n", num);
1824 if ((audiofd > -1) && (ctrlfd > -1))
1840#define SAY_NUM_BUF_SIZE 256
1850 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num,
options);
1858 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d\n", num,
state,
options, mf);
1861 while (!res && (num || (
state > 0))) {
1869 ast_verb(3,
"ast_say_digits_full: num: %d, state=%d, options=\"%s\", mf=%d, tmpnum=%d\n", num,
state,
options, mf, tmpnum);
1873 }
else if (
state == 2) {
1874 if ((num >= 11) && (num < 21)) {
1876 snprintf(fn,
sizeof(fn),
"digits/ve");
1878 snprintf(fn,
sizeof(fn),
"digits/uu");
1883 snprintf(fn,
sizeof(fn),
"digits/ve");
1886 snprintf(fn,
sizeof(fn),
"digits/uu");
1890 snprintf(fn,
sizeof(fn),
"digits/ve");
1892 snprintf(fn,
sizeof(fn),
"digits/uu");
1896 snprintf(fn,
sizeof(fn),
"digits/ve");
1899 snprintf(fn,
sizeof(fn),
"digits/ve");
1902 snprintf(fn,
sizeof(fn),
"digits/ve");
1905 snprintf(fn,
sizeof(fn),
"digits/ve");
1908 snprintf(fn,
sizeof(fn),
"digits/uu");
1911 snprintf(fn,
sizeof(fn),
"digits/ve");
1914 snprintf(fn,
sizeof(fn),
"digits/ve");
1919 }
else if (
state == 3) {
1920 snprintf(fn,
sizeof(fn),
"digits/1k");
1922 }
else if (num < 0) {
1923 snprintf(fn,
sizeof(fn),
"digits/minus");
1925 }
else if (num < 20) {
1927 snprintf(fn,
sizeof(fn),
"digits/%d", num);
1929 snprintf(fn,
sizeof(fn),
"digits/%dm", num);
1932 }
else if ((num < 100) && (num >= 20)) {
1933 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
1938 }
else if ((num >= 100) && (num < 1000)) {
1940 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
1941 num = num - (tmpnum * 100);
1942 if ((num > 0) && (num < 11)) {
1945 }
else if ((num >= 1000) && (num < 10000)) {
1946 tmpnum = num / 1000;
1947 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
1948 num = num - (tmpnum * 1000);
1949 if ((num > 0) && (num < 11)) {
1952 }
else if (num < 20000) {
1953 snprintf(fn,
sizeof(fn),
"digits/%dm", (num / 1000));
1956 }
else if (num < 1000000) {
1961 snprintf(fn,
sizeof(fn),
"digits/1k");
1963 if ((num > 0) && (num < 11)) {
1966 }
else if (num < 2000000) {
1967 snprintf(fn,
sizeof(fn),
"digits/million");
1968 num = num % 1000000;
1969 if ((num > 0) && (num < 11)) {
1972 }
else if (num < 3000000) {
1973 snprintf(fn,
sizeof(fn),
"digits/twomillion");
1974 num = num - 2000000;
1975 if ((num > 0) && (num < 11)) {
1978 }
else if (num < 1000000000) {
1983 snprintf(fn,
sizeof(fn),
"digits/million");
1984 num = num % 1000000;
1985 if ((num > 0) && (num < 11)) {
1989 ast_debug(1,
"Number '%d' is too big for me\n", num);
1995 if ((audiofd > -1) && (ctrlfd > -1)) {
2027 while(!res && (num || playh)) {
2030 if ( num > INT_MIN ) {
2038 }
else if (num < 11 || num == 20) {
2039 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2041 }
else if (num < 20) {
2044 }
else if (num < 30) {
2047 }
else if (num < 100) {
2048 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2052 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2056 if (num < 1000000) {
2063 if (num < 1000000000) {
2070 ast_debug(1,
"Number '%d' is too big for me\n", num);
2078 if ((audiofd > -1) && (ctrlfd > -1))
2109 while (!res && (num || playh || playa )) {
2112 if ( num > INT_MIN ) {
2126 }
else if (num < 5 && cn == 2) {
2127 snprintf(fn,
sizeof(fn),
"digits/%dkvk", num);
2129 }
else if (num < 5 && cn == 3) {
2130 snprintf(fn,
sizeof(fn),
"digits/%dhk", num);
2132 }
else if (num < 20) {
2133 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2135 }
else if (num < 100) {
2136 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2140 }
else if (num < 1000) {
2141 int hundreds = num / 100;
2144 snprintf(fn,
sizeof(fn),
"digits/%dhk", hundreds);
2146 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2149 num -= 100 * hundreds;
2150 if (num && num < 20)
2153 if (num && (num % 10) == 0)
2155 }
else if (num < 1000000) {
2158 if ((num % 100) == 0 && (num % 1000 != 0)) {
2165 if (num && (num < 20 || (num % 10 == 0)))
2167 }
else if (num < 1000000000) {
2168 int millions = num / 1000000;
2178 if (num && num < 100)
2180 }
else if (num < INT_MAX) {
2181 int milliards = num / 1000000000;
2191 if (num && num < 100)
2194 ast_debug(1,
"Number '%d' is too big for me\n", num);
2200 if ((audiofd > -1) && (ctrlfd > -1))
2247 while (!res && (num || playh)) {
2250 if ( num > INT_MIN ) {
2258 }
else if (num < 20) {
2259 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2261 }
else if (num == 21) {
2262 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2264 }
else if (num == 28) {
2265 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2267 }
else if (num == 31) {
2268 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2270 }
else if (num == 38) {
2271 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2273 }
else if (num == 41) {
2274 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2276 }
else if (num == 48) {
2277 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2279 }
else if (num == 51) {
2280 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2282 }
else if (num == 58) {
2283 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2285 }
else if (num == 61) {
2286 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2288 }
else if (num == 68) {
2289 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2291 }
else if (num == 71) {
2292 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2294 }
else if (num == 78) {
2295 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2297 }
else if (num == 81) {
2298 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2300 }
else if (num == 88) {
2301 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2303 }
else if (num == 91) {
2304 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2306 }
else if (num == 98) {
2307 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2309 }
else if (num < 100) {
2310 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2314 if ((num / 100) > 1) {
2315 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2322 if (num < 1000000) {
2329 if ((tempnum / 1000) < 2)
2334 if (num < 1000000000) {
2335 if ((num / 1000000) > 1)
2341 if ((tempnum / 1000000) < 2)
2346 ast_debug(1,
"Number '%d' is too big for me\n", num);
2354 if ((audiofd > -1) && (ctrlfd > -1))
2376 while (!res && (num || playh )) {
2379 if ( num > INT_MIN ) {
2387 }
else if (num < 20) {
2388 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2390 }
else if (num < 100) {
2399 snprintf(fn,
sizeof(fn),
"digits/%d", num - units);
2402 }
else if (num < 200) {
2406 }
else if (num < 1000) {
2407 snprintf(fn,
sizeof(fn),
"digits/%d", num / 100);
2415 }
else if (num < 10000) {
2422 if (num < 1000000) {
2429 if (num < 1000000000) {
2436 ast_debug(1,
"Number '%d' is too big for me\n", num);
2445 if ((audiofd > -1) && (ctrlfd > -1))
2479 while (!res && (num || playh || playa )) {
2482 if ( num > INT_MIN ) {
2493 }
else if (num == 1 && cn == -1) {
2496 }
else if (num < 20) {
2497 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2499 }
else if (num < 100) {
2500 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2502 }
else if (num < 1000) {
2503 int hundreds = num / 100;
2507 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
2510 num -= 100 * hundreds;
2513 }
else if (num < 1000000) {
2519 if (num && num < 100)
2521 }
else if (num < 1000000000) {
2522 int millions = num / 1000000;
2528 if (num && num < 100)
2531 ast_debug(1,
"Number '%d' is too big for me\n", num);
2537 if ((audiofd > -1) && (ctrlfd > -1))
2553 char *dziesiatki[10];
2564 return odm->
rzedy[rzad - 1][0];
2565 if ((i > 21 || i < 11) && i%10 > 1 && i%10 < 5)
2566 return odm->
rzedy[rzad - 1][1];
2568 return odm->
rzedy[rzad - 1][2];
2573 strcpy(buffer,
str);
2574 buffer += strlen(
str);
2580 char file_name[255] =
"digits/";
2581 strcat(file_name, fn);
2582 ast_debug(1,
"Trying to play: %s\n", file_name);
2584 if ((audiofd > -1) && (ctrlfd > -1))
2604 if (i == 0 && rzad > 0) {
2612 m1000E6 = i % 1000000000;
2613 i1000E6 = i / 1000000000;
2617 m1000E3 = m1000E6 % 1000000;
2618 i1000E3 = m1000E6 / 1000000;
2622 m1000 = m1000E3 % 1000;
2623 i1000 = m1000E3 / 1000;
2633 if (m100 > 0 && m100 <= 9) {
2638 }
else if (m100 % 10 == 0 && m100 != 0) {
2640 }
else if (m100 > 10 && m100 <= 19) {
2642 }
else if (m100 > 20) {
2755 char *zenski_cyfry[] = {
"0",
"1z",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2757 char *zenski_cyfry2[] = {
"0",
"1",
"2z",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2759 char *meski_cyfry[] = {
"0",
"1",
"2-1m",
"3-1m",
"4-1m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2761 char *meski_cyfry2[] = {
"0",
"1",
"2-2m",
"3-2m",
"4-2m",
"5m",
"6m",
"7m",
"8m",
"9m"};
2763 char *meski_setki[] = {
"",
"100m",
"200m",
"300m",
"400m",
"500m",
"600m",
"700m",
"800m",
"900m"};
2765 char *meski_dziesiatki[] = {
"",
"10m",
"20m",
"30m",
"40m",
"50m",
"60m",
"70m",
"80m",
"90m"};
2767 char *meski_nastki[] = {
"",
"11m",
"12m",
"13m",
"14m",
"15m",
"16m",
"17m",
"18m",
"19m"};
2769 char *nijaki_cyfry[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2771 char *nijaki_cyfry2[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"};
2773 char *nijaki_setki[] = {
"",
"100",
"200",
"300",
"400",
"500",
"600",
"700",
"800",
"900"};
2775 char *nijaki_dziesiatki[] = {
"",
"10",
"20",
"30",
"40",
"50",
"60",
"70",
"80",
"90"};
2777 char *nijaki_nastki[] = {
"",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19"};
2779 char *rzedy[][3] = { {
"1000",
"1000.2",
"1000.5"}, {
"1000000",
"1000000.2",
"1000000.5"}, {
"1000000000",
"1000000000.2",
"1000000000.5"}};
2788 if (odmiana_nieosobowa ==
NULL) {
2789 odmiana_nieosobowa =
ast_malloc(
sizeof(*odmiana_nieosobowa));
2793 memcpy(odmiana_nieosobowa->
cyfry, nijaki_cyfry,
sizeof(odmiana_nieosobowa->
cyfry));
2794 memcpy(odmiana_nieosobowa->
cyfry2, nijaki_cyfry2,
sizeof(odmiana_nieosobowa->
cyfry));
2795 memcpy(odmiana_nieosobowa->
setki, nijaki_setki,
sizeof(odmiana_nieosobowa->
setki));
2796 memcpy(odmiana_nieosobowa->
dziesiatki, nijaki_dziesiatki,
sizeof(odmiana_nieosobowa->
dziesiatki));
2797 memcpy(odmiana_nieosobowa->
nastki, nijaki_nastki,
sizeof(odmiana_nieosobowa->
nastki));
2798 memcpy(odmiana_nieosobowa->
rzedy, rzedy,
sizeof(odmiana_nieosobowa->
rzedy));
2801 if (odmiana_zenska ==
NULL) {
2802 odmiana_zenska =
ast_malloc(
sizeof(*odmiana_zenska));
2806 memcpy(odmiana_zenska->
cyfry, zenski_cyfry,
sizeof(odmiana_zenska->
cyfry));
2807 memcpy(odmiana_zenska->
cyfry2, zenski_cyfry2,
sizeof(odmiana_zenska->
cyfry));
2808 memcpy(odmiana_zenska->
setki, nijaki_setki,
sizeof(odmiana_zenska->
setki));
2810 memcpy(odmiana_zenska->
nastki, nijaki_nastki,
sizeof(odmiana_zenska->
nastki));
2811 memcpy(odmiana_zenska->
rzedy, rzedy,
sizeof(odmiana_zenska->
rzedy));
2814 if (odmiana_meska ==
NULL) {
2815 odmiana_meska =
ast_malloc(
sizeof(*odmiana_meska));
2819 memcpy(odmiana_meska->
cyfry, meski_cyfry,
sizeof(odmiana_meska->
cyfry));
2820 memcpy(odmiana_meska->
cyfry2, meski_cyfry2,
sizeof(odmiana_meska->
cyfry));
2821 memcpy(odmiana_meska->
setki, meski_setki,
sizeof(odmiana_meska->
setki));
2823 memcpy(odmiana_meska->
nastki, meski_nastki,
sizeof(odmiana_meska->
nastki));
2824 memcpy(odmiana_meska->
rzedy, rzedy,
sizeof(odmiana_meska->
rzedy));
2828 if (strncasecmp(
options,
"f", 1) == 0)
2830 else if (strncasecmp(
options,
"m", 1) == 0)
2833 o = odmiana_nieosobowa;
2835 o = odmiana_nieosobowa;
2862 while (!res && num ) {
2865 if ( num > INT_MIN ) {
2870 }
else if (num < 20) {
2871 if ((num == 1 || num == 2) && (mf < 0))
2872 snprintf(fn,
sizeof(fn),
"digits/%dF", num);
2874 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2876 }
else if (num < 100) {
2877 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
2881 }
else if (num < 1000) {
2887 if (mf < 0 && num > 199)
2888 snprintf(fn,
sizeof(fn),
"digits/%dF", (num / 100) * 100);
2890 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100) * 100);
2895 }
else if (num < 1000000) {
2902 if ((num % 1000) && ((num % 1000) < 100 || !(num % 100)))
2905 }
else if (num < 1000000000) {
2914 if ((num % 1000000) &&
2916 ((!((num / 1000) % 1000) && ((num % 1000) < 100 || !(num % 100))) ||
2918 (!(num % 1000) && (((num / 1000) % 1000) < 100 || !((num / 1000) % 100))) ) )
2920 num = num % 1000000;
2928 if ((audiofd > -1) && (ctrlfd > -1))
2935 if (!res && playh) {
2962 while (num || playh) {
2965 if ( num > INT_MIN ) {
2973 }
else if (start && num < 200 && num > 99 && cn == -1) {
2975 snprintf(fn,
sizeof(fn),
"digits/hundred");
2977 }
else if (num == 1 && cn == -1) {
2980 }
else if (num < 20) {
2981 snprintf(fn,
sizeof(fn),
"digits/%d", num);
2983 }
else if (num < 100) {
2984 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
2986 }
else if (num < 1000) {
2988 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
2991 }
else if (num < 1000000) {
2999 }
else if (num < 1000000000) {
3008 ast_debug(1,
"Number '%d' is too big for me\n", num);
3013 if ((audiofd > -1) && (ctrlfd > -1)) {
3035 int last_length = 0;
3041 while (!res && (num || playh || playt || playz)) {
3044 if ( num > INT_MIN ) {
3050 snprintf(fn,
sizeof(fn),
"digits/0");
3057 snprintf(fn,
sizeof(fn),
"digits/thousand");
3059 }
else if (num < 10) {
3060 snprintf(
buf, 12,
"%d", num);
3061 if (last_length - strlen(
buf) > 1 && last_length != 0) {
3062 last_length = strlen(
buf);
3066 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3068 }
else if (num < 100) {
3069 snprintf(
buf, 10,
"%d", num);
3070 if (last_length - strlen(
buf) > 1 && last_length != 0) {
3071 last_length = strlen(
buf);
3075 last_length = strlen(
buf);
3076 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
3080 snprintf(
buf, 10,
"%d", num);
3081 if (last_length - strlen(
buf) > 1 && last_length != 0) {
3082 last_length = strlen(
buf);
3086 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
3088 snprintf(
buf, 10,
"%d", num);
3089 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3090 last_length = strlen(
buf);
3091 num -= ((num / 100) * 100);
3092 }
else if (num < 10000){
3093 snprintf(
buf, 10,
"%d", num);
3094 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 1000));
3096 snprintf(
buf, 10,
"%d", num);
3097 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3098 last_length = strlen(
buf);
3099 num -= ((num / 1000) * 1000);
3100 }
else if (num < 100000000) {
3104 snprintf(
buf, 10,
"%d", num);
3105 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3106 num -= ((num / 10000) * 10000);
3107 last_length = strlen(
buf);
3108 snprintf(fn,
sizeof(fn),
"digits/wan");
3110 if (num < 1000000000) {
3114 snprintf(
buf, 10,
"%d", num);
3115 ast_debug(1,
"Number '%d' %d %d\n", num, (
int)strlen(
buf), last_length);
3116 last_length = strlen(
buf);
3117 num -= ((num / 100000000) * 100000000);
3118 snprintf(fn,
sizeof(fn),
"digits/yi");
3120 ast_debug(1,
"Number '%d' is too big for me\n", num);
3127 if ((audiofd > -1) && (ctrlfd > -1))
3152 while (!res && (num || playh)) {
3154 snprintf(fn,
sizeof(fn),
"digits/hundred");
3156 }
else if (num < 100) {
3157 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3159 }
else if (num < 1000) {
3160 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 100));
3162 num -= ((num / 100) * 100);
3163 }
else if (num < 100000) {
3168 snprintf(fn,
sizeof(fn),
"digits/thousand");
3169 }
else if (num < 10000000) {
3174 snprintf(fn,
sizeof(fn),
"digits/lac");
3175 }
else if (num < 1000000000) {
3179 num = num % 10000000;
3180 snprintf(fn,
sizeof(fn),
"digits/crore");
3182 ast_debug(1,
"Number '%d' is too big for me\n", num);
3188 if ((audiofd > -1) && (ctrlfd > -1)) {
3204 }
else if (num < 100) {
3206 }
else if (num < 1000) {
3236 while (!res && (num)) {
3239 if ( num > INT_MIN ) {
3244 }
else if (num < 20) {
3246 snprintf(fn,
sizeof(fn),
"digits/%d%s", num,
options);
3248 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3251 }
else if (num < 100) {
3252 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 10));
3254 }
else if (num < 1000){
3255 snprintf(fn,
sizeof(fn),
"digits/%d", num - (num % 100));
3257 }
else if (num < 1000000) {
3260 if (lastdigits < 3) {
3267 if (lastdigits == 1) {
3269 }
else if (lastdigits > 1 && lastdigits < 5) {
3275 }
else if (num < 1000000000) {
3281 if (lastdigits == 1) {
3283 }
else if (lastdigits > 1 && lastdigits < 5) {
3290 ast_debug(1,
"Number '%d' is too big for me\n", num);
3295 if ((audiofd > -1) && (ctrlfd > -1))
3315 while(!res && (num || playh)) {
3318 if ( num > INT_MIN ) {
3326 }
else if (num < 100) {
3327 if ((num <= 20) || ((num % 10) == 1)) {
3328 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3331 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
3334 }
else if (num < 1000) {
3335 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
3338 }
else if (num < 10000) {
3344 }
else if (num < 100000) {
3350 }
else if (num < 1000000) {
3365 if ((audiofd > -1) && (ctrlfd > -1))
3388 while (!res && (num || playh)) {
3391 if ( num > INT_MIN ) {
3397 snprintf(fn,
sizeof(fn),
"digits/%da", num);
3406 }
else if (playoh) {
3409 }
else if (playohz) {
3412 }
else if (num < 20) {
3413 snprintf(fn,
sizeof(fn),
"digits/%d", num);
3415 }
else if (num < 100) {
3416 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
3418 if ((num == 5) || (num == 4) || (num == 1)) playl++;
3421 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
3423 if (num && (num < 10)) {
3430 if (num < 1000000) {
3435 snprintf(fn,
sizeof(fn),
"digits/thousand");
3436 if (num && (num < 10)) {
3438 }
else if (num && (num < 100)){
3446 if (num < 1000000000) {
3460 if ((audiofd > -1) && (ctrlfd > -1))
3475 if (!strncasecmp(
language,
"en", 2)) {
3477 }
else if (!strncasecmp(
language,
"da", 2)) {
3479 }
else if (!strncasecmp(
language,
"de", 2)) {
3481 }
else if (!strncasecmp(
language,
"he", 2)) {
3483 }
else if (!strncasecmp(
language,
"is", 2)) {
3485 }
else if (!strncasecmp(
language,
"vi", 2)) {
3487 }
else if (!strncasecmp(
language,
"ps", 2)) {
3489 }
else if (!strncasecmp(
language,
"dr", 2)) {
3504 while (!res && num) {
3507 if ( num > INT_MIN ) {
3512 }
else if (num < 20) {
3513 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3515 }
else if (num < 100) {
3516 int tens = num / 10;
3519 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3521 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3523 }
else if (num < 1000) {
3524 int hundreds = num / 100;
3526 if (hundreds > 1 || t == 1) {
3536 }
else if (num < 1000000) {
3537 int thousands = num / 1000;
3539 if (thousands > 1 || t == 1) {
3550 }
else if (num < 1000000000) {
3551 int millions = num / 1000000;
3552 num = num % 1000000;
3562 }
else if (num < INT_MAX) {
3563 int billions = num / 1000000000;
3564 num = num % 1000000000;
3574 }
else if (num == INT_MAX) {
3578 ast_debug(1,
"Number '%d' is too big for me\n", num);
3584 if ((audiofd > -1) && (ctrlfd > -1)) {
3603 while (!res && num) {
3606 if ( num > INT_MIN ) {
3611 }
else if (num <= 31) {
3612 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3614 }
else if (num < 100) {
3615 int tens = num / 10;
3618 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3620 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3622 }
else if (num < 1000) {
3623 int hundreds = num / 100;
3625 if (hundreds > 1 || t == 1) {
3635 }
else if (num < 1000000) {
3636 int thousands = num / 1000;
3638 if (thousands > 1 || t == 1) {
3649 }
else if (num < 1000000000) {
3650 int millions = num / 1000000;
3651 num = num % 1000000;
3661 }
else if (num < INT_MAX) {
3662 int billions = num / 1000000000;
3663 num = num % 1000000000;
3673 }
else if (num == INT_MAX) {
3677 ast_debug(1,
"Number '%d' is too big for me\n", num);
3683 if ((audiofd > -1) && (ctrlfd > -1)) {
3702 while (!res && num) {
3705 if ( num > INT_MIN ) {
3710 }
else if (num <= 31) {
3711 snprintf(fn,
sizeof(fn),
"digits/h-%d", num);
3713 }
else if (num < 100) {
3714 int tens = num / 10;
3717 snprintf(fn,
sizeof(fn),
"digits/h-%d", (tens * 10));
3719 snprintf(fn,
sizeof(fn),
"digits/%d", (tens * 10));
3721 }
else if (num < 1000) {
3722 int hundreds = num / 100;
3724 if (hundreds > 1 || t == 1) {
3734 }
else if (num < 1000000) {
3735 int thousands = num / 1000;
3737 if (thousands > 1 || t == 1) {
3748 }
else if (num < 1000000000) {
3749 int millions = num / 1000000;
3750 num = num % 1000000;
3760 }
else if (num < INT_MAX) {
3761 int billions = num / 1000000000;
3762 num = num % 1000000000;
3772 }
else if (num == INT_MAX) {
3776 ast_debug(1,
"Number '%d' is too big for me\n", num);
3782 if ((audiofd > -1) && (ctrlfd > -1)) {
3801 if ((audiofd > -1) && (ctrlfd > -1)) {
3818 char fn[256] =
"", fna[256] =
"";
3832 while (!res && num) {
3835 if ( num > INT_MIN ) {
3840 }
else if (num < 100 && t) {
3843 }
else if (num < 20) {
3844 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3846 }
else if (num < 100) {
3847 int ones = num % 10;
3849 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
3852 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
3855 }
else if (num == 100 && t == 0) {
3856 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
3858 }
else if (num < 1000) {
3859 int hundreds = num / 100;
3861 if (hundreds == 1) {
3864 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
3869 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
3872 }
else if (num < 1000000) {
3873 int thousands = num / 1000;
3875 if (thousands == 1) {
3882 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
3884 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3895 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
3899 }
else if (num < 1000000000) {
3900 int millions = num / 1000000;
3901 num = num % 1000000;
3902 if (millions == 1) {
3908 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
3918 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
3922 }
else if (num < INT_MAX) {
3923 int billions = num / 1000000000;
3924 num = num % 1000000000;
3925 if (billions == 1) {
3931 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
3940 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
3944 }
else if (num == INT_MAX) {
3945 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
3948 ast_debug(1,
"Number '%d' is too big for me\n", num);
3954 if ((audiofd > -1) && (ctrlfd > -1))
3962 if ((audiofd > -1) && (ctrlfd > -1)) {
3981 char fn[256] =
"", fna[256] =
"";
3995 while (!res && num) {
3998 if ( num > INT_MIN ) {
4003 }
else if (num < 100 && t) {
4006 }
else if (num < 20) {
4007 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
4009 }
else if (num < 100) {
4010 int ones = num % 10;
4012 snprintf(fn,
sizeof(fn),
"digits/%d-and", ones);
4015 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
4018 }
else if (num == 100 && t == 0) {
4019 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
4021 }
else if (num < 1000) {
4022 int hundreds = num / 100;
4024 if (hundreds == 1) {
4027 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
4032 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
4035 }
else if (num < 1000000) {
4036 int thousands = num / 1000;
4038 if (thousands == 1) {
4045 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
4047 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4058 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4062 }
else if (num < 1000000000) {
4063 int millions = num / 1000000;
4064 num = num % 1000000;
4065 if (millions == 1) {
4071 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
4081 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
4085 }
else if (num < INT_MAX) {
4086 int billions = num / 1000000000;
4087 num = num % 1000000000;
4088 if (billions == 1) {
4094 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
4103 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
4107 }
else if (num == INT_MAX) {
4108 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
4111 ast_debug(1,
"Number '%d' is too big for me\n", num);
4117 if ((audiofd > -1) && (ctrlfd > -1))
4125 if ((audiofd > -1) && (ctrlfd > -1)) {
4144 ast_verb(3,
"ast_say_digits_full: started. num: %d, options=\"%s\"\n", num,
options);
4150 ast_verb(3,
"ast_say_digits_full: num: %d, options=\"%s\", mf=%d\n", num,
options, mf);
4152 while (!res && num) {
4154 snprintf(fn,
sizeof(fn),
"digits/minus");
4155 if (num > INT_MIN) {
4160 }
else if (num < 21) {
4163 snprintf(fn,
sizeof(fn),
"digits/f-0%d", num);
4165 snprintf(fn,
sizeof(fn),
"digits/f-%d", num);
4169 snprintf(fn,
sizeof(fn),
"digits/m-0%d", num);
4171 snprintf(fn,
sizeof(fn),
"digits/m-%d", num);
4175 }
else if ((num < 100) && num >= 20) {
4176 snprintf(fn,
sizeof(fn),
"digits/%d", (num / 10) * 10);
4178 }
else if ((num >= 100) && (num < 1000)) {
4179 int tmpnum = num / 100;
4180 snprintf(fn,
sizeof(fn),
"digits/%d00", tmpnum);
4181 num = num - (tmpnum * 100);
4182 }
else if ((num >= 1000) && (num < 10000)) {
4183 int tmpnum = num / 1000;
4184 snprintf(fn,
sizeof(fn),
"digits/%dk", tmpnum);
4185 num = num - (tmpnum * 1000);
4186 }
else if (num < 20000) {
4187 snprintf(fn,
sizeof(fn),
"digits/m-%d", (num / 1000));
4189 }
else if (num < 1000000) {
4194 snprintf(fn,
sizeof(fn),
"digits/1k");
4196 }
else if (num < 2000000) {
4197 snprintf(fn,
sizeof(fn),
"digits/1m");
4198 num = num % 1000000;
4199 }
else if (num < 3000000) {
4200 snprintf(fn,
sizeof(fn),
"digits/2m");
4201 num = num - 2000000;
4202 }
else if (num < 1000000000) {
4207 snprintf(fn,
sizeof(fn),
"digits/1m");
4208 num = num % 1000000;
4210 ast_debug(1,
"Number '%d' is too big for me\n", num);
4215 if ((audiofd > -1) && (ctrlfd > -1)) {
4232 char fn[256] =
"", fna[256] =
"";
4246 while (!res && num) {
4249 if ( num > INT_MIN ) {
4254 }
else if (num < 100 && t) {
4257 }
else if (num < 20) {
4258 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
4260 }
else if (num < 100) {
4261 int ones = num % 10;
4263 int tens = num - ones;
4264 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", tens, gender);
4273 snprintf(fn,
sizeof(fn),
"digits/h-%d%s", num, gender);
4277 }
else if (num == 100 && t == 0) {
4278 snprintf(fn,
sizeof(fn),
"digits/h-hundred%s", gender);
4280 }
else if (num < 1000) {
4281 int hundreds = num / 100;
4283 if (hundreds == 1) {
4286 snprintf(fn,
sizeof(fn),
"digits/%d", hundreds);
4291 snprintf(fna,
sizeof(fna),
"digits/h-hundred%s", gender);
4294 }
else if (num < 1000000) {
4295 int thousands = num / 1000;
4297 if (thousands == 1) {
4305 snprintf(fna,
sizeof(fna),
"digits/h-thousand%s", gender);
4307 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4318 snprintf(fn,
sizeof(fn),
"digits/h-thousand%s", gender);
4323 }
else if (num < 1000000000) {
4324 int millions = num / 1000000;
4325 num = num % 1000000;
4326 if (millions == 1) {
4333 snprintf(fna,
sizeof(fna),
"digits/h-million%s", gender);
4343 snprintf(fn,
sizeof(fn),
"digits/h-million%s", gender);
4348 }
else if (num < INT_MAX) {
4349 int billions = num / 1000000000;
4350 num = num % 1000000000;
4351 if (billions == 1) {
4357 snprintf(fna,
sizeof(fna),
"digits/h-milliard%s", gender);
4366 snprintf(fn,
sizeof(fna),
"digits/h-milliard%s", gender);
4371 }
else if (num == INT_MAX) {
4372 snprintf(fn,
sizeof(fn),
"digits/h-last%s", gender);
4375 ast_debug(1,
"Number '%d' is too big for me\n", num);
4381 if ((audiofd > -1) && (ctrlfd > -1))
4389 if ((audiofd > -1) && (ctrlfd > -1)) {
4405 if (!strncasecmp(lang,
"en", 2)) {
4407 }
else if (!strncasecmp(lang,
"da", 2)) {
4409 }
else if (!strncasecmp(lang,
"de", 2)) {
4411 }
else if (!strncasecmp(lang,
"fr", 2)) {
4413 }
else if (!strncasecmp(lang,
"gr", 2)) {
4415 }
else if (!strncasecmp(lang,
"ja", 2)) {
4417 }
else if (!strncasecmp(lang,
"he", 2)) {
4419 }
else if (!strncasecmp(lang,
"hu", 2)) {
4421 }
else if (!strncasecmp(lang,
"is", 2)) {
4423 }
else if (!strncasecmp(lang,
"ka", 2)) {
4425 }
else if (!strncasecmp(lang,
"nl", 2)) {
4427 }
else if (!strncasecmp(lang,
"pt", 2)) {
4429 }
else if (!strncasecmp(lang,
"th", 2)) {
4431 }
else if (!strncasecmp(lang,
"ps", 2)) {
4433 }
else if (!strncasecmp(lang,
"dr", 2)) {
4445 struct timeval when = { t, 0 };
4450 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4456 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4473 struct timeval when = { t, 0 };
4479 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4489 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4505 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
4508 res =
wait_file(chan, ints,
"digits/hundred", lang);
4509 if (!res && year % 100 != 0) {
4522 struct timeval when = { t, 0 };
4528 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4538 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4555 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100) );
4558 res =
wait_file(chan, ints,
"digits/hundred", lang);
4559 if (!res && year % 100 != 0) {
4572 struct timeval when = { t, 0 };
4583 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4593 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4604 struct timeval when = { t, 0 };
4610 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4620 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4633 struct timeval when = { t, 0 };
4639 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4647 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4662 struct timeval when = { t, 0 };
4668 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4682 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4698 struct timeval when = { t, 0 };
4704 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4710 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4711 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4715 res =
wait_file(chan, ints,
"digits/pt-de", lang);
4725 struct timeval when = { t, 0 };
4731 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4738 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4759 struct timeval when = { t, 0 };
4765 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
4775 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
4791 snprintf(fn,
sizeof(fn),
"digits/%d", (year / 100));
4794 res =
wait_file(chan, ints,
"digits/hundred", lang);
4795 if (!res && year % 100 != 0) {
4807 if (!strncasecmp(lang,
"en", 2)) {
4809 }
else if (!strncasecmp(lang,
"da", 2)) {
4811 }
else if (!strncasecmp(lang,
"de", 2)) {
4813 }
else if (!strncasecmp(lang,
"es", 2)) {
4815 }
else if (!strncasecmp(lang,
"he", 2)) {
4817 }
else if (!strncasecmp(lang,
"fr", 2)) {
4819 }
else if (!strncasecmp(lang,
"gr", 2)) {
4821 }
else if (!strncasecmp(lang,
"is", 2)) {
4823 }
else if (!strncasecmp(lang,
"ja", 2)) {
4825 }
else if (!strncasecmp(lang,
"it", 2)) {
4827 }
else if (!strncasecmp(lang,
"nl", 2)) {
4829 }
else if (!strncasecmp(lang,
"pl", 2)) {
4831 }
else if (!strncasecmp(lang,
"pt", 2)) {
4833 }
else if (!strncasecmp(lang,
"th", 2)) {
4835 }
else if (!strncasecmp(lang,
"zh", 2)) {
4837 }
else if (!strncasecmp(lang,
"vi", 2)) {
4848 struct timeval when = { t, 0 };
4850 int res=0, offset, sndoffset;
4851 char sndfile[256], nextmsg[256];
4854 format =
"ABdY 'digits/at' IMp";
4858 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
4859 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
4860 switch (format[offset]) {
4864 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
4865 sndfile[sndoffset] = format[offset];
4867 sndfile[sndoffset] =
'\0';
4868 res =
wait_file(chan, ints, sndfile, lang);
4873 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
4874 res =
wait_file(chan, ints, nextmsg, lang);
4880 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
4881 res =
wait_file(chan, ints, nextmsg, lang);
4900 res =
wait_file(chan, ints,
"digits/19", lang);
4904 res =
wait_file(chan, ints,
"digits/oh", lang);
4917 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
4919 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
4920 res =
wait_file(chan, ints, nextmsg, lang);
4925 if (format[offset] ==
'H') {
4928 res =
wait_file(chan, ints,
"digits/oh", lang);
4933 res =
wait_file(chan, ints,
"digits/oh", lang);
4940 res =
wait_file(chan, ints,
"digits/20", lang);
4944 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
4945 res =
wait_file(chan, ints, nextmsg, lang);
4954 if (format[offset] ==
'M') {
4955 res =
wait_file(chan, ints,
"digits/oclock", lang);
4957 res =
wait_file(chan, ints,
"digits/hundred", lang);
4959 }
else if (tm.
tm_min < 10) {
4960 res =
wait_file(chan, ints,
"digits/oh", lang);
4962 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
4963 res =
wait_file(chan, ints, nextmsg, lang);
4976 res =
wait_file(chan, ints, nextmsg, lang);
4988 gettimeofday(&now,
NULL);
4993 if (beg_today + 15768000 < t) {
4996 }
else if (beg_today + 2628000 < t) {
4999 }
else if (beg_today + 86400 * 6 < t) {
5002 }
else if (beg_today + 172800 < t) {
5005 }
else if (beg_today + 86400 < t) {
5007 res =
wait_file(chan, ints,
"digits/tomorrow", lang);
5008 }
else if (beg_today < t) {
5010 res =
wait_file(chan, ints,
"digits/today", lang);
5011 }
else if (beg_today - 86400 < t) {
5013 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5014 }
else if (beg_today - 86400 * 6 < t) {
5017 }
else if (beg_today - 2628000 < t) {
5020 }
else if (beg_today - 15768000 < t) {
5044 if (beg_today + 15768000 < t) {
5047 }
else if (beg_today + 2628000 < t) {
5050 }
else if (beg_today + 86400 * 6 < t) {
5053 }
else if (beg_today + 172800 < t) {
5056 }
else if (beg_today + 86400 < t) {
5058 res =
wait_file(chan, ints,
"digits/tomorrow", lang);
5059 }
else if (beg_today < t) {
5061 res =
wait_file(chan, ints,
"digits/today", lang);
5062 }
else if (beg_today - 86400 < t) {
5064 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5065 }
else if (beg_today - 86400 * 6 < t) {
5068 }
else if (beg_today - 2628000 < t) {
5071 }
else if (beg_today - 15768000 < t) {
5086 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
5087 res =
wait_file(chan, ints, nextmsg, lang);
5088 }
else if (tm.
tm_sec < 10) {
5089 res =
wait_file(chan, ints,
"digits/oh", lang);
5091 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
5092 res =
wait_file(chan, ints, nextmsg, lang);
5107 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5126 struct timeval when = { t, 0 };
5128 int res=0, offset, sndoffset;
5129 char sndfile[256], nextmsg[256];
5132 format =
"A dBY HMS";
5136 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5137 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5138 switch (format[offset]) {
5142 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5143 sndfile[sndoffset] = format[offset];
5145 sndfile[sndoffset] =
'\0';
5146 res =
wait_file(chan, ints, sndfile, lang);
5151 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5152 res =
wait_file(chan, ints, nextmsg, lang);
5158 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5159 res =
wait_file(chan, ints, nextmsg, lang);
5183 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
5184 res =
wait_file(chan, ints, nextmsg, lang);
5186 res =
wait_file(chan, ints,
"digits/hundred", lang);
5187 if (!res && year % 100 != 0) {
5198 res =
wait_file(chan, ints,
"digits/oclock", lang);
5202 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
5204 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5206 res =
wait_file(chan, ints, nextmsg, lang);
5212 res =
wait_file(chan, ints,
"digits/0", lang);
5224 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
5226 res =
wait_file(chan, ints,
"minute", lang);
5228 res =
wait_file(chan, ints,
"minutes", lang);
5239 res =
wait_file(chan, ints, nextmsg, lang);
5255 if (beg_today < t) {
5257 res =
wait_file(chan, ints,
"digits/today", lang);
5258 }
else if (beg_today - 86400 < t) {
5260 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5280 if (beg_today < t) {
5282 }
else if ((beg_today - 86400) < t) {
5284 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5285 }
else if (beg_today - 86400 * 6 < t) {
5302 res =
wait_file(chan, ints,
"seconds", lang);
5315 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5328 struct timeval when = { t, 0 };
5330 int res=0, offset, sndoffset;
5331 char sndfile[256], nextmsg[256];
5334 format =
"A dBY HMS";
5338 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5339 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5340 switch (format[offset]) {
5344 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5345 sndfile[sndoffset] = format[offset];
5347 sndfile[sndoffset] =
'\0';
5348 res =
wait_file(chan, ints, sndfile, lang);
5353 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5354 res =
wait_file(chan, ints, nextmsg, lang);
5360 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5361 res =
wait_file(chan, ints, nextmsg, lang);
5385 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
5386 res =
wait_file(chan, ints, nextmsg, lang);
5388 res =
wait_file(chan, ints,
"digits/hundred", lang);
5389 if (!res && year % 100 != 0) {
5405 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
5407 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5408 res =
wait_file(chan, ints, nextmsg, lang);
5410 res =
wait_file(chan, ints,
"digits/oclock", lang);
5417 res =
wait_file(chan, ints,
"digits/1N", lang);
5422 res =
wait_file(chan, ints,
"digits/oclock", lang);
5427 if (
next_item(&format[offset + 1]) ==
'S') {
5429 }
else if (tm.
tm_min > 0) {
5433 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
5435 res =
wait_file(chan, ints,
"minute", lang);
5437 res =
wait_file(chan, ints,
"minutes", lang);
5448 res =
wait_file(chan, ints, nextmsg, lang);
5464 if (beg_today < t) {
5466 res =
wait_file(chan, ints,
"digits/today", lang);
5467 }
else if (beg_today - 86400 < t) {
5469 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5489 if (beg_today < t) {
5491 }
else if ((beg_today - 86400) < t) {
5493 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5494 }
else if (beg_today - 86400 * 6 < t) {
5511 res =
wait_file(chan, ints, tm.
tm_sec == 1 ?
"second" :
"seconds", lang);
5524 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5537 struct timeval when = { t, 0 };
5539 int res=0, offset, sndoffset;
5540 char sndfile[256], nextmsg[256];
5543 format =
"A dBY HMS";
5547 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5548 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5549 switch (format[offset]) {
5553 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5554 sndfile[sndoffset] = format[offset];
5556 sndfile[sndoffset] =
'\0';
5557 res =
wait_file(chan, ints, sndfile, lang);
5562 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5563 res =
wait_file(chan, ints, nextmsg, lang);
5569 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5570 res =
wait_file(chan, ints, nextmsg, lang);
5594 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (year / 100) );
5595 res =
wait_file(chan, ints, nextmsg, lang);
5597 res =
wait_file(chan, ints,
"digits/hundred", lang);
5598 if (!res && year % 100 != 0) {
5609 res =
wait_file(chan, ints,
"digits/oclock", lang);
5613 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
5615 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5617 res =
wait_file(chan, ints, nextmsg, lang);
5623 res =
wait_file(chan, ints,
"digits/0", lang);
5634 res =
wait_file(chan, ints,
"digits/0", lang);
5636 if (
next_item(&format[offset + 1]) ==
'S')
5641 if (!res &&
next_item(&format[offset + 1]) ==
'S') {
5644 res =
wait_file(chan, ints,
"minute", lang);
5646 res =
wait_file(chan, ints,
"minutes", lang);
5657 res =
wait_file(chan, ints, nextmsg, lang);
5673 if (beg_today < t) {
5675 res =
wait_file(chan, ints,
"digits/today", lang);
5676 }
else if (beg_today - 86400 < t) {
5678 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5698 if (beg_today < t) {
5700 }
else if ((beg_today - 86400) < t) {
5702 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5703 }
else if (beg_today - 86400 * 6 < t) {
5720 if (!res && (tm.
tm_sec % 10 == 1) && (tm.
tm_sec != 11)) {
5721 res =
wait_file(chan, ints,
"second", lang);
5723 res =
wait_file(chan, ints,
"seconds", lang);
5736 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5749 struct timeval when = { t, 0 };
5751 int res=0, offset, sndoffset;
5752 char sndfile[256], nextmsg[256];
5755 format =
"a 'digits/tee' e 'digits/duan' hY I 'digits/naliga' M 'digits/natee'";
5759 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
5760 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5761 switch (format[offset]) {
5765 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5766 sndfile[sndoffset] = format[offset];
5768 sndfile[sndoffset] =
'\0';
5769 res =
wait_file(chan, ints, sndfile, lang);
5774 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5775 res =
wait_file(chan, ints, nextmsg, lang);
5781 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5782 res =
wait_file(chan, ints, nextmsg, lang);
5802 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5803 res =
wait_file(chan, ints, nextmsg, lang);
5810 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
5811 res =
wait_file(chan, ints, nextmsg, lang);
5834 if (beg_today < t) {
5836 res =
wait_file(chan, ints,
"digits/today", lang);
5837 }
else if (beg_today - 86400 < t) {
5839 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5840 }
else if (beg_today - 86400 * 6 < t) {
5843 }
else if (beg_today - 2628000 < t) {
5846 }
else if (beg_today - 15768000 < t) {
5869 if (beg_today < t) {
5871 }
else if ((beg_today - 86400) < t) {
5873 res =
wait_file(chan, ints,
"digits/yesterday", lang);
5874 }
else if (beg_today - 86400 * 6 < t) {
5877 }
else if (beg_today - 2628000 < t) {
5880 }
else if (beg_today - 15768000 < t) {
5904 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
5934#define IL_DATE_STR "AdBY"
5935#define IL_TIME_STR "HM"
5936#define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " IL_TIME_STR
5940 struct timeval when = { t, 0 };
5942 int res = 0, offset, sndoffset;
5943 char sndfile[256], nextmsg[256];
5951 for (offset = 0; format[offset] !=
'\0'; offset++) {
5952 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
5953 switch (format[offset]) {
5957 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
5958 sndfile[sndoffset] = format[offset];
5960 sndfile[sndoffset] =
'\0';
5961 res =
wait_file(chan, ints, sndfile, lang);
5966 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
5967 res =
wait_file(chan, ints, nextmsg, lang);
5973 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
5974 res =
wait_file(chan, ints, nextmsg, lang);
6017 char todo = format[offset];
6023 if (beg_today < t) {
6026 res =
wait_file(chan, ints,
"digits/today", lang);
6028 }
else if (beg_today - 86400 < t) {
6030 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6031 }
else if ((todo !=
'Q') && (beg_today - 86400 * 6 < t)) {
6044 ints, lang,
"f", -1, -1
6067 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6081 struct timeval when = { t, 0 };
6083 int res=0, offset, sndoffset;
6084 char sndfile[256], nextmsg[256];
6087 format =
"'digits/es-el' Ad 'digits/es-de' B 'digits/es-de' Y 'digits/at' IMp";
6091 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6092 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6093 switch (format[offset]) {
6097 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6098 sndfile[sndoffset] = format[offset];
6100 sndfile[sndoffset] =
'\0';
6101 snprintf(nextmsg,
sizeof(nextmsg),
"%s", sndfile);
6102 res =
wait_file(chan, ints, nextmsg, lang);
6107 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6108 res =
wait_file(chan, ints, nextmsg, lang);
6114 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6115 res =
wait_file(chan, ints, nextmsg, lang);
6119 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6120 res =
wait_file(chan, ints, nextmsg, lang);
6137 snprintf(nextmsg,
sizeof(nextmsg),
"digits/1F");
6139 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6141 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6142 res =
wait_file(chan, ints, nextmsg, lang);
6157 res =
wait_file(chan, ints,
"digits/p-m", lang);
6159 res =
wait_file(chan, ints,
"digits/afternoon", lang);
6161 res =
wait_file(chan, ints,
"digits/a-m", lang);
6177 if (beg_today < t) {
6179 res =
wait_file(chan, ints,
"digits/today", lang);
6180 }
else if (beg_today - 86400 < t) {
6182 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6202 if (beg_today < t) {
6204 res =
wait_file(chan, ints,
"digits/today", lang);
6205 }
else if ((beg_today - 86400) < t) {
6207 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6208 }
else if (beg_today - 86400 * 6 < t) {
6222 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6223 res =
wait_file(chan, ints, nextmsg, lang);
6224 }
else if (tm.
tm_sec < 10) {
6225 res =
wait_file(chan, ints,
"digits/oh", lang);
6227 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6228 res =
wait_file(chan, ints, nextmsg, lang);
6230 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
6231 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6232 res =
wait_file(chan, ints, nextmsg, lang);
6235 ten = (tm.
tm_sec / 10) * 10;
6237 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
6238 res =
wait_file(chan, ints, nextmsg, lang);
6242 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6243 res =
wait_file(chan, ints, nextmsg, lang);
6257 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6272 struct timeval when = { t, 0 };
6274 int res=0, offset, sndoffset;
6275 char sndfile[256], nextmsg[256];
6278 format =
"AdBY 'digits/at' IMp";
6282 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6283 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6284 switch (format[offset]) {
6288 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6289 sndfile[sndoffset] = format[offset];
6291 sndfile[sndoffset] =
'\0';
6292 res =
wait_file(chan, ints, sndfile, lang);
6297 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6298 res =
wait_file(chan, ints, nextmsg, lang);
6304 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6305 res =
wait_file(chan, ints, nextmsg, lang);
6309 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6310 res =
wait_file(chan, ints, nextmsg, lang);
6316 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mday);
6317 res =
wait_file(chan, ints, nextmsg, lang);
6325 res =
wait_file(chan, ints,
"digits/2", lang);
6327 res =
wait_file(chan, ints,
"digits/thousand", lang);
6339 res =
wait_file(chan, ints,
"digits/thousand", lang);
6341 wait_file(chan, ints,
"digits/9", lang);
6342 wait_file(chan, ints,
"digits/hundred", lang);
6354 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6356 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6357 res =
wait_file(chan, ints, nextmsg, lang);
6359 res =
wait_file(chan, ints,
"digits/oclock", lang);
6366 res =
wait_file(chan, ints,
"digits/oclock", lang);
6382 res =
wait_file(chan, ints, nextmsg, lang);
6398 if (beg_today < t) {
6400 res =
wait_file(chan, ints,
"digits/today", lang);
6401 }
else if (beg_today - 86400 < t) {
6403 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6423 if (beg_today < t) {
6425 }
else if ((beg_today - 86400) < t) {
6427 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6428 }
else if (beg_today - 86400 * 6 < t) {
6443 res =
wait_file(chan, ints,
"second", lang);
6455 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6468 struct timeval when = { t, 0 };
6470 int res=0, offset, sndoffset;
6471 char sndfile[256], nextmsg[256];
6474 format =
"AdB 'digits/at' IMp";
6478 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6479 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6480 switch (format[offset]) {
6484 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6485 sndfile[sndoffset] = format[offset];
6487 sndfile[sndoffset] =
'\0';
6488 res =
wait_file(chan, ints, sndfile, lang);
6493 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6494 res =
wait_file(chan, ints, nextmsg, lang);
6500 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6501 res =
wait_file(chan, ints, nextmsg, lang);
6505 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6506 res =
wait_file(chan, ints, nextmsg, lang);
6512 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mday);
6513 res =
wait_file(chan, ints, nextmsg, lang);
6523 res =
wait_file(chan, ints,
"digits/ore-2000", lang);
6527 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year - 100);
6528 res =
wait_file(chan, ints, nextmsg, lang);
6536 res =
wait_file(chan, ints,
"digits/ore-1900", lang);
6537 if ((!res) && (tm.
tm_year != 0)) {
6540 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
6541 res =
wait_file(chan, ints, nextmsg, lang);
6547 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten * 10);
6548 res =
wait_file(chan, ints, nextmsg, lang);
6551 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6552 res =
wait_file(chan, ints, nextmsg, lang);
6566 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6568 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6570 res =
wait_file(chan, ints, nextmsg, lang);
6576 res =
wait_file(chan, ints,
"digits/ore-mezzanotte", lang);
6578 res =
wait_file(chan, ints,
"digits/ore-una", lang);
6595 res =
wait_file(chan, ints, nextmsg, lang);
6611 if (beg_today < t) {
6613 res =
wait_file(chan, ints,
"digits/today", lang);
6614 }
else if (beg_today - 86400 < t) {
6616 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6633 if (beg_today < t) {
6635 }
else if ((beg_today - 86400) < t) {
6637 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6638 }
else if (beg_today - 86400 * 6 < t) {
6652 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6653 res =
wait_file(chan, ints, nextmsg, lang);
6654 }
else if (tm.
tm_sec < 10) {
6655 res =
wait_file(chan, ints,
"digits/oh", lang);
6657 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6658 res =
wait_file(chan, ints, nextmsg, lang);
6660 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
6661 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
6662 res =
wait_file(chan, ints, nextmsg, lang);
6665 ten = (tm.
tm_sec / 10) * 10;
6667 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
6668 res =
wait_file(chan, ints, nextmsg, lang);
6672 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6673 res =
wait_file(chan, ints, nextmsg, lang);
6687 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6700 struct timeval when = { t, 0 };
6702 int res=0, offset, sndoffset;
6703 char sndfile[256], nextmsg[256];
6706 format =
"AdBY 'digits/at' IMp";
6710 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
6711 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6712 switch (format[offset]) {
6716 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6717 sndfile[sndoffset] = format[offset];
6719 sndfile[sndoffset] =
'\0';
6720 res =
wait_file(chan, ints, sndfile, lang);
6725 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6726 res =
wait_file(chan, ints, nextmsg, lang);
6732 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6733 res =
wait_file(chan, ints, nextmsg, lang);
6737 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
6738 res =
wait_file(chan, ints, nextmsg, lang);
6748 res =
wait_file(chan, ints,
"digits/2", lang);
6750 res =
wait_file(chan, ints,
"digits/thousand", lang);
6762 res =
wait_file(chan, ints,
"digits/19", lang);
6766 res =
wait_file(chan, ints,
"digits/oh", lang);
6768 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
6769 res =
wait_file(chan, ints, nextmsg, lang);
6771 }
else if (tm.
tm_year <= 20) {
6773 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
6774 res =
wait_file(chan, ints, nextmsg, lang);
6780 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten * 10);
6781 res =
wait_file(chan, ints, nextmsg, lang);
6784 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
6785 res =
wait_file(chan, ints, nextmsg, lang);
6799 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
6801 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
6802 res =
wait_file(chan, ints, nextmsg, lang);
6809 res =
wait_file(chan, ints,
"digits/nl-uur", lang);
6823 res =
wait_file(chan, ints, nextmsg, lang);
6839 if (beg_today < t) {
6841 res =
wait_file(chan, ints,
"digits/today", lang);
6842 }
else if (beg_today - 86400 < t) {
6844 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6861 if (beg_today < t) {
6863 }
else if ((beg_today - 86400) < t) {
6865 res =
wait_file(chan, ints,
"digits/yesterday", lang);
6866 }
else if (beg_today - 86400 * 6 < t) {
6890 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
6903 struct timeval when = { thetime, 0 };
6905 int res=0, offset, sndoffset;
6906 char sndfile[256], nextmsg[256];
6910 for (offset = 0 ; format[offset] !=
'\0' ; offset++) {
6912 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
6913 switch (format[offset]) {
6917 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
6918 sndfile[sndoffset] = format[offset];
6920 sndfile[sndoffset] =
'\0';
6921 res =
wait_file(chan, ints, sndfile, lang);
6926 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
6927 res =
wait_file(chan, ints, nextmsg, lang);
6933 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
6934 res =
wait_file(chan, ints, nextmsg, lang);
6945 res =
wait_file(chan, ints,
"digits/h-30", lang);
6949 res =
wait_file(chan, ints,
"digits/h-20", lang);
6953 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", remaining);
6954 res =
wait_file(chan, ints, nextmsg, lang);
6960 res =
wait_file(chan, ints,
"digits/2", lang);
6962 res =
wait_file(chan, ints,
"digits/1000.2", lang);
6967 }
else if (tm.
tm_year == 100) {
6968 res =
wait_file(chan, ints,
"digits/h-2000", lang);
6975 res =
wait_file(chan, ints,
"digits/1000", lang);
6977 wait_file(chan, ints,
"digits/900", lang);
6983 wait_file(chan, ints,
"digits/year", lang);
6991 snprintf(nextmsg,
sizeof(nextmsg),
"digits/t-%d", tm.
tm_hour - 12);
6993 snprintf(nextmsg,
sizeof(nextmsg),
"digits/t-%d", tm.
tm_hour);
6995 res =
wait_file(chan, ints, nextmsg, lang);
7001 snprintf(nextmsg,
sizeof(nextmsg),
"digits/t-%d", tm.
tm_hour);
7002 res =
wait_file(chan, ints, nextmsg, lang);
7004 res =
wait_file(chan, ints,
"digits/t-24", lang);
7010 if (format[offset] ==
'M') {
7011 res =
wait_file(chan, ints,
"digits/oclock", lang);
7013 res =
wait_file(chan, ints,
"digits/100", lang);
7025 res =
wait_file(chan, ints, nextmsg, lang);
7038 if (beg_today < thetime) {
7040 res =
wait_file(chan, ints,
"digits/today", lang);
7041 }
else if (beg_today - 86400 < thetime) {
7043 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7060 if (beg_today < thetime) {
7062 }
else if ((beg_today - 86400) < thetime) {
7064 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7065 }
else if (beg_today - 86400 * 6 < thetime) {
7081 res =
wait_file(chan, ints,
"digits/1z", lang);
7083 res =
wait_file(chan, ints,
"digits/second-a", lang);
7091 if (one > 1 && one < 5 && ten != 1)
7092 res =
wait_file(chan, ints,
"seconds", lang);
7094 res =
wait_file(chan, ints,
"second", lang);
7108 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7120 struct timeval when = { t, 0 };
7122 int res=0, offset, sndoffset;
7123 char sndfile[256], nextmsg[256];
7126 format =
"Ad 'digits/pt-de' B 'digits/pt-de' Y I 'digits/pt-e' Mp";
7130 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
7131 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
7132 switch (format[offset]) {
7136 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
7137 sndfile[sndoffset] = format[offset];
7139 sndfile[sndoffset] =
'\0';
7140 snprintf(nextmsg,
sizeof(nextmsg),
"%s", sndfile);
7141 res =
wait_file(chan, ints, nextmsg, lang);
7146 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
7147 res =
wait_file(chan, ints, nextmsg, lang);
7153 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
7154 res =
wait_file(chan, ints, nextmsg, lang);
7158 if (!strcasecmp(lang,
"pt_BR")) {
7161 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d", tm.
tm_mon +1);
7162 res =
wait_file(chan, ints, nextmsg, lang);
7177 if (!strcasecmp(lang,
"pt_BR")) {
7179 if (format[offset] ==
'I')
7180 res =
wait_file(chan, ints,
"digits/pt-a", lang);
7182 res =
wait_file(chan, ints,
"digits/pt-meianoite", lang);
7183 }
else if (tm.
tm_hour == 12) {
7184 if (format[offset] ==
'I')
7185 res =
wait_file(chan, ints,
"digits/pt-ao", lang);
7187 res =
wait_file(chan, ints,
"digits/pt-meiodia", lang);
7189 if (format[offset] ==
'I') {
7191 res =
wait_file(chan, ints,
"digits/pt-as", lang);
7193 res =
wait_file(chan, ints,
"digits/pt-a", lang);
7200 if (format[offset] ==
'I')
7201 res =
wait_file(chan, ints,
"digits/pt-ah", lang);
7203 res =
wait_file(chan, ints,
"digits/pt-meianoite", lang);
7206 if (format[offset] ==
'I')
7207 res =
wait_file(chan, ints,
"digits/pt-ao", lang);
7209 res =
wait_file(chan, ints,
"digits/pt-meiodia", lang);
7212 if (format[offset] ==
'I') {
7213 res =
wait_file(chan, ints,
"digits/pt-ah", lang);
7216 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
7226 if (!strcasecmp(lang,
"pt_BR")) {
7228 if ((!res) && (format[offset] ==
'H')) {
7230 res =
wait_file(chan, ints,
"digits/hours", lang);
7232 res =
wait_file(chan, ints,
"digits/hour", lang);
7241 res =
wait_file(chan, ints,
"digits/20", lang);
7245 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
7246 res =
wait_file(chan, ints, nextmsg, lang);
7254 if (!strcasecmp(lang,
"pt_BR")) {
7258 res =
wait_file(chan, ints,
"minutes", lang);
7260 res =
wait_file(chan, ints,
"minute", lang);
7265 res =
wait_file(chan, ints,
"digits/pt-hora", lang);
7268 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
7277 if (!strcasecmp(lang,
"pt_BR")) {
7279 res =
wait_file(chan, ints,
"digits/pt-da", lang);
7282 res =
wait_file(chan, ints,
"digits/morning", lang);
7284 res =
wait_file(chan, ints,
"digits/afternoon", lang);
7285 else res =
wait_file(chan, ints,
"digits/night", lang);
7290 res =
wait_file(chan, ints,
"digits/p-m", lang);
7292 res =
wait_file(chan, ints,
"digits/a-m", lang);
7309 if (beg_today < t) {
7311 res =
wait_file(chan, ints,
"digits/today", lang);
7312 }
else if (beg_today - 86400 < t) {
7314 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7334 if (beg_today < t) {
7336 }
else if ((beg_today - 86400) < t) {
7338 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7339 }
else if (beg_today - 86400 * 6 < t) {
7352 if (!strcasecmp(lang,
"pt_BR")) {
7356 res =
wait_file(chan, ints,
"seconds", lang);
7358 res =
wait_file(chan, ints,
"second", lang);
7363 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7364 res =
wait_file(chan, ints, nextmsg, lang);
7365 }
else if (tm.
tm_sec < 10) {
7366 res =
wait_file(chan, ints,
"digits/oh", lang);
7368 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7369 res =
wait_file(chan, ints, nextmsg, lang);
7371 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
7372 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7373 res =
wait_file(chan, ints, nextmsg, lang);
7376 ten = (tm.
tm_sec / 10) * 10;
7378 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
7379 res =
wait_file(chan, ints, nextmsg, lang);
7383 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
7384 res =
wait_file(chan, ints, nextmsg, lang);
7399 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7412 struct timeval when = { t, 0 };
7414 int res=0, offset, sndoffset;
7415 char sndfile[256], nextmsg[256];
7422 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
7423 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
7424 switch (format[offset]) {
7428 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
7429 sndfile[sndoffset] = format[offset];
7431 sndfile[sndoffset] =
'\0';
7432 res =
wait_file(chan, ints, sndfile, lang);
7437 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
7438 res =
wait_file(chan, ints, nextmsg, lang);
7445 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
7446 res =
wait_file(chan, ints, nextmsg, lang);
7452 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday);
7453 res =
wait_file(chan, ints, nextmsg, lang);
7455 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday - (tm.
tm_mday % 10));
7456 res =
wait_file(chan, ints, nextmsg, lang);
7458 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday % 10);
7459 res =
wait_file(chan, ints, nextmsg, lang);
7462 if (!res) res =
wait_file(chan, ints,
"digits/day", lang);
7467 res =
wait_file(chan, ints,
"digits/2", lang);
7469 res =
wait_file(chan, ints,
"digits/thousand", lang);
7473 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (tm.
tm_year - 100) / 10);
7474 res =
wait_file(chan, ints, nextmsg, lang);
7476 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", (tm.
tm_year - 100) % 10);
7477 res =
wait_file(chan, ints, nextmsg, lang);
7482 res =
wait_file(chan, ints,
"digits/year", lang);
7489 res =
wait_file(chan, ints,
"digits/1", lang);
7491 res =
wait_file(chan, ints,
"digits/9", lang);
7496 res =
wait_file(chan, ints,
"digits/0", lang);
7498 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
7499 res =
wait_file(chan, ints, nextmsg, lang);
7503 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year / 10);
7504 res =
wait_file(chan, ints, nextmsg, lang);
7506 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year % 10);
7507 res =
wait_file(chan, ints, nextmsg, lang);
7513 res =
wait_file(chan, ints,
"digits/year", lang);
7523 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
7525 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
7526 res =
wait_file(chan, ints, nextmsg, lang);
7528 res =
wait_file(chan, ints,
"digits/oclock", lang);
7533 res =
wait_file(chan, ints,
"digits/0", lang);
7541 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
7542 res =
wait_file(chan, ints, nextmsg, lang);
7544 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - (tm.
tm_hour % 10));
7545 res =
wait_file(chan, ints, nextmsg, lang);
7547 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour % 10);
7548 res =
wait_file(chan, ints, nextmsg, lang);
7552 res =
wait_file(chan, ints,
"digits/oclock", lang);
7559 res =
wait_file(chan, ints,
"digits/0", lang);
7561 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
7562 res =
wait_file(chan, ints, nextmsg, lang);
7564 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min - (tm.
tm_min % 10));
7565 res =
wait_file(chan, ints, nextmsg, lang);
7567 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min % 10);
7568 res =
wait_file(chan, ints, nextmsg, lang);
7572 res =
wait_file(chan, ints,
"minute", lang);
7582 res =
wait_file(chan, ints, nextmsg, lang);
7598 if (beg_today < t) {
7600 res =
wait_file(chan, ints,
"digits/today", lang);
7601 }
else if (beg_today - 86400 < t) {
7603 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7623 if (beg_today < t) {
7625 }
else if ((beg_today - 86400) < t) {
7627 res =
wait_file(chan, ints,
"digits/yesterday", lang);
7628 }
else if (beg_today - 86400 * 6 < t) {
7643 res =
wait_file(chan, ints,
"digits/0", lang);
7645 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
7646 res =
wait_file(chan, ints, nextmsg, lang);
7648 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec - (tm.
tm_sec % 10));
7649 res =
wait_file(chan, ints, nextmsg, lang);
7651 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec % 10);
7652 res =
wait_file(chan, ints, nextmsg, lang);
7656 res =
wait_file(chan, ints,
"second", lang);
7668 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
7680 if (!strncasecmp(lang,
"en", 2)) {
7682 }
else if (!strncasecmp(lang,
"de", 2)) {
7684 }
else if (!strncasecmp(lang,
"fr", 2)) {
7686 }
else if (!strncasecmp(lang,
"gr", 2)) {
7688 }
else if (!strncasecmp(lang,
"ja", 2)) {
7690 }
else if (!strncasecmp(lang,
"he", 2)) {
7692 }
else if (!strncasecmp(lang,
"hu", 2)) {
7694 }
else if (!strncasecmp(lang,
"ka", 2)) {
7696 }
else if (!strncasecmp(lang,
"nl", 2)) {
7698 }
else if (!strncasecmp(lang,
"pt_BR", 5)) {
7700 }
else if (!strncasecmp(lang,
"pt", 2)) {
7702 }
else if (!strncasecmp(lang,
"th", 2)) {
7704 }
else if (!strncasecmp(lang,
"zh", 2)) {
7706 }
else if (!strncasecmp(lang,
"ps", 2)) {
7708 }
else if (!strncasecmp(lang,
"dr", 2)) {
7719 struct timeval when = { t, 0 };
7728 else if (hour == 12)
7730 else if (hour > 12) {
7768 struct timeval when = { t, 0 };
7788 struct timeval when = { t, 0 };
7811 struct timeval when = { t, 0 };
7835 struct timeval when = { t, 0 };
7855 struct timeval when = { t, 0 };
7866 res =
wait_file(chan, ints,
"digits/pt-e", lang);
7871 res =
wait_file(chan, ints,
"digits/pt-hora", lang);
7874 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
7884 struct timeval when = { t, 0 };
7893 res =
wait_file(chan, ints,
"digits/hours", lang);
7895 res =
wait_file(chan, ints,
"digits/hour", lang);
7897 if ((!res) && (tm.
tm_min)) {
7898 res =
wait_file(chan, ints,
"digits/pt-e", lang);
7903 res =
wait_file(chan, ints,
"minutes", lang);
7905 res =
wait_file(chan, ints,
"minute", lang);
7914 struct timeval when = { t, 0 };
7932 struct timeval when = { t, 0 };
7941 else if (hour == 12)
7943 else if (hour > 12) {
7974 struct timeval when = { t, 0 };
8010 if (!strncasecmp(lang,
"en", 2)) {
8012 }
else if (!strncasecmp(lang,
"de", 2)) {
8014 }
else if (!strncasecmp(lang,
"fr", 2)) {
8016 }
else if (!strncasecmp(lang,
"gr", 2)) {
8018 }
else if (!strncasecmp(lang,
"ja", 2)) {
8020 }
else if (!strncasecmp(lang,
"he", 2)) {
8022 }
else if (!strncasecmp(lang,
"hu", 2)) {
8024 }
else if (!strncasecmp(lang,
"ka", 2)) {
8026 }
else if (!strncasecmp(lang,
"nl", 2)) {
8028 }
else if (!strncasecmp(lang,
"pt_BR", 5)) {
8030 }
else if (!strncasecmp(lang,
"pt", 2)) {
8032 }
else if (!strncasecmp(lang,
"th", 2)) {
8034 }
else if (!strncasecmp(lang,
"zh", 2)) {
8045 struct timeval when = { t, 0 };
8053 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8059 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8070 else if (hour == 12)
8072 else if (hour > 12) {
8112 struct timeval when = { t, 0 };
8127 struct timeval when = { t, 0 };
8141 struct timeval when = { t, 0 };
8152 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8158 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8182 struct timeval when = { t, 0 };
8201 struct timeval when = { t, 0 };
8209 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8215 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8226 else if (hour == 12)
8228 else if (hour > 12) {
8268 struct timeval when = { t, 0 };
8282 struct timeval when = { t, 0 };
8289 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8295 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8325 struct timeval when = { t, 0 };
8335 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8343 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8352 else if (hour == 12)
8354 else if (hour > 12) {
8385 struct timeval when = { t, 0 };
8393 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8400 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8450 if (!strncasecmp(lang,
"en", 2)) {
8452 }
else if (!strncasecmp(lang,
"fr", 2)) {
8454 }
else if (!strncasecmp(lang,
"he", 2)) {
8456 }
else if (!strncasecmp(lang,
"ka", 2)) {
8458 }
else if (!strncasecmp(lang,
"pt", 2)) {
8470 struct timeval nowtv =
ast_tvnow(), when = { t, 0 };
8479 if ((daydiff < 0) || (daydiff > 6)) {
8482 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8490 }
else if (daydiff) {
8493 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8508 struct timeval nowtv =
ast_tvnow(), when = { t, 0 };
8517 if ((daydiff < 0) || (daydiff > 6)) {
8520 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8528 }
else if (daydiff) {
8531 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8549 struct timeval nowtv =
ast_tvnow(), when = { t, 0 };
8555 if ((daydiff < 0) || (daydiff > 6)) {
8560 res =
wait_file(chan, ints,
"digits/pt-de", lang);
8561 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8565 }
else if (daydiff) {
8567 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8571 if (!strcasecmp(lang,
"pt_BR")) {
8585 res =
wait_file(chan, ints,
"digits/pt-sss", lang);
8596 struct timeval nowt =
ast_tvnow(), when = { t, 0 };
8605 if ((daydiff < 0) || (daydiff > 6)) {
8608 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8616 }
else if (daydiff) {
8619 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8645 snprintf(fn,
sizeof(fn),
"digits/female-%d", num);
8647 }
else if (num < 13) {
8649 }
else if (num <100 ) {
8650 tmp = (num/10) * 10;
8652 snprintf(fn,
sizeof(fn),
"digits/%d", tmp);
8694 while (!res && num ) {
8696 snprintf(fn,
sizeof(fn),
"digits/%d", num);
8698 }
else if (num <= 100) {
8700 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
8702 }
else if (num < 200) {
8704 snprintf(fn,
sizeof(fn),
"digits/hundred-100");
8706 }
else if (num < 1000) {
8708 snprintf(fn,
sizeof(fn),
"digits/hundred-%d", (num/100)*100);
8710 }
else if (num < 2000){
8711 snprintf(fn,
sizeof(fn),
"digits/xilia");
8715 if (num < 1000000) {
8720 snprintf(fn,
sizeof(fn),
"digits/thousands");
8722 if (num < 1000000000) {
8727 snprintf(fn,
sizeof(fn),
"digits/millions");
8729 ast_debug(1,
"Number '%d' is too big for me\n", num);
8736 if ((audiofd > -1) && (ctrlfd > -1))
8757 while (!res && (num || playh)) {
8760 if ( num > INT_MIN ) {
8768 }
else if (num < 20) {
8769 snprintf(fn,
sizeof(fn),
"digits/%d", num);
8771 }
else if (num < 100) {
8772 snprintf(fn,
sizeof(fn),
"digits/%d", (num /10) * 10);
8776 snprintf(fn,
sizeof(fn),
"digits/%d", (num/100));
8780 if (num < 1000000) {
8785 snprintf(fn,
sizeof(fn),
"digits/thousand");
8787 if (num < 1000000000) {
8794 ast_debug(1,
"Number '%d' is too big for me\n", num);
8802 if ((audiofd > -1) && (ctrlfd > -1))
8826 struct timeval when = { t, 0 };
8835 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8846 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8862 struct timeval tv = { t, 0 };
8875 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
8885 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
8906 struct timeval when = { t, 0 };
8916 else if (hour == 12)
8918 else if (hour > 12) {
8953 struct timeval tv = { t, 0 };
8963 else if (hour == 12)
8965 else if (hour > 12) {
8977 if (hour == 9 || hour == 21) {
9000 struct timeval when = { t, 0 };
9009 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
9020 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
9033 struct timeval tv = { t, 0 };
9046 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
9056 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
9065 else if (hour == 12)
9067 else if (hour > 12) {
9078 if (hour == 9 || hour == 21) {
9100 struct timeval when = { t, 0 };
9102 int res=0, offset, sndoffset;
9103 char sndfile[256], nextmsg[256];
9106 format =
"AdBY 'digits/at' IMp";
9110 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
9111 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9112 switch (format[offset]) {
9116 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
9117 sndfile[sndoffset] = format[offset];
9119 sndfile[sndoffset] =
'\0';
9120 res =
wait_file(chan, ints, sndfile, lang);
9125 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
9126 res =
wait_file(chan, ints, nextmsg, lang);
9132 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
9133 res =
wait_file(chan, ints, nextmsg, lang);
9183 res =
wait_file(chan, ints, nextmsg, lang);
9199 if (beg_today < t) {
9201 res =
wait_file(chan, ints,
"digits/today", lang);
9202 }
else if (beg_today - 86400 < t) {
9204 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9224 if (beg_today < t) {
9226 }
else if ((beg_today - 86400) < t) {
9228 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9229 }
else if (beg_today - 86400 * 6 < t) {
9243 res =
wait_file(chan, ints, nextmsg, lang);
9248 res =
wait_file(chan, ints, nextmsg, lang);
9259 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9272 struct timeval tv = { time, 0 };
9274 int res = 0, offset, sndoffset;
9275 char sndfile[256], nextmsg[256];
9278 format =
"YbdAPIMS";
9282 for (offset = 0; format[offset] !=
'\0'; offset++) {
9283 ast_log(
LOG_DEBUG,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9284 switch (format[offset]) {
9288 for (sndoffset = 0; (format[++offset] !=
'\'') && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
9289 sndfile[sndoffset] = format[offset];
9291 sndfile[sndoffset] =
'\0';
9292 res =
wait_file(chan,ints,sndfile,lang);
9297 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
9298 res =
wait_file(chan,ints,nextmsg,lang);
9304 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
9305 res =
wait_file(chan,ints,nextmsg,lang);
9311 snprintf(nextmsg,
sizeof(nextmsg),
"digits/h-%d_2", tm.
tm_mday);
9312 res =
wait_file(chan,ints,nextmsg,lang);
9315 res =
wait_file(chan,ints,
"digits/20",lang);
9317 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_mday - 20);
9318 res =
wait_file(chan,ints,nextmsg,lang);
9320 res =
wait_file(chan,ints,
"digits/nichi",lang);
9321 }
else if (tm.
tm_mday == 30) {
9323 res =
wait_file(chan,ints,
"digits/h-30_2",lang);
9326 res =
wait_file(chan,ints,
"digits/30",lang);
9327 res =
wait_file(chan,ints,
"digits/1",lang);
9328 res =
wait_file(chan,ints,
"digits/nichi",lang);
9334 res =
wait_file(chan,ints,
"digits/2",lang);
9336 res =
wait_file(chan,ints,
"digits/thousand",lang);
9341 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year - 100);
9342 res =
wait_file(chan,ints,nextmsg,lang);
9350 res =
wait_file(chan,ints,
"digits/19",lang);
9354 res =
wait_file(chan,ints,
"digits/oh",lang);
9356 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
9357 res =
wait_file(chan,ints,nextmsg,lang);
9359 }
else if (tm.
tm_year <= 20) {
9361 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_year);
9362 res =
wait_file(chan,ints,nextmsg,lang);
9368 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten * 10);
9369 res =
wait_file(chan,ints,nextmsg,lang);
9372 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
9373 res =
wait_file(chan,ints,nextmsg,lang);
9380 res =
wait_file(chan,ints,
"digits/nen",lang);
9386 snprintf(nextmsg,
sizeof(nextmsg),
"digits/p-m");
9388 snprintf(nextmsg,
sizeof(nextmsg),
"digits/a-m");
9389 res =
wait_file(chan,ints,nextmsg,lang);
9395 snprintf(nextmsg,
sizeof(nextmsg),
"digits/12");
9397 snprintf(nextmsg,
sizeof(nextmsg),
"digits/9_2");
9399 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
9401 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
9402 res =
wait_file(chan,ints,nextmsg,lang);
9403 if(!res) res =
wait_file(chan,ints,
"digits/ji",lang);
9411 res =
wait_file(chan,ints,
"digits/20",lang);
9415 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remainder);
9416 res =
wait_file(chan,ints,nextmsg,lang);
9420 res =
wait_file(chan,ints,
"digits/ji",lang);
9425 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_min);
9426 res =
wait_file(chan,ints,nextmsg,lang);
9429 ten = (tm.
tm_min / 10) * 10;
9431 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
9432 res =
wait_file(chan,ints,nextmsg,lang);
9436 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
9437 res =
wait_file(chan,ints,nextmsg,lang);
9441 res =
wait_file(chan,ints,
"digits/fun",lang);
9450 gettimeofday(&now,
NULL);
9455 if (beg_today < time) {
9457 res =
wait_file(chan,ints,
"digits/today",lang);
9458 }
else if (beg_today - 86400 < time) {
9460 res =
wait_file(chan,ints,
"digits/yesterday",lang);
9473 gettimeofday(&now,
NULL);
9478 if (beg_today < time) {
9480 }
else if ((beg_today - 86400) < time) {
9482 res =
wait_file(chan,ints,
"digits/yesterday",lang);
9483 }
else if (beg_today - 86400 * 6 < time) {
9497 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
9498 res =
wait_file(chan,ints,nextmsg,lang);
9499 }
else if ((tm.
tm_sec < 21) || (tm.
tm_sec % 10 == 0)) {
9500 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_sec);
9501 res =
wait_file(chan,ints,nextmsg,lang);
9504 ten = (tm.
tm_sec / 10) * 10;
9506 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", ten);
9507 res =
wait_file(chan,ints,nextmsg,lang);
9511 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", one);
9512 res =
wait_file(chan,ints,nextmsg,lang);
9516 res =
wait_file(chan,ints,
"digits/byou",lang);
9527 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9540 struct timeval when = { t, 0 };
9542 int res = 0, offset, sndoffset;
9543 char sndfile[256], nextmsg[256];
9546 format =
"A 'digits/day' eB 'digits/year' Y 'digits/at' k 'hours' M 'minutes' p";
9550 for (offset=0 ; format[offset] !=
'\0' ; offset++) {
9551 ast_debug(1,
"Parsing %c (offset %d) in %s\n", format[offset], offset, format);
9552 switch (format[offset]) {
9556 for (sndoffset = 0; !strchr(
"\'\0", format[++offset]) && (sndoffset <
sizeof(sndfile) - 1) ; sndoffset++) {
9557 sndfile[sndoffset] = format[offset];
9559 sndfile[sndoffset] =
'\0';
9560 res =
wait_file(chan, ints, sndfile, lang);
9565 snprintf(nextmsg,
sizeof(nextmsg),
"digits/day-%d", tm.
tm_wday);
9566 res =
wait_file(chan, ints, nextmsg, lang);
9572 snprintf(nextmsg,
sizeof(nextmsg),
"digits/mon-%d", tm.
tm_mon);
9573 res =
wait_file(chan, ints, nextmsg, lang);
9592 res =
wait_file(chan, ints,
"digits/19", lang);
9596 res =
wait_file(chan, ints,
"digits/odd", lang);
9609 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour - 12);
9611 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", tm.
tm_hour);
9612 res =
wait_file(chan, ints, nextmsg, lang);
9617 if (format[offset] ==
'H') {
9620 res =
wait_file(chan, ints,
"digits/0", lang);
9625 res =
wait_file(chan, ints,
"digits/0", lang);
9632 res =
wait_file(chan, ints,
"digits/20", lang);
9636 snprintf(nextmsg,
sizeof(nextmsg),
"digits/%d", remaining);
9637 res =
wait_file(chan, ints, nextmsg, lang);
9654 res =
wait_file(chan, ints, nextmsg, lang);
9666 gettimeofday(&now,
NULL);
9671 if (beg_today < t) {
9673 res =
wait_file(chan, ints,
"digits/today", lang);
9674 }
else if (beg_today - 86400 < t) {
9676 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9677 }
else if (beg_today - 86400 * 6 < t) {
9680 }
else if (beg_today - 2628000 < t) {
9683 }
else if (beg_today - 15768000 < t) {
9707 if (beg_today < t) {
9709 }
else if ((beg_today - 86400) < t) {
9711 res =
wait_file(chan, ints,
"digits/yesterday", lang);
9712 }
else if (beg_today - 86400 * 6 < t) {
9715 }
else if (beg_today - 2628000 < t) {
9718 }
else if (beg_today - 15768000 < t) {
9743 ast_log(
LOG_WARNING,
"Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);
9782 strncat(res,
"minus ", res_len - strlen(res) - 1);
9783 if ( num > INT_MIN ) {
9792 if (num <= 20 || num == 40 || num == 60 || num == 80 || num == 100) {
9793 snprintf(
buf,
sizeof(
buf),
"%d", num);
9794 strncat(res,
buf, res_len - strlen(res) - 1);
9800 strncat(res,
"20_ ", res_len - strlen(res) - 1);
9805 strncat(res,
"40_ ", res_len - strlen(res) - 1);
9810 strncat(res,
"60_ ", res_len - strlen(res) - 1);
9815 strncat(res,
"80_ ", res_len - strlen(res) - 1);
9821 remaining = num % 100;
9822 digit = (num - remaining) / 100;
9824 if (remaining == 0) {
9825 snprintf(
buf,
sizeof(
buf),
"%d", num);
9826 strncat(res,
buf, res_len - strlen(res) - 1);
9830 strncat(res,
buf, res_len - strlen(res) - 1);
9837 strncat(res,
"1000", res_len - strlen(res) - 1);
9842 if (num < 1000000) {
9843 remaining = num % 1000;
9844 digit = (num - remaining) / 1000;
9846 if (remaining == 0) {
9848 strncat(res,
" 1000", res_len - strlen(res) - 1);
9853 strncat(res,
"1000_ ", res_len - strlen(res) - 1);
9858 strncat(res,
" 1000_ ", res_len - strlen(res) - 1);
9863 if (num == 1000000) {
9864 strncat(res,
"1 1000000", res_len - strlen(res) - 1);
9869 if (num < 1000000000) {
9870 remaining = num % 1000000;
9871 digit = (num - remaining) / 1000000;
9873 if (remaining == 0) {
9875 strncat(res,
" 1000000", res_len - strlen(res) - 1);
9880 strncat(res,
" 1000000_ ", res_len - strlen(res) - 1);
9885 if (num == 1000000000) {
9886 strncat(res,
"1 1000000000", res_len - strlen(res) - 1);
9891 if (num > 1000000000) {
9892 remaining = num % 1000000000;
9893 digit = (num - remaining) / 1000000000;
9895 if (remaining == 0) {
9897 strncat(res,
" 1000000000", res_len - strlen(res) - 1);
9902 strncat(res,
" 1000000000_ ", res_len - strlen(res) - 1);
9918 const char* remaining = fn;
9929 while (res == 0 && (s = strstr(remaining,
" "))) {
9930 size_t len = s - remaining;
9933 sprintf(new_string,
"digits/");
9934 strncat(new_string, remaining,
len);
9938 if ((audiofd > -1) && (ctrlfd > -1)) {
9949 while (*remaining ==
' ') {
9956 if (res == 0 && *remaining) {
9958 char* new_string =
ast_malloc(strlen(remaining) + 1 + strlen(
"digits/"));
9959 sprintf(new_string,
"digits/%s", remaining);
9962 if ((audiofd > -1) && (ctrlfd > -1)) {
9993 struct timeval when = { t, 0 };
10004 snprintf(fn,
sizeof(fn),
"digits/tslis %d", tm.
tm_wday);
10019 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
10036 struct timeval when = { t, 0 };
10070 struct timeval when = { t, 0 };
10093 struct timeval when = { t, 0 }, nowt =
ast_tvnow();
10099 if ((daydiff < 0) || (daydiff > 6)) {
10105 snprintf(fn,
sizeof(fn),
"digits/mon-%d", tm.
tm_mon);
10112 }
else if (daydiff) {
10115 snprintf(fn,
sizeof(fn),
"digits/day-%d", tm.
tm_wday);
10142 if (num == 1 || num == -1) {
10171 if (num > 0 && num < 5) {
10182 const char *ending;
10192 temp =
ast_alloca((temp_len = (strlen(noun) + strlen(ending) + 1)));
10193 snprintf(temp, temp_len,
"%s%s", noun, ending);
10214 return gender ? gender :
"";
10224 const char *ending;
10234 temp =
ast_alloca((temp_len = (strlen(adjective) + strlen(ending) + 1)));
10235 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 const char * find_first_and(const char *lang)
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().