Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
6fb73a4c
提交
6fb73a4c
authored
4月 04, 2011
作者:
Buklov Boris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix and add support multy currency <action application=set data=currency=rubl/> dollar or other
上级
6eba56d2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
71 行增加
和
29 行删除
+71
-29
phrase_ru.xml
docs/phrase/phrase_ru.xml
+3
-2
mod_say_ru.c
src/mod/say/mod_say_ru/mod_say_ru.c
+42
-26
mod_say_ru.h
src/mod/say/mod_say_ru/mod_say_ru.h
+26
-1
没有找到文件。
docs/phrase/phrase_ru.xml
浏览文件 @
6fb73a4c
...
...
@@ -316,6 +316,7 @@
<currency>
<prompt
phrase=
"и"
filename=
"and.wav"
/>
<prompt
phrase=
"Цент"
filename=
"cent.wav"
/>
<prompt
phrase=
"Цента"
filename=
"centa.wav"
/>
<prompt
phrase=
"центральный"
filename=
"central.wav"
/>
<prompt
phrase=
"Центов в минуту"
filename=
"cents-per-minute.wav"
/>
<prompt
phrase=
"Центов"
filename=
"centov.wav"
/>
...
...
@@ -326,9 +327,9 @@
<prompt
phrase=
"Доллары"
filename=
"dollari.wav"
/>
<prompt
phrase=
"Минус"
filename=
"minus.wav"
/>
<prompt
phrase=
"Отрицательный"
filename=
"negative.wav"
/>
<prompt
phrase=
"Копе
ек
"
filename=
"kopeck-i.wav"
/>
<prompt
phrase=
"Копе
йки
"
filename=
"kopeck-i.wav"
/>
<prompt
phrase=
"Копейка"
filename=
"kopeck.wav"
/>
<prompt
phrase=
"Копе
йки
"
filename=
"kopecks.wav"
/>
<prompt
phrase=
"Копе
ек
"
filename=
"kopecks.wav"
/>
<prompt
phrase=
"Рубль"
filename=
"ruble.wav"
/>
<prompt
phrase=
"Рубля"
filename=
"ruble-a.wav"
/>
<prompt
phrase=
"Рублей"
filename=
"rubles.wav"
/>
...
...
src/mod/say/mod_say_ru/mod_say_ru.c
浏览文件 @
6fb73a4c
...
...
@@ -58,6 +58,10 @@ struct say_t matrix[7][8] = { {m_00, m_01, m_02, m_03, m_04, m_05, m_06, m_07},
{
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
);
...
...
@@ -253,8 +257,7 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s
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");
...
...
@@ -278,40 +281,48 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s
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
;
}
...
...
@@ -628,7 +639,9 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t
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
);
...
...
@@ -692,12 +705,15 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t
}
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
;
}
}
...
...
src/mod/say/mod_say_ru/mod_say_ru.h
浏览文件 @
6fb73a4c
...
...
@@ -49,10 +49,12 @@ typedef enum {
typedef
enum
{
ruble
,
dollar
dollar
,
euro
}
currency_t
;
typedef
struct
{
say_gender_t
gender
;
cases_t
cases
;
...
...
@@ -66,6 +68,29 @@ struct say_t {
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
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论