SWITCH_DECLARE(void *) getPrivate(char *var);
SWITCH_DECLARE(const char *) getVariable(char *var);
SWITCH_DECLARE(switch_status_t) process_callback_result(char *result);
- SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
+ SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method,
+ const char *say_gender = NULL);
SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
SWITCH_DECLARE(const char *) hangupCause();
SWITCH_DECLARE(const char *) getState();
switch_bind_flag_t bind_flags, const char *app);
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session, uint32_t key);
SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
-SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
- const char *say_method, switch_input_args_t *args);
+SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,
+ const char *tosay,
+ const char *module_name,
+ const char *say_type,
+ const char *say_method,
+ const char *say_gender,
+ switch_input_args_t *args);
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
+SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name);
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session);
SST_SHORT_DATE_TIME
} switch_say_type_t;
+typedef enum {
+ SSG_MASCULINE,
+ SSG_FEMININE,
+ SSG_NEUTER
+} switch_say_gender_t;
+
typedef enum {
SMA_NONE,
SMA_GET,
switch_read_frame_callback_function_t read_frame_callback;
void *user_data;
} switch_input_args_t;
+
+typedef struct {
+ switch_say_type_t type;
+ switch_say_method_t method;
+ switch_say_gender_t gender;
+} switch_say_args_t;
+
typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args);
+ char *tosay,
+ switch_say_args_t *say_args,
+ switch_input_args_t *args);
+
typedef struct switch_xml *switch_xml_t;
typedef struct switch_core_time_duration switch_core_time_duration_t;
typedef switch_xml_t(*switch_xml_search_function_t) (const char *section,
prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex);
}
-#define SAY_SYNTAX "<module_name> <say_type> <say_method> <text>"
+#define SAY_SYNTAX "<module_name> <say_type> <say_method> [<say_gender>] <text>"
SWITCH_STANDARD_APP(say_function)
{
- char *argv[4] = { 0 };
+ char *argv[5] = { 0 };
int argc;
char *lbuf = NULL;
switch_input_args_t args = { 0 };
switch_channel_t *channel = switch_core_session_get_channel(session);
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
- && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
+ && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) && (argc == 4 || argc == 5)) {
args.input_callback = on_dtmf;
switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
- switch_ivr_say(session, argv[3], argv[0], argv[1], argv[2], &args);
+ switch_ivr_say(session, (argc == 4) ? argv[3] : argv[4], argv[0], argv[1], argv[2], (argc == 5) ? argv[3] : NULL ,&args);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", SAY_SYNTAX);
}
SWITCH_MODULE_LOAD_FUNCTION(mod_say_de_load);
SWITCH_MODULE_DEFINITION(mod_say_de, mod_say_de_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = de_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }}\
-
-
-static switch_status_t de_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ de_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ 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;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t de_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t de_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
int x = 0;
}
}
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
case SSM_PRONOUNCED:
if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
- if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
break;
}
-static switch_status_t de_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t de_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0;
switch_time_exp_t tm;
uint8_t say_date = 0, say_time = 0;
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
}
switch_time_exp_lt(&tm, target);
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
-static switch_status_t de_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t de_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- de_say_general_count(session, dollars, type, method, args);
+ de_say_general_count(session, dollars, say_args, args);
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
/* Say cents */
if (cents) {
- de_say_general_count(session, cents, type, method, args);
+ de_say_general_count(session, cents, say_args, args);
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {
-static switch_status_t de_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t de_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = de_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load);
SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = en_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }}\
-
-
-static switch_status_t en_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ en_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ return SWITCH_STATUS_FALSE; \
+ }} \
+
+
+static switch_status_t en_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *p;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t en_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t en_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
int x = 0;
char sbuf[128] = "";
switch_status_t status;
- if (method == SSM_ITERATED) {
+ if (say_args->method == SSM_ITERATED) {
if ((tosay = strip_commas(tosay, sbuf, sizeof(sbuf)))) {
char *p;
for (p = tosay; p && *p; p++) {
}
}
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
case SSM_PRONOUNCED:
if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
- if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
break;
}
-static switch_status_t en_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t en_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0, target_now = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *tz = switch_channel_get_variable(channel, "timezone");
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
switch_time_exp_lt(&tm_now, target_now);
}
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
-static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- en_say_general_count(session, dollars, type, method, args);
+ en_say_general_count(session, dollars, say_args, args);
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
/* Say cents */
if (cents) {
- en_say_general_count(session, cents, type, method, args);
+ en_say_general_count(session, cents, say_args, args);
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {
-static switch_status_t en_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t en_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = en_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
SWITCH_MODULE_LOAD_FUNCTION(mod_say_es_load);
SWITCH_MODULE_DEFINITION(mod_say_es, mod_say_es_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = es_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }}\
-
-
-static switch_status_t es_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ es_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ 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;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t es_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t es_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
int x = 0;
}
}
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
case SSM_PRONOUNCED:
if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
- if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
break;
}
-static switch_status_t es_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t es_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t es_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t es_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0;
switch_time_exp_t tm;
uint8_t say_date = 0, say_time = 0;
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
}
switch_time_exp_lt(&tm, target);
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
-static switch_status_t es_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t es_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- es_say_general_count(session, dollars, type, method, args);
+ es_say_general_count(session, dollars, say_args, args);
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
/* Say cents */
if (cents) {
- es_say_general_count(session, cents, type, method, args);
+ es_say_general_count(session, cents, say_args, args);
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {
-static switch_status_t es_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t es_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = es_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
* Anthony Minessale II <anthm@freeswitch.org>
* Michael B. Murdock <mike@mmurdock.org>
*
- * mod_say_fr.c -- Say for English
+ * mod_say_fr.c -- Say for french
*
*/
SWITCH_MODULE_LOAD_FUNCTION(mod_say_fr_load);
SWITCH_MODULE_DEFINITION(mod_say_fr, mod_say_fr_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = fr_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }}\
-
-
-static switch_status_t fr_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ fr_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ 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;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t fr_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t fr_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
int x = 0;
}
}
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
case SSM_PRONOUNCED:
if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
- if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
break;
}
-static switch_status_t fr_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t fr_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t fr_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t fr_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0;
switch_time_exp_t tm;
uint8_t say_date = 0, say_time = 0;
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
}
switch_time_exp_lt(&tm, target);
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
-static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- fr_say_general_count(session, dollars, type, method, args);
+ fr_say_general_count(session, dollars, say_args, args);
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
/* Say cents */
if (cents) {
- fr_say_general_count(session, cents, type, method, args);
+ fr_say_general_count(session, cents, say_args, args);
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {
-static switch_status_t fr_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = fr_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
SWITCH_MODULE_LOAD_FUNCTION(mod_say_hu_load);
SWITCH_MODULE_DEFINITION(mod_say_hu, mod_say_hu_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = hu_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }}\
-
-
-static switch_status_t hu_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ hu_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ return SWITCH_STATUS_FALSE; \
+ }} \
+
+
+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;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t hu_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t hu_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
int x = 0;
}
}
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
case SSM_PRONOUNCED:
if ((status =
play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", number, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
- if ((status = play_group(method, places[2], places[1], places[0], NULL, number, session, args)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, number, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
break;
}
-static switch_status_t hu_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t hu_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t hu_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t hu_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0, target_now = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *tz = switch_channel_get_variable(channel, "timezone");
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
switch_time_exp_lt(&tm_now, target_now);
}
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
-static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = "";
char *forint;
forint++;
}
- hu_say_general_count(session, forint, type, method, args);
+ hu_say_general_count(session, forint, say_args, args);
say_file("currency/forint.wav");
return SWITCH_STATUS_SUCCESS;
-static switch_status_t hu_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t hu_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = hu_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
* Anthony Minessale II <anthm@freeswitch.org>
* Michael B. Murdock <mike@mmurdock.org>
*
- * mod_say_it.c -- Say for English
+ * mod_say_it.c -- Say for Italian
*
*/
SWITCH_MODULE_LOAD_FUNCTION(mod_say_it_load);
SWITCH_MODULE_DEFINITION(mod_say_it, mod_say_it_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = it_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }}\
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ it_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ return SWITCH_STATUS_FALSE; \
+ }} \
#define say_file(...) {\
char tmp[80];\
}}\
-static switch_status_t it_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+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;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t it_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t it_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
int places_count = 0;
}
while (in > 0 && ++places_count > 0 /* fake check to put in while */ );
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
case SSM_PRONOUNCED:
}
/* Play last group */
- if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
break;
}
-static switch_status_t it_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t it_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t it_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t it_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0;
switch_time_exp_t tm;
uint8_t say_date = 0, say_time = 0;
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
}
switch_time_exp_lt(&tm, target);
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
-static switch_status_t it_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t it_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- it_say_general_count(session, dollars, type, method, args);
+ it_say_general_count(session, dollars, say_args, args);
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
/* Say cents */
if (cents) {
- it_say_general_count(session, cents, type, method, args);
+ it_say_general_count(session, cents, say_args, args);
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {
-static switch_status_t it_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t it_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = it_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
* Anthony Minessale II <anthm@freeswitch.org>
* Michael B. Murdock <mike@mmurdock.org>
*
- * mod_say_nl.c -- Say for English
+ * mod_say_nl.c -- Say for nl
*
*/
SWITCH_MODULE_LOAD_FUNCTION(mod_say_nl_load);
SWITCH_MODULE_DEFINITION(mod_say_nl, mod_say_nl_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = nl_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }}\
-
-
-static switch_status_t nl_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ nl_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ return SWITCH_STATUS_FALSE; \
+ }} \
+
+
+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;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t nl_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t nl_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
int x = 0;
}
}
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
case SSM_PRONOUNCED:
if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
- if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
break;
}
-static switch_status_t nl_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t nl_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t nl_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t nl_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0;
switch_time_exp_t tm;
uint8_t say_date = 0, say_time = 0;
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
}
switch_time_exp_lt(&tm, target);
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
-static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- nl_say_general_count(session, dollars, type, method, args);
+ nl_say_general_count(session, dollars, say_args, args);
if (atoi(dollars) == 1) {
say_file("currency/dollar.wav");
} else {
/* Say cents */
if (cents) {
- nl_say_general_count(session, cents, type, method, args);
+ nl_say_general_count(session, cents, say_args, args);
if (atoi(cents) == 1) {
say_file("currency/cent.wav");
} else {
-static switch_status_t nl_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t nl_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = nl_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
return ret;
}
-static switch_status_t ru_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+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;
if (a >= 48 && a <= 57) {
say_file("digits/%d.wav", a - 48);
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
}
//дописать
-static switch_status_t ru_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t ru_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
switch_status_t status;
casus_t casus; //падеж
say_type_t say_type; //тип произношения
- switch (type) {
+ switch (say_args->type) {
case SST_MESSAGES:
say_type = it_c;
casus = nominativus;
return status;
}
-static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type,
- switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = "";
char *rubles = NULL;
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
char buf[80];
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *tz = switch_channel_get_variable(channel, "timezone");
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s type=%d method=%d\n", tosay, type, method);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s type=%d method=%d\n", tosay, say_args->type, say_args->method);
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
switch_time_exp_lt(&tm_now, target_now);
}
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
}
if (say_time) {
switch_snprintf(buf, sizeof(buf), "%d:%d:%d", tm.tm_hour + 1, tm.tm_min, tm.tm_sec);
- ru_say_time(session, buf, SST_TIME_MEASUREMENT, method, args);
+ say_args->type = SST_TIME_MEASUREMENT;
+ ru_say_time(session, buf, say_args, args);
}
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t ru_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t ru_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t ru_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t ru_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = ru_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
SWITCH_MODULE_LOAD_FUNCTION(mod_say_th_load);
SWITCH_MODULE_DEFINITION(mod_say_th, mod_say_th_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = th_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }\
-}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }\
-}\
-
-
-static switch_status_t th_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ th_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ 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;
if (a >= '0' && a <= '9') {
say_file("digits/%d.wav", a - '0');
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t th_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t th_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
char sbuf[13] = "";
if (in != 0) {
snprintf(digits, sizeof(digits), "%10.10d", in);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Say: %s \n", digits);
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
say_file("digits/ordinal.wav");
/* Fall through */
}
-static switch_status_t th_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t th_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t th_say_time(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t th_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0;
uint8_t say_date = 0;
uint8_t say_time = 0;
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
target = switch_micro_time_now();
switch_time_exp_lt(&tm, target);
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t th_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t th_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- th_say_general_count(session, dollars, type, method, args);
+ th_say_general_count(session, dollars, say_args, args);
say_file("currency/dollar.wav");
/* Say cents */
if (cents) {
- th_say_general_count(session, cents, type, method, args);
+ th_say_general_count(session, cents, say_args, args);
} else {
say_file("digits/0.wav");
}
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t th_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t th_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = th_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
SWITCH_MODULE_LOAD_FUNCTION(mod_say_zh_load);
SWITCH_MODULE_DEFINITION(mod_say_zh, mod_say_zh_load, NULL, NULL);
-#define say_num(num, t) { \
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((tstatus = zh_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return tstatus;\
- }\
-}\
-
-#define say_file(...) {\
- char tmp[80];\
- switch_status_t tstatus;\
- switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return tstatus;\
- }\
- if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
- return SWITCH_STATUS_FALSE;\
- }\
-}\
-
-
-static switch_status_t zh_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+#define say_num(num, meth) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_say_method_t smeth = say_args->method; \
+ switch_say_type_t stype = say_args->type; \
+ say_args->type = SST_ITEMS; say_args->method = meth; \
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = \
+ zh_say_general_count(session, tmp, say_args, args)) \
+ != SWITCH_STATUS_SUCCESS) { \
+ return tstatus; \
+ } \
+ say_args->method = smeth; say_args->type = stype; \
+ } \
+
+#define say_file(...) { \
+ char tmp[80]; \
+ switch_status_t tstatus; \
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \
+ if ((tstatus = \
+ switch_ivr_play_file(session, NULL, tmp, args)) \
+ != SWITCH_STATUS_SUCCESS){ \
+ return tstatus; \
+ } \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+ 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;
if (a >= '0' && a <= '9') {
say_file("digits/%d.wav", a - '0');
} else {
- if (type == SST_NAME_SPELLED) {
+ if (say_args->type == SST_NAME_SPELLED) {
say_file("ascii/%d.wav", a);
- } else if (type == SST_NAME_PHONETIC) {
+ } else if (say_args->type == SST_NAME_PHONETIC) {
say_file("phonetic-ascii/%d.wav", a);
}
}
return ret;
}
-static switch_status_t zh_say_general_count(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t zh_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int in;
char sbuf[13] = "";
if (in != 0) {
snprintf(digits, sizeof(digits), "%10.10d", in);
- switch (method) {
+ switch (say_args->method) {
case SSM_COUNTED:
say_file("digits/ordinal.wav");
/* Fall through */
}
-static switch_status_t zh_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t zh_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *a, *b, *c, *d;
if (!(a = switch_core_session_strdup(session, tosay))) {
*d++ = '\0';
- say_num(atoi(a), method);
+ say_num(atoi(a), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(b), method);
+ say_num(atoi(b), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(c), method);
+ say_num(atoi(c), say_args->method);
say_file("digits/dot.wav");
- say_num(atoi(d), method);
+ say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t zh_say_time(switch_core_session_t *session,
- char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t zh_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
int32_t t;
switch_time_t target = 0;
uint8_t say_date = 0;
uint8_t say_time = 0;
- if (type == SST_TIME_MEASUREMENT) {
+ if (say_args->type == SST_TIME_MEASUREMENT) {
int64_t hours = 0;
int64_t minutes = 0;
int64_t seconds = 0;
target = switch_micro_time_now();
switch_time_exp_lt(&tm, target);
- switch (type) {
+ switch (say_args->type) {
case SST_CURRENT_DATE_TIME:
say_date = say_time = 1;
break;
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t zh_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
- switch_input_args_t *args)
+static switch_status_t zh_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
char *dollars = NULL;
}
/* Say dollar amount */
- zh_say_general_count(session, dollars, type, method, args);
+ zh_say_general_count(session, dollars, say_args, args);
say_file("currency/dollar.wav");
/* Say cents */
if (cents) {
- zh_say_general_count(session, cents, type, method, args);
+ zh_say_general_count(session, cents, say_args, args);
} else {
say_file("digits/0.wav");
}
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t zh_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+static switch_status_t zh_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 (type) {
+ switch (say_args->type) {
case SST_NUMBER:
case SST_ITEMS:
case SST_PERSONS:
say_cb = zh_say_money;
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type);
break;
}
if (say_cb) {
- return say_cb(session, tosay, type, method, args);
+ return say_cb(session, tosay, say_args, args);
}
return SWITCH_STATUS_FALSE;
return dtmf_buf;
}
-SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name, const char *say_type, const char *say_method)
+SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender)
{
this_check_void();
sanity_check_noreturn;
return;
}
begin_allow_threads();
- switch_ivr_say(session, tosay, module_name, say_type, say_method, ap);
+ switch_ivr_say(session, tosay, module_name, say_type, say_method, say_gender, ap);
end_allow_threads();
}
stfu_n_destroy(&jb);
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
- const char *say_method, switch_input_args_t *args)
+SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,
+ const char *tosay,
+ const char *module_name,
+ const char *say_type,
+ const char *say_method,
+ const char *say_gender,
+ switch_input_args_t *args)
{
switch_say_interface_t *si;
switch_channel_t *channel;
if ((si = switch_loadable_module_get_say_interface(module_name))) {
/* should go back and proto all the say mods to const.... */
- status = si->say_function(session, (char *) tosay, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
+ switch_say_args_t say_args = {0};
+
+ say_args.type = switch_ivr_get_say_type_by_name(say_type);
+ say_args.method = switch_ivr_get_say_method_by_name(say_method);
+ say_args.gender = switch_ivr_get_say_gender_by_name(say_gender);
+
+ status = si->say_function(session, (char *) tosay, &say_args, args);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
status = SWITCH_STATUS_FALSE;
NULL
};
+static char *SAY_GENDER_NAMES[] = {
+ "MASCULINE",
+ "FEMININE",
+ "NEUTER",
+ NULL
+};
+
+SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name)
+{
+ int x = 0;
+
+ if (!name) return (switch_say_gender_t)0;
+
+ for (x = 0; SAY_GENDER_NAMES[x]; x++) {
+ if (!strcasecmp(SAY_GENDER_NAMES[x], name)) {
+ break;
+ }
+ }
+
+ return (switch_say_gender_t) x;
+}
+
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name)
{
int x = 0;
+
+ if (!name) return (switch_say_method_t)0;
+
for (x = 0; SAY_METHOD_NAMES[x]; x++) {
if (!strcasecmp(SAY_METHOD_NAMES[x], name)) {
break;
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name)
{
int x = 0;
+
+ if (!name) return (switch_say_type_t)0;
+
for (x = 0; SAY_TYPE_NAMES[x]; x++) {
if (!strcasecmp(SAY_TYPE_NAMES[x], name)) {
break;
if ((si = switch_loadable_module_get_say_interface(module_name))) {
char *say_type = (char *) switch_xml_attr_soft(action, "type");
char *say_method = (char *) switch_xml_attr_soft(action, "method");
+ char *say_gender = (char *) switch_xml_attr_soft(action, "gender");
+ switch_say_args_t say_args = {0};
+
+ say_args.type = switch_ivr_get_say_type_by_name(say_type);
+ say_args.method = switch_ivr_get_say_method_by_name(say_method);
+ say_args.gender = switch_ivr_get_say_gender_by_name(say_gender);
- status =
- si->say_function(session, odata, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method),
- args);
+ status = si->say_function(session, odata, &say_args, args);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
}