Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c50f59e3
提交
c50f59e3
authored
7月 14, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add reporting vars
上级
8ceb2a9b
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
59 行增加
和
4 行删除
+59
-4
mod_fifo.c
src/mod/applications/mod_fifo/mod_fifo.c
+59
-4
没有找到文件。
src/mod/applications/mod_fifo/mod_fifo.c
浏览文件 @
c50f59e3
...
@@ -710,6 +710,11 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
...
@@ -710,6 +710,11 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
case
SWITCH_MESSAGE_INDICATE_BRIDGE
:
case
SWITCH_MESSAGE_INDICATE_BRIDGE
:
{
{
const
char
*
col1
=
NULL
,
*
col2
=
NULL
;
const
char
*
col1
=
NULL
,
*
col2
=
NULL
;
long
epoch_start
=
0
;
char
date
[
80
]
=
""
;
switch_time_t
ts
;
switch_time_exp_t
tm
;
switch_size_t
retsize
;
if
(
switch_true
(
switch_channel_get_variable
(
channel
,
"fifo_bridged"
)))
{
if
(
switch_true
(
switch_channel_get_variable
(
channel
,
"fifo_bridged"
)))
{
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
...
@@ -760,6 +765,29 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
...
@@ -760,6 +765,29 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
epoch_start
=
(
long
)
switch_epoch_time_now
(
NULL
);
ts
=
switch_micro_time_now
();
switch_time_exp_lt
(
&
tm
,
ts
);
epoch_start
=
(
long
)
switch_epoch_time_now
(
NULL
);
switch_strftime_nocheck
(
date
,
&
retsize
,
sizeof
(
date
),
"%Y-%m-%d %T"
,
&
tm
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_status"
,
"TALKING"
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_target"
,
switch_core_session_get_uuid
(
caller_session
));
switch_channel_set_variable
(
consumer_channel
,
"fifo_timestamp"
,
date
);
switch_channel_set_variable_printf
(
consumer_channel
,
"fifo_epoch_start_bridge"
,
"%ld"
,
epoch_start
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_role"
,
"consumer"
);
switch_channel_set_variable
(
caller_channel
,
"fifo_status"
,
"TALKING"
);
switch_channel_set_variable
(
caller_channel
,
"fifo_timestamp"
,
date
);
switch_channel_set_variable_printf
(
caller_channel
,
"fifo_epoch_start_bridge"
,
"%ld"
,
epoch_start
);
switch_channel_set_variable
(
caller_channel
,
"fifo_target"
,
switch_core_session_get_uuid
(
session
));
switch_channel_set_variable
(
caller_channel
,
"fifo_role"
,
"caller"
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_role"
,
"consumer"
);
switch_channel_set_variable
(
caller_channel
,
"fifo_role"
,
"caller"
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_bridged"
,
"true"
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_bridged"
,
"true"
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_manual_bridge"
,
"true"
);
switch_channel_set_variable
(
consumer_channel
,
"fifo_manual_bridge"
,
"true"
);
...
@@ -772,6 +800,8 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
...
@@ -772,6 +800,8 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
switch_time_exp_t
tm
;
switch_time_exp_t
tm
;
switch_time_t
ts
=
switch_micro_time_now
();
switch_time_t
ts
=
switch_micro_time_now
();
switch_size_t
retsize
;
switch_size_t
retsize
;
long
epoch_start
=
0
,
epoch_end
=
0
;
const
char
*
epoch_start_a
=
NULL
;
switch_channel_set_variable
(
channel
,
"fifo_bridged"
,
NULL
);
switch_channel_set_variable
(
channel
,
"fifo_bridged"
,
NULL
);
...
@@ -789,6 +819,17 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
...
@@ -789,6 +819,17 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
switch_channel_set_variable
(
caller_channel
,
"fifo_status"
,
"DONE"
);
switch_channel_set_variable
(
caller_channel
,
"fifo_status"
,
"DONE"
);
switch_channel_set_variable
(
caller_channel
,
"fifo_timestamp"
,
date
);
switch_channel_set_variable
(
caller_channel
,
"fifo_timestamp"
,
date
);
if
((
epoch_start_a
=
switch_channel_get_variable
(
consumer_channel
,
"fifo_epoch_start_bridge"
)))
{
epoch_start
=
atol
(
epoch_start_a
);
}
epoch_end
=
(
long
)
switch_epoch_time_now
(
NULL
);
switch_channel_set_variable_printf
(
consumer_channel
,
"fifo_epoch_stop_bridge"
,
"%ld"
,
epoch_end
);
switch_channel_set_variable_printf
(
consumer_channel
,
"fifo_bridge_seconds"
,
"%d"
,
epoch_end
-
epoch_start
);
switch_channel_set_variable_printf
(
caller_channel
,
"fifo_epoch_stop_bridge"
,
"%ld"
,
epoch_end
);
switch_channel_set_variable_printf
(
caller_channel
,
"fifo_bridge_seconds"
,
"%d"
,
epoch_end
-
epoch_start
);
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FIFO_EVENT
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FIFO_EVENT
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
consumer_channel
,
event
);
switch_channel_event_set_data
(
consumer_channel
,
event
);
...
@@ -2207,6 +2248,7 @@ SWITCH_STANDARD_APP(fifo_function)
...
@@ -2207,6 +2248,7 @@ SWITCH_STANDARD_APP(fifo_function)
const
char
*
record_template
=
switch_channel_get_variable
(
channel
,
"fifo_record_template"
);
const
char
*
record_template
=
switch_channel_get_variable
(
channel
,
"fifo_record_template"
);
char
*
expanded
=
NULL
;
char
*
expanded
=
NULL
;
char
*
sql
=
NULL
;
char
*
sql
=
NULL
;
long
epoch_start
,
epoch_end
;
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FIFO_EVENT
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FIFO_EVENT
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
channel
,
event
);
switch_channel_event_set_data
(
channel
,
event
);
...
@@ -2274,14 +2316,19 @@ SWITCH_STANDARD_APP(fifo_function)
...
@@ -2274,14 +2316,19 @@ SWITCH_STANDARD_APP(fifo_function)
ts
=
switch_micro_time_now
();
ts
=
switch_micro_time_now
();
switch_time_exp_lt
(
&
tm
,
ts
);
switch_time_exp_lt
(
&
tm
,
ts
);
epoch_start
=
(
long
)
switch_epoch_time_now
(
NULL
);
switch_strftime_nocheck
(
date
,
&
retsize
,
sizeof
(
date
),
"%Y-%m-%d %T"
,
&
tm
);
switch_strftime_nocheck
(
date
,
&
retsize
,
sizeof
(
date
),
"%Y-%m-%d %T"
,
&
tm
);
switch_channel_set_variable
(
channel
,
"fifo_status"
,
"TALKING"
);
switch_channel_set_variable
(
channel
,
"fifo_status"
,
"TALKING"
);
switch_channel_set_variable
(
channel
,
"fifo_target"
,
caller_uuid
);
switch_channel_set_variable
(
channel
,
"fifo_target"
,
caller_uuid
);
switch_channel_set_variable
(
channel
,
"fifo_timestamp"
,
date
);
switch_channel_set_variable
(
channel
,
"fifo_timestamp"
,
date
);
switch_channel_set_variable_printf
(
channel
,
"fifo_epoch_start_bridge"
,
"%ld"
,
epoch_start
);
switch_channel_set_variable
(
channel
,
"fifo_role"
,
"consumer"
);
switch_channel_set_variable
(
other_channel
,
"fifo_status"
,
"TALKING"
);
switch_channel_set_variable
(
other_channel
,
"fifo_status"
,
"TALKING"
);
switch_channel_set_variable
(
other_channel
,
"fifo_timestamp"
,
date
);
switch_channel_set_variable
(
other_channel
,
"fifo_timestamp"
,
date
);
switch_channel_set_variable_printf
(
other_channel
,
"fifo_epoch_start_bridge"
,
"%ld"
,
epoch_start
);
switch_channel_set_variable
(
other_channel
,
"fifo_target"
,
switch_core_session_get_uuid
(
session
));
switch_channel_set_variable
(
other_channel
,
"fifo_target"
,
switch_core_session_get_uuid
(
session
));
switch_channel_set_variable
(
other_channel
,
"fifo_role"
,
"caller"
);
send_presence
(
node
);
send_presence
(
node
);
...
@@ -2355,6 +2402,14 @@ SWITCH_STANDARD_APP(fifo_function)
...
@@ -2355,6 +2402,14 @@ SWITCH_STANDARD_APP(fifo_function)
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
}
}
epoch_end
=
(
long
)
switch_epoch_time_now
(
NULL
);
switch_channel_set_variable_printf
(
channel
,
"fifo_epoch_stop_bridge"
,
"%ld"
,
epoch_end
);
switch_channel_set_variable_printf
(
channel
,
"fifo_bridge_seconds"
,
"%d"
,
epoch_end
-
epoch_start
);
switch_channel_set_variable_printf
(
other_channel
,
"fifo_epoch_stop_bridge"
,
"%ld"
,
epoch_end
);
switch_channel_set_variable_printf
(
other_channel
,
"fifo_bridge_seconds"
,
"%d"
,
epoch_end
-
epoch_start
);
sql
=
switch_mprintf
(
"delete from fifo_bridge where consumer_uuid='%q'"
,
switch_core_session_get_uuid
(
session
));
sql
=
switch_mprintf
(
"delete from fifo_bridge where consumer_uuid='%q'"
,
switch_core_session_get_uuid
(
session
));
fifo_execute_sql
(
sql
,
globals
.
sql_mutex
);
fifo_execute_sql
(
sql
,
globals
.
sql_mutex
);
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论