Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
3026e639
提交
3026e639
authored
6月 17, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MODENDP-312
上级
50178693
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
101 行增加
和
41 行删除
+101
-41
switch_types.h
src/include/switch_types.h
+4
-2
mod_spandsp_fax.c
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
+3
-9
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+37
-9
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+10
-10
switch_rtp.c
src/switch_rtp.c
+47
-11
没有找到文件。
src/include/switch_types.h
浏览文件 @
3026e639
...
@@ -754,8 +754,10 @@ typedef struct {
...
@@ -754,8 +754,10 @@ typedef struct {
uint32_t
T38FaxMaxDatagram
;
uint32_t
T38FaxMaxDatagram
;
const
char
*
T38FaxUdpEC
;
const
char
*
T38FaxUdpEC
;
const
char
*
T38VendorInfo
;
const
char
*
T38VendorInfo
;
const
char
*
ip
;
const
char
*
remote_ip
;
uint32_t
port
;
uint32_t
remote_port
;
const
char
*
local_ip
;
uint32_t
local_port
;
}
switch_t38_options_t
;
}
switch_t38_options_t
;
/*!
/*!
...
...
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
浏览文件 @
3026e639
...
@@ -741,15 +741,12 @@ static t38_mode_t negotiate_t38(pvt_t *pvt)
...
@@ -741,15 +741,12 @@ static t38_mode_t negotiate_t38(pvt_t *pvt)
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"T38FaxMaxDatagram = %d
\n
"
,
t38_options
->
T38FaxMaxDatagram
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"T38FaxMaxDatagram = %d
\n
"
,
t38_options
->
T38FaxMaxDatagram
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"T38FaxUdpEC = '%s'
\n
"
,
t38_options
->
T38FaxUdpEC
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"T38FaxUdpEC = '%s'
\n
"
,
t38_options
->
T38FaxUdpEC
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"T38VendorInfo = '%s'
\n
"
,
switch_str_nil
(
t38_options
->
T38VendorInfo
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"T38VendorInfo = '%s'
\n
"
,
switch_str_nil
(
t38_options
->
T38VendorInfo
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"ip = '%s'
\n
"
,
t38_options
->
ip
?
t38_options
->
ip
:
"Not specified"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"ip = '%s'
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"port = %d
\n
"
,
t38_options
->
port
);
t38_options
->
remote_ip
?
t38_options
->
remote_ip
:
"Not specified"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"port = %d
\n
"
,
t38_options
->
remote_port
);
/* Time to practice our negotiating skills, by editing the t38_options */
/* Time to practice our negotiating skills, by editing the t38_options */
/* use default IP/PORT */
t38_options
->
ip
=
NULL
;
t38_options
->
port
=
0
;
if
(
t38_options
->
T38FaxVersion
>
3
)
{
if
(
t38_options
->
T38FaxVersion
>
3
)
{
t38_options
->
T38FaxVersion
=
3
;
t38_options
->
T38FaxVersion
=
3
;
}
}
...
@@ -835,9 +832,6 @@ static t38_mode_t request_t38(pvt_t *pvt)
...
@@ -835,9 +832,6 @@ static t38_mode_t request_t38(pvt_t *pvt)
t38_options
->
T38FaxUdpEC
=
"t38UDPRedundancy"
;
t38_options
->
T38FaxUdpEC
=
"t38UDPRedundancy"
;
t38_options
->
T38VendorInfo
=
"0 0 0"
;
t38_options
->
T38VendorInfo
=
"0 0 0"
;
/* use default IP/PORT */
t38_options
->
ip
=
NULL
;
t38_options
->
port
=
0
;
switch_channel_set_private
(
channel
,
"t38_options"
,
t38_options
);
switch_channel_set_private
(
channel
,
"t38_options"
,
t38_options
);
pvt
->
t38_mode
=
T38_MODE_REQUESTED
;
pvt
->
t38_mode
=
T38_MODE_REQUESTED
;
...
...
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
3026e639
...
@@ -1195,6 +1195,39 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
...
@@ -1195,6 +1195,39 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
static
void
start_udptl
(
private_object_t
*
tech_pvt
,
switch_t38_options_t
*
t38_options
)
{
if
(
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
char
*
remote_host
=
switch_rtp_get_remote_host
(
tech_pvt
->
rtp_session
);
switch_port_t
remote_port
=
switch_rtp_get_remote_port
(
tech_pvt
->
rtp_session
);
const
char
*
err
,
*
val
;
switch_rtp_udptl_mode
(
tech_pvt
->
rtp_session
);
if
(
remote_host
&&
remote_port
&&
!
strcmp
(
remote_host
,
t38_options
->
remote_ip
)
&&
remote_port
==
t38_options
->
remote_port
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"Remote address:port [%s:%d] has not changed.
\n
"
,
t38_options
->
remote_ip
,
t38_options
->
remote_port
);
return
;
}
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
rtp_session
,
t38_options
->
remote_ip
,
t38_options
->
remote_port
,
0
,
SWITCH_TRUE
,
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"IMAGE UDPTL REPORTS ERROR: [%s]
\n
"
,
err
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"IMAGE UDPTL CHANGING DEST TO: [%s:%d]
\n
"
,
t38_options
->
remote_ip
,
t38_options
->
remote_port
);
if
(
!
sofia_test_pflag
(
tech_pvt
->
profile
,
PFLAG_DISABLE_RTP_AUTOADJ
)
&&
!
((
val
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"disable_udptl_auto_adjust"
))
&&
switch_true
(
val
)))
{
/* Reactivate the NAT buster flag. */
switch_rtp_set_flag
(
tech_pvt
->
rtp_session
,
SWITCH_RTP_FLAG_AUTOADJ
);
}
}
}
}
static
switch_status_t
sofia_send_dtmf
(
switch_core_session_t
*
session
,
const
switch_dtmf_t
*
dtmf
)
static
switch_status_t
sofia_send_dtmf
(
switch_core_session_t
*
session
,
const
switch_dtmf_t
*
dtmf
)
{
{
private_object_t
*
tech_pvt
;
private_object_t
*
tech_pvt
;
...
@@ -1528,12 +1561,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -1528,12 +1561,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
nua_respond
(
tech_pvt
->
nh
,
SIP_488_NOT_ACCEPTABLE
,
TAG_END
());
nua_respond
(
tech_pvt
->
nh
,
SIP_488_NOT_ACCEPTABLE
,
TAG_END
());
goto
end_lock
;
goto
end_lock
;
}
}
start_udptl
(
tech_pvt
,
t38_options
);
if
(
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
switch_rtp_udptl_mode
(
tech_pvt
->
rtp_session
);
}
}
}
break
;
case
SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION
:
case
SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION
:
{
{
switch_t38_options_t
*
t38_options
=
switch_channel_get_private
(
tech_pvt
->
channel
,
"t38_options"
);
switch_t38_options_t
*
t38_options
=
switch_channel_get_private
(
tech_pvt
->
channel
,
"t38_options"
);
...
@@ -1543,13 +1574,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -1543,13 +1574,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
goto
end_lock
;
goto
end_lock
;
}
}
if
(
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
start_udptl
(
tech_pvt
,
t38_options
);
switch_rtp_udptl_mode
(
tech_pvt
->
rtp_session
);
}
sofia_glue_set_image_sdp
(
tech_pvt
,
t38_options
,
msg
->
numeric_arg
);
sofia_glue_set_image_sdp
(
tech_pvt
,
t38_options
,
msg
->
numeric_arg
);
if
(
!
sofia_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
if
(
!
sofia_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
char
*
extra_headers
=
sofia_glue_get_extra_headers
(
channel
,
SOFIA_SIP_RESPONSE_HEADER_PREFIX
);
char
*
extra_headers
=
sofia_glue_get_extra_headers
(
channel
,
SOFIA_SIP_RESPONSE_HEADER_PREFIX
);
if
(
sofia_use_soa
(
tech_pvt
))
{
if
(
sofia_use_soa
(
tech_pvt
))
{
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
3026e639
...
@@ -40,8 +40,8 @@
...
@@ -40,8 +40,8 @@
void
sofia_glue_set_image_sdp
(
private_object_t
*
tech_pvt
,
switch_t38_options_t
*
t38_options
,
int
insist
)
void
sofia_glue_set_image_sdp
(
private_object_t
*
tech_pvt
,
switch_t38_options_t
*
t38_options
,
int
insist
)
{
{
char
buf
[
2048
];
char
buf
[
2048
];
const
char
*
ip
=
t38_options
->
ip
;
const
char
*
ip
=
t38_options
->
local_
ip
;
uint32_t
port
=
t38_options
->
port
;
uint32_t
port
=
t38_options
->
local_
port
;
const
char
*
family
=
"IP4"
;
const
char
*
family
=
"IP4"
;
const
char
*
username
=
tech_pvt
->
profile
->
username
;
const
char
*
username
=
tech_pvt
->
profile
->
username
;
...
@@ -3409,13 +3409,13 @@ void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_
...
@@ -3409,13 +3409,13 @@ void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_
local_t38_options
->
T38FaxFillBitRemoval
=
t38_options
->
T38FaxFillBitRemoval
;
local_t38_options
->
T38FaxFillBitRemoval
=
t38_options
->
T38FaxFillBitRemoval
;
local_t38_options
->
T38FaxTranscodingMMR
=
t38_options
->
T38FaxTranscodingMMR
;
local_t38_options
->
T38FaxTranscodingMMR
=
t38_options
->
T38FaxTranscodingMMR
;
local_t38_options
->
T38FaxTranscodingJBIG
=
t38_options
->
T38FaxTranscodingJBIG
;
local_t38_options
->
T38FaxTranscodingJBIG
=
t38_options
->
T38FaxTranscodingJBIG
;
local_t38_options
->
T38FaxRateManagement
=
t38_options
->
T38FaxRateManagement
;
local_t38_options
->
T38FaxRateManagement
=
switch_core_session_strdup
(
session
,
t38_options
->
T38FaxRateManagement
)
;
local_t38_options
->
T38FaxMaxBuffer
=
t38_options
->
T38FaxMaxBuffer
;
local_t38_options
->
T38FaxMaxBuffer
=
t38_options
->
T38FaxMaxBuffer
;
local_t38_options
->
T38FaxMaxDatagram
=
t38_options
->
T38FaxMaxDatagram
;
local_t38_options
->
T38FaxMaxDatagram
=
t38_options
->
T38FaxMaxDatagram
;
local_t38_options
->
T38FaxUdpEC
=
t38_options
->
T38FaxUdpEC
;
local_t38_options
->
T38FaxUdpEC
=
switch_core_session_strdup
(
session
,
t38_options
->
T38FaxUdpEC
)
;
local_t38_options
->
T38VendorInfo
=
t38_options
->
T38VendorInfo
;
local_t38_options
->
T38VendorInfo
=
switch_core_session_strdup
(
session
,
t38_options
->
T38VendorInfo
)
;
local_t38_options
->
ip
=
NULL
;
local_t38_options
->
remote_ip
=
switch_core_session_strdup
(
session
,
t38_options
->
remote_ip
)
;
local_t38_options
->
port
=
0
;
local_t38_options
->
remote_port
=
t38_options
->
remote_port
;
switch_channel_set_private
(
channel
,
"t38_options"
,
local_t38_options
);
switch_channel_set_private
(
channel
,
"t38_options"
,
local_t38_options
);
...
@@ -3430,12 +3430,12 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_
...
@@ -3430,12 +3430,12 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_
t38_options
=
switch_core_session_alloc
(
tech_pvt
->
session
,
sizeof
(
switch_t38_options_t
));
t38_options
=
switch_core_session_alloc
(
tech_pvt
->
session
,
sizeof
(
switch_t38_options_t
));
}
}
t38_options
->
port
=
m
->
m_port
;
t38_options
->
remote_
port
=
m
->
m_port
;
if
(
m
->
m_connections
)
{
if
(
m
->
m_connections
)
{
t38_options
->
ip
=
switch_core_session_strdup
(
tech_pvt
->
session
,
m
->
m_connections
->
c_address
);
t38_options
->
remote_
ip
=
switch_core_session_strdup
(
tech_pvt
->
session
,
m
->
m_connections
->
c_address
);
}
else
if
(
sdp
&&
sdp
->
sdp_connection
)
{
}
else
if
(
sdp
&&
sdp
->
sdp_connection
)
{
t38_options
->
ip
=
switch_core_session_strdup
(
tech_pvt
->
session
,
sdp
->
sdp_connection
->
c_address
);
t38_options
->
remote_
ip
=
switch_core_session_strdup
(
tech_pvt
->
session
,
sdp
->
sdp_connection
->
c_address
);
}
}
for
(
attr
=
m
->
m_attributes
;
attr
;
attr
=
attr
->
a_next
)
{
for
(
attr
=
m
->
m_attributes
;
attr
;
attr
=
attr
->
a_next
)
{
...
...
src/switch_rtp.c
浏览文件 @
3026e639
...
@@ -1024,9 +1024,21 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_sessi
...
@@ -1024,9 +1024,21 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_sessi
return
rtp_session
->
remote_port
;
return
rtp_session
->
remote_port
;
}
}
static
void
ping_socket
(
switch_rtp_t
*
rtp_session
)
{
uint32_t
o
=
UINT_MAX
;
switch_size_t
len
=
sizeof
(
o
);
switch_socket_sendto
(
rtp_session
->
sock_input
,
rtp_session
->
local_addr
,
0
,
(
void
*
)
&
o
,
&
len
);
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_ENABLE_RTCP
)
&&
rtp_session
->
rtcp_sock_input
)
{
switch_socket_sendto
(
rtp_session
->
rtcp_sock_input
,
rtp_session
->
rtcp_local_addr
,
0
,
(
void
*
)
&
o
,
&
len
);
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_udptl_mode
(
switch_rtp_t
*
rtp_session
)
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_udptl_mode
(
switch_rtp_t
*
rtp_session
)
{
{
switch_socket_t
*
sock
;
READ_INC
(
rtp_session
);
READ_INC
(
rtp_session
);
WRITE_INC
(
rtp_session
);
WRITE_INC
(
rtp_session
);
...
@@ -1035,6 +1047,29 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
...
@@ -1035,6 +1047,29 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
memset
(
&
rtp_session
->
timer
,
0
,
sizeof
(
rtp_session
->
timer
));
memset
(
&
rtp_session
->
timer
,
0
,
sizeof
(
rtp_session
->
timer
));
}
}
switch_clear_flag
(
rtp_session
,
SWITCH_RTP_FLAG_ENABLE_RTCP
);
if
(
rtp_session
->
rtcp_sock_input
)
{
ping_socket
(
rtp_session
);
switch_socket_shutdown
(
rtp_session
->
rtcp_sock_input
,
SWITCH_SHUTDOWN_READWRITE
);
}
if
(
rtp_session
->
rtcp_sock_output
&&
rtp_session
->
rtcp_sock_output
!=
rtp_session
->
rtcp_sock_input
)
{
switch_socket_shutdown
(
rtp_session
->
rtcp_sock_output
,
SWITCH_SHUTDOWN_READWRITE
);
}
if
((
sock
=
rtp_session
->
rtcp_sock_input
))
{
rtp_session
->
rtcp_sock_input
=
NULL
;
switch_socket_close
(
sock
);
if
(
rtp_session
->
rtcp_sock_output
&&
rtp_session
->
rtcp_sock_output
!=
sock
)
{
if
((
sock
=
rtp_session
->
rtcp_sock_output
))
{
rtp_session
->
rtcp_sock_output
=
NULL
;
switch_socket_close
(
sock
);
}
}
}
switch_set_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_UDPTL
);
switch_set_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_UDPTL
);
switch_set_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
);
switch_set_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
);
switch_socket_opt_set
(
rtp_session
->
sock_input
,
SWITCH_SO_NONBLOCK
,
FALSE
);
switch_socket_opt_set
(
rtp_session
->
sock_input
,
SWITCH_SO_NONBLOCK
,
FALSE
);
...
@@ -1619,17 +1654,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
...
@@ -1619,17 +1654,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
static
void
ping_socket
(
switch_rtp_t
*
rtp_session
)
{
uint32_t
o
=
UINT_MAX
;
switch_size_t
len
=
sizeof
(
o
);
switch_socket_sendto
(
rtp_session
->
sock_input
,
rtp_session
->
local_addr
,
0
,
(
void
*
)
&
o
,
&
len
);
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_ENABLE_RTCP
)
&&
rtp_session
->
rtcp_sock_input
)
{
switch_socket_sendto
(
rtp_session
->
rtcp_sock_input
,
rtp_session
->
rtcp_local_addr
,
0
,
(
void
*
)
&
o
,
&
len
);
}
}
SWITCH_DECLARE
(
void
)
switch_rtp_break
(
switch_rtp_t
*
rtp_session
)
SWITCH_DECLARE
(
void
)
switch_rtp_break
(
switch_rtp_t
*
rtp_session
)
{
{
if
(
!
switch_rtp_ready
(
rtp_session
))
{
if
(
!
switch_rtp_ready
(
rtp_session
))
{
...
@@ -1739,6 +1763,18 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
...
@@ -1739,6 +1763,18 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
switch_socket_close
(
sock
);
switch_socket_close
(
sock
);
}
}
if
((
sock
=
(
*
rtp_session
)
->
rtcp_sock_input
))
{
(
*
rtp_session
)
->
rtcp_sock_input
=
NULL
;
switch_socket_close
(
sock
);
if
((
*
rtp_session
)
->
rtcp_sock_output
&&
(
*
rtp_session
)
->
rtcp_sock_output
!=
sock
)
{
if
((
sock
=
(
*
rtp_session
)
->
rtcp_sock_output
))
{
(
*
rtp_session
)
->
rtcp_sock_output
=
NULL
;
switch_socket_close
(
sock
);
}
}
}
if
(
switch_test_flag
((
*
rtp_session
),
SWITCH_RTP_FLAG_VAD
))
{
if
(
switch_test_flag
((
*
rtp_session
),
SWITCH_RTP_FLAG_VAD
))
{
switch_rtp_disable_vad
(
*
rtp_session
);
switch_rtp_disable_vad
(
*
rtp_session
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论