Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b96f8548
提交
b96f8548
authored
9月 30, 2010
作者:
Moises Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
freetdm: fix libpri mod
上级
00207ced
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
46 行增加
和
25 行删除
+46
-25
ftdm_io.c
libs/freetdm/src/ftdm_io.c
+38
-24
ftmod_libpri.c
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c
+8
-1
没有找到文件。
libs/freetdm/src/ftdm_io.c
浏览文件 @
b96f8548
...
...
@@ -1793,7 +1793,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id,
ftdm_channel_t
*
best_rated
=
NULL
;
ftdm_status_t
status
=
FTDM_FAIL
;
int
best_rate
=
0
;
int
may_be_available
=
0
;
*
ftdmchan
=
NULL
;
...
...
@@ -1828,40 +1827,55 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id,
ftdm_mutex_lock
(
check
->
mutex
);
/* The following if's and gotos replace a big if (this || this || this || this) else { nothing; } */
/* if it is not a voice channel, nothing else to check to open it */
if
(
!
FTDM_IS_VOICE_CHANNEL
(
check
))
{
goto
openchan
;
}
/* if it's an FXS device with a call active and has callwaiting enabled, we allow to open it twice */
if
(
check
->
type
==
FTDM_CHAN_TYPE_FXS
&&
check
->
token_count
==
1
&&
ftdm_channel_test_feature
(
check
,
FTDM_CHANNEL_FEATURE_CALLWAITING
))
{
goto
openchan
;
}
/* if channel is available, time to open it */
if
(
chan_is_avail
(
check
))
{
goto
openchan
;
}
/* not available, but still might be available ... */
calculate_best_rate
(
check
,
&
best_rated
,
&
best_rate
);
if
(
best_rated
)
{
may_be_available
=
1
;
goto
openchan
;
}
/* the channel is only allowed to be open if not in use, or, for FXS devices with a call with call waiting enabled */
if
(
(
check
->
type
==
FTDM_CHAN_TYPE_FXS
&&
check
->
token_count
==
1
&&
ftdm_channel_test_feature
(
check
,
FTDM_CHANNEL_FEATURE_CALLWAITING
))
||
chan_is_avail
(
check
)
||
(
check
->
type
==
FTDM_CHAN_TYPE_DQ921
&&
ftdm_test_flag
(
check
,
FTDM_CHANNEL_CONFIGURED
)
&&
ftdm_test_flag
(
check
,
FTDM_CHANNEL_READY
))
||
may_be_available
)
{
if
(
!
ftdm_test_flag
(
check
,
FTDM_CHANNEL_OPEN
))
{
status
=
check
->
fio
->
open
(
check
);
if
(
status
==
FTDM_SUCCESS
)
{
ftdm_set_flag
(
check
,
FTDM_CHANNEL_OPEN
);
}
}
else
{
status
=
FTDM_SUCCESS
;
/* channel is unavailable, do not open the channel */
goto
unlockchan
;
openchan
:
if
(
!
ftdm_test_flag
(
check
,
FTDM_CHANNEL_OPEN
))
{
status
=
check
->
fio
->
open
(
check
);
if
(
status
==
FTDM_SUCCESS
)
{
ftdm_set_flag
(
check
,
FTDM_CHANNEL_OPEN
);
}
ftdm_set_flag
(
check
,
FTDM_CHANNEL_INUSE
);
ftdm_set_flag
(
check
,
FTDM_CHANNEL_OUTBOUND
);
*
ftdmchan
=
check
;
}
else
{
status
=
FTDM_SUCCESS
;
}
ftdm_set_flag
(
check
,
FTDM_CHANNEL_INUSE
);
ftdm_set_flag
(
check
,
FTDM_CHANNEL_OUTBOUND
);
*
ftdmchan
=
check
;
unlockchan
:
ftdm_mutex_unlock
(
check
->
mutex
);
done
:
ftdm_mutex_unlock
(
globals
.
mutex
);
if
(
status
!=
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Failed to open channel %d:%d
\n
"
,
span_id
,
chan_id
);
}
return
status
;
}
...
...
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c
浏览文件 @
b96f8548
...
...
@@ -1087,10 +1087,17 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj)
got_d
=
1
;
x
++
;
break
;
}
else
{
ftdm_log
(
FTDM_LOG_ERROR
,
"failed to open d-channel #%d %d:%d
\n
"
,
x
,
span
->
channels
[
i
]
->
span_id
,
span
->
channels
[
i
]
->
chan_id
);
}
}
}
}
if
(
!
got_d
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Failed to get a D-channel in span %d
\n
"
,
span
->
span_id
);
break
;
}
if
(
lpwrap_init_pri
(
&
isdn_data
->
spri
,
...
...
@@ -1149,7 +1156,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj)
ftdm_sleep
(
5000
);
}
ftdm_log
(
FTDM_LOG_DEBUG
,
"PRI thread ended on span %d
\n
"
,
isdn_data
->
spri
.
span
->
span_id
);
ftdm_log
(
FTDM_LOG_DEBUG
,
"PRI thread ended on span %d
\n
"
,
span
->
span_id
);
ftdm_clear_flag
(
span
,
FTDM_SPAN_IN_THREAD
);
ftdm_clear_flag
(
isdn_data
,
FTMOD_LIBPRI_RUNNING
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论