Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
18299684
提交
18299684
authored
12月 08, 2010
作者:
Moises Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
freetdm: added core command to print channels by flag
上级
315441d2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
62 行增加
和
0 行删除
+62
-0
ftdm_io.c
libs/freetdm/src/ftdm_io.c
+61
-0
ftdm_types.h
libs/freetdm/src/include/private/ftdm_types.h
+1
-0
没有找到文件。
libs/freetdm/src/ftdm_io.c
浏览文件 @
18299684
...
@@ -4073,6 +4073,52 @@ static struct {
...
@@ -4073,6 +4073,52 @@ static struct {
ftdm_io_interface_t
*
pika_interface
;
ftdm_io_interface_t
*
pika_interface
;
}
interfaces
;
}
interfaces
;
static
void
print_channels_by_flag
(
ftdm_stream_handle_t
*
stream
,
uint32_t
flag
,
int
not
,
int
*
count
)
{
ftdm_hash_iterator_t
*
i
=
NULL
;
ftdm_span_t
*
span
;
ftdm_channel_t
*
fchan
=
NULL
;
ftdm_iterator_t
*
citer
=
NULL
;
ftdm_iterator_t
*
curr
=
NULL
;
const
void
*
key
=
NULL
;
void
*
val
=
NULL
;
*
count
=
0
;
ftdm_mutex_lock
(
globals
.
mutex
);
for
(
i
=
hashtable_first
(
globals
.
span_hash
);
i
;
i
=
hashtable_next
(
i
))
{
hashtable_this
(
i
,
&
key
,
NULL
,
&
val
);
if
(
!
key
||
!
val
)
{
break
;
}
span
=
val
;
citer
=
ftdm_span_get_chan_iterator
(
span
,
NULL
);
if
(
!
citer
)
{
continue
;
}
for
(
curr
=
citer
;
curr
;
curr
=
ftdm_iterator_next
(
curr
))
{
fchan
=
ftdm_iterator_current
(
curr
);
if
(
not
&&
!
ftdm_test_flag
(
fchan
,
flag
))
{
stream
->
write_function
(
stream
,
"[s%dc%d][%d:%d] has not flag %d
\n
"
,
fchan
->
span_id
,
fchan
->
chan_id
,
fchan
->
physical_span_id
,
fchan
->
physical_chan_id
,
flag
);
(
*
count
)
++
;
}
else
if
(
!
not
&&
ftdm_test_flag
(
fchan
,
flag
))
{
stream
->
write_function
(
stream
,
"[s%dc%d][%d:%d] has flag %d
\n
"
,
fchan
->
span_id
,
fchan
->
chan_id
,
fchan
->
physical_span_id
,
fchan
->
physical_chan_id
,
flag
);
(
*
count
)
++
;
}
}
ftdm_iterator_free
(
citer
);
}
ftdm_mutex_unlock
(
globals
.
mutex
);
}
static
void
print_channels_by_state
(
ftdm_stream_handle_t
*
stream
,
ftdm_channel_state_t
state
,
int
not
,
int
*
count
)
static
void
print_channels_by_state
(
ftdm_stream_handle_t
*
stream
,
ftdm_channel_state_t
state
,
int
not
,
int
*
count
)
{
{
ftdm_hash_iterator_t
*
i
=
NULL
;
ftdm_hash_iterator_t
*
i
=
NULL
;
...
@@ -4125,6 +4171,8 @@ static char *handle_core_command(const char *cmd)
...
@@ -4125,6 +4171,8 @@ static char *handle_core_command(const char *cmd)
int
not
=
0
;
int
not
=
0
;
char
*
argv
[
10
]
=
{
0
};
char
*
argv
[
10
]
=
{
0
};
char
*
state
=
NULL
;
char
*
state
=
NULL
;
char
*
flag
=
NULL
;
uint32_t
flagval
=
0
;
ftdm_channel_state_t
i
=
FTDM_CHANNEL_STATE_INVALID
;
ftdm_channel_state_t
i
=
FTDM_CHANNEL_STATE_INVALID
;
ftdm_stream_handle_t
stream
=
{
0
};
ftdm_stream_handle_t
stream
=
{
0
};
...
@@ -4159,6 +4207,19 @@ static char *handle_core_command(const char *cmd)
...
@@ -4159,6 +4207,19 @@ static char *handle_core_command(const char *cmd)
}
}
print_channels_by_state
(
&
stream
,
i
,
not
,
&
count
);
print_channels_by_state
(
&
stream
,
i
,
not
,
&
count
);
stream
.
write_function
(
&
stream
,
"
\n
Total channels %s %s: %d
\n
"
,
not
?
"not in state"
:
"in state"
,
ftdm_channel_state2str
(
i
),
count
);
stream
.
write_function
(
&
stream
,
"
\n
Total channels %s %s: %d
\n
"
,
not
?
"not in state"
:
"in state"
,
ftdm_channel_state2str
(
i
),
count
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"flag"
))
{
if
(
argc
<
2
)
{
stream
.
write_function
(
&
stream
,
"core state command requires an argument
\n
"
);
goto
done
;
}
flag
=
argv
[
1
];
if
(
argv
[
1
][
0
]
==
'!'
)
{
not
=
1
;
flag
++
;
}
flagval
=
atoi
(
flag
);
print_channels_by_flag
(
&
stream
,
flagval
,
not
,
&
count
);
stream
.
write_function
(
&
stream
,
"
\n
Total channels %s %s: %d
\n
"
,
not
?
"without flag"
:
"with flag"
,
flagval
,
count
);
}
else
{
}
else
{
stream
.
write_function
(
&
stream
,
"invalid core command %s
\n
"
,
argv
[
0
]);
stream
.
write_function
(
&
stream
,
"invalid core command %s
\n
"
,
argv
[
0
]);
}
}
...
...
libs/freetdm/src/include/private/ftdm_types.h
浏览文件 @
18299684
...
@@ -266,6 +266,7 @@ typedef enum {
...
@@ -266,6 +266,7 @@ typedef enum {
FTDM_CHANNEL_USER_HANGUP
=
(
1
<<
29
),
FTDM_CHANNEL_USER_HANGUP
=
(
1
<<
29
),
FTDM_CHANNEL_RX_DISABLED
=
(
1
<<
30
),
FTDM_CHANNEL_RX_DISABLED
=
(
1
<<
30
),
FTDM_CHANNEL_TX_DISABLED
=
(
1
<<
31
),
FTDM_CHANNEL_TX_DISABLED
=
(
1
<<
31
),
/* ok, when we reach 32, we need to move to uint64_t all the flag stuff */
}
ftdm_channel_flag_t
;
}
ftdm_channel_flag_t
;
#if defined(__cplusplus) && defined(WIN32)
#if defined(__cplusplus) && defined(WIN32)
// fix C2676
// fix C2676
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论