Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a3e6bead
提交
a3e6bead
authored
5月 26, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FSCORE-591
上级
69b94bce
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
26 行增加
和
8 行删除
+26
-8
mod_sndfile.c
src/mod/formats/mod_sndfile/mod_sndfile.c
+1
-1
switch_ivr_async.c
src/switch_ivr_async.c
+25
-7
没有找到文件。
src/mod/formats/mod_sndfile/mod_sndfile.c
浏览文件 @
a3e6bead
...
...
@@ -300,7 +300,7 @@ static switch_status_t sndfile_file_write(switch_file_handle_t *handle, void *da
handle
->
sample_count
+=
*
len
;
return
SWITCH_STATUS_SUCCESS
;
return
sf_error
(
context
->
handle
)
==
SF_ERR_NO_ERROR
?
SWITCH_STATUS_SUCCESS
:
SWITCH_STATUS_FALSE
;
}
static
switch_status_t
sndfile_file_set_string
(
switch_file_handle_t
*
handle
,
switch_audio_col_t
col
,
const
char
*
string
)
...
...
src/switch_ivr_async.c
浏览文件 @
a3e6bead
...
...
@@ -459,6 +459,7 @@ struct record_helper {
switch_file_handle_t
*
fh
;
uint32_t
packet_len
;
int
min_sec
;
switch_bool_t
hangup_on_error
;
};
static
switch_bool_t
record_callback
(
switch_media_bug_t
*
bug
,
void
*
user_data
,
switch_abc_type_t
type
)
...
...
@@ -502,8 +503,13 @@ 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
&&
!
switch_test_flag
((
&
frame
),
SFF_CNG
))
{
len
=
(
switch_size_t
)
frame
.
datalen
/
2
;
if
(
len
)
switch_core_file_write
(
rh
->
fh
,
data
,
&
len
);
if
(
len
&&
switch_core_file_write
(
rh
->
fh
,
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
);
return
SWITCH_FALSE
;
}
}
...
...
@@ -528,8 +534,12 @@ 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
&&
!
switch_test_flag
((
&
frame
),
SFF_CNG
))
{
len
=
(
switch_size_t
)
frame
.
datalen
/
2
;
if
(
len
)
switch_core_file_write
(
rh
->
fh
,
data
,
&
len
);
if
(
len
&&
switch_core_file_write
(
rh
->
fh
,
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
);
return
SWITCH_FALSE
;
}
}
}
...
...
@@ -934,6 +944,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
switch_codec_implementation_t
read_impl
=
{
0
};
struct
record_helper
*
rh
=
NULL
;
int
file_flags
=
SWITCH_FILE_FLAG_WRITE
|
SWITCH_FILE_DATA_SHORT
;
switch_bool_t
hangup_on_error
=
SWITCH_FALSE
;
if
((
p
=
switch_channel_get_variable
(
channel
,
"RECORD_HANGUP_ON_ERROR"
)))
{
hangup_on_error
=
switch_true
(
p
);
}
switch_core_session_get_read_impl
(
session
,
&
read_impl
);
...
...
@@ -1028,8 +1043,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
if
(
switch_core_file_open
(
fh
,
file
,
channels
,
read_impl
.
actual_samples_per_second
,
file_flags
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error opening %s
\n
"
,
file
);
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_TRUE
);
if
(
hangup_on_error
)
{
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_TRUE
);
}
return
SWITCH_STATUS_GENERR
;
}
...
...
@@ -1087,7 +1104,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
}
}
rh
->
hangup_on_error
=
hangup_on_error
;
if
((
status
=
switch_core_media_bug_add
(
session
,
"session_record"
,
file
,
record_callback
,
rh
,
to
,
flags
,
&
bug
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error adding media bug for file %s
\n
"
,
file
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论