diff -Naur asterisk.old/apps/app_sayunixtime.c asterisk.new/apps/app_sayunixtime.c --- asterisk.old/apps/app_sayunixtime.c 2005-07-16 08:00:46.000000000 +0900 +++ asterisk.new/apps/app_sayunixtime.c 2005-08-28 02:50:22.000000000 +0900 @@ -76,6 +76,8 @@ format = "A dBY HMS"; } else if ( !strcasecmp(chan->language, "de" ) ) { format = "A dBY HMS"; + } else if ( !strcasecmp(chan->language, "jp" ) ) { + format = "YBdA HMS"; } else { format = "ABdY 'digits/at' IMp"; } diff -Naur asterisk.old/res/res_agi.c asterisk.new/res/res_agi.c --- asterisk.old/res/res_agi.c 2005-08-23 10:30:22.000000000 +0900 +++ asterisk.new/res/res_agi.c 2005-08-28 02:54:56.000000000 +0900 @@ -737,6 +737,8 @@ } else { if (!strcasecmp(chan->language, "de")) { format = "A dBY HMS"; + } else if (!strcasecmp(chan->language, "jp")) { + format = "YBdA HMS"; } else { format = "ABdY 'digits/at' IMp"; } diff -Naur asterisk.old/say.c asterisk.new/say.c --- asterisk.old/say.c 2005-08-27 05:29:11.000000000 +0900 +++ asterisk.new/say.c 2005-08-28 03:59:31.000000000 +0900 @@ -334,11 +334,13 @@ static int ast_say_number_full_tw(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd); static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char *ints, const char *language, 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); +static int ast_say_number_full_jp(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd); /* Forward declarations of language specific variants of ast_say_enumeration_full */ static int ast_say_enumeration_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, 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); 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); +static int ast_say_enumeration_full_jp(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd); /* Forward declarations of ast_say_date, ast_say_datetime and ast_say_time functions */ static int ast_say_date_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang); @@ -348,6 +350,7 @@ static int ast_say_date_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_date_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_date_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang); +static int ast_say_date_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_date_with_format_en(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone); static int ast_say_date_with_format_da(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone); @@ -360,6 +363,7 @@ static int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone); static int ast_say_date_with_format_tw(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone); static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone); +static int ast_say_date_with_format_jp(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone); static int ast_say_time_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_time_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang); @@ -368,6 +372,7 @@ static int ast_say_time_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_time_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_time_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang); +static int ast_say_time_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_datetime_en(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); @@ -376,10 +381,12 @@ static int ast_say_datetime_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_datetime_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_datetime_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang); +static int ast_say_datetime_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_datetime_from_now_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_datetime_from_now_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int ast_say_datetime_from_now_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang); +static int ast_say_datetime_from_now_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang); static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang) { @@ -429,6 +436,8 @@ return(ast_say_number_full_gr(chan, num, ints, language, audiofd, ctrlfd)); } else if (!strcasecmp(language, "ru") ) { /* Russian syntax */ return(ast_say_number_full_ru(chan, num, ints, language, options, audiofd, ctrlfd)); + } else if (!strcasecmp(language, "jp") ) { /* Japanese syntax */ + return(ast_say_number_full_jp(chan, num, ints, language, options, audiofd, ctrlfd)); } /* Default to english */ @@ -2261,6 +2270,8 @@ return(ast_say_enumeration_full_da(chan, num, ints, language, options, audiofd, ctrlfd)); } else if (!strcasecmp(language, "de") ) { /* German syntax */ return(ast_say_enumeration_full_de(chan, num, ints, language, options, audiofd, ctrlfd)); + } else if (!strcasecmp(language, "jp") ) { /* Japanese syntax */ + return(ast_say_enumeration_full_jp(chan, num, ints, language, options, audiofd, ctrlfd)); } /* Default to english */ @@ -2714,6 +2725,8 @@ return(ast_say_date_pt(chan, t, ints, lang)); } else if (!strcasecmp(lang, "gr") ) { /* Greek syntax */ return(ast_say_date_gr(chan, t, ints, lang)); + } else if (!strcasecmp(lang, "jp") ) { /* Japanese syntax */ + return(ast_say_date_jp(chan, t, ints, lang)); } /* Default to English */ @@ -2951,6 +2964,8 @@ return(ast_say_date_with_format_tw(chan, time, ints, lang, format, timezone)); } else if (!strcasecmp(lang, "gr") ) { /* Greek syntax */ return(ast_say_date_with_format_gr(chan, time, ints, lang, format, timezone)); + } else if (!strcasecmp(lang, "jp") ) { /* Japanese syntax */ + return(ast_say_date_with_format_jp(chan, time, ints, lang, format, timezone)); } /* Default to English */ @@ -5116,6 +5131,8 @@ return(ast_say_time_tw(chan, t, ints, lang)); } else if (!strcasecmp(lang, "gr") ) { /* Greek syntax */ return(ast_say_time_gr(chan, t, ints, lang)); + } else if (!strcasecmp(lang, "jp") ) { /* Japanese syntax */ + return(ast_say_time_jp(chan, t, ints, lang)); } /* Default to English */ @@ -5305,6 +5322,8 @@ return(ast_say_datetime_tw(chan, t, ints, lang)); } else if (!strcasecmp(lang, "gr") ) { /* Greek syntax */ return(ast_say_datetime_gr(chan, t, ints, lang)); + } else if (!strcasecmp(lang, "jp") ) { /* Japanese syntax */ + return(ast_say_datetime_jp(chan, t, ints, lang)); } /* Default to English */ @@ -5576,6 +5595,8 @@ return(ast_say_datetime_from_now_fr(chan, t, ints, lang)); } else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */ return(ast_say_datetime_from_now_pt(chan, t, ints, lang)); + } else if (!strcasecmp(lang, "jp") ) { /* Japanese syntax */ + return(ast_say_datetime_from_now_jp(chan, t, ints, lang)); } /* Default to English */ @@ -6122,3 +6143,538 @@ } return res; } + +/* Japanese Syntax Support */ + +/*ast_say_number_full_jp: Japanese syntax + extra sounds needed: + 100 + 1000 + 10000 + 100000000 +*/ +static int ast_say_number_full_jp(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd) +{ + int playh = 0 ; + int res = 0 ; + char fn[256] = ""; + + if (!num) + { + return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd); + } + + while( !res && (num || playh) ) + { + if (playh > 0) + { + switch( playh ) + { + case 100: + snprintf(fn, sizeof(fn), "digits/100"); + break ; + case 1000: + snprintf(fn, sizeof(fn), "digits/1000"); + break ; + case 10000: + snprintf(fn, sizeof(fn), "digits/10000"); + break ; + case 100000000: + snprintf(fn, sizeof(fn), "digits/100000000"); + break ; + } + playh = 0; + } else if (num < 10) { + snprintf(fn, sizeof(fn), "digits/%d", num); + num = 0; + } else if (num < 100) { + snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10); + num -= ((num / 10) * 10); + } else if (num < 1000) { + if ( num / 100 != 1 ) + { + snprintf(fn, sizeof(fn), "digits/%d", (num/100)); + playh = 100 ; + num -= ((num / 100) * 100); + } else { + snprintf(fn, sizeof(fn), "digits/100"); + num -= 100 ; + } + } else if (num < 10000) { + if ( num / 1000 != 1 ) + { + snprintf(fn, sizeof(fn), "digits/%d", (num/1000)) ; + playh = 1000 ; + num -= ((num / 1000) * 1000); + } else { + snprintf(fn, sizeof(fn), "digits/1000") ; + num -= 1000 ; + } + } else if (num < 100000000) { + res = ast_say_number_full_jp(chan, num / 10000, ints, language, options, audiofd, ctrlfd); + if (res) + return res; + playh = 10000 ; + num -= ((num / 10000) * 10000); + } else { + ast_log(LOG_WARNING, "Number '%d' is too big for me\n", num); + res = -1; + } + if (!res) + { + if(!ast_streamfile(chan, fn, language)) + { + if ((audiofd > -1) && (ctrlfd > -1)) + res = ast_waitstream_full(chan, ints, audiofd, ctrlfd); + else + res = ast_waitstream(chan, ints); + } + ast_stopstream(chan); + } + } + return res; +} + +/* ast_say_enumeration_full_jp: Japanese syntax + extra sounds needed: + jp-banme +*/ +static int ast_say_enumeration_full_jp(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd) +{ + int res = 0; + char fn[256] ; + + if (!num) + return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd); + + while(!res && num) { + if (num < 0) { + snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */ + res = ast_streamfile(chan, fn, language); + if (!res) + res = ast_waitstream(chan, ints); + + if ( num > INT_MIN ) { + num = -num; + } else { + num = 0; + } + } else { + res = ast_say_number_full_jp(chan, num, ints, language, options, audiofd, ctrlfd); + if (!res) { + res = ast_waitstream(chan, ints); + if (!res) { + res = ast_streamfile(chan, "digits/jp-banme", language); + if (!res) + res = ast_waitstream(chan, ints); + } + } + num = 0; + } + } + return res; +} + +/* ast_say_date_jp: Japanese syntax + extra sounds needed: + jp-nen + jp-day-1 jp-day-2 jp-day-3 jp-day-4 jp-day-5 + jp-day-6 jp-day-7 jp-day-8 jp-day-9 jp-day-10 + jp-day-11 jp-day-12 jp-day-13 jp-day-14 jp-day-15 + jp-day-16 jp-day-17 jp-day-18 jp-day-19 jp-day-20 + jp-day-21 jp-day-22 jp-day-23 jp-day-24 jp-day-25 + jp-day-26 jp-day-27 jp-day-28 jp-day-29 jp-day-30 + jp-day-31 + +*/ +int ast_say_date_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang) +{ + struct tm tm; + char fn[256]; + int res = 0; + ast_localtime(&t,&tm,NULL); + + /* Year */ + if (!res) + { + res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL); + if (!res) + res = ast_waitstream(chan, ints); + snprintf(fn, sizeof(fn), "digits/jp-nen" ) ; + res = ast_streamfile(chan, fn, lang); + if (!res) + res = ast_waitstream(chan, ints); + } + + /* Month */ + if (!res) { + snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon); + res = ast_streamfile(chan, fn, lang); + if (!res) + res = ast_waitstream(chan, ints); + } + + /* Day */ + if (!res) { + snprintf(fn, sizeof(fn), "digits/jp-day-%d", tm.tm_mday); + res = ast_streamfile(chan, fn, lang); + if (!res) + res = ast_waitstream(chan, ints); + } + + /* Week */ + if (!res) { + snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday); + res = ast_streamfile(chan, fn, lang); + if (!res) + res = ast_waitstream(chan, ints); + } + + return res; +} + +/* ast_say_date_with_format_jp:Japanese syntax + extra sounds needed; + jp-zero (rei) + jp-hour (ji) + jp-min (hun) + jp-sec (byou) + jp-year (nen) + jp-day-1 jp-day-2 jp-day-3 jp-day-4 jp-day-5 + jp-day-6 jp-day-7 jp-day-8 jp-day-9 jp-day-10 + jp-day-11 jp-day-12 jp-day-13 jp-day-14 jp-day-15 + jp-day-16 jp-day-17 jp-day-18 jp-day-19 jp-day-20 + jp-day-21 jp-day-22 jp-day-23 jp-day-24 jp-day-25 + jp-day-26 jp-day-27 jp-day-28 jp-day-29 jp-day-30 + jp-day-31 +*/ +int ast_say_date_with_format_jp(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone) +{ + struct tm tm; + int res=0, offset, sndoffset; + char sndfile[256], nextmsg[256]; + + ast_localtime(&time,&tm,timezone); + + for (offset=0 ; format[offset] != '\0' ; offset++) { + ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format); + switch (format[offset]) { + /* NOTE: if you add more options here, please try to be consistent with strftime(3) */ + case '\'': + /* Literal name of a sound file */ + sndoffset=0; + for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++) + sndfile[sndoffset] = format[offset]; + sndfile[sndoffset] = '\0'; + res = wait_file(chan,ints,sndfile,lang); + break; + case 'A': + case 'a': + /* Sunday - Saturday */ + snprintf(nextmsg,sizeof(nextmsg), "digits/day-%d", tm.tm_wday); + res = wait_file(chan,ints,nextmsg,lang); + break; + case 'B': + case 'b': + case 'h': + /* January - December */ + snprintf(nextmsg,sizeof(nextmsg), "digits/mon-%d", tm.tm_mon); + res = wait_file(chan,ints,nextmsg,lang); + break; + case 'm': + /* Month enumerated */ + res = ast_say_enumeration(chan, (tm.tm_mon + 1), ints, lang, (char *) NULL); + break; + case 'd': + case 'e': + /* First - Thirtyfirst */ + snprintf(nextmsg, sizeof(nextmsg), "digits/jp-day-%d", tm.tm_mday); + res = ast_streamfile(chan, nextmsg, lang); + if (!res) + res = ast_waitstream(chan, ints); + break; + case 'Y': + /* Year */ + res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL); + if (!res) { + res = ast_waitstream(chan, ints); + if (!res) { + res = ast_streamfile(chan, "digits/jp-nen", lang); + if (!res) + res = ast_waitstream(chan, ints); + } + } + break; + case 'I': + case 'l': + /* 12-Hour */ + if (tm.tm_hour == 0) { + snprintf(nextmsg,sizeof(nextmsg), "digits/jp-zero"); + res = wait_file(chan,ints,nextmsg,lang); + } else { + res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL); + if (!res) + res = ast_waitstream(chan, ints); + } + if (!res) { + res = ast_streamfile(chan, "digits/jp-hour", lang); + if (!res) + res = ast_waitstream(chan, ints); + } + break; + case 'H': + case 'k': + /* 24-Hour */ + if (tm.tm_hour == 0) { + snprintf(nextmsg,sizeof(nextmsg), "digits/jp-zero"); + res = wait_file(chan,ints,nextmsg,lang); + } else { + res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL); + if (!res) + res = ast_waitstream(chan, ints); + } + if ( !res ) { + res = ast_streamfile(chan, "digits/jp-hour", lang); + if (!res) + res = ast_waitstream(chan, ints); + } + break; + case 'M': + case 'N': + /* Minute */ + if ( !tm.tm_min ) + { + res = ast_streamfile(chan, "digits/jp-zero", lang ) ; + } else { + res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL); + } + if (!res) { + res = ast_waitstream(chan, ints); + if (!res) { + res = ast_streamfile(chan, "digits/jp-min", lang); + if (!res) + res = ast_waitstream(chan, ints); + } + } + break; + case 'P': + case 'p': + /* AM/PM */ + if (tm.tm_hour > 11) + snprintf(nextmsg,sizeof(nextmsg), "digits/p-m"); + else + snprintf(nextmsg,sizeof(nextmsg), "digits/a-m"); + res = wait_file(chan,ints,nextmsg,lang); + break; + case 'Q': + /* Shorthand for "Today", "Yesterday", or YBdA HMS */ + { + struct timeval now; + struct tm tmnow; + time_t beg_today; + + gettimeofday(&now,NULL); + ast_localtime(&now.tv_sec,&tmnow,timezone); + /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */ + /* In any case, it saves not having to do ast_mktime() */ + beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec); + if (beg_today < time) { + /* Today */ + res = wait_file(chan,ints, "digits/today",lang); + } else if (beg_today - 86400 < time) { + /* Yesterday */ + res = wait_file(chan,ints, "digits/yesterday",lang); + } else { + res = ast_say_date_with_format(chan, time, ints, lang, "YBdA HMS", timezone); + } + } + break; + case 'q': + /* Shorthand for "" (today), "Yesterday", A (weekday), or YBdA HMS */ + { + struct timeval now; + struct tm tmnow; + time_t beg_today; + + gettimeofday(&now,NULL); + ast_localtime(&now.tv_sec,&tmnow,timezone); + /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */ + /* In any case, it saves not having to do ast_mktime() */ + beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec); + if (beg_today < time) { + /* Today */ + res = wait_file(chan,ints, "digits/today",lang); + } else if ((beg_today - 86400) < time) { + /* Yesterday */ + res = wait_file(chan,ints, "digits/yesterday",lang); + } else if (beg_today - 86400 * 6 < time) { + /* Within the last week */ + res = ast_say_date_with_format(chan, time, ints, lang, "A", timezone); + } else { + res = ast_say_date_with_format(chan, time, ints, lang, "YBdA HMS", timezone); + } + } + break; + case 'R': + res = ast_say_date_with_format(chan, time, ints, lang, "HM", timezone); + break; + case 'S': + /* Seconds */ + if ( !tm.tm_sec ) + { + res = ast_streamfile(chan, "digits/jp-zero", lang ) ; + } else { + res = ast_say_number(chan, tm.tm_sec, ints, lang, (char *) NULL); + } + if (!res) { + res = ast_waitstream(chan, ints); + if (!res) { + res = ast_streamfile(chan, "digits/jp-sec", lang); + if (!res) + res = ast_waitstream(chan, ints); + } + } + break; + case 'T': + res = ast_say_date_with_format(chan, time, ints, lang, "HMS", timezone); + break; + case ' ': + case ' ': + /* Just ignore spaces and tabs */ + break; + default: + /* Unknown character */ + ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset); + } + /* Jump out on DTMF */ + if (res) { + break; + } + } + return res; +} + +/* ast_say_time_jp:Japanese Syntax + extra sounds needed: + jp-hour (ji) + jp-min (hun) +*/ +int ast_say_time_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang) +{ + struct tm tm; + int res = 0; + int hour, pm=0; + + localtime_r(&t,&tm); + hour = tm.tm_hour; + if (!hour) + hour = 12; + else if (hour == 12) + pm = 1; + else if (hour > 12) { + hour -= 12; + pm = 1; + } + + res = ast_say_number(chan, hour, ints, lang, (char *) NULL); + if (!res) { + res = ast_waitstream(chan, ints); + if (!res) { + res = ast_streamfile(chan, "digits/jp-hour", lang); + if (!res) + res = ast_waitstream(chan, ints); + } + } + + if (!res) { + if ( !tm.tm_min ) + { + res = ast_streamfile(chan, "digits/jp-zero", lang); + } else { + res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL); + } + if (!res) { + res = ast_waitstream(chan, ints); + if (!res) { + res = ast_streamfile(chan, "digits/jp-min", lang); + if (!res) + res = ast_waitstream(chan, ints); + } + } + } + + if (pm) { + if (!res) + res = ast_streamfile(chan, "digits/p-m", lang); + } else { + if (!res) + res = ast_streamfile(chan, "digits/a-m", lang); + } + if (!res) + res = ast_waitstream(chan, ints); + return res; +} + +/* ast_say_datetime_jp:Japanese syntax + extra sounds needed + none +*/ +int ast_say_datetime_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang) +{ + struct tm tm; + int res = 0; + + localtime_r(&t,&tm); + res = ast_say_date(chan, t, ints, lang); + if (!res) + ast_say_time(chan, t, ints, lang); + return res; +} + +/* ast_say_datetime_from_now_jp:Japanese syntax + extra sounds needed + none +*/ +int ast_say_datetime_from_now_jp(struct ast_channel *chan, time_t t, const char *ints, const char *lang) +{ + int res=0; + time_t nowt; + int daydiff; + struct tm tm; + struct tm now; + char fn[256]; + + time(&nowt); + + localtime_r(&t,&tm); + localtime_r(&nowt,&now); + daydiff = now.tm_yday - tm.tm_yday; + + if ((daydiff < 0) || (daydiff > 6)) { + /* Day of month and month */ + if (!res) { + snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon); + res = ast_streamfile(chan, fn, lang); + if (!res) + res = ast_waitstream(chan, ints); + } + if (!res) { + snprintf(fn, sizeof(fn), "digits/jp-day-%d", tm.tm_mday); + res = ast_streamfile(chan, fn, lang); + if (!res) + res = ast_waitstream(chan, ints); + } + + } else if (daydiff) { + /* Just what day of the week */ + if (!res) { + snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday); + res = ast_streamfile(chan, fn, lang); + if (!res) + res = ast_waitstream(chan, ints); + } + } /* Otherwise, it was today */ + if (!res) + res = ast_say_time(chan, t, ints, lang); + return res; +}