Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
aa69927b
提交
aa69927b
authored
12月 18, 2010
作者:
Moises Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
freetdm: OPENZAP-124 - Add round robin hunting direction (Patched by Ric)
上级
a1a50c87
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
48 行增加
和
2 行删除
+48
-2
mod_freetdm.c
libs/freetdm/mod_freetdm/mod_freetdm.c
+4
-0
ftdm_io.c
libs/freetdm/src/ftdm_io.c
+40
-1
freetdm.h
libs/freetdm/src/include/freetdm.h
+3
-1
ftdm_core.h
libs/freetdm/src/include/private/ftdm_core.h
+1
-0
没有找到文件。
libs/freetdm/mod_freetdm/mod_freetdm.c
浏览文件 @
aa69927b
...
@@ -1136,6 +1136,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
...
@@ -1136,6 +1136,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
direction
=
FTDM_BOTTOM_UP
;
direction
=
FTDM_BOTTOM_UP
;
}
else
if
(
*
argv
[
1
]
==
'a'
)
{
}
else
if
(
*
argv
[
1
]
==
'a'
)
{
direction
=
FTDM_TOP_DOWN
;
direction
=
FTDM_TOP_DOWN
;
}
else
if
(
*
argv
[
1
]
==
'r'
)
{
direction
=
FTDM_RR_DOWN
;
}
else
if
(
*
argv
[
1
]
==
'R'
)
{
direction
=
FTDM_RR_UP
;
}
else
{
}
else
{
chan_id
=
atoi
(
argv
[
1
]);
chan_id
=
atoi
(
argv
[
1
]);
}
}
...
...
libs/freetdm/src/ftdm_io.c
浏览文件 @
aa69927b
...
@@ -1706,6 +1706,21 @@ static ftdm_status_t __inline__ get_best_rated(ftdm_channel_t **fchan, ftdm_chan
...
@@ -1706,6 +1706,21 @@ static ftdm_status_t __inline__ get_best_rated(ftdm_channel_t **fchan, ftdm_chan
return
FTDM_SUCCESS
;
return
FTDM_SUCCESS
;
}
}
static
uint32_t
__inline__
rr_next
(
uint32_t
last
,
uint32_t
min
,
uint32_t
max
,
ftdm_direction_t
direction
)
{
uint32_t
next
=
min
;
ftdm_log
(
FTDM_LOG_DEBUG
,
"last = %d, min = %d, max = %d
\n
"
,
last
,
min
,
max
);
if
(
direction
==
FTDM_RR_DOWN
)
{
next
=
(
last
>=
max
)
?
min
:
++
last
;
}
else
{
next
=
(
last
<=
min
)
?
max
:
--
last
;
}
return
next
;
}
FT_DECLARE
(
int
)
ftdm_channel_get_availability
(
ftdm_channel_t
*
ftdmchan
)
FT_DECLARE
(
int
)
ftdm_channel_get_availability
(
ftdm_channel_t
*
ftdmchan
)
{
{
int
availability
=
-
1
;
int
availability
=
-
1
;
...
@@ -1748,6 +1763,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir
...
@@ -1748,6 +1763,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir
if
(
direction
==
FTDM_TOP_DOWN
)
{
if
(
direction
==
FTDM_TOP_DOWN
)
{
i
=
0
;
i
=
0
;
}
else
if
(
direction
==
FTDM_RR_DOWN
||
direction
==
FTDM_RR_UP
)
{
i
=
rr_next
(
group
->
last_used_index
,
0
,
group
->
chan_count
-
1
,
direction
);
}
else
{
}
else
{
i
=
group
->
chan_count
-
1
;
i
=
group
->
chan_count
-
1
;
}
}
...
@@ -1762,16 +1779,24 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir
...
@@ -1762,16 +1779,24 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir
if
(
request_voice_channel
(
check
,
ftdmchan
,
caller_data
,
direction
))
{
if
(
request_voice_channel
(
check
,
ftdmchan
,
caller_data
,
direction
))
{
status
=
FTDM_SUCCESS
;
status
=
FTDM_SUCCESS
;
if
(
direction
==
FTDM_RR_UP
||
direction
==
FTDM_RR_DOWN
)
{
group
->
last_used_index
=
i
;
}
break
;
break
;
}
}
calculate_best_rate
(
check
,
&
best_rated
,
&
best_rate
);
calculate_best_rate
(
check
,
&
best_rated
,
&
best_rate
);
if
(
direction
==
FTDM_TOP_DOWN
)
{
if
(
direction
==
FTDM_TOP_DOWN
)
{
if
(
i
>=
group
->
chan_count
)
{
if
(
i
>=
(
group
->
chan_count
-
1
)
)
{
break
;
break
;
}
}
i
++
;
i
++
;
}
else
if
(
direction
==
FTDM_RR_DOWN
||
direction
==
FTDM_RR_UP
)
{
if
(
check
==
best_rated
)
{
group
->
last_used_index
=
i
;
}
i
=
rr_next
(
i
,
0
,
group
->
chan_count
-
1
,
direction
);
}
else
{
}
else
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
break
;
break
;
...
@@ -1850,6 +1875,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
...
@@ -1850,6 +1875,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
if
(
direction
==
FTDM_TOP_DOWN
)
{
if
(
direction
==
FTDM_TOP_DOWN
)
{
i
=
1
;
i
=
1
;
}
else
if
(
direction
==
FTDM_RR_DOWN
||
direction
==
FTDM_RR_UP
)
{
i
=
rr_next
(
span
->
last_used_index
,
1
,
span
->
chan_count
,
direction
);
}
else
{
}
else
{
i
=
span
->
chan_count
;
i
=
span
->
chan_count
;
}
}
...
@@ -1860,6 +1887,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
...
@@ -1860,6 +1887,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
if
(
i
>
span
->
chan_count
)
{
if
(
i
>
span
->
chan_count
)
{
break
;
break
;
}
}
}
else
if
(
direction
==
FTDM_RR_DOWN
||
direction
==
FTDM_RR_UP
)
{
if
(
i
==
span
->
last_used_index
)
{
break
;
}
}
else
{
}
else
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
break
;
break
;
...
@@ -1873,6 +1904,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
...
@@ -1873,6 +1904,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
if
(
request_voice_channel
(
check
,
ftdmchan
,
caller_data
,
direction
))
{
if
(
request_voice_channel
(
check
,
ftdmchan
,
caller_data
,
direction
))
{
status
=
FTDM_SUCCESS
;
status
=
FTDM_SUCCESS
;
if
(
direction
==
FTDM_RR_UP
||
direction
==
FTDM_RR_DOWN
)
{
span
->
last_used_index
=
i
;
}
break
;
break
;
}
}
...
@@ -1880,6 +1914,11 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
...
@@ -1880,6 +1914,11 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc
if
(
direction
==
FTDM_TOP_DOWN
)
{
if
(
direction
==
FTDM_TOP_DOWN
)
{
i
++
;
i
++
;
}
else
if
(
direction
==
FTDM_RR_DOWN
||
direction
==
FTDM_RR_UP
)
{
if
(
check
==
best_rated
)
{
span
->
last_used_index
=
i
;
}
i
=
rr_next
(
i
,
1
,
span
->
chan_count
,
direction
);
}
else
{
}
else
{
i
--
;
i
--
;
}
}
...
...
libs/freetdm/src/include/freetdm.h
浏览文件 @
aa69927b
...
@@ -144,7 +144,9 @@ typedef enum {
...
@@ -144,7 +144,9 @@ typedef enum {
/*! \brief Hunting direction (when hunting for free channels) */
/*! \brief Hunting direction (when hunting for free channels) */
typedef
enum
{
typedef
enum
{
FTDM_TOP_DOWN
,
FTDM_TOP_DOWN
,
FTDM_BOTTOM_UP
FTDM_BOTTOM_UP
,
FTDM_RR_DOWN
,
FTDM_RR_UP
,
}
ftdm_direction_t
;
}
ftdm_direction_t
;
/*! \brief I/O channel type */
/*! \brief I/O channel type */
...
...
libs/freetdm/src/include/private/ftdm_core.h
浏览文件 @
aa69927b
...
@@ -493,6 +493,7 @@ struct ftdm_span {
...
@@ -493,6 +493,7 @@ struct ftdm_span {
ftdm_trunk_type_t
trunk_type
;
ftdm_trunk_type_t
trunk_type
;
ftdm_analog_start_type_t
start_type
;
ftdm_analog_start_type_t
start_type
;
ftdm_signal_type_t
signal_type
;
ftdm_signal_type_t
signal_type
;
uint32_t
last_used_index
;
/* Private signaling data. Do not touch unless you are a signaling module */
/* Private signaling data. Do not touch unless you are a signaling module */
void
*
signal_data
;
void
*
signal_data
;
fio_signal_cb_t
signal_cb
;
fio_signal_cb_t
signal_cb
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论