say years like 1985 as nineteen-85

This commit is contained in:
Anthony Minessale 2011-11-15 09:51:46 -06:00
parent adfbee993e
commit c0af0a85d6
3 changed files with 22 additions and 2 deletions

View File

@ -350,7 +350,8 @@ typedef enum {
SSM_NA,
SSM_PRONOUNCED,
SSM_ITERATED,
SSM_COUNTED
SSM_COUNTED,
SSM_PRONOUNCED_YEAR
} switch_say_method_t;
/* WARNING, Do not forget to update *SAY_TYPE_NAMES[] in src/switch_ivr_say.c */

View File

@ -140,8 +140,26 @@ static switch_status_t en_say_general_count(switch_say_file_handle_t *sh, char *
in -= places[(uint32_t) x] * num;
}
}
switch (say_args->method) {
case SSM_PRONOUNCED_YEAR:
{
int num = atoi(tosay);
int a = num / 100;
int b = num % 100;
if (!b || !(a % 10)) {
say_num(sh, num, SSM_PRONOUNCED);
return SWITCH_STATUS_SUCCESS;
}
say_num(sh, a, SSM_PRONOUNCED);
say_num(sh, b, SSM_PRONOUNCED);
return SWITCH_STATUS_SUCCESS;
}
break;
case SSM_COUNTED:
case SSM_PRONOUNCED:
if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million", sh)) != SWITCH_STATUS_SUCCESS) {
@ -340,7 +358,7 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
say_num(sh, tm.tm_mday, SSM_COUNTED);
}
if (say_year) {
say_num(sh, tm.tm_year + 1900, SSM_PRONOUNCED);
say_num(sh, tm.tm_year + 1900, SSM_PRONOUNCED_YEAR);
}
if (say_time) {

View File

@ -37,6 +37,7 @@ static char *SAY_METHOD_NAMES[] = {
"PRONOUNCED",
"ITERATED",
"COUNTED",
"PRONOUNCED_YEAR",
NULL
};