Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
898a183a
提交
898a183a
authored
7月 25, 2012
作者:
Mathieu Rene
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
missing crtp init in mod_freetdm.c -- start implementing media modify
上级
f223b9a0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
69 行增加
和
19 行删除
+69
-19
mod_freetdm.c
libs/freetdm/mod_freetdm/mod_freetdm.c
+3
-0
media_gateway.c
src/mod/endpoints/mod_media_gateway/media_gateway.c
+28
-19
rtp.c
src/mod/endpoints/mod_sofia/rtp.c
+38
-0
没有找到文件。
libs/freetdm/mod_freetdm/mod_freetdm.c
浏览文件 @
898a183a
...
@@ -178,6 +178,7 @@ static const char* channel_get_variable(switch_core_session_t *session, switch_e
...
@@ -178,6 +178,7 @@ static const char* channel_get_variable(switch_core_session_t *session, switch_e
ftdm_status_t
ftdm_channel_from_event
(
ftdm_sigmsg_t
*
sigmsg
,
switch_core_session_t
**
sp
);
ftdm_status_t
ftdm_channel_from_event
(
ftdm_sigmsg_t
*
sigmsg
,
switch_core_session_t
**
sp
);
void
dump_chan
(
ftdm_span_t
*
span
,
uint32_t
chan_id
,
switch_stream_handle_t
*
stream
);
void
dump_chan
(
ftdm_span_t
*
span
,
uint32_t
chan_id
,
switch_stream_handle_t
*
stream
);
void
dump_chan_xml
(
ftdm_span_t
*
span
,
uint32_t
chan_id
,
switch_stream_handle_t
*
stream
);
void
dump_chan_xml
(
ftdm_span_t
*
span
,
uint32_t
chan_id
,
switch_stream_handle_t
*
stream
);
void
ctdm_init
(
switch_loadable_module_interface_t
*
module_interface
);
static
switch_core_session_t
*
ftdm_channel_get_session
(
ftdm_channel_t
*
channel
,
int32_t
id
)
static
switch_core_session_t
*
ftdm_channel_get_session
(
ftdm_channel_t
*
channel
,
int32_t
id
)
{
{
...
@@ -5359,6 +5360,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load)
...
@@ -5359,6 +5360,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load)
SWITCH_ADD_APP
(
app_interface
,
"disable_dtmf"
,
"Disable DTMF Detection"
,
"Disable DTMF Detection"
,
disable_dtmf_function
,
""
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"disable_dtmf"
,
"Disable DTMF Detection"
,
"Disable DTMF Detection"
,
disable_dtmf_function
,
""
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"enable_dtmf"
,
"Enable DTMF Detection"
,
"Enable DTMF Detection"
,
enable_dtmf_function
,
""
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"enable_dtmf"
,
"Enable DTMF Detection"
,
"Enable DTMF Detection"
,
enable_dtmf_function
,
""
,
SAF_NONE
);
ctdm_init
(
*
module_interface
);
/* indicate that the module should continue to be loaded */
/* indicate that the module should continue to be loaded */
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
...
src/mod/endpoints/mod_media_gateway/media_gateway.c
浏览文件 @
898a183a
...
@@ -88,19 +88,6 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
...
@@ -88,19 +88,6 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
char
dialstring
[
100
];
char
dialstring
[
100
];
switch_call_cause_t
cause
;
switch_call_cause_t
cause
;
if
(
!
zstr
(
term
->
uuid
))
{
/* A UUID is present, check if the channel still exists */
switch_core_session_t
*
session
;
if
((
session
=
switch_core_session_locate
(
term
->
uuid
)))
{
switch_core_session_rwunlock
(
session
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Channel [%s] already exists for termination [%s]
\n
"
,
term
->
uuid
,
term
->
name
);
return
SWITCH_STATUS_SUCCESS
;
}
/* The referenced channel doesn't exist anymore, clear it */
term
->
uuid
=
NULL
;
}
switch_event_create
(
&
var_event
,
SWITCH_EVENT_CLONE
);
switch_event_create
(
&
var_event
,
SWITCH_EVENT_CLONE
);
...
@@ -126,14 +113,35 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
...
@@ -126,14 +113,35 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
/* Set common variables on the channel */
/* Set common variables on the channel */
switch_event_add_header_string
(
var_event
,
SWITCH_STACK_BOTTOM
,
SWITCH_PARK_AFTER_BRIDGE_VARIABLE
,
"true"
);
switch_event_add_header_string
(
var_event
,
SWITCH_STACK_BOTTOM
,
SWITCH_PARK_AFTER_BRIDGE_VARIABLE
,
"true"
);
if
(
!
zstr
(
term
->
uuid
))
{
/* A UUID is present, check if the channel still exists */
switch_core_session_t
*
session
;
if
((
session
=
switch_core_session_locate
(
term
->
uuid
)))
{
switch_event_add_header_string
(
var_event
,
SWITCH_STACK_BOTTOM
,
"command"
,
"media_modify"
);
switch_core_session_receive_event
(
session
,
&
var_event
);
if
(
switch_ivr_originate
(
NULL
,
&
session
,
&
cause
,
dialstring
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
var_event
,
0
,
NULL
)
!=
SWITCH_CAUSE_SUCCESS
)
{
switch_core_session_rwunlock
(
session
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to instanciate termination [%s]: %s
\n
"
,
term
->
name
,
switch_channel_cause2str
(
cause
));
status
=
SWITCH_STATUS_FALSE
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Sent refresh to channel [%s], for termination [%s]
\n
"
,
term
->
uuid
,
term
->
name
);
goto
done
;
return
SWITCH_STATUS_SUCCESS
;
}
/* The referenced channel doesn't exist anymore, clear it */
term
->
uuid
=
NULL
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Termination [%s] successfully instanciated as [%s] [%s]
\n
"
,
term
->
name
,
dialstring
,
switch_core_session_get_uuid
(
session
));
if
(
!
zstr
(
term
->
uuid
))
{
if
(
switch_ivr_originate
(
NULL
,
&
session
,
&
cause
,
dialstring
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
var_event
,
0
,
NULL
)
!=
SWITCH_CAUSE_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to instanciate termination [%s]: %s
\n
"
,
term
->
name
,
switch_channel_cause2str
(
cause
));
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Termination [%s] successfully instanciated as [%s] [%s]
\n
"
,
term
->
name
,
dialstring
,
switch_core_session_get_uuid
(
session
));
}
switch_set_flag
(
term
,
MGT_ACTIVE
);
switch_set_flag
(
term
,
MGT_ACTIVE
);
...
@@ -162,7 +170,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha
...
@@ -162,7 +170,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha
switch_snprintf
(
name
,
sizeof
name
,
"%s/%d"
,
profile
->
rtp_termination_id_prefix
,
term_id
);
switch_snprintf
(
name
,
sizeof
name
,
"%s/%d"
,
profile
->
rtp_termination_id_prefix
,
term_id
);
}
else
{
}
else
{
for
(
term
=
profile
->
physical_terminations
;
term
;
term
=
term
->
next
)
{
for
(
term
=
profile
->
physical_terminations
;
term
;
term
=
term
->
next
)
{
if
(
!
s
trncasecmp
(
prefix
,
term
->
name
,
prefixlen
)
&&
!
switch_test_flag
(
term
,
MGT_ALLOCATED
))
{
if
(
!
s
witch_test_flag
(
term
,
MGT_ALLOCATED
)
&&
!
strncasecmp
(
prefix
,
term
->
name
,
prefixlen
))
{
switch_set_flag
(
term
,
MGT_ALLOCATED
);
switch_set_flag
(
term
,
MGT_ALLOCATED
);
return
term
;
return
term
;
}
}
...
@@ -185,6 +193,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha
...
@@ -185,6 +193,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha
term
->
u
.
rtp
.
local_port
=
switch_rtp_request_port
(
term
->
u
.
rtp
.
local_addr
);
term
->
u
.
rtp
.
local_port
=
switch_rtp_request_port
(
term
->
u
.
rtp
.
local_addr
);
term
->
u
.
rtp
.
codec
=
megaco_codec_str
(
profile
->
default_codec
);
term
->
u
.
rtp
.
codec
=
megaco_codec_str
(
profile
->
default_codec
);
term
->
u
.
rtp
.
term_id
=
term_id
;
term
->
u
.
rtp
.
term_id
=
term_id
;
term
->
u
.
rtp
.
ptime
=
20
;
term
->
name
=
switch_core_strdup
(
term
->
pool
,
name
);
term
->
name
=
switch_core_strdup
(
term
->
pool
,
name
);
}
}
...
...
src/mod/endpoints/mod_sofia/rtp.c
浏览文件 @
898a183a
...
@@ -93,6 +93,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
...
@@ -93,6 +93,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
static
switch_status_t
channel_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
switch_io_flag_t
flags
,
int
stream_id
);
static
switch_status_t
channel_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
switch_io_flag_t
flags
,
int
stream_id
);
static
switch_status_t
channel_receive_message
(
switch_core_session_t
*
session
,
switch_core_session_message_t
*
msg
);
static
switch_status_t
channel_receive_message
(
switch_core_session_t
*
session
,
switch_core_session_message_t
*
msg
);
static
switch_status_t
channel_send_dtmf
(
switch_core_session_t
*
session
,
const
switch_dtmf_t
*
dtmf
);
static
switch_status_t
channel_send_dtmf
(
switch_core_session_t
*
session
,
const
switch_dtmf_t
*
dtmf
);
static
switch_status_t
channel_receive_event
(
switch_core_session_t
*
session
,
switch_event_t
*
event
);
switch_state_handler_table_t
crtp_state_handlers
=
{
switch_state_handler_table_t
crtp_state_handlers
=
{
.
on_init
=
channel_on_init
,
.
on_init
=
channel_on_init
,
...
@@ -104,6 +105,7 @@ switch_io_routines_t crtp_io_routines = {
...
@@ -104,6 +105,7 @@ switch_io_routines_t crtp_io_routines = {
.
read_frame
=
channel_read_frame
,
.
read_frame
=
channel_read_frame
,
.
write_frame
=
channel_write_frame
,
.
write_frame
=
channel_write_frame
,
.
receive_message
=
channel_receive_message
,
.
receive_message
=
channel_receive_message
,
.
receive_event
=
channel_receive_event
,
.
send_dtmf
=
channel_send_dtmf
.
send_dtmf
=
channel_send_dtmf
};
};
...
@@ -395,6 +397,42 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
...
@@ -395,6 +397,42 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
static
switch_bool_t
compare_var
(
switch_event_t
*
event
,
switch_channel_t
*
channel
,
const
char
*
varname
)
{
const
char
*
chan_val
=
switch_channel_get_variable_dup
(
channel
,
varname
,
SWITCH_FALSE
,
-
1
);
const
char
*
event_val
=
switch_event_get_header
(
event
,
varname
);
return
strcasecmp
(
chan_val
,
event_val
);
}
static
switch_status_t
channel_receive_event
(
switch_core_session_t
*
session
,
switch_event_t
*
event
)
{
const
char
*
command
=
switch_event_get_header
(
event
,
"command"
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
if
(
!
zstr
(
command
)
&&
!
strcasecmp
(
command
,
"media_modify"
))
{
/* Compare parameters */
if
(
compare_var
(
event
,
channel
,
kREMOTEADDR
)
||
compare_var
(
event
,
channel
,
kREMOTEPORT
)
||
compare_var
(
event
,
channel
,
kLOCALADDR
)
||
compare_var
(
event
,
channel
,
kLOCALPORT
))
{
/* We need to reset the rtp session */
}
if
(
compare_var
(
event
,
channel
,
kCODEC
)
||
compare_var
(
event
,
channel
,
kPTIME
)
||
compare_var
(
event
,
channel
,
kPT
)
||
compare_var
(
event
,
channel
,
kRATE
))
{
/* Reset codec */
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Received unknown command [%s] in event.
\n
"
,
!
command
?
"null"
:
command
);
}
}
static
switch_status_t
channel_receive_message
(
switch_core_session_t
*
session
,
switch_core_session_message_t
*
msg
)
static
switch_status_t
channel_receive_message
(
switch_core_session_t
*
session
,
switch_core_session_message_t
*
msg
)
{
{
crtp_private_t
*
tech_pvt
=
NULL
;
crtp_private_t
*
tech_pvt
=
NULL
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论