check for say errors in say_money functions

This commit is contained in:
Michael Jerris 2014-05-07 13:18:16 -04:00
parent 2459e710f7
commit 02f6269cf1
5 changed files with 35 additions and 9 deletions

View File

@ -401,6 +401,7 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
char *cents = NULL;
switch_status_t status;
if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -428,7 +429,9 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
}
/* Say dollar amount */
fr_say_general_count(session, dollars, say_args, args);
if (( status = fr_say_general_count(session, dollars, say_args, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
@ -440,7 +443,9 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
/* Say cents */
if (cents) {
fr_say_general_count(session, cents, say_args, args);
if (( status = fr_say_general_count(session, cents, say_args, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {

View File

@ -357,6 +357,7 @@ static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay,
{
char sbuf[16] = "";
char *forint;
switch_status_t status;
if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -374,7 +375,9 @@ static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay,
forint++;
}
hu_say_general_count(session, forint, say_args, args);
if (( status = hu_say_general_count(session, forint, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
return status;
}
say_file("currency/forint.wav");
return SWITCH_STATUS_SUCCESS;

View File

@ -440,6 +440,7 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay,
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
char *cents = NULL;
switch_status_t status;
if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -467,7 +468,10 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay,
}
/* Say dollar amount */
it_say_general_count(session, dollars, say_args, args);
if (( status = it_say_general_count(session, dollars, say_args, args) ) != SWITCH_STATUS_SUCCESS ) {
return status;
}
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
@ -479,7 +483,9 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay,
/* Say cents */
if (cents) {
it_say_general_count(session, cents, say_args, args);
if (( status = it_say_general_count(session, cents, say_args, args) ) != SWITCH_STATUS_SUCCESS ) {
return status;
}
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {

View File

@ -321,6 +321,7 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay,
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
char *cents = NULL;
switch_status_t status;
if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -348,7 +349,10 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay,
}
/* Say dollar amount */
nl_say_general_count(session, dollars, say_args, args);
if (( status = nl_say_general_count(session, dollars, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
return status;
}
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
@ -360,7 +364,9 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay,
/* Say cents */
if (cents) {
nl_say_general_count(session, cents, say_args, args);
if (( status = nl_say_general_count(session, cents, say_args, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {

View File

@ -423,6 +423,7 @@ static switch_status_t th_say_money(switch_core_session_t *session, char *tosay,
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
char *cents = NULL;
switch_status_t status;
if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -450,12 +451,17 @@ static switch_status_t th_say_money(switch_core_session_t *session, char *tosay,
}
/* Say dollar amount */
th_say_general_count(session, dollars, say_args, args);
if (( status = th_say_general_count(session, dollars, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
return status;
}
say_file("currency/dollar.wav");
/* Say cents */
if (cents) {
th_say_general_count(session, cents, say_args, args);
if (( status = th_say_general_count(session, cents, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
return status;
}
} else {
say_file("digits/0.wav");
}