Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c2893801
提交
c2893801
authored
9月 07, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add timestamps for on and off hold times to put in xml cdrs
上级
e2544415
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
75 行增加
和
2 行删除
+75
-2
switch_channel.h
src/include/switch_channel.h
+1
-0
switch_core.h
src/include/switch_core.h
+10
-0
switch_channel.c
src/switch_channel.c
+31
-0
switch_ivr.c
src/switch_ivr.c
+33
-2
没有找到文件。
src/include/switch_channel.h
浏览文件 @
c2893801
...
...
@@ -642,6 +642,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel,
SWITCH_DECLARE
(
switch_caller_extension_t
*
)
switch_channel_get_queued_extension
(
switch_channel_t
*
channel
);
SWITCH_DECLARE
(
void
)
switch_channel_transfer_to_extension
(
switch_channel_t
*
channel
,
switch_caller_extension_t
*
caller_extension
);
SWITCH_DECLARE
(
const
char
*
)
switch_channel_get_partner_uuid
(
switch_channel_t
*
channel
);
SWITCH_DECLARE
(
switch_hold_record_t
*
)
switch_channel_get_hold_record
(
switch_channel_t
*
channel
);
SWITCH_END_EXTERN_C
#endif
...
...
src/include/switch_core.h
浏览文件 @
c2893801
...
...
@@ -61,6 +61,16 @@ struct switch_app_log {
struct
switch_app_log
*
next
;
};
typedef
struct
switch_hold_record_s
{
switch_time_t
on
;
switch_time_t
off
;
char
*
uuid
;
struct
switch_hold_record_s
*
next
;
}
switch_hold_record_t
;
#define MESSAGE_STAMP_FFL(_m) _m->_file = __FILE__; _m->_func = __SWITCH_FUNC__; _m->_line = __LINE__
#define MESSAGE_STRING_ARG_MAX 10
...
...
src/switch_channel.c
浏览文件 @
c2893801
...
...
@@ -155,8 +155,13 @@ struct switch_channel {
switch_event_t
*
app_list
;
switch_event_t
*
api_list
;
switch_event_t
*
var_list
;
switch_hold_record_t
*
hold_record
;
};
SWITCH_DECLARE
(
switch_hold_record_t
*
)
switch_channel_get_hold_record
(
switch_channel_t
*
channel
)
{
return
channel
->
hold_record
;
}
SWITCH_DECLARE
(
const
char
*
)
switch_channel_cause2str
(
switch_call_cause_t
cause
)
{
...
...
@@ -1611,9 +1616,24 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw
switch_mutex_unlock
(
channel
->
flag_mutex
);
if
(
HELD
)
{
switch_hold_record_t
*
hr
;
const
char
*
brto
=
switch_channel_get_partner_uuid
(
channel
);
switch_channel_set_callstate
(
channel
,
CCS_HELD
);
switch_mutex_lock
(
channel
->
profile_mutex
);
channel
->
caller_profile
->
times
->
last_hold
=
switch_time_now
();
hr
=
switch_core_session_alloc
(
channel
->
session
,
sizeof
(
*
hr
));
hr
->
on
=
switch_time_now
();
if
(
brto
)
{
hr
->
uuid
=
switch_core_session_strdup
(
channel
->
session
,
brto
);
}
if
(
channel
->
hold_record
)
{
hr
->
next
=
channel
->
hold_record
;
}
channel
->
hold_record
=
hr
;
switch_mutex_unlock
(
channel
->
profile_mutex
);
}
...
...
@@ -1763,6 +1783,11 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch
if
(
channel
->
caller_profile
->
times
->
last_hold
)
{
channel
->
caller_profile
->
times
->
hold_accum
+=
(
switch_time_now
()
-
channel
->
caller_profile
->
times
->
last_hold
);
}
if
(
channel
->
hold_record
)
{
channel
->
hold_record
->
off
=
switch_time_now
();
}
switch_mutex_unlock
(
channel
->
profile_mutex
);
}
...
...
@@ -2905,6 +2930,12 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
switch_event_t
*
event
;
const
char
*
var
;
switch_mutex_lock
(
channel
->
profile_mutex
);
if
(
channel
->
hold_record
&&
!
channel
->
hold_record
->
off
)
{
channel
->
hold_record
->
off
=
switch_time_now
();
}
switch_mutex_unlock
(
channel
->
profile_mutex
);
switch_mutex_lock
(
channel
->
state_mutex
);
last_state
=
channel
->
state
;
channel
->
state
=
CS_HANGUP
;
...
...
src/switch_ivr.c
浏览文件 @
c2893801
...
...
@@ -2195,11 +2195,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_caller_profile_t
*
caller_profile
;
switch_xml_t
variables
,
cdr
,
x_main_cp
,
x_caller_profile
,
x_caller_extension
,
x_times
,
time_tag
,
x_application
,
x_callflow
,
x_inner_extension
,
x_apps
,
x_o
,
x_channel_data
,
x_field
;
x_application
,
x_callflow
,
x_inner_extension
,
x_apps
,
x_o
,
x_channel_data
,
x_field
,
xhr
,
x_hold
;
switch_app_log_t
*
app_log
;
char
tmp
[
512
],
*
f
;
int
cdr_off
=
0
,
v_off
=
0
,
cd_off
=
0
;
switch_hold_record_t
*
hold_record
=
switch_channel_get_hold_record
(
channel
),
*
hr
;
if
(
*
xml_cdr
)
{
cdr
=
*
xml_cdr
;
}
else
{
...
...
@@ -2266,6 +2267,36 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
}
}
if
(
hold_record
)
{
int
cf_off
=
0
;
if
(
!
(
xhr
=
switch_xml_add_child_d
(
cdr
,
"hold-record"
,
cdr_off
++
)))
{
goto
error
;
}
for
(
hr
=
hold_record
;
hr
;
hr
=
hr
->
next
)
{
char
*
t
=
tmp
;
if
(
!
(
x_hold
=
switch_xml_add_child_d
(
xhr
,
"hold"
,
cf_off
++
)))
{
goto
error
;
}
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%"
SWITCH_TIME_T_FMT
,
hr
->
on
);
switch_xml_set_attr_d
(
x_hold
,
"on"
,
t
);
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%"
SWITCH_TIME_T_FMT
,
hr
->
off
);
switch_xml_set_attr_d
(
x_hold
,
"off"
,
t
);
if
(
hr
->
uuid
)
{
switch_xml_set_attr_d
(
x_hold
,
"bridged-to"
,
hr
->
uuid
);
}
}
}
caller_profile
=
switch_channel_get_caller_profile
(
channel
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论