Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e0dc4842
提交
e0dc4842
authored
6月 11, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-5498
上级
ab947f5b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
30 行增加
和
11 行删除
+30
-11
switch_core.h
src/include/switch_core.h
+2
-0
switch_types.h
src/include/switch_types.h
+1
-0
switch_channel.c
src/switch_channel.c
+27
-11
没有找到文件。
src/include/switch_core.h
浏览文件 @
e0dc4842
...
...
@@ -91,6 +91,8 @@ typedef struct switch_device_stats_s {
uint32_t
active
;
uint32_t
held
;
uint32_t
hup
;
uint32_t
ringing
;
uint32_t
early
;
}
switch_device_stats_t
;
...
...
src/include/switch_types.h
浏览文件 @
e0dc4842
...
...
@@ -1115,6 +1115,7 @@ typedef enum {
typedef
enum
{
SDS_DOWN
,
SDS_RINGING
,
SDS_ACTIVE
,
SDS_ACTIVE_MULTI
,
SDS_HELD
,
...
...
src/switch_channel.c
浏览文件 @
e0dc4842
...
...
@@ -251,6 +251,7 @@ struct switch_device_state_table {
};
static
struct
switch_device_state_table
DEVICE_STATE_CHART
[]
=
{
{
"DOWN"
,
SDS_DOWN
},
{
"RINGING"
,
SDS_RINGING
},
{
"ACTIVE"
,
SDS_ACTIVE
},
{
"ACTIVE_MULTI"
,
SDS_ACTIVE_MULTI
},
{
"HELD"
,
SDS_HELD
},
...
...
@@ -274,6 +275,8 @@ SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *chan
switch_log_printf
(
SWITCH_CHANNEL_ID_LOG
,
file
,
func
,
line
,
switch_channel_get_uuid
(
channel
),
SWITCH_LOG_DEBUG
,
"(%s) Callstate Change %s -> %s
\n
"
,
channel
->
name
,
switch_channel_callstate2str
(
o_callstate
),
switch_channel_callstate2str
(
callstate
));
switch_channel_check_device_state
(
channel
,
channel
->
callstate
);
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_CALLSTATE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Original-Channel-Call-State"
,
switch_channel_callstate2str
(
o_callstate
));
...
...
@@ -1741,7 +1744,6 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw
const
char
*
brto
=
switch_channel_get_partner_uuid
(
channel
);
switch_channel_set_callstate
(
channel
,
CCS_HELD
);
switch_channel_check_device_state
(
channel
,
CCS_HELD
);
switch_mutex_lock
(
channel
->
profile_mutex
);
channel
->
caller_profile
->
times
->
last_hold
=
switch_time_now
();
...
...
@@ -1900,8 +1902,7 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch
switch_mutex_unlock
(
channel
->
flag_mutex
);
if
(
ACTIVE
)
{
switch_channel_set_callstate
(
channel
,
CCS_ACTIVE
);
switch_channel_check_device_state
(
channel
,
CCS_UNHOLD
);
switch_channel_set_callstate
(
channel
,
CCS_UNHOLD
);
switch_mutex_lock
(
channel
->
profile_mutex
);
if
(
channel
->
caller_profile
->
times
->
last_hold
)
{
channel
->
caller_profile
->
times
->
hold_accum
+=
(
switch_time_now
()
-
channel
->
caller_profile
->
times
->
last_hold
);
...
...
@@ -4591,7 +4592,13 @@ static void fetch_device_stats(switch_device_record_t *drec)
if
(
np
->
callstate
==
CCS_HELD
)
{
drec
->
stats
.
held
++
;
}
else
{
drec
->
stats
.
active
++
;
if
(
np
->
callstate
==
CCS_EARLY
)
{
drec
->
stats
.
early
++
;
}
else
if
(
np
->
callstate
==
CCS_RINGING
)
{
drec
->
stats
.
ringing
++
;
}
else
{
drec
->
stats
.
active
++
;
}
}
}
else
{
drec
->
stats
.
hup
++
;
...
...
@@ -4701,8 +4708,6 @@ static void process_device_hup(switch_channel_t *channel)
switch_channel_set_flag
(
channel
,
CF_FINAL_DEVICE_LEG
);
}
switch_channel_check_device_state
(
channel
,
CCS_HANGUP
);
channel
->
device_node
->
parent
->
refs
--
;
switch_mutex_unlock
(
globals
.
device_mutex
);
...
...
@@ -4729,8 +4734,16 @@ static void switch_channel_check_device_state(switch_channel_t *channel, switch_
if
(
drec
->
stats
.
offhook
==
0
)
{
drec
->
state
=
SDS_HANGUP
;
}
else
{
if
(
drec
->
stats
.
active
==
0
&&
drec
->
stats
.
held
>
0
)
{
drec
->
state
=
SDS_HELD
;
if
(
drec
->
stats
.
active
==
0
)
{
if
((
drec
->
stats
.
ringing
+
drec
->
stats
.
early
)
>
0
)
{
drec
->
state
=
SDS_RINGING
;
}
else
{
if
(
drec
->
stats
.
held
>
0
)
{
drec
->
state
=
SDS_HELD
;
}
else
{
drec
->
state
=
SDS_DOWN
;
}
}
}
else
if
(
drec
->
stats
.
active
==
1
)
{
drec
->
state
=
SDS_ACTIVE
;
}
else
{
...
...
@@ -4772,7 +4785,7 @@ static void switch_channel_check_device_state(switch_channel_t *channel, switch_
}
switch_log_printf
(
SWITCH_CHANNEL_CHANNEL_LOG
(
channel
),
SWITCH_LOG_DEBUG1
,
"%s device: %s
\n
State: %s Dev State: %s/%s Total:%u Offhook:%u Active:%u Held:%u Hungup:%u Dur: %u %s
\n
"
,
"%s device: %s
\n
State: %s Dev State: %s/%s Total:%u Offhook:%u
Ringing:%u Early:%u
Active:%u Held:%u Hungup:%u Dur: %u %s
\n
"
,
switch_channel_get_name
(
channel
),
drec
->
device_id
,
switch_channel_callstate2str
(
callstate
),
...
...
@@ -4780,6 +4793,8 @@ static void switch_channel_check_device_state(switch_channel_t *channel, switch_
switch_channel_device_state2str
(
drec
->
state
),
drec
->
stats
.
total
,
drec
->
stats
.
offhook
,
drec
->
stats
.
ringing
,
drec
->
stats
.
early
,
drec
->
stats
.
active
,
drec
->
stats
.
held
,
drec
->
stats
.
hup
,
...
...
@@ -4823,6 +4838,7 @@ static void add_uuid(switch_device_record_t *drec, switch_channel_t *channel)
node
->
uuid
=
switch_core_strdup
(
drec
->
pool
,
switch_core_session_get_uuid
(
channel
->
session
));
node
->
parent
=
drec
;
node
->
callstate
=
channel
->
callstate
;
channel
->
device_node
=
node
;
if
(
!
drec
->
uuid_list
)
{
...
...
@@ -4878,8 +4894,8 @@ SWITCH_DECLARE(const char *) switch_channel_set_device_id(switch_channel_t *chan
switch_log_printf
(
SWITCH_CHANNEL_CHANNEL_LOG
(
channel
),
SWITCH_LOG_DEBUG
,
"Setting DEVICE ID to [%s]
\n
"
,
device_id
);
switch_channel_check_device_state
(
channel
,
CCS_ACTIVE
);
switch_channel_check_device_state
(
channel
,
channel
->
callstate
);
return
device_id
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论