Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b4a3455a
提交
b4a3455a
authored
10月 29, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fifo tweaks for tracking user count
上级
40c10532
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
57 行增加
和
7 行删除
+57
-7
mod_fifo.c
src/mod/applications/mod_fifo/mod_fifo.c
+57
-7
没有找到文件。
src/mod/applications/mod_fifo/mod_fifo.c
浏览文件 @
b4a3455a
...
@@ -1067,7 +1067,7 @@ static void do_unbridge(switch_core_session_t *consumer_session, switch_core_ses
...
@@ -1067,7 +1067,7 @@ static void do_unbridge(switch_core_session_t *consumer_session, switch_core_ses
switch_channel_event_set_data
(
consumer_channel
,
event
);
switch_channel_event_set_data
(
consumer_channel
,
event
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
MANUAL_QUEUE_NAME
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
MANUAL_QUEUE_NAME
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"bridge-consumer-stop"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"bridge-consumer-stop"
);
if
(
use_count
)
{
if
(
outbound_id
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Outbound-ID"
,
outbound_id
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Outbound-ID"
,
outbound_id
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Use-Count"
,
"%d"
,
use_count
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Use-Count"
,
"%d"
,
use_count
);
}
}
...
@@ -2218,7 +2218,7 @@ SWITCH_STANDARD_API(fifo_add_outbound_function)
...
@@ -2218,7 +2218,7 @@ SWITCH_STANDARD_API(fifo_add_outbound_function)
}
}
static
void
dec_use_count
(
switch_core_session_t
*
session
,
switch_bool_t
send_event
)
static
void
dec_use_count
(
switch_core_session_t
*
session
,
const
char
*
type
)
{
{
char
*
sql
;
char
*
sql
;
const
char
*
outbound_id
=
NULL
;
const
char
*
outbound_id
=
NULL
;
...
@@ -2226,8 +2226,6 @@ static void dec_use_count(switch_core_session_t *session, switch_bool_t send_eve
...
@@ -2226,8 +2226,6 @@ static void dec_use_count(switch_core_session_t *session, switch_bool_t send_eve
long
now
=
(
long
)
switch_epoch_time_now
(
NULL
);
long
now
=
(
long
)
switch_epoch_time_now
(
NULL
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
do_unbridge
(
session
,
NULL
);
if
((
outbound_id
=
switch_channel_get_variable
(
channel
,
"fifo_outbound_uuid"
)))
{
if
((
outbound_id
=
switch_channel_get_variable
(
channel
,
"fifo_outbound_uuid"
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s untracking call on uuid %s!
\n
"
,
switch_channel_get_name
(
channel
),
outbound_id
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s untracking call on uuid %s!
\n
"
,
switch_channel_get_name
(
channel
),
outbound_id
);
...
@@ -2242,11 +2240,14 @@ static void dec_use_count(switch_core_session_t *session, switch_bool_t send_eve
...
@@ -2242,11 +2240,14 @@ static void dec_use_count(switch_core_session_t *session, switch_bool_t send_eve
fifo_dec_use_count
(
outbound_id
);
fifo_dec_use_count
(
outbound_id
);
}
}
if
(
send_event
)
{
do_unbridge
(
session
,
NULL
);
if
(
type
)
{
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
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
MANUAL_QUEUE_NAME
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
MANUAL_QUEUE_NAME
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"channel-consumer-stop"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"channel-consumer-stop"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Type"
,
type
);
if
(
outbound_id
)
{
if
(
outbound_id
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Outbound-ID"
,
outbound_id
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Outbound-ID"
,
outbound_id
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Use-Count"
,
"%d"
,
fifo_get_use_count
(
outbound_id
));
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Use-Count"
,
"%d"
,
fifo_get_use_count
(
outbound_id
));
...
@@ -2262,7 +2263,7 @@ static switch_status_t hanguphook(switch_core_session_t *session)
...
@@ -2262,7 +2263,7 @@ static switch_status_t hanguphook(switch_core_session_t *session)
switch_channel_state_t
state
=
switch_channel_get_state
(
channel
);
switch_channel_state_t
state
=
switch_channel_get_state
(
channel
);
if
(
state
>=
CS_HANGUP
&&
!
switch_channel_test_app_flag_key
(
FIFO_APP_KEY
,
channel
,
FIFO_APP_DID_HOOK
))
{
if
(
state
>=
CS_HANGUP
&&
!
switch_channel_test_app_flag_key
(
FIFO_APP_KEY
,
channel
,
FIFO_APP_DID_HOOK
))
{
dec_use_count
(
session
,
SWITCH_TRUE
);
dec_use_count
(
session
,
"manual"
);
switch_core_event_hook_remove_state_change
(
session
,
hanguphook
);
switch_core_event_hook_remove_state_change
(
session
,
hanguphook
);
switch_channel_set_app_flag_key
(
FIFO_APP_KEY
,
channel
,
FIFO_APP_DID_HOOK
);
switch_channel_set_app_flag_key
(
FIFO_APP_KEY
,
channel
,
FIFO_APP_DID_HOOK
);
}
}
...
@@ -2325,6 +2326,9 @@ SWITCH_STANDARD_APP(fifo_track_call_function)
...
@@ -2325,6 +2326,9 @@ SWITCH_STANDARD_APP(fifo_track_call_function)
switch_channel_event_set_data
(
channel
,
event
);
switch_channel_event_set_data
(
channel
,
event
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
MANUAL_QUEUE_NAME
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
MANUAL_QUEUE_NAME
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"channel-consumer-start"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"channel-consumer-start"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Outbound-ID"
,
data
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Use-Count"
,
"%d"
,
fifo_get_use_count
(
data
));
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Type"
,
"manual"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Caller-CID-Name"
,
cid_name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Caller-CID-Name"
,
cid_name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Caller-CID-Number"
,
cid_number
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Caller-CID-Number"
,
cid_number
);
switch_event_fire
(
&
event
);
switch_event_fire
(
&
event
);
...
@@ -2729,16 +2733,33 @@ SWITCH_STANDARD_APP(fifo_function)
...
@@ -2729,16 +2733,33 @@ SWITCH_STANDARD_APP(fifo_function)
const
char
*
url
=
NULL
;
const
char
*
url
=
NULL
;
const
char
*
caller_uuid
=
NULL
;
const
char
*
caller_uuid
=
NULL
;
const
char
*
outbound_id
=
switch_channel_get_variable
(
channel
,
"fifo_outbound_uuid"
);
const
char
*
outbound_id
=
switch_channel_get_variable
(
channel
,
"fifo_outbound_uuid"
);
switch_event_t
*
event
;
const
char
*
cid_name
=
NULL
,
*
cid_number
=
NULL
;
//const char *track_use_count = switch_channel_get_variable(channel, "fifo_track_use_count");
//const char *track_use_count = switch_channel_get_variable(channel, "fifo_track_use_count");
//int do_track = switch_true(track_use_count);
//int do_track = switch_true(track_use_count);
if
(
switch_core_event_hook_remove_receive_message
(
session
,
messagehook
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_event_hook_remove_receive_message
(
session
,
messagehook
)
==
SWITCH_STATUS_SUCCESS
)
{
dec_use_count
(
session
,
SWITCH_FALSE
);
dec_use_count
(
session
,
NULL
);
switch_core_event_hook_remove_state_change
(
session
,
hanguphook
);
switch_core_event_hook_remove_state_change
(
session
,
hanguphook
);
switch_channel_clear_app_flag_key
(
FIFO_APP_KEY
,
channel
,
FIFO_APP_TRACKING
);
switch_channel_clear_app_flag_key
(
FIFO_APP_KEY
,
channel
,
FIFO_APP_TRACKING
);
}
}
if
(
switch_channel_direction
(
channel
)
==
SWITCH_CALL_DIRECTION_INBOUND
)
{
cid_name
=
switch_channel_get_variable
(
channel
,
"callee_id_name"
);
cid_number
=
switch_channel_get_variable
(
channel
,
"callee_id_number"
);
if
(
!
cid_name
)
{
cid_name
=
switch_channel_get_variable
(
channel
,
"destination_number"
);
}
if
(
!
cid_number
)
{
cid_number
=
cid_name
;
}
}
else
{
cid_name
=
switch_channel_get_variable
(
channel
,
"caller_id_name"
);
cid_number
=
switch_channel_get_variable
(
channel
,
"caller_id_number"
);
}
if
(
!
zstr
(
strat_str
))
{
if
(
!
zstr
(
strat_str
))
{
if
(
!
strcasecmp
(
strat_str
,
"more_ppl"
))
{
if
(
!
strcasecmp
(
strat_str
,
"more_ppl"
))
{
strat
=
STRAT_MORE_PPL
;
strat
=
STRAT_MORE_PPL
;
...
@@ -3148,6 +3169,22 @@ SWITCH_STANDARD_APP(fifo_function)
...
@@ -3148,6 +3169,22 @@ SWITCH_STANDARD_APP(fifo_function)
}
}
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FIFO_EVENT
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
channel
,
event
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
argv
[
0
]);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"channel-consumer-start"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Type"
,
"onhook"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Caller-CID-Name"
,
cid_name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Caller-CID-Number"
,
cid_number
);
if
(
outbound_id
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Outbound-ID"
,
outbound_id
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Use-Count"
,
"%d"
,
fifo_get_use_count
(
outbound_id
));
}
switch_event_fire
(
&
event
);
}
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
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
argv
[
0
]);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
argv
[
0
]);
...
@@ -3221,6 +3258,19 @@ SWITCH_STANDARD_APP(fifo_function)
...
@@ -3221,6 +3258,19 @@ SWITCH_STANDARD_APP(fifo_function)
}
}
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
FIFO_EVENT
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
channel
,
event
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Name"
,
arg_fifo_name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Action"
,
"channel-consumer-stop"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Type"
,
"onhook"
);
if
(
outbound_id
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Outbound-ID"
,
outbound_id
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"FIFO-Consumer-Use-Count"
,
"%d"
,
fifo_get_use_count
(
outbound_id
));
}
switch_event_fire
(
&
event
);
}
del_bridge_call
(
switch_core_session_get_uuid
(
session
));
del_bridge_call
(
switch_core_session_get_uuid
(
session
));
del_bridge_call
(
switch_core_session_get_uuid
(
other_session
));
del_bridge_call
(
switch_core_session_get_uuid
(
other_session
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论