Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e227bf49
提交
e227bf49
authored
4月 11, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-5269 --resolve
上级
8dd4c8f9
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
57 行增加
和
6 行删除
+57
-6
switch_ivr.h
src/include/switch_ivr.h
+1
-0
switch_types.h
src/include/switch_types.h
+2
-1
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+13
-1
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+16
-0
switch_ivr_async.c
src/switch_ivr_async.c
+25
-4
没有找到文件。
src/include/switch_ivr.h
浏览文件 @
e227bf49
...
...
@@ -982,6 +982,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_create_message_reply(switch_event_t *
SWITCH_DECLARE
(
char
*
)
switch_ivr_check_presence_mapping
(
const
char
*
exten_name
,
const
char
*
domain_name
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_kill_uuid
(
const
char
*
uuid
,
switch_call_cause_t
cause
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_blind_transfer_ack
(
switch_core_session_t
*
session
,
switch_bool_t
success
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_record_session_mask
(
switch_core_session_t
*
session
,
const
char
*
file
,
switch_bool_t
on
);
/** @} */
...
...
src/include/switch_types.h
浏览文件 @
e227bf49
...
...
@@ -1514,7 +1514,8 @@ typedef enum {
SMBF_LOCK
=
(
1
<<
12
),
SMBF_TAP_NATIVE_READ
=
(
1
<<
13
),
SMBF_TAP_NATIVE_WRITE
=
(
1
<<
14
),
SMBF_ONE_ONLY
=
(
1
<<
15
)
SMBF_ONE_ONLY
=
(
1
<<
15
),
SMBF_MASK
=
(
1
<<
16
)
}
switch_media_bug_flag_enum_t
;
typedef
uint32_t
switch_media_bug_flag_t
;
...
...
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
e227bf49
...
...
@@ -3641,7 +3641,7 @@ SWITCH_STANDARD_API(uuid_bridge_function)
return
SWITCH_STATUS_SUCCESS
;
}
#define SESS_REC_SYNTAX "<uuid> [start|stop] <path> [<limit>]"
#define SESS_REC_SYNTAX "<uuid> [start|stop
|mask|unmask
] <path> [<limit>]"
SWITCH_STANDARD_API
(
session_record_function
)
{
switch_core_session_t
*
rsession
=
NULL
;
...
...
@@ -3688,6 +3688,18 @@ SWITCH_STANDARD_API(session_record_function)
}
else
{
stream
->
write_function
(
stream
,
"+OK Success
\n
"
);
}
}
else
if
(
!
strcasecmp
(
action
,
"mask"
))
{
if
(
switch_ivr_record_session_mask
(
rsession
,
path
,
SWITCH_TRUE
)
!=
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"-ERR Cannot mask recording session!
\n
"
);
}
else
{
stream
->
write_function
(
stream
,
"+OK Success
\n
"
);
}
}
else
if
(
!
strcasecmp
(
action
,
"unmask"
))
{
if
(
switch_ivr_record_session_mask
(
rsession
,
path
,
SWITCH_FALSE
)
!=
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"-ERR Cannot unmask recording session!
\n
"
);
}
else
{
stream
->
write_function
(
stream
,
"+OK Success
\n
"
);
}
}
else
{
goto
usage
;
}
...
...
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
e227bf49
...
...
@@ -2791,6 +2791,16 @@ SWITCH_STANDARD_APP(preprocess_session_function)
switch_ivr_preprocess_session
(
session
,
(
char
*
)
data
);
}
SWITCH_STANDARD_APP
(
record_session_mask_function
)
{
switch_ivr_record_session_mask
(
session
,
(
char
*
)
data
,
SWITCH_TRUE
);
}
SWITCH_STANDARD_APP
(
record_session_unmask_function
)
{
switch_ivr_record_session_mask
(
session
,
(
char
*
)
data
,
SWITCH_FALSE
);
}
SWITCH_STANDARD_APP
(
record_session_function
)
{
char
*
path
=
NULL
;
...
...
@@ -5459,6 +5469,10 @@ SWITCH_STANDARD_API(page_api_function)
#define SPEAK_DESC "Speak text to a channel via the tts interface"
#define DISPLACE_DESC "Displace audio from a file to the channels input"
#define SESS_REC_DESC "Starts a background recording of the entire session"
#define SESS_REC_MASK_DESC "Replace audio in a recording with blank data to mask critical voice sections"
#define SESS_REC_UNMASK_DESC "Resume normal operation after calling mask"
#define STOP_SESS_REC_DESC "Stops a background recording of the entire session"
#define SCHED_TRANSF_DESCR "Schedule a transfer in the future"
#define SCHED_BROADCAST_DESCR "Schedule a broadcast in the future"
...
...
@@ -5690,6 +5704,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
"
\n\t
<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp> [<digit_timeout>] ['<failure_ext> [failure_dp [failure_context]]']"
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"stop_record_session"
,
"Stop Record Session"
,
STOP_SESS_REC_DESC
,
stop_record_session_function
,
"<path>"
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"record_session"
,
"Record Session"
,
SESS_REC_DESC
,
record_session_function
,
"<path> [+<timeout>]"
,
SAF_MEDIA_TAP
);
SWITCH_ADD_APP
(
app_interface
,
"record_session_mask"
,
"Mask audio in recording"
,
SESS_REC_MASK_DESC
,
record_session_mask_function
,
"<path>"
,
SAF_MEDIA_TAP
);
SWITCH_ADD_APP
(
app_interface
,
"record_session_unmask"
,
"Resume recording"
,
SESS_REC_UNMASK_DESC
,
record_session_unmask_function
,
"<path>"
,
SAF_MEDIA_TAP
);
SWITCH_ADD_APP
(
app_interface
,
"record"
,
"Record File"
,
"Record a file from the channels input"
,
record_function
,
"<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]"
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"preprocess"
,
"pre-process"
,
"pre-process"
,
preprocess_session_function
,
""
,
SAF_NONE
);
...
...
src/switch_ivr_async.c
浏览文件 @
e227bf49
...
...
@@ -1105,6 +1105,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_event_t
*
event
;
switch_frame_t
*
nframe
;
switch_size_t
len
;
int
mask
=
switch_core_media_bug_test_flag
(
bug
,
SMBF_MASK
);
unsigned
char
null_data
[
SWITCH_RECOMMENDED_BUFFER_SIZE
]
=
{
0
};
switch
(
type
)
{
case
SWITCH_ABC_TYPE_INIT
:
...
...
@@ -1122,7 +1124,9 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
if
(
rh
->
rready
&&
rh
->
wready
)
{
nframe
=
switch_core_media_bug_get_native_read_frame
(
bug
);
len
=
nframe
->
datalen
;
switch_core_file_write
(
&
rh
->
in_fh
,
nframe
->
data
,
&
len
);
switch_core_file_write
(
&
rh
->
in_fh
,
mask
?
null_data
:
nframe
->
data
,
&
len
);
}
}
break
;
...
...
@@ -1133,7 +1137,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
if
(
rh
->
rready
&&
rh
->
wready
)
{
nframe
=
switch_core_media_bug_get_native_write_frame
(
bug
);
len
=
nframe
->
datalen
;
switch_core_file_write
(
&
rh
->
out_fh
,
nframe
->
data
,
&
len
);
switch_core_file_write
(
&
rh
->
out_fh
,
mask
?
null_data
:
nframe
->
data
,
&
len
);
}
}
break
;
...
...
@@ -1161,7 +1166,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
while
(
switch_core_media_bug_read
(
bug
,
&
frame
,
SWITCH_TRUE
)
==
SWITCH_STATUS_SUCCESS
)
{
len
=
(
switch_size_t
)
frame
.
datalen
/
2
;
if
(
len
&&
switch_core_file_write
(
rh
->
fh
,
data
,
&
len
)
!=
SWITCH_STATUS_SUCCESS
&&
rh
->
hangup_on_error
)
{
if
(
len
&&
switch_core_file_write
(
rh
->
fh
,
mask
?
null_data
:
data
,
&
len
)
!=
SWITCH_STATUS_SUCCESS
&&
rh
->
hangup_on_error
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error writing %s
\n
"
,
rh
->
file
);
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_TRUE
);
...
...
@@ -1229,7 +1234,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
if
(
status
==
SWITCH_STATUS_SUCCESS
||
status
==
SWITCH_STATUS_BREAK
)
{
len
=
(
switch_size_t
)
frame
.
datalen
/
2
;
if
(
len
&&
switch_core_file_write
(
rh
->
fh
,
data
,
&
len
)
!=
SWITCH_STATUS_SUCCESS
&&
rh
->
hangup_on_error
)
{
if
(
len
&&
switch_core_file_write
(
rh
->
fh
,
mask
?
null_data
:
data
,
&
len
)
!=
SWITCH_STATUS_SUCCESS
&&
rh
->
hangup_on_error
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error writing %s
\n
"
,
rh
->
file
);
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_TRUE
);
...
...
@@ -1246,6 +1251,22 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
return
SWITCH_TRUE
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_record_session_mask
(
switch_core_session_t
*
session
,
const
char
*
file
,
switch_bool_t
on
)
{
switch_media_bug_t
*
bug
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
if
((
bug
=
switch_channel_get_private
(
channel
,
file
)))
{
if
(
on
)
{
switch_core_media_bug_set_flag
(
bug
,
SMBF_MASK
);
}
else
{
switch_core_media_bug_clear_flag
(
bug
,
SMBF_MASK
);
}
return
SWITCH_STATUS_SUCCESS
;
}
return
SWITCH_STATUS_FALSE
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_stop_record_session
(
switch_core_session_t
*
session
,
const
char
*
file
)
{
switch_media_bug_t
*
bug
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论