]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
say years like 1985 as nineteen-85
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 15 Nov 2011 15:51:46 +0000 (09:51 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 15 Nov 2011 15:51:46 +0000 (09:51 -0600)
src/include/switch_types.h
src/mod/say/mod_say_en/mod_say_en.c
src/switch_ivr_say.c

index 4789d09abd755928fecce8f916cfdc52788e9965..79d45c11b46e414fd8456bc09333446310c6469a 100644 (file)
@@ -350,7 +350,8 @@ typedef enum {
        SSM_NA,
        SSM_PRONOUNCED,
        SSM_ITERATED,
-       SSM_COUNTED
+       SSM_COUNTED,
+       SSM_PRONOUNCED_YEAR
 } switch_say_method_t;
 
 /* WARNING, Do not forget to update *SAY_TYPE_NAMES[] in src/switch_ivr_say.c */
index 01409c7b21a0e71fa0ebe1d9d51f9a7276fc84c5..4e6b21abdf4e6c2ad127b4028bc40eed217372fc 100644 (file)
@@ -140,8 +140,26 @@ static switch_status_t en_say_general_count(switch_say_file_handle_t *sh, char *
                                in -= places[(uint32_t) x] * num;
                        }
                }
+               
 
                switch (say_args->method) {
+               case SSM_PRONOUNCED_YEAR:
+                       {
+                               int num = atoi(tosay);
+                               int a = num / 100;
+                               int b = num % 100;
+
+                               if (!b || !(a % 10)) {
+                                       say_num(sh, num, SSM_PRONOUNCED);
+                                       return SWITCH_STATUS_SUCCESS;
+                               }
+
+                               say_num(sh, a, SSM_PRONOUNCED);
+                               say_num(sh, b, SSM_PRONOUNCED);
+
+                               return SWITCH_STATUS_SUCCESS;
+                       }
+                       break;
                case SSM_COUNTED:
                case SSM_PRONOUNCED:
                        if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million", sh)) != SWITCH_STATUS_SUCCESS) {
@@ -340,7 +358,7 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                say_num(sh, tm.tm_mday, SSM_COUNTED);
        }
        if (say_year) {
-               say_num(sh, tm.tm_year + 1900, SSM_PRONOUNCED);
+               say_num(sh, tm.tm_year + 1900, SSM_PRONOUNCED_YEAR);
        }
 
        if (say_time) {
index 9ba60fb5d54442ff3a6ab9c837e83e428c0350c2..7764ee441b9f307b67934f45cc8e2b13fdff723d 100644 (file)
@@ -37,6 +37,7 @@ static char *SAY_METHOD_NAMES[] = {
        "PRONOUNCED",
        "ITERATED",
        "COUNTED",
+       "PRONOUNCED_YEAR",
        NULL
 };