Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1c907e5b
提交
1c907e5b
authored
9月 07, 2012
作者:
Kapil Gupta
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding code to invoke freetdm dtmf removal api
上级
b15c1d12
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
75 行增加
和
0 行删除
+75
-0
media_gateway.c
src/mod/endpoints/mod_media_gateway/media_gateway.c
+62
-0
media_gateway_cmd_handler.c
...d/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
+11
-0
mod_media_gateway.h
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h
+2
-0
没有找到文件。
src/mod/endpoints/mod_media_gateway/media_gateway.c
浏览文件 @
1c907e5b
...
@@ -208,6 +208,51 @@ done:
...
@@ -208,6 +208,51 @@ done:
return
status
;
return
status
;
}
}
switch_status_t
megaco_tdm_term_dtmf_removal
(
mg_termination_t
*
term
,
int
enable
)
{
char
buf
[
128
];
switch_event_t
*
event
=
NULL
;
mg_termination_t
*
tdm_term
=
NULL
;
if
(
NULL
==
term
)
return
SWITCH_STATUS_FALSE
;
if
(
MG_TERM_RTP
==
term
->
type
){
if
(
NULL
==
term
->
context
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Null Context from rtp term, not able to get tdm term
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
tdm_term
=
megaco_context_get_peer_term
(
term
->
context
,
term
);
}
else
{
tdm_term
=
term
;
}
if
(
NULL
==
tdm_term
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Null TDM term
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
memset
(
&
buf
[
0
],
0
,
sizeof
(
buf
));
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_TRAP
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Failed to create NOTIFY event
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"span-name"
,
"%s"
,
tdm_term
->
u
.
tdm
.
span_name
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"chan-number"
,
"%d"
,
tdm_term
->
u
.
tdm
.
channel
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"condition"
,
"mg-tdm-dtmfremoval"
);
sprintf
(
buf
,
"%s"
,(
1
==
enable
)
?
"enable"
:
"disable"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Sending DTMF Removal Event[%s] for MG Term[%s], TDM span[%s] channel[%d]
\n
"
,
buf
,
tdm_term
->
name
,
tdm_term
->
u
.
tdm
.
span_name
,
tdm_term
->
u
.
tdm
.
channel
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"command"
,
buf
);
switch_event_fire
(
&
event
);
return
SWITCH_STATUS_SUCCESS
;
}
switch_status_t
megaco_prepare_tdm_termination
(
mg_termination_t
*
term
)
switch_status_t
megaco_prepare_tdm_termination
(
mg_termination_t
*
term
)
{
{
switch_event_t
*
event
=
NULL
;
switch_event_t
*
event
=
NULL
;
...
@@ -403,6 +448,23 @@ void megaco_termination_destroy(mg_termination_t *term)
...
@@ -403,6 +448,23 @@ void megaco_termination_destroy(mg_termination_t *term)
}
}
}
}
mg_termination_t
*
megaco_context_get_peer_term
(
mg_context_t
*
ctx
,
mg_termination_t
*
term
)
{
switch_assert
(
ctx
!=
NULL
);
switch_assert
(
term
!=
NULL
);
if
(
ctx
->
terminations
[
0
]
&&
(
term
==
ctx
->
terminations
[
0
]))
{
return
ctx
->
terminations
[
1
];
}
if
(
ctx
->
terminations
[
1
]
&&
(
term
==
ctx
->
terminations
[
1
]))
{
return
ctx
->
terminations
[
0
];
}
return
NULL
;
}
switch_status_t
megaco_context_is_term_present
(
mg_context_t
*
ctx
,
mg_termination_t
*
term
)
switch_status_t
megaco_context_is_term_present
(
mg_context_t
*
ctx
,
mg_termination_t
*
term
)
{
{
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
浏览文件 @
1c907e5b
...
@@ -741,6 +741,17 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -741,6 +741,17 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
goto
error
;
goto
error
;
}
}
if
(
is_rtp
){
mg_termination_t
*
tdm_term
=
NULL
;
/* disable dtmf removal */
tdm_term
=
megaco_context_get_peer_term
(
mg_ctxt
,
term
);
if
(
term
->
u
.
rtp
.
rfc2833_pt
){
megaco_tdm_term_dtmf_removal
(
tdm_term
,
0x01
);
}
else
{
megaco_tdm_term_dtmf_removal
(
tdm_term
,
0x00
);
}
}
mg_print_t38_attributes
(
term
);
mg_print_t38_attributes
(
term
);
...
...
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h
浏览文件 @
1c907e5b
...
@@ -321,6 +321,7 @@ static inline megaco_codec_t megaco_codec_parse(const char *codec) {
...
@@ -321,6 +321,7 @@ static inline megaco_codec_t megaco_codec_parse(const char *codec) {
}
}
switch_status_t
megaco_tdm_term_dtmf_removal
(
mg_termination_t
*
term
,
int
enable
);
megaco_profile_t
*
megaco_profile_locate
(
const
char
*
name
);
megaco_profile_t
*
megaco_profile_locate
(
const
char
*
name
);
mg_termination_t
*
megaco_term_locate_by_span_chan_id
(
const
char
*
span_name
,
const
char
*
chan_number
);
mg_termination_t
*
megaco_term_locate_by_span_chan_id
(
const
char
*
span_name
,
const
char
*
chan_number
);
mg_peer_profile_t
*
megaco_peer_profile_locate
(
const
char
*
name
);
mg_peer_profile_t
*
megaco_peer_profile_locate
(
const
char
*
name
);
...
@@ -363,6 +364,7 @@ switch_status_t megaco_context_is_term_present(mg_context_t *ctx, mg_termination
...
@@ -363,6 +364,7 @@ switch_status_t megaco_context_is_term_present(mg_context_t *ctx, mg_termination
switch_status_t
megaco_prepare_tdm_termination
(
mg_termination_t
*
term
);
switch_status_t
megaco_prepare_tdm_termination
(
mg_termination_t
*
term
);
switch_status_t
megaco_check_tdm_termination
(
mg_termination_t
*
term
);
switch_status_t
megaco_check_tdm_termination
(
mg_termination_t
*
term
);
mg_termination_t
*
megaco_context_get_peer_term
(
mg_context_t
*
ctx
,
mg_termination_t
*
term
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论