Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9049c004
提交
9049c004
authored
6月 15, 2015
作者:
Michael Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7572: add some events for file open/close/fail when using file_string
上级
a647b429
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
1 行删除
+25
-1
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+25
-1
没有找到文件。
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
9049c004
...
@@ -4572,18 +4572,28 @@ struct file_string_context {
...
@@ -4572,18 +4572,28 @@ struct file_string_context {
typedef
struct
file_string_context
file_string_context_t
;
typedef
struct
file_string_context
file_string_context_t
;
#define FILE_STRING_OPEN "filestring::open"
#define FILE_STRING_CLOSE "filestring::close"
#define FILE_STRING_FAIL "filestring::fail"
static
switch_status_t
next_file
(
switch_file_handle_t
*
handle
)
static
switch_status_t
next_file
(
switch_file_handle_t
*
handle
)
{
{
file_string_context_t
*
context
=
handle
->
private_info
;
file_string_context_t
*
context
=
handle
->
private_info
;
char
*
file
;
char
*
file
;
const
char
*
prefix
=
handle
->
prefix
;
const
char
*
prefix
=
handle
->
prefix
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_event_t
*
event
=
NULL
;
top:
top:
context
->
index
++
;
context
->
index
++
;
if
(
switch_test_flag
((
&
context
->
fh
),
SWITCH_FILE_OPEN
))
{
if
(
switch_test_flag
((
&
context
->
fh
),
SWITCH_FILE_OPEN
))
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FILE_STRING_CLOSE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"File"
,
context
->
argv
[(
context
->
index
-
1
)]);
switch_event_fire
(
&
event
);
}
switch_core_file_close
(
&
context
->
fh
);
switch_core_file_close
(
&
context
->
fh
);
}
}
...
@@ -4611,6 +4621,11 @@ static switch_status_t next_file(switch_file_handle_t *handle)
...
@@ -4611,6 +4621,11 @@ static switch_status_t next_file(switch_file_handle_t *handle)
if
((
p
=
strrchr
(
path
,
*
SWITCH_PATH_SEPARATOR
)))
{
if
((
p
=
strrchr
(
path
,
*
SWITCH_PATH_SEPARATOR
)))
{
*
p
=
'\0'
;
*
p
=
'\0'
;
if
(
switch_dir_make_recursive
(
path
,
SWITCH_DEFAULT_DIR_PERMS
,
handle
->
memory_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_dir_make_recursive
(
path
,
SWITCH_DEFAULT_DIR_PERMS
,
handle
->
memory_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FILE_STRING_FAIL
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"File"
,
context
->
argv
[
context
->
index
]);
switch_event_fire
(
&
event
);
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error creating %s
\n
"
,
path
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error creating %s
\n
"
,
path
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
...
@@ -4621,6 +4636,10 @@ static switch_status_t next_file(switch_file_handle_t *handle)
...
@@ -4621,6 +4636,10 @@ static switch_status_t next_file(switch_file_handle_t *handle)
}
}
if
(
switch_core_file_open
(
&
context
->
fh
,
file
,
handle
->
channels
,
handle
->
samplerate
,
handle
->
flags
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_file_open
(
&
context
->
fh
,
file
,
handle
->
channels
,
handle
->
samplerate
,
handle
->
flags
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FILE_STRING_FAIL
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"File"
,
context
->
argv
[
context
->
index
]);
switch_event_fire
(
&
event
);
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open file %s
\n
"
,
file
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open file %s
\n
"
,
file
);
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
...
@@ -4629,6 +4648,11 @@ static switch_status_t next_file(switch_file_handle_t *handle)
...
@@ -4629,6 +4648,11 @@ static switch_status_t next_file(switch_file_handle_t *handle)
goto
top
;
goto
top
;
}
}
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FILE_STRING_OPEN
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"File"
,
context
->
argv
[
context
->
index
]);
switch_event_fire
(
&
event
);
}
if
(
handle
->
dbuflen
)
{
if
(
handle
->
dbuflen
)
{
free
(
handle
->
dbuf
);
free
(
handle
->
dbuf
);
handle
->
dbuflen
=
0
;
handle
->
dbuflen
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论