use common code for spell in say mods

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16935 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2010-03-08 07:55:57 +00:00
parent 8a40f2bcdb
commit 8b20d78f8d
9 changed files with 15 additions and 191 deletions

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;