fix issues with speaking 1 or 0 amounts in time measurement

add fixes from mmurdock via irc, thanks mike


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3915 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-01-06 02:53:11 +00:00
parent 77c4a3da64
commit 26c18bb142

View File

@ -291,13 +291,16 @@ static switch_status_t en_say_time(switch_core_session_t *session,
if ((p = strrchr(tme, ':'))) { if ((p = strrchr(tme, ':'))) {
*p++ = '\0'; *p++ = '\0';
seconds = atoi(p); seconds = atoi(p);
if ((p = strrchr(tme, ':'))) { if ((p = strchr(tme, ':'))) {
*p++ = '\0'; *p++ = '\0';
minutes = atoi(p); minutes = atoi(p);
if (tme) { if (tme) {
hours = atoi(tme); hours = atoi(tme);
} }
} }
else {
minutes = atoi(tme);
}
} }
} else { } else {
if ((seconds = atoi(tosay)) <= 0) { if ((seconds = atoi(tosay)) <= 0) {
@ -319,16 +322,43 @@ static switch_status_t en_say_time(switch_core_session_t *session,
if (hours) { if (hours) {
say_num(hours, SSM_PRONOUNCED); say_num(hours, SSM_PRONOUNCED);
if (hours == 1) {
say_file("digits/hour.wav"); //TODO -- NEED TO GET "hour.wav" recorded
}
else {
say_file("digits/hours.wav");
}
}
else {
say_file("digits/0.wav");
say_file("digits/hours.wav"); say_file("digits/hours.wav");
} }
if (minutes) { if (minutes) {
say_num(minutes, SSM_PRONOUNCED); say_num(minutes, SSM_PRONOUNCED);
if (minutes == 1) {
say_file("digits/minute.wav");
}
else {
say_file("digits/minutes.wav");
}
}
else {
say_file("digits/0.wav");
say_file("digits/minutes.wav"); say_file("digits/minutes.wav");
} }
if (seconds) { if (seconds) {
say_num(seconds, SSM_PRONOUNCED); say_num(seconds, SSM_PRONOUNCED);
if (seconds == 1) {
say_file("digits/second.wav");
}
else {
say_file("digits/seconds.wav");
}
}
else {
say_file("digits/0.wav");
say_file("digits/seconds.wav"); say_file("digits/seconds.wav");
} }
@ -419,6 +449,9 @@ static switch_status_t en_say_money(switch_core_session_t *session,
if ((cents = strchr(sbuf, '.'))) { if ((cents = strchr(sbuf, '.'))) {
*cents++ = '\0'; *cents++ = '\0';
if (strlen(cents) > 2) {
cents[2] = '\0';
}
} }
/* If positive sign - skip over" */ /* If positive sign - skip over" */