diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 35784a6200..be200410b6 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -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) { char *p; @@ -547,6 +570,9 @@ static switch_new_say_callback_t choose_callback(switch_say_args_t *say_args) case SST_CURRENCY: say_cb = en_say_money; break; + case SST_TELEPHONE_NUMBER: + say_cb = say_telephone_number; + break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); break; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 9b5d7d62ec..8ffe90ea11 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -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 (!sh->cnt++) { 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 { sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); }