<currency>\r
<prompt phrase="и" filename="and.wav"/>\r
<prompt phrase="Цент" filename="cent.wav"/>\r
+ <prompt phrase="Цента" filename="centa.wav"/>\r
<prompt phrase="центральный" filename="central.wav"/>\r
<prompt phrase="Центов в минуту" filename="cents-per-minute.wav"/>\r
<prompt phrase="Центов" filename="centov.wav"/>\r
<prompt phrase="Доллары" filename="dollari.wav"/>\r
<prompt phrase="Минус" filename="minus.wav"/>\r
<prompt phrase="Отрицательный" filename="negative.wav"/>\r
- <prompt phrase="Ð\9aопеек" filename="kopeck-i.wav"/>\r
+ <prompt phrase="Ð\9aопейки" filename="kopeck-i.wav"/>\r
<prompt phrase="Копейка" filename="kopeck.wav"/>\r
- <prompt phrase="Ð\9aопейки" filename="kopecks.wav"/>\r
+ <prompt phrase="Ð\9aопеек" filename="kopecks.wav"/>\r
<prompt phrase="Рубль" filename="ruble.wav"/>\r
<prompt phrase="Рубля" filename="ruble-a.wav"/>\r
<prompt phrase="Рублей" filename="rubles.wav"/>\r
{m_60, m_61, m_62, m_63, m_64, m_65, m_66, m_67}
};
+
+struct say_cur_t matrix_currency[3] = {c_0, c_1, c_2};
+
+
SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load);
SWITCH_MODULE_DEFINITION(mod_say_ru, mod_say_ru_load, NULL, NULL);
int iruble = 0;
int ikopecks = 0;
int ikopeck = 0;
-
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n", tosay);
+// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s say_opt->currency=%d\n", tosay,say_opt->currency);
if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
rubles++;
}
- ru_say_count(sh, rubles, male, nominativus);
+
+ ru_say_count(sh, rubles, matrix_currency[say_opt->currency].first_gender,matrix_currency[say_opt->currency].first_cases);
if (rubles) {
irubles = atoi(rubles) % 100;
iruble = atoi(rubles) % 10;
}
-
- if (irubles == 1 || (irubles > 20 && iruble == 1)) { /* рубль */
- switch_say_file(sh, "currency/ruble");
- } else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5)) { /*рубля */
- switch_say_file(sh, "currency/ruble-a");
- } else { /*рублей */
- switch_say_file(sh, "currency/rubles");
+ if (iruble<5) {
+ if ((irubles>10)&&(irubles<15)) {
+ switch_say_file(sh, "currency/%s",matrix_currency->first[5]);
+ }
+ else {
+ switch_say_file(sh, "currency/%s",matrix_currency->first[iruble]);
+ }
}
-
+ else {
+ switch_say_file(sh, "currency/%s",matrix_currency->first[5]);
+ }
+
+
/* Say kopecks */
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n", kopecks);
- ru_say_count(sh, kopecks, female, nominativus);
+ ru_say_count(sh, kopecks, matrix_currency[say_opt->currency].second_gender,matrix_currency[say_opt->currency].second_cases);
if (kopecks) {
ikopecks = atoi(kopecks) % 100;
ikopeck = atoi(kopecks) % 10;
}
- if (ikopecks == 1 || (ikopecks > 20 && ikopeck == 1)) {
- /* копейка */
- switch_say_file(sh, "currency/kopeck");
- } else if ((ikopecks > 1 && ikopecks < 5) || (ikopecks > 20 && ikopeck > 1 && ikopeck < 5)) {
- /* копейки */
- switch_say_file(sh, "currency/kopeck-i");
- } else {
- /* копеек */
- switch_say_file(sh, "currency/kopecks");
+ if (ikopeck<5) {
+ if ((ikopecks>10)&&(ikopecks<15)) {
+ switch_say_file(sh, "currency/%s",matrix_currency->second[5]);
+ }
+ else {
+ switch_say_file(sh, "currency/%s",matrix_currency->second[ikopeck]);
+ }
}
+ else {
+ switch_say_file(sh, "currency/%s",matrix_currency->second[5]);
+ }
+
+
+
return SWITCH_STATUS_SUCCESS;
}
const char *gender=NULL;
const char *currency=NULL;
say_opt_t say_opt;
-
+ say_opt.cases=0;
+ say_opt.gender=0;
+ say_opt.currency=0;
if (session) {
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_get_variables(channel, &var_event);
}
if (currency) {
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", currency);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", currency);
- if (strcmp(currency,"rubl") || strcmp(currency,"рубль")) {
+ if ((strcmp(currency,"ruble")==0) || (strcmp(currency,"рубль")==0)) {
say_opt.currency=(currency_t)0;
+// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "rul!!! \n");
+
}
- if (strcmp(gender,"dollar") || strcmp(gender,"доллар")) {
+ if ((strcmp(currency,"dollar")==0) || (strcmp(currency,"доллар")==0)) {
+// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "dollar!!! !\n");
say_opt.currency=(currency_t)1;
}
}
typedef enum {
ruble,
- dollar
+ dollar,
+ euro
} currency_t;
+
typedef struct {
say_gender_t gender;
cases_t cases;
char *million[14];
int all;
};
+struct say_cur_t {
+ char *first[6];
+ say_gender_t first_gender;
+ cases_t first_cases;
+ char *second[6];
+ say_gender_t second_gender;
+ cases_t second_cases;
+
+};
+
+// описываем как произносить валяюты от 0 до 5 дальше идёт номер рода и падежа (с нуля)
+//рубли
+#define c_0 {{"rubles","ruble","ruble-a","ruble-a","ruble-a","rubles"},male,nominativus,\
+ {"kopecks","kopeck","kopeck-i","kopeck-i","kopeck-i","kopecks"},female,nominativus}
+
+#define c_1 {{"dollars","dollar","dollara","dollara","dollara","dollars"},male,nominativus,\
+ {"centov","cent","centa","centa","centa","centov"},male,nominativus}
+
+#define c_2 {{"rubles","ruble","ruble-a","ruble-a","ruble-a","rubles"},male,nominativus,\
+ {"kopecks","kopeck","kopeck-i","kopeck-i","kopeck-i","kopecks"},female,nominativus}
+
+
+
typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt);