]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5740 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 12 Sep 2013 15:41:52 +0000 (20:41 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 12 Sep 2013 15:42:16 +0000 (20:42 +0500)
src/mod/say/mod_say_en/mod_say_en.c
src/switch_loadable_module.c

index 35784a62009b79febff52f8a26035e81a7b55455..be200410b63451680a600cfe70e0e86732ac4b1c 100644 (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)
 {
        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;
index 9b5d7d62ec55391f23dd7d012b92410d6d5b3f31..8ffe90ea117e765f9aff0fdbb682c37f0aef25d5 100644 (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 (!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);
                }