提交 02f6269c authored 作者: Michael Jerris's avatar Michael Jerris

check for say errors in say_money functions

上级 2459e710
......@@ -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 {
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论