Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7c440105
提交
7c440105
authored
2月 25, 2014
作者:
Marc Olivier Chouinard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-5914 --resolve
上级
9f98ccc1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
32 行增加
和
24 行删除
+32
-24
mod_json_cdr.c
src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c
+32
-24
没有找到文件。
src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c
浏览文件 @
7c440105
...
@@ -64,6 +64,7 @@ static struct {
...
@@ -64,6 +64,7 @@ static struct {
uint32_t
enable_ssl_verifyhost
;
uint32_t
enable_ssl_verifyhost
;
int
encode
;
int
encode
;
int
log_http_and_disk
;
int
log_http_and_disk
;
switch_bool_t
log_errors_to_disk
;
int
log_b
;
int
log_b
;
int
prefix_a
;
int
prefix_a
;
int
disable100continue
;
int
disable100continue
;
...
@@ -386,36 +387,40 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -386,36 +387,40 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
curl_handle
=
NULL
;
curl_handle
=
NULL
;
/* if we are here the web post failed for some reason */
/* if we are here the web post failed for some reason */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Unable to post to web server, writing to file
\n
"
);
if
(
globals
.
log_errors_to_disk
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Unable to post to web server, writing to file
\n
"
);
for
(
err_dir_index
=
0
;
err_dir_index
<
globals
.
err_dir_count
;
err_dir_index
++
)
{
for
(
err_dir_index
=
0
;
err_dir_index
<
globals
.
err_dir_count
;
err_dir_index
++
)
{
switch_thread_rwlock_rdlock
(
globals
.
log_path_lock
);
switch_thread_rwlock_rdlock
(
globals
.
log_path_lock
);
path
=
switch_mprintf
(
"%s%s%s%s.cdr.json"
,
globals
.
err_log_dir
[
err_dir_index
],
SWITCH_PATH_SEPARATOR
,
a_prefix
,
switch_core_session_get_uuid
(
session
));
path
=
switch_mprintf
(
"%s%s%s%s.cdr.json"
,
globals
.
err_log_dir
[
err_dir_index
],
SWITCH_PATH_SEPARATOR
,
a_prefix
,
switch_core_session_get_uuid
(
session
));
switch_thread_rwlock_unlock
(
globals
.
log_path_lock
);
switch_thread_rwlock_unlock
(
globals
.
log_path_lock
);
if
(
path
)
{
if
(
path
)
{
#ifdef _MSC_VER
#ifdef _MSC_VER
if
((
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRUSR
|
S_IWUSR
))
>
-
1
)
{
if
((
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRUSR
|
S_IWUSR
))
>
-
1
)
{
#else
#else
if
((
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
))
>
-
1
)
{
if
((
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
))
>
-
1
)
{
#endif
#endif
int
wrote
;
int
wrote
;
wrote
=
write
(
fd
,
json_text
,
(
unsigned
)
strlen
(
json_text
));
wrote
=
write
(
fd
,
json_text
,
(
unsigned
)
strlen
(
json_text
));
close
(
fd
);
close
(
fd
);
fd
=
-
1
;
fd
=
-
1
;
if
(
wrote
<
0
)
{
if
(
wrote
<
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error writing [%s]
\n
"
,
path
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error writing [%s]
\n
"
,
path
);
}
}
break
;
break
;
}
else
{
}
else
{
char
ebuf
[
512
]
=
{
0
};
char
ebuf
[
512
]
=
{
0
};
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open %s! [%s]
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open %s! [%s]
\n
"
,
path
,
switch_strerror_r
(
errno
,
ebuf
,
sizeof
(
ebuf
)));
path
,
switch_strerror_r
(
errno
,
ebuf
,
sizeof
(
ebuf
)));
}
}
switch_safe_free
(
path
);
switch_safe_free
(
path
);
}
}
}
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Unable to post to web server, not writing to file
\n
"
);
}
}
}
success:
success:
status
=
SWITCH_STATUS_SUCCESS
;
status
=
SWITCH_STATUS_SUCCESS
;
...
@@ -484,6 +489,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
...
@@ -484,6 +489,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
}
}
globals
.
log_http_and_disk
=
0
;
globals
.
log_http_and_disk
=
0
;
globals
.
log_errors_to_disk
=
SWITCH_TRUE
;
globals
.
log_b
=
1
;
globals
.
log_b
=
1
;
globals
.
disable100continue
=
0
;
globals
.
disable100continue
=
0
;
globals
.
pool
=
pool
;
globals
.
pool
=
pool
;
...
@@ -513,6 +519,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
...
@@ -513,6 +519,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
}
}
}
else
if
(
!
strcasecmp
(
var
,
"log-http-and-disk"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"log-http-and-disk"
))
{
globals
.
log_http_and_disk
=
switch_true
(
val
);
globals
.
log_http_and_disk
=
switch_true
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"log-errors-to-disk"
))
{
globals
.
log_errors_to_disk
=
!
switch_false
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"delay"
)
&&
!
zstr
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"delay"
)
&&
!
zstr
(
val
))
{
globals
.
delay
=
(
uint32_t
)
atoi
(
val
);
globals
.
delay
=
(
uint32_t
)
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"log-b-leg"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"log-b-leg"
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论