]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
use common code for spell in say mods
authorMichael Jerris <mike@jerris.com>
Mon, 8 Mar 2010 07:55:57 +0000 (07:55 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 8 Mar 2010 07:55:57 +0000 (07:55 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16935 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/say/mod_say_de/mod_say_de.c
src/mod/say/mod_say_es/mod_say_es.c
src/mod/say/mod_say_fr/mod_say_fr.c
src/mod/say/mod_say_hu/mod_say_hu.c
src/mod/say/mod_say_it/mod_say_it.c
src/mod/say/mod_say_nl/mod_say_nl.c
src/mod/say/mod_say_ru/mod_say_ru.c
src/mod/say/mod_say_th/mod_say_th.c
src/mod/say/mod_say_zh/mod_say_zh.c

index 474acf719a5bc6378b453675de3f34308289febf..ccb06e286adffa44c3cbe521ea1fe990bf0f20a1 100644 (file)
@@ -80,27 +80,6 @@ SWITCH_MODULE_DEFINITION(mod_say_de, mod_say_de_load, NULL, NULL);
                        return SWITCH_STATUS_FALSE;                                                                     \
                }}                                                                                                                              \
 
-
-static switch_status_t de_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= 48 && a <= 57) {
-                       say_file("digits/%d.wav", a - 48);
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
 {
 
@@ -506,7 +485,7 @@ static switch_status_t de_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = de_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = de_say_money;
index 8f8b82fb6d66b35a5a678dd694a26098429b704c..fdab4210ae7cfa16e6462d215159930188160a21 100644 (file)
@@ -80,27 +80,6 @@ SWITCH_MODULE_DEFINITION(mod_say_es, mod_say_es_load, NULL, NULL);
                        return SWITCH_STATUS_FALSE;                                                                     \
                }}                                                                                                                              \
 
-
-static switch_status_t es_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= 48 && a <= 57) {
-                       say_file("digits/%d.wav", a - 48);
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
 {
        if (a) {
@@ -527,7 +506,7 @@ static switch_status_t es_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = es_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = es_say_money;
index 4427c514e68c52569df19180f5a3a4030a30bf38..ac114e4f600cdd0fb3375888ddeec9af7fa6604f 100644 (file)
@@ -80,27 +80,6 @@ SWITCH_MODULE_DEFINITION(mod_say_fr, mod_say_fr_load, NULL, NULL);
                        return SWITCH_STATUS_FALSE;                                                                     \
                }}                                                                                                                              \
 
-
-static switch_status_t fr_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= 48 && a <= 57) {
-                       say_file("digits/%d.wav", a - 48);
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static switch_status_t play_group(switch_say_method_t method, switch_say_gender_t gender, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
 {
        int ftdNumber = 0;
@@ -557,7 +536,6 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
 
 static switch_status_t fr_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
 {
-
        switch_say_callback_t say_cb = NULL;
 
        switch (say_args->type) {
@@ -577,9 +555,15 @@ static switch_status_t fr_say(switch_core_session_t *session, char *tosay, switc
        case SST_IP_ADDRESS:
                say_cb = fr_ip;
                break;
+       case SST_TELEPHONE_NUMBER:
+       case SST_TELEPHONE_EXTENSION:
+       case SST_URL:
+       case SST_EMAIL_ADDRESS:
+       case SST_POSTAL_ADDRESS:
+       case SST_ACCOUNT_NUMBER:
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = fr_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = fr_say_money;
index 43fa23a63226f36b98c3133bf8e4fb87bb9e4609..c0cc8b287424ee7c0b520dc2558654970e36bccd 100644 (file)
@@ -81,26 +81,6 @@ SWITCH_MODULE_DEFINITION(mod_say_hu, mod_say_hu_load, NULL, NULL);
                }}                                                                                                                              \
 
 
-static switch_status_t hu_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= 48 && a <= 57) {
-                       say_file("digits/%d.wav", a - 48);
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, int tosay, switch_core_session_t *session,
                                                                  switch_input_args_t *args)
 {
@@ -505,7 +485,7 @@ static switch_status_t hu_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = hu_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = hu_say_money;
index 43853845e5adc3d1bab37e56f205049ae9fe479c..5a615dfbd0b5a4fde5493729ba41094e8ba4a472 100644 (file)
@@ -92,26 +92,6 @@ SWITCH_MODULE_DEFINITION(mod_say_it, mod_say_it_load, NULL, NULL);
                }}\
 
 
-static switch_status_t it_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= 48 && a <= 57) {
-                       say_file("digits/%d.wav", a - 48);
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
 {
 
@@ -533,7 +513,7 @@ static switch_status_t it_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = it_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = it_say_money;
index 6c22b1219fe78122319e0592509a19a9cfc26d74..8ef1c49f6bafb9998363a82dffad1d2065d4f624 100644 (file)
@@ -81,26 +81,6 @@ SWITCH_MODULE_DEFINITION(mod_say_nl, mod_say_nl_load, NULL, NULL);
                }}                                                                                                                              \
 
 
-static switch_status_t nl_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= 48 && a <= 57) {
-                       say_file("digits/%d.wav", a - 48);
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
 {
 
@@ -497,7 +477,7 @@ static switch_status_t nl_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = nl_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = nl_say_money;
index ba9ca937c6542a3df1bf9e3d143a4979aa951f5c..b4e0d2ce82f997727d091e2494a277fadc04cfec 100644 (file)
@@ -111,25 +111,6 @@ static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
        return ret;
 }
 
-static switch_status_t ru_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= 48 && a <= 57) {
-                       say_file("digits/%d.wav", a - 48);
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static switch_status_t play_group(say_type_t say_type, casus_t casus, int a, int b, int c,
                                                                  unit_t what, switch_core_session_t *session, switch_input_args_t *args)
 {
@@ -634,7 +615,7 @@ static switch_status_t ru_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = ru_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = ru_say_money;
index 23d2dcdea7f3c3e88f05914aca70859d61c89728..2a60bd06129fcd8badc4e2d5b4e86d6595a2b987 100644 (file)
@@ -87,26 +87,6 @@ SWITCH_MODULE_DEFINITION(mod_say_th, mod_say_th_load, NULL, NULL);
                        return SWITCH_STATUS_FALSE;                                                                     \
                }}                                                                                                                              \
 
-static switch_status_t th_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= '0' && a <= '9') {
-                       say_file("digits/%d.wav", a - '0');
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
 static char *strip_commas(char *in, char *out, switch_size_t len)
 {
        char *p = in;
@@ -587,7 +567,7 @@ static switch_status_t th_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = th_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = th_say_money;
index 834bf1b419e60765a95ef828694844c7a89df533..deef5cc605a84916bed3e587579986bc77b3b09f 100644 (file)
@@ -86,25 +86,6 @@ SWITCH_MODULE_DEFINITION(mod_say_zh, mod_say_zh_load, NULL, NULL);
                        return SWITCH_STATUS_FALSE;                                                                     \
                }}                                                                                                                              \
 
-static switch_status_t zh_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-       char *p;
-
-       for (p = tosay; p && *p; p++) {
-               int a = tolower((int) *p);
-               if (a >= '0' && a <= '9') {
-                       say_file("digits/%d.wav", a - '0');
-               } else {
-                       if (say_args->type == SST_NAME_SPELLED) {
-                               say_file("ascii/%d.wav", a);
-                       } else if (say_args->type == SST_NAME_PHONETIC) {
-                               say_file("phonetic-ascii/%d.wav", a);
-                       }
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
 
 static char *strip_commas(char *in, char *out, switch_size_t len)
 {
@@ -566,7 +547,7 @@ static switch_status_t zh_say(switch_core_session_t *session, char *tosay, switc
                break;
        case SST_NAME_SPELLED:
        case SST_NAME_PHONETIC:
-               say_cb = zh_spell;
+               return switch_ivr_say_spell(session, tosay, say_args, args);
                break;
        case SST_CURRENCY:
                say_cb = zh_say_money;