FS-5740 --resolve

This commit is contained in:
Anthony Minessale 2013-09-12 20:41:52 +05:00
parent 3392db98bf
commit 6c384012ed
2 changed files with 28 additions and 0 deletions

View File

@ -498,6 +498,29 @@ static switch_status_t say_ip(switch_say_file_handle_t *sh,
} }
static switch_status_t say_telephone_number(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args)
{
int silence = 0;
char *p;
for (p = tosay; !zstr(p); p++) {
int a = tolower((int) *p);
if (a >= '0' && a <= '9') {
switch_say_file(sh, "digits/%c", a);
silence = 0;
} else if (a == '+' || (a >= 'a' && a <= 'z')) {
switch_say_file(sh, "ascii/%d", a);
silence = 0;
} else if (!silence) {
switch_say_file(sh, "silence_stream://100");
silence = 1;
}
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t say_spell(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) static switch_status_t say_spell(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args)
{ {
char *p; char *p;
@ -547,6 +570,9 @@ static switch_new_say_callback_t choose_callback(switch_say_args_t *say_args)
case SST_CURRENCY: case SST_CURRENCY:
say_cb = en_say_money; say_cb = en_say_money;
break; break;
case SST_TELEPHONE_NUMBER:
say_cb = say_telephone_number;
break;
default: default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break; break;

View File

@ -2538,6 +2538,8 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f
if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) {
if (!sh->cnt++) { if (!sh->cnt++) {
sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext);
} else if (strstr(buf, "://")) {
sh->stream.write_function(&sh->stream, "!%s", buf);
} else { } else {
sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext);
} }