Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
05a1e400
提交
05a1e400
authored
4月 22, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FSCORE-594
上级
5c5d260b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
62 行增加
和
19 行删除
+62
-19
switch_rtp.h
src/include/switch_rtp.h
+1
-1
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+34
-4
switch_rtp.c
src/switch_rtp.c
+27
-14
没有找到文件。
src/include/switch_rtp.h
浏览文件 @
05a1e400
...
@@ -168,7 +168,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
...
@@ -168,7 +168,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
\param port the remote port
\param port the remote port
\param err pointer for error messages
\param err pointer for error messages
*/
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_set_remote_address
(
switch_rtp_t
*
rtp_session
,
const
char
*
host
,
switch_port_t
port
,
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_set_remote_address
(
switch_rtp_t
*
rtp_session
,
const
char
*
host
,
switch_port_t
port
,
switch_port_t
remote_rtcp_port
,
switch_bool_t
change_adv_addr
,
const
char
**
err
);
switch_bool_t
change_adv_addr
,
const
char
**
err
);
SWITCH_DECLARE
(
char
*
)
switch_rtp_get_remote_host
(
switch_rtp_t
*
rtp_session
);
SWITCH_DECLARE
(
char
*
)
switch_rtp_get_remote_host
(
switch_rtp_t
*
rtp_session
);
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
05a1e400
...
@@ -1127,8 +1127,16 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
...
@@ -1127,8 +1127,16 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
sofia_set_flag_locked
(
tech_pvt
,
TFLAG_VIDEO
);
sofia_set_flag_locked
(
tech_pvt
,
TFLAG_VIDEO
);
switch_channel_set_flag
(
tech_pvt
->
channel
,
CF_VIDEO
);
switch_channel_set_flag
(
tech_pvt
->
channel
,
CF_VIDEO
);
if
(
switch_rtp_ready
(
tech_pvt
->
video_rtp_session
))
{
if
(
switch_rtp_ready
(
tech_pvt
->
video_rtp_session
))
{
const
char
*
rport
=
NULL
;
switch_port_t
remote_rtcp_port
=
0
;
if
((
rport
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_remote_video_rtcp_port"
)))
{
remote_rtcp_port
=
atoi
(
rport
);
}
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
video_rtp_session
,
tech_pvt
->
remote_sdp_video_ip
,
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
video_rtp_session
,
tech_pvt
->
remote_sdp_video_ip
,
tech_pvt
->
remote_sdp_video_port
,
SWITCH_TRUE
,
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
tech_pvt
->
remote_sdp_video_port
,
remote_rtcp_port
,
SWITCH_TRUE
,
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"VIDEO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"VIDEO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"VIDEO RTP CHANGING DEST TO: [%s:%d]
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"VIDEO RTP CHANGING DEST TO: [%s:%d]
\n
"
,
...
@@ -1149,6 +1157,8 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
...
@@ -1149,6 +1157,8 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
if
(
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
if
(
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
char
*
remote_host
=
switch_rtp_get_remote_host
(
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
);
switch_port_t
remote_port
=
switch_rtp_get_remote_port
(
tech_pvt
->
rtp_session
);
const
char
*
rport
=
NULL
;
switch_port_t
remote_rtcp_port
=
0
;
if
(
remote_host
&&
remote_port
&&
!
strcmp
(
remote_host
,
tech_pvt
->
remote_sdp_audio_ip
)
&&
remote_port
==
tech_pvt
->
remote_sdp_audio_port
)
{
if
(
remote_host
&&
remote_port
&&
!
strcmp
(
remote_host
,
tech_pvt
->
remote_sdp_audio_ip
)
&&
remote_port
==
tech_pvt
->
remote_sdp_audio_port
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"Remote address:port [%s:%d] has not changed.
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"Remote address:port [%s:%d] has not changed.
\n
"
,
...
@@ -1156,8 +1166,13 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
...
@@ -1156,8 +1166,13 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
if
((
rport
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_remote_audio_rtcp_port"
)))
{
remote_rtcp_port
=
atoi
(
rport
);
}
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
rtp_session
,
tech_pvt
->
remote_sdp_audio_ip
,
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
rtp_session
,
tech_pvt
->
remote_sdp_audio_ip
,
tech_pvt
->
remote_sdp_audio_port
,
SWITCH_TRUE
,
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
tech_pvt
->
remote_sdp_audio_port
,
remote_rtcp_port
,
SWITCH_TRUE
,
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"AUDIO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"AUDIO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"AUDIO RTP CHANGING DEST TO: [%s:%d]
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"AUDIO RTP CHANGING DEST TO: [%s:%d]
\n
"
,
...
@@ -2605,9 +2620,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
...
@@ -2605,9 +2620,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
switch_channel_set_variable
(
tech_pvt
->
channel
,
SWITCH_LOCAL_MEDIA_PORT_VARIABLE
,
tmp
);
switch_channel_set_variable
(
tech_pvt
->
channel
,
SWITCH_LOCAL_MEDIA_PORT_VARIABLE
,
tmp
);
if
(
tech_pvt
->
rtp_session
&&
sofia_test_flag
(
tech_pvt
,
TFLAG_REINVITE
))
{
if
(
tech_pvt
->
rtp_session
&&
sofia_test_flag
(
tech_pvt
,
TFLAG_REINVITE
))
{
const
char
*
rport
=
NULL
;
switch_port_t
remote_rtcp_port
=
0
;
sofia_clear_flag_locked
(
tech_pvt
,
TFLAG_REINVITE
);
sofia_clear_flag_locked
(
tech_pvt
,
TFLAG_REINVITE
);
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
rtp_session
,
tech_pvt
->
remote_sdp_audio_ip
,
tech_pvt
->
remote_sdp_audio_port
,
SWITCH_TRUE
,
&
err
)
!=
if
((
rport
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_remote_audio_rtcp_port"
)))
{
remote_rtcp_port
=
atoi
(
rport
);
}
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
rtp_session
,
tech_pvt
->
remote_sdp_audio_ip
,
tech_pvt
->
remote_sdp_audio_port
,
remote_rtcp_port
,
SWITCH_TRUE
,
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"AUDIO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"AUDIO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
}
else
{
}
else
{
...
@@ -2859,10 +2882,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
...
@@ -2859,10 +2882,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
switch_channel_set_variable
(
tech_pvt
->
channel
,
SWITCH_LOCAL_VIDEO_PORT_VARIABLE
,
tmp
);
switch_channel_set_variable
(
tech_pvt
->
channel
,
SWITCH_LOCAL_VIDEO_PORT_VARIABLE
,
tmp
);
if
(
tech_pvt
->
video_rtp_session
&&
sofia_test_flag
(
tech_pvt
,
TFLAG_REINVITE
))
{
if
(
tech_pvt
->
video_rtp_session
&&
sofia_test_flag
(
tech_pvt
,
TFLAG_REINVITE
))
{
const
char
*
rport
=
NULL
;
switch_port_t
remote_rtcp_port
=
0
;
sofia_clear_flag_locked
(
tech_pvt
,
TFLAG_REINVITE
);
sofia_clear_flag_locked
(
tech_pvt
,
TFLAG_REINVITE
);
if
((
rport
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_remote_video_rtcp_port"
)))
{
remote_rtcp_port
=
atoi
(
rport
);
}
if
(
switch_rtp_set_remote_address
if
(
switch_rtp_set_remote_address
(
tech_pvt
->
video_rtp_session
,
tech_pvt
->
remote_sdp_video_ip
,
tech_pvt
->
remote_sdp_video_port
,
SWITCH_TRUE
,
(
tech_pvt
->
video_rtp_session
,
tech_pvt
->
remote_sdp_video_ip
,
tech_pvt
->
remote_sdp_video_port
,
remote_rtcp_port
,
SWITCH_TRUE
,
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
&
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"VIDEO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_ERROR
,
"VIDEO RTP REPORTS ERROR: [%s]
\n
"
,
err
);
}
else
{
}
else
{
...
...
src/switch_rtp.c
浏览文件 @
05a1e400
...
@@ -778,19 +778,27 @@ static switch_status_t enable_remote_rtcp_socket(switch_rtp_t *rtp_session, cons
...
@@ -778,19 +778,27 @@ static switch_status_t enable_remote_rtcp_socket(switch_rtp_t *rtp_session, cons
rtp_session
->
remote_rtcp_port
,
0
,
rtp_session
->
pool
)
!=
SWITCH_STATUS_SUCCESS
||
!
rtp_session
->
rtcp_remote_addr
)
{
rtp_session
->
remote_rtcp_port
,
0
,
rtp_session
->
pool
)
!=
SWITCH_STATUS_SUCCESS
||
!
rtp_session
->
rtcp_remote_addr
)
{
*
err
=
"RTCP Remote Address Error!"
;
*
err
=
"RTCP Remote Address Error!"
;
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
else
{
const
char
*
host
;
char
bufa
[
30
];
host
=
switch_get_addr
(
bufa
,
sizeof
(
bufa
),
rtp_session
->
rtcp_remote_addr
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Setting RTCP remote addr to %s:%d
\n
"
,
host
,
rtp_session
->
remote_rtcp_port
);
}
}
if
(
rtp_session
->
rtcp_sock_input
&&
switch_sockaddr_get_family
(
rtp_session
->
rtcp_remote_addr
)
==
if
(
!
(
rtp_session
->
rtcp_sock_input
&&
rtp_session
->
rtcp_sock_output
))
{
switch_sockaddr_get_family
(
rtp_session
->
rtcp_local_addr
))
{
if
(
rtp_session
->
rtcp_sock_input
&&
switch_sockaddr_get_family
(
rtp_session
->
rtcp_remote_addr
)
==
rtp_session
->
rtcp_sock_output
=
rtp_session
->
rtcp_sock_input
;
switch_sockaddr_get_family
(
rtp_session
->
rtcp_local_addr
))
{
}
else
{
rtp_session
->
rtcp_sock_output
=
rtp_session
->
rtcp_sock_input
;
if
(
rtp_session
->
rtcp_sock_output
&&
rtp_session
->
rtcp_sock_output
!=
rtp_session
->
rtcp_sock_input
)
{
}
else
{
switch_socket_close
(
rtp_session
->
rtcp_sock_output
);
if
(
rtp_session
->
rtcp_sock_output
&&
rtp_session
->
rtcp_sock_output
!=
rtp_session
->
rtcp_sock_input
)
{
}
switch_socket_close
(
rtp_session
->
rtcp_sock_output
);
if
((
status
=
switch_socket_create
(
&
rtp_session
->
rtcp_sock_output
,
}
switch_sockaddr_get_family
(
rtp_session
->
rtcp_remote_addr
),
if
((
status
=
switch_socket_create
(
&
rtp_session
->
rtcp_sock_output
,
SOCK_DGRAM
,
0
,
rtp_session
->
pool
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_sockaddr_get_family
(
rtp_session
->
rtcp_remote_addr
),
*
err
=
"RTCP Socket Error!"
;
SOCK_DGRAM
,
0
,
rtp_session
->
pool
))
!=
SWITCH_STATUS_SUCCESS
)
{
*
err
=
"RTCP Socket Error!"
;
}
}
}
}
}
}
else
{
}
else
{
...
@@ -1020,7 +1028,7 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_sessi
...
@@ -1020,7 +1028,7 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_sessi
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_set_remote_address
(
switch_rtp_t
*
rtp_session
,
const
char
*
host
,
switch_port_t
port
,
SWITCH_DECLARE
(
switch_status_t
)
switch_rtp_set_remote_address
(
switch_rtp_t
*
rtp_session
,
const
char
*
host
,
switch_port_t
port
,
switch_port_t
remote_rtcp_port
,
switch_bool_t
change_adv_addr
,
const
char
**
err
)
switch_bool_t
change_adv_addr
,
const
char
**
err
)
{
{
switch_sockaddr_t
*
remote_addr
;
switch_sockaddr_t
*
remote_addr
;
...
@@ -1056,6 +1064,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
...
@@ -1056,6 +1064,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
}
}
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_ENABLE_RTCP
))
{
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_ENABLE_RTCP
))
{
if
(
remote_rtcp_port
)
{
rtp_session
->
remote_rtcp_port
=
remote_rtcp_port
;
}
else
{
rtp_session
->
remote_rtcp_port
=
rtp_session
->
remote_port
+
1
;
}
status
=
enable_remote_rtcp_socket
(
rtp_session
,
err
);
status
=
enable_remote_rtcp_socket
(
rtp_session
,
err
);
}
}
...
@@ -1462,7 +1475,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
...
@@ -1462,7 +1475,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
goto
end
;
goto
end
;
}
}
if
(
switch_rtp_set_remote_address
(
rtp_session
,
tx_host
,
tx_port
,
SWITCH_TRUE
,
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_rtp_set_remote_address
(
rtp_session
,
tx_host
,
tx_port
,
0
,
SWITCH_TRUE
,
err
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_mutex_unlock
(
rtp_session
->
flag_mutex
);
switch_mutex_unlock
(
rtp_session
->
flag_mutex
);
rtp_session
=
NULL
;
rtp_session
=
NULL
;
goto
end
;
goto
end
;
...
@@ -2426,7 +2439,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -2426,7 +2439,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
switch_channel_set_variable
(
channel
,
"rtp_auto_adjust"
,
"true"
);
switch_channel_set_variable
(
channel
,
"rtp_auto_adjust"
,
"true"
);
}
}
switch_rtp_set_remote_address
(
rtp_session
,
tx_host
,
switch_sockaddr_get_port
(
rtp_session
->
from_addr
),
SWITCH_FALSE
,
&
err
);
switch_rtp_set_remote_address
(
rtp_session
,
tx_host
,
switch_sockaddr_get_port
(
rtp_session
->
from_addr
),
0
,
SWITCH_FALSE
,
&
err
);
switch_clear_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_AUTOADJ
);
switch_clear_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_AUTOADJ
);
}
}
}
else
{
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论