Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
bacef26a
提交
bacef26a
authored
6月 27, 2010
作者:
Moises Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
openzap: misc dtmf merged changes from freetdm
上级
7ef629e3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
39 行增加
和
20 行删除
+39
-20
mod_openzap.c
libs/openzap/mod_openzap/mod_openzap.c
+23
-14
ozmod_wanpipe.c
libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
+16
-6
没有找到文件。
libs/openzap/mod_openzap/mod_openzap.c
浏览文件 @
bacef26a
...
...
@@ -1529,6 +1529,24 @@ static ZIO_SIGNAL_CB_FUNCTION(on_common_signal)
return
ZAP_BREAK
;
}
static
void
zap_enable_channel_dtmf
(
zap_channel_t
*
zchan
,
switch_channel_t
*
channel
)
{
if
(
channel
)
{
const
char
*
var
;
if
((
var
=
switch_channel_get_variable
(
channel
,
"openzap_disable_dtmf"
)))
{
if
(
switch_true
(
var
))
{
zap_channel_command
(
zchan
,
ZAP_COMMAND_DISABLE_DTMF_DETECT
,
NULL
);
zap_log
(
ZAP_LOG_INFO
,
"DTMF detection disabled in channel %d:%d
\n
"
,
zchan
->
span_id
,
zchan
->
chan_id
);
return
;
}
}
/* the variable is not present or has negative value then proceed to enable DTMF */
}
if
(
zap_channel_command
(
zchan
,
ZAP_COMMAND_ENABLE_DTMF_DETECT
,
NULL
)
!=
ZAP_SUCCESS
)
{
zap_log
(
ZAP_LOG_ERROR
,
"Failed to enable DTMF detection in channel %d:%d
\n
"
,
zchan
->
span_id
,
zchan
->
chan_id
);
}
}
static
ZIO_SIGNAL_CB_FUNCTION
(
on_fxo_signal
)
{
switch_core_session_t
*
session
=
NULL
;
...
...
@@ -1567,6 +1585,7 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxo_signal)
if
((
session
=
zap_channel_get_session
(
sigmsg
->
channel
,
0
)))
{
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_mark_answered
(
channel
);
zap_enable_channel_dtmf
(
sigmsg
->
channel
,
channel
);
switch_core_session_rwunlock
(
session
);
}
}
...
...
@@ -1606,6 +1625,7 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
if
((
session
=
zap_channel_get_session
(
sigmsg
->
channel
,
0
)))
{
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_mark_answered
(
channel
);
zap_enable_channel_dtmf
(
sigmsg
->
channel
,
channel
);
switch_core_session_rwunlock
(
session
);
}
}
...
...
@@ -1887,12 +1907,9 @@ static ZIO_SIGNAL_CB_FUNCTION(on_r2_signal)
case
ZAP_SIGEVENT_UP
:
{
if
((
session
=
zap_channel_get_session
(
sigmsg
->
channel
,
0
)))
{
zap_tone_type_t
tt
=
ZAP_TONE_DTMF
;
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_mark_answered
(
channel
);
if
(
zap_channel_command
(
sigmsg
->
channel
,
ZAP_COMMAND_ENABLE_DTMF_DETECT
,
&
tt
)
!=
ZAP_SUCCESS
)
{
zap_log
(
ZAP_LOG_ERROR
,
"Failed to enable DTMF detection in R2 channel %d:%d
\n
"
,
sigmsg
->
channel
->
span_id
,
sigmsg
->
channel
->
chan_id
);
}
zap_enable_channel_dtmf
(
sigmsg
->
channel
,
channel
);
switch_core_session_rwunlock
(
session
);
}
}
...
...
@@ -1923,12 +1940,7 @@ static ZIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal)
switch
(
sigmsg
->
event_id
)
{
case
ZAP_SIGEVENT_START
:
{
zap_tone_type_t
tt
=
ZAP_TONE_DTMF
;
if
(
zap_channel_command
(
sigmsg
->
channel
,
ZAP_COMMAND_ENABLE_DTMF_DETECT
,
&
tt
)
!=
ZAP_SUCCESS
)
{
zap_log
(
ZAP_LOG_ERROR
,
"TONE ERROR
\n
"
);
}
zap_enable_channel_dtmf
(
sigmsg
->
channel
,
channel
);
return
zap_channel_from_event
(
sigmsg
,
&
session
);
}
break
;
...
...
@@ -1949,12 +1961,9 @@ static ZIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal)
case
ZAP_SIGEVENT_UP
:
{
if
((
session
=
zap_channel_get_session
(
sigmsg
->
channel
,
0
)))
{
zap_tone_type_t
tt
=
ZAP_TONE_DTMF
;
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_mark_answered
(
channel
);
if
(
zap_channel_command
(
sigmsg
->
channel
,
ZAP_COMMAND_ENABLE_DTMF_DETECT
,
&
tt
)
!=
ZAP_SUCCESS
)
{
zap_log
(
ZAP_LOG_ERROR
,
"TONE ERROR
\n
"
);
}
zap_enable_channel_dtmf
(
sigmsg
->
channel
,
channel
);
switch_core_session_rwunlock
(
session
);
}
else
{
const
char
*
uuid
=
zap_channel_get_uuid
(
sigmsg
->
channel
,
0
);
...
...
libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
浏览文件 @
bacef26a
...
...
@@ -264,11 +264,8 @@ static unsigned wp_open_range(zap_span_t *span, unsigned spanno, unsigned start,
err
=
sangoma_tdm_get_hw_dtmf
(
chan
->
sockfd
,
&
tdm_api
);
if
(
err
>
0
)
{
err
=
sangoma_tdm_enable_dtmf_events
(
chan
->
sockfd
,
&
tdm_api
);
if
(
err
==
0
)
{
zap_channel_set_feature
(
chan
,
ZAP_CHANNEL_FEATURE_DTMF_DETECT
);
dtmf
=
"hardware"
;
}
zap_channel_set_feature
(
chan
,
ZAP_CHANNEL_FEATURE_DTMF_DETECT
);
dtmf
=
"hardware"
;
}
}
...
...
@@ -1186,8 +1183,21 @@ static ZIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
sangoma_wait_obj_delete
(
&
sangoma_wait_obj
);
}
#endif
if
(
zchan
->
sockfd
!=
ZAP_INVALID_SOCKET
)
{
/* enable HW DTMF. As odd as it seems. Why enable when the channel is being destroyed and won't be used anymore?
* because that way we can transfer the DTMF state back to the driver, if we're being restarted we will set again
* the FEATURE_DTMF flag and use HW DTMF, if we don't enable here, then on module restart we won't see
* HW DTMF available and will use software */
if
(
zap_channel_test_feature
(
zchan
,
ZAP_CHANNEL_FEATURE_DTMF_DETECT
))
{
wanpipe_tdm_api_t
tdm_api
;
int
err
;
memset
(
&
tdm_api
,
0
,
sizeof
(
tdm_api
));
err
=
sangoma_tdm_enable_dtmf_events
(
zchan
->
sockfd
,
&
tdm_api
);
if
(
err
)
{
zap_log
(
ZAP_LOG_WARNING
,
"Failed to enable Sangoma HW DTMF on channel %d:%d at destroy
\n
"
,
zchan
->
span_id
,
zchan
->
chan_id
);
}
}
sangoma_close
(
&
zchan
->
sockfd
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论