Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
15fd3f13
提交
15fd3f13
authored
1月 16, 2017
作者:
Dan Edwards
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9162 Include external IP address in SDP if include_external_ip is set
上级
52bbe5ca
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
57 行增加
和
1 行删除
+57
-1
switch_core_media.c
src/switch_core_media.c
+57
-1
没有找到文件。
src/switch_core_media.c
浏览文件 @
15fd3f13
...
@@ -8814,6 +8814,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
...
@@ -8814,6 +8814,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
const
char
*
local_sdp_audio_zrtp_hash
;
const
char
*
local_sdp_audio_zrtp_hash
;
switch_media_handle_t
*
smh
;
switch_media_handle_t
*
smh
;
switch_rtp_engine_t
*
a_engine
;
switch_rtp_engine_t
*
a_engine
;
int
include_external
;
switch_assert
(
session
);
switch_assert
(
session
);
...
@@ -8829,6 +8830,8 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
...
@@ -8829,6 +8830,8 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"m=audio %d %s"
,
port
,
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"m=audio %d %s"
,
port
,
get_media_profile_name
(
session
,
secure
||
a_engine
->
crypto_type
!=
CRYPTO_INVALID
));
get_media_profile_name
(
session
,
secure
||
a_engine
->
crypto_type
!=
CRYPTO_INVALID
));
include_external
=
switch_channel_var_true
(
session
->
channel
,
"include_external_ip"
);
for
(
i
=
0
;
i
<
smh
->
mparams
->
num_codecs
;
i
++
)
{
for
(
i
=
0
;
i
<
smh
->
mparams
->
num_codecs
;
i
++
)
{
const
switch_codec_implementation_t
*
imp
=
smh
->
codecs
[
i
];
const
switch_codec_implementation_t
*
imp
=
smh
->
codecs
[
i
];
int
this_ptime
=
(
imp
->
microseconds_per_packet
/
1000
);
int
this_ptime
=
(
imp
->
microseconds_per_packet
/
1000
);
...
@@ -8987,6 +8990,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
...
@@ -8987,6 +8990,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
if
(
a_engine
->
ice_out
.
cands
[
0
][
0
].
ready
)
{
if
(
a_engine
->
ice_out
.
cands
[
0
][
0
].
ready
)
{
char
tmp1
[
11
]
=
""
;
char
tmp1
[
11
]
=
""
;
char
tmp2
[
11
]
=
""
;
char
tmp2
[
11
]
=
""
;
char
tmp3
[
11
]
=
""
;
uint32_t
c1
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
1
);
uint32_t
c1
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
1
);
uint32_t
c2
=
c1
-
1
;
uint32_t
c2
=
c1
-
1
;
...
@@ -8997,8 +9001,10 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
...
@@ -8997,8 +9001,10 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
tmp1
[
10
]
=
'\0'
;
tmp1
[
10
]
=
'\0'
;
tmp2
[
10
]
=
'\0'
;
tmp2
[
10
]
=
'\0'
;
tmp3
[
10
]
=
'\0'
;
switch_stun_random_string
(
tmp1
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp1
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp2
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp2
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp3
,
10
,
"0123456789"
);
gen_ice
(
session
,
SWITCH_MEDIA_TYPE_AUDIO
,
NULL
,
0
);
gen_ice
(
session
,
SWITCH_MEDIA_TYPE_AUDIO
,
NULL
,
0
);
...
@@ -9019,6 +9025,13 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
...
@@ -9019,6 +9025,13 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
);
);
if
(
include_external
&&
!
zstr
(
smh
->
mparams
->
extsipip
))
{
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"a=candidate:%s 1 %s %u %s %d typ host generation 0
\n
"
,
tmp3
,
ice_out
->
cands
[
0
][
0
].
transport
,
c1
,
smh
->
mparams
->
extsipip
,
ice_out
->
cands
[
0
][
0
].
con_port
);
}
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
strcmp
(
a_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
0
].
con_addr
)
strcmp
(
a_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
a_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
0
].
con_port
)
{
&&
a_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
0
].
con_port
)
{
...
@@ -9038,6 +9051,13 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
...
@@ -9038,6 +9051,13 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
a_engine
->
rtcp_mux
>
0
?
0
:
1
)
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
a_engine
->
rtcp_mux
>
0
?
0
:
1
)
);
);
if
(
include_external
&&
!
zstr
(
smh
->
mparams
->
extsipip
))
{
switch_snprintf
(
buf
+
strlen
(
buf
),
buflen
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp3
,
ice_out
->
cands
[
0
][
0
].
transport
,
c1
,
smh
->
mparams
->
extsipip
,
ice_out
->
cands
[
0
][
0
].
con_port
);
}
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
1
].
con_addr
)
&&
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
1
].
con_addr
)
&&
strcmp
(
a_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
1
].
con_addr
)
strcmp
(
a_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
1
].
con_addr
)
&&
a_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
1
].
con_port
)
{
&&
a_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
1
].
con_port
)
{
...
@@ -9266,6 +9286,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -9266,6 +9286,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
int
bw
=
256
;
int
bw
=
256
;
uint8_t
fir
=
0
,
nack
=
0
,
pli
=
0
,
tmmbr
=
0
,
has_vid
=
0
;
uint8_t
fir
=
0
,
nack
=
0
,
pli
=
0
,
tmmbr
=
0
,
has_vid
=
0
;
const
char
*
use_rtcp_mux
=
NULL
;
const
char
*
use_rtcp_mux
=
NULL
;
int
include_external
;
switch_assert
(
session
);
switch_assert
(
session
);
...
@@ -9277,6 +9298,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -9277,6 +9298,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
v_engine
=
&
smh
->
engines
[
SWITCH_MEDIA_TYPE_VIDEO
];
v_engine
=
&
smh
->
engines
[
SWITCH_MEDIA_TYPE_VIDEO
];
t_engine
=
&
smh
->
engines
[
SWITCH_MEDIA_TYPE_TEXT
];
t_engine
=
&
smh
->
engines
[
SWITCH_MEDIA_TYPE_TEXT
];
include_external
=
switch_channel_var_true
(
session
->
channel
,
"include_external_ip"
);
use_rtcp_mux
=
switch_channel_get_variable
(
session
->
channel
,
"rtcp_mux"
);
use_rtcp_mux
=
switch_channel_get_variable
(
session
->
channel
,
"rtcp_mux"
);
if
(
use_rtcp_mux
&&
switch_false
(
use_rtcp_mux
))
{
if
(
use_rtcp_mux
&&
switch_false
(
use_rtcp_mux
))
{
...
@@ -9704,6 +9727,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -9704,6 +9727,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if
(
a_engine
->
ice_out
.
cands
[
0
][
0
].
ready
)
{
if
(
a_engine
->
ice_out
.
cands
[
0
][
0
].
ready
)
{
char
tmp1
[
11
]
=
""
;
char
tmp1
[
11
]
=
""
;
char
tmp2
[
11
]
=
""
;
char
tmp2
[
11
]
=
""
;
char
tmp3
[
11
]
=
""
;
uint32_t
c1
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
1
);
uint32_t
c1
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
1
);
//uint32_t c2 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 2);
//uint32_t c2 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 2);
//uint32_t c3 = (2^24)*126 + (2^8)*65534 + (2^0)*(256 - 1);
//uint32_t c3 = (2^24)*126 + (2^8)*65534 + (2^0)*(256 - 1);
...
@@ -9715,8 +9739,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -9715,8 +9739,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
tmp1
[
10
]
=
'\0'
;
tmp1
[
10
]
=
'\0'
;
tmp2
[
10
]
=
'\0'
;
tmp2
[
10
]
=
'\0'
;
tmp3
[
10
]
=
'\0'
;
switch_stun_random_string
(
tmp1
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp1
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp2
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp2
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp3
,
10
,
"0123456789"
);
ice_out
=
&
a_engine
->
ice_out
;
ice_out
=
&
a_engine
->
ice_out
;
...
@@ -9730,6 +9756,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -9730,6 +9756,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
);
);
if
(
include_external
&&
!
zstr
(
smh
->
mparams
->
extsipip
))
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 1 %s %u %s %d typ host generation 0
\n
"
,
tmp3
,
ice_out
->
cands
[
0
][
0
].
transport
,
c1
,
smh
->
mparams
->
extsipip
,
ice_out
->
cands
[
0
][
0
].
con_port
);
}
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
strcmp
(
a_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
0
].
con_addr
)
strcmp
(
a_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
a_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
0
].
con_port
)
{
&&
a_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
0
].
con_port
)
{
...
@@ -9749,6 +9782,12 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -9749,6 +9782,12 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
a_engine
->
rtcp_mux
>
0
?
0
:
1
)
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
a_engine
->
rtcp_mux
>
0
?
0
:
1
)
);
);
if
(
include_external
&&
!
zstr
(
smh
->
mparams
->
extsipip
))
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp3
,
ice_out
->
cands
[
0
][
0
].
transport
,
c2
,
smh
->
mparams
->
extsipip
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
a_engine
->
rtcp_mux
>
0
?
0
:
1
)
);
}
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
if
(
!
zstr
(
a_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
...
@@ -10231,6 +10270,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -10231,6 +10270,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if
(
v_engine
->
ice_out
.
cands
[
0
][
0
].
ready
)
{
if
(
v_engine
->
ice_out
.
cands
[
0
][
0
].
ready
)
{
char
tmp1
[
11
]
=
""
;
char
tmp1
[
11
]
=
""
;
char
tmp2
[
11
]
=
""
;
char
tmp2
[
11
]
=
""
;
char
tmp3
[
11
]
=
""
;
uint32_t
c1
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
1
);
uint32_t
c1
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
1
);
//uint32_t c2 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 2);
//uint32_t c2 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 2);
//uint32_t c3 = (2^24)*126 + (2^8)*65534 + (2^0)*(256 - 1);
//uint32_t c3 = (2^24)*126 + (2^8)*65534 + (2^0)*(256 - 1);
...
@@ -10242,8 +10282,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -10242,8 +10282,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
tmp1
[
10
]
=
'\0'
;
tmp1
[
10
]
=
'\0'
;
tmp2
[
10
]
=
'\0'
;
tmp2
[
10
]
=
'\0'
;
tmp3
[
10
]
=
'\0'
;
switch_stun_random_string
(
tmp1
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp1
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp2
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp2
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp3
,
10
,
"0123456789"
);
ice_out
=
&
v_engine
->
ice_out
;
ice_out
=
&
v_engine
->
ice_out
;
...
@@ -10264,6 +10306,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -10264,6 +10306,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
);
);
if
(
include_external
&&
!
zstr
(
smh
->
mparams
->
extsipip
))
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 1 %s %u %s %d typ host generation 0
\n
"
,
tmp3
,
ice_out
->
cands
[
0
][
0
].
transport
,
c1
,
smh
->
mparams
->
extsipip
,
ice_out
->
cands
[
0
][
0
].
con_port
);
}
if
(
!
zstr
(
v_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
if
(
!
zstr
(
v_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
strcmp
(
v_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
0
].
con_addr
)
strcmp
(
v_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
0
].
con_addr
)
&&
v_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
0
].
con_port
)
{
&&
v_engine
->
local_sdp_port
!=
ice_out
->
cands
[
0
][
0
].
con_port
)
{
...
@@ -10283,6 +10332,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -10283,6 +10332,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
v_engine
->
rtcp_mux
>
0
?
0
:
1
)
ice_out
->
cands
[
0
][
0
].
con_addr
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
v_engine
->
rtcp_mux
>
0
?
0
:
1
)
);
);
if
(
include_external
&&
!
zstr
(
smh
->
mparams
->
extsipip
))
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp3
,
ice_out
->
cands
[
0
][
0
].
transport
,
c2
,
smh
->
mparams
->
extsipip
,
ice_out
->
cands
[
0
][
0
].
con_port
+
(
v_engine
->
rtcp_mux
>
0
?
0
:
1
)
);
}
if
(
!
zstr
(
v_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
1
].
con_addr
)
&&
if
(
!
zstr
(
v_engine
->
local_sdp_ip
)
&&
!
zstr
(
ice_out
->
cands
[
0
][
1
].
con_addr
)
&&
strcmp
(
v_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
1
].
con_addr
)
strcmp
(
v_engine
->
local_sdp_ip
,
ice_out
->
cands
[
0
][
1
].
con_addr
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论