Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c395c054
提交
c395c054
authored
7月 21, 2008
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@9122
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
8362b558
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
144 行增加
和
45 行删除
+144
-45
internal.xml
conf/sip_profiles/internal.xml
+5
-1
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+76
-43
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+3
-1
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+50
-0
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+10
-0
没有找到文件。
conf/sip_profiles/internal.xml
浏览文件 @
c395c054
...
@@ -122,7 +122,11 @@
...
@@ -122,7 +122,11 @@
<!--<param name="disable-transfer" value="true"/>-->
<!--<param name="disable-transfer" value="true"/>-->
<!--<param name="disable-register" value="true"/>-->
<!--<param name="disable-register" value="true"/>-->
<!--<param name="enable-3pcc" value="true"/>-->
<!--<param name="enable-3pcc" value="true"/>-->
<!-- use stun when specified (default is true) -->
<!--<param name="stun-enabled" value="true"/>-->
<!-- use stun when specified (default is true) -->
<!-- set to true to have the profile determine stun is not useful and turn it off globally-->
<!--<param name="stun-auto-disable" value="true"/>-->
</settings>
</settings>
</profile>
</profile>
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
c395c054
...
@@ -1201,22 +1201,22 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
...
@@ -1201,22 +1201,22 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
switch_assert
(
gp
->
state
<
REG_STATE_LAST
);
switch_assert
(
gp
->
state
<
REG_STATE_LAST
);
stream
->
write_function
(
stream
,
"%s
\n
"
,
line
);
stream
->
write_function
(
stream
,
"%s
\n
"
,
line
);
stream
->
write_function
(
stream
,
"Name
\t
%s
\n
"
,
switch_str_nil
(
gp
->
name
));
stream
->
write_function
(
stream
,
"Name
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
name
));
stream
->
write_function
(
stream
,
"Scheme
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_scheme
));
stream
->
write_function
(
stream
,
"Scheme
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_scheme
));
stream
->
write_function
(
stream
,
"Realm
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_realm
));
stream
->
write_function
(
stream
,
"Realm
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_realm
));
stream
->
write_function
(
stream
,
"Username
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_username
));
stream
->
write_function
(
stream
,
"Username
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_username
));
stream
->
write_function
(
stream
,
"Password
\t
%s
\n
"
,
switch_strlen_zero
(
gp
->
register_password
)
?
"no"
:
"yes"
);
stream
->
write_function
(
stream
,
"Password
\t
\t
%s
\n
"
,
switch_strlen_zero
(
gp
->
register_password
)
?
"no"
:
"yes"
);
stream
->
write_function
(
stream
,
"From
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_from
));
stream
->
write_function
(
stream
,
"From
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_from
));
stream
->
write_function
(
stream
,
"Contact
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_contact
));
stream
->
write_function
(
stream
,
"Contact
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_contact
));
stream
->
write_function
(
stream
,
"To
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_to
));
stream
->
write_function
(
stream
,
"To
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_to
));
stream
->
write_function
(
stream
,
"Proxy
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_proxy
));
stream
->
write_function
(
stream
,
"Proxy
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_proxy
));
stream
->
write_function
(
stream
,
"Context
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_context
));
stream
->
write_function
(
stream
,
"Context
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
register_context
));
stream
->
write_function
(
stream
,
"Expires
\t
%s
\n
"
,
switch_str_nil
(
gp
->
expires_str
));
stream
->
write_function
(
stream
,
"Expires
\t
\t
%s
\n
"
,
switch_str_nil
(
gp
->
expires_str
));
stream
->
write_function
(
stream
,
"Freq
\t
%d
\n
"
,
gp
->
freq
);
stream
->
write_function
(
stream
,
"Freq
\t
\t
%d
\n
"
,
gp
->
freq
);
stream
->
write_function
(
stream
,
"Ping
\t
%d
\n
"
,
gp
->
ping
);
stream
->
write_function
(
stream
,
"Ping
\t
\t
%d
\n
"
,
gp
->
ping
);
stream
->
write_function
(
stream
,
"PingFreq
\t
%d
\n
"
,
gp
->
ping_freq
);
stream
->
write_function
(
stream
,
"PingFreq
\t
\t
%d
\n
"
,
gp
->
ping_freq
);
stream
->
write_function
(
stream
,
"State
\t
%s
\n
"
,
sofia_state_names
[
gp
->
state
]);
stream
->
write_function
(
stream
,
"State
\t
\t
%s
\n
"
,
sofia_state_names
[
gp
->
state
]);
stream
->
write_function
(
stream
,
"Status
\t
%s%s
\n
"
,
status_names
[
gp
->
status
],
gp
->
pinging
?
" (ping)"
:
""
);
stream
->
write_function
(
stream
,
"Status
\t
\t
%s%s
\n
"
,
status_names
[
gp
->
status
],
gp
->
pinging
?
" (ping)"
:
""
);
stream
->
write_function
(
stream
,
"%s
\n
"
,
line
);
stream
->
write_function
(
stream
,
"%s
\n
"
,
line
);
sofia_reg_release_gateway
(
gp
);
sofia_reg_release_gateway
(
gp
);
}
else
{
}
else
{
...
@@ -1227,46 +1227,48 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
...
@@ -1227,46 +1227,48 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
if
((
profile
=
sofia_glue_find_profile
(
argv
[
1
])))
{
if
((
profile
=
sofia_glue_find_profile
(
argv
[
1
])))
{
stream
->
write_function
(
stream
,
"%s
\n
"
,
line
);
stream
->
write_function
(
stream
,
"%s
\n
"
,
line
);
stream
->
write_function
(
stream
,
"Name
\t
%s
\n
"
,
switch_str_nil
(
argv
[
1
]));
stream
->
write_function
(
stream
,
"Name
\t
\t
%s
\n
"
,
switch_str_nil
(
argv
[
1
]));
stream
->
write_function
(
stream
,
"Domain Name
\t
%s
\n
"
,
switch_str_nil
(
profile
->
domain_name
));
stream
->
write_function
(
stream
,
"Domain Name
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
domain_name
));
if
(
strcasecmp
(
argv
[
1
],
profile
->
name
))
{
if
(
strcasecmp
(
argv
[
1
],
profile
->
name
))
{
stream
->
write_function
(
stream
,
"Alias Of
\t
%s
\n
"
,
switch_str_nil
(
profile
->
name
));
stream
->
write_function
(
stream
,
"Alias Of
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
name
));
}
}
stream
->
write_function
(
stream
,
"DBName
\t
%s
\n
"
,
switch_str_nil
(
profile
->
dbname
));
stream
->
write_function
(
stream
,
"DBName
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
dbname
));
stream
->
write_function
(
stream
,
"Dialplan
\t
%s
\n
"
,
switch_str_nil
(
profile
->
dialplan
));
stream
->
write_function
(
stream
,
"Dialplan
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
dialplan
));
stream
->
write_function
(
stream
,
"Context
\t
%s
\n
"
,
switch_str_nil
(
profile
->
context
));
stream
->
write_function
(
stream
,
"Context
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
context
));
stream
->
write_function
(
stream
,
"RTP-IP
\t
%s
\n
"
,
switch_str_nil
(
profile
->
rtpip
));
stream
->
write_function
(
stream
,
"RTP-IP
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
rtpip
));
if
(
profile
->
extrtpip
)
{
if
(
profile
->
extrtpip
)
{
stream
->
write_function
(
stream
,
"Ext-RTP-IP
\t
%s
\n
"
,
profile
->
extrtpip
);
stream
->
write_function
(
stream
,
"Ext-RTP-IP
\t
\t
%s
\n
"
,
profile
->
extrtpip
);
}
}
stream
->
write_function
(
stream
,
"SIP-IP
\t
%s
\n
"
,
switch_str_nil
(
profile
->
sipip
));
stream
->
write_function
(
stream
,
"SIP-IP
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
sipip
));
if
(
profile
->
extsipip
)
{
if
(
profile
->
extsipip
)
{
stream
->
write_function
(
stream
,
"Ext-SIP-IP
\t
%s
\n
"
,
profile
->
extsipip
);
stream
->
write_function
(
stream
,
"Ext-SIP-IP
\t
\t
%s
\n
"
,
profile
->
extsipip
);
}
}
stream
->
write_function
(
stream
,
"URL
\t
%s
\n
"
,
switch_str_nil
(
profile
->
url
));
stream
->
write_function
(
stream
,
"URL
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
url
));
stream
->
write_function
(
stream
,
"BIND-URL
\t
%s
\n
"
,
switch_str_nil
(
profile
->
bindurl
));
stream
->
write_function
(
stream
,
"BIND-URL
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
bindurl
));
if
(
sofia_test_pflag
(
profile
,
PFLAG_TLS
))
{
if
(
sofia_test_pflag
(
profile
,
PFLAG_TLS
))
{
stream
->
write_function
(
stream
,
"TLS-URL
\t
%s
\n
"
,
switch_str_nil
(
profile
->
tls_url
));
stream
->
write_function
(
stream
,
"TLS-URL
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
tls_url
));
stream
->
write_function
(
stream
,
"TLS-BIND-URL %s
\n
"
,
switch_str_nil
(
profile
->
tls_bindurl
));
stream
->
write_function
(
stream
,
"TLS-BIND-URL
\t
%s
\n
"
,
switch_str_nil
(
profile
->
tls_bindurl
));
}
}
stream
->
write_function
(
stream
,
"HOLD-MUSIC
\t
%s
\n
"
,
switch_str_nil
(
profile
->
hold_music
)
);
stream
->
write_function
(
stream
,
"HOLD-MUSIC
\t
\t
%s
\n
"
,
switch_strlen_zero
(
profile
->
hold_music
)
?
"NONE"
:
profile
->
hold_music
);
stream
->
write_function
(
stream
,
"CODECS
\t
%s
\n
"
,
switch_str_nil
(
profile
->
codec_string
));
stream
->
write_function
(
stream
,
"CODECS
\t
\t
%s
\n
"
,
switch_str_nil
(
profile
->
codec_string
));
stream
->
write_function
(
stream
,
"TEL-EVENT
\t
%d
\n
"
,
profile
->
te
);
stream
->
write_function
(
stream
,
"TEL-EVENT
\t
\t
%d
\n
"
,
profile
->
te
);
if
(
profile
->
dtmf_type
==
DTMF_2833
)
{
if
(
profile
->
dtmf_type
==
DTMF_2833
)
{
stream
->
write_function
(
stream
,
"DTMF-MODE
\t
rfc2833
\n
"
);
stream
->
write_function
(
stream
,
"DTMF-MODE
\t
\t
rfc2833
\n
"
);
}
else
if
(
profile
->
dtmf_type
==
DTMF_INFO
)
{
}
else
if
(
profile
->
dtmf_type
==
DTMF_INFO
)
{
stream
->
write_function
(
stream
,
"DTMF-MODE
\t
info
\n
"
);
stream
->
write_function
(
stream
,
"DTMF-MODE
\t
\t
info
\n
"
);
}
else
{
}
else
{
stream
->
write_function
(
stream
,
"DTMF-MODE
\t
none
\n
"
);
stream
->
write_function
(
stream
,
"DTMF-MODE
\t\t
none
\n
"
);
}
}
stream
->
write_function
(
stream
,
"CNG
\t
%d
\n
"
,
profile
->
cng_pt
);
stream
->
write_function
(
stream
,
"CNG
\t\t
%d
\n
"
,
profile
->
cng_pt
);
stream
->
write_function
(
stream
,
"SESSION-TO
\t
%d
\n
"
,
profile
->
session_timeout
);
stream
->
write_function
(
stream
,
"SESSION-TO
\t\t
%d
\n
"
,
profile
->
session_timeout
);
stream
->
write_function
(
stream
,
"MAX-DIALOG
\t
%d
\n
"
,
profile
->
max_proceeding
);
stream
->
write_function
(
stream
,
"MAX-DIALOG
\t\t
%d
\n
"
,
profile
->
max_proceeding
);
stream
->
write_function
(
stream
,
"NOMEDIA
\t
%s
\n
"
,
switch_test_flag
(
profile
,
TFLAG_INB_NOMEDIA
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"NOMEDIA
\t\t
%s
\n
"
,
switch_test_flag
(
profile
,
TFLAG_INB_NOMEDIA
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"LATE-NEG
\t
%s
\n
"
,
switch_test_flag
(
profile
,
TFLAG_LATE_NEGOTIATION
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"LATE-NEG
\t\t
%s
\n
"
,
switch_test_flag
(
profile
,
TFLAG_LATE_NEGOTIATION
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"PROXY-MEDIA
\t
%s
\n
"
,
switch_test_flag
(
profile
,
TFLAG_PROXY_MEDIA
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"PROXY-MEDIA
\t\t
%s
\n
"
,
switch_test_flag
(
profile
,
TFLAG_PROXY_MEDIA
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"AGGRESSIVENAT
\t
%s
\n
"
,
sofia_test_pflag
(
profile
,
PFLAG_AGGRESSIVE_NAT_DETECTION
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"AGGRESSIVENAT
\t\t
%s
\n
"
,
sofia_test_pflag
(
profile
,
PFLAG_AGGRESSIVE_NAT_DETECTION
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"STUN_ENABLED
\t\t
%s
\n
"
,
sofia_test_pflag
(
profile
,
PFLAG_STUN_ENABLED
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"STUN_AUTO_DISABLE
\t
%s
\n
"
,
sofia_test_pflag
(
profile
,
PFLAG_STUN_AUTO_DISABLE
)
?
"true"
:
"false"
);
stream
->
write_function
(
stream
,
"
\n
Registrations:
\n
%s
\n
"
,
line
);
stream
->
write_function
(
stream
,
"
\n
Registrations:
\n
%s
\n
"
,
line
);
cb
.
profile
=
profile
;
cb
.
profile
=
profile
;
...
@@ -1376,6 +1378,37 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
...
@@ -1376,6 +1378,37 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
goto
done
;
goto
done
;
}
}
if
(
!
strcasecmp
(
argv
[
1
],
"stun-auto-disable"
))
{
if
(
argv
[
2
])
{
int
is_true
=
switch_true
(
argv
[
2
]);
if
(
is_true
)
{
profile
->
pflags
|=
PFLAG_STUN_AUTO_DISABLE
;
}
else
{
profile
->
pflags
&=
~
PFLAG_STUN_AUTO_DISABLE
;
}
}
stream
->
write_function
(
stream
,
"+OK stun-auto-disable=%s"
,
(
profile
->
pflags
&
PFLAG_STUN_AUTO_DISABLE
)
?
"true"
:
"false"
);
goto
done
;
}
if
(
!
strcasecmp
(
argv
[
1
],
"stun-enabled"
))
{
if
(
argv
[
2
])
{
int
is_true
=
switch_true
(
argv
[
2
]);
if
(
is_true
)
{
profile
->
pflags
|=
PFLAG_STUN_ENABLED
;
}
else
{
profile
->
pflags
&=
~
PFLAG_STUN_ENABLED
;
}
}
stream
->
write_function
(
stream
,
"+OK stun-enabled=%s"
,
(
profile
->
pflags
&
PFLAG_STUN_ENABLED
)
?
"true"
:
"false"
);
goto
done
;
}
if
(
!
strcasecmp
(
argv
[
1
],
"rescan"
))
{
if
(
!
strcasecmp
(
argv
[
1
],
"rescan"
))
{
if
(
argc
>
2
&&
!
strcasecmp
(
argv
[
2
],
"reloadxml"
))
{
if
(
argc
>
2
&&
!
strcasecmp
(
argv
[
2
],
"reloadxml"
))
{
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
c395c054
...
@@ -157,7 +157,9 @@ typedef enum {
...
@@ -157,7 +157,9 @@ typedef enum {
PFLAG_3PCC
=
(
1
<<
23
),
PFLAG_3PCC
=
(
1
<<
23
),
PFLAG_DISABLE_RTP_AUTOADJ
=
(
1
<<
24
),
PFLAG_DISABLE_RTP_AUTOADJ
=
(
1
<<
24
),
PFLAG_DISABLE_SRTP_AUTH
=
(
1
<<
25
),
PFLAG_DISABLE_SRTP_AUTH
=
(
1
<<
25
),
PFLAG_FUNNY_STUN
=
(
1
<<
26
)
PFLAG_FUNNY_STUN
=
(
1
<<
26
),
PFLAG_STUN_ENABLED
=
(
1
<<
27
),
PFLAG_STUN_AUTO_DISABLE
=
(
1
<<
28
)
}
PFLAGS
;
}
PFLAGS
;
typedef
enum
{
typedef
enum
{
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
c395c054
...
@@ -982,6 +982,8 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
...
@@ -982,6 +982,8 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
/* you could change profile->foo here if it was a minor change like context or dialplan ... */
/* you could change profile->foo here if it was a minor change like context or dialplan ... */
profile
->
rport_level
=
1
;
/* default setting */
profile
->
rport_level
=
1
;
/* default setting */
profile
->
acl_count
=
0
;
profile
->
pflags
|=
PFLAG_STUN_ENABLED
;
if
((
settings
=
switch_xml_child
(
xprofile
,
"settings"
)))
{
if
((
settings
=
switch_xml_child
(
xprofile
,
"settings"
)))
{
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
...
@@ -1053,6 +1055,36 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
...
@@ -1053,6 +1055,36 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
}
else
{
}
else
{
profile
->
pflags
&=
~
PFLAG_FUNNY_STUN
;
profile
->
pflags
&=
~
PFLAG_FUNNY_STUN
;
}
}
}
else
if
(
!
strcasecmp
(
var
,
"stun-enabled"
))
{
if
(
switch_true
(
val
))
{
profile
->
pflags
|=
PFLAG_STUN_ENABLED
;
}
else
{
profile
->
pflags
&=
~
PFLAG_STUN_ENABLED
;
}
}
else
if
(
!
strcasecmp
(
var
,
"stun-auto-disable"
))
{
if
(
switch_true
(
val
))
{
profile
->
pflags
|=
PFLAG_STUN_AUTO_DISABLE
;
}
else
{
profile
->
pflags
&=
~
PFLAG_STUN_AUTO_DISABLE
;
}
}
else
if
(
!
strcasecmp
(
var
,
"apply-nat-acl"
))
{
if
(
profile
->
acl_count
<
SOFIA_MAX_ACL
)
{
profile
->
nat_acl
[
profile
->
nat_acl_count
++
]
=
switch_core_strdup
(
profile
->
pool
,
val
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Max acl records of %d reached
\n
"
,
SOFIA_MAX_ACL
);
}
}
else
if
(
!
strcasecmp
(
var
,
"apply-inbound-acl"
))
{
if
(
profile
->
acl_count
<
SOFIA_MAX_ACL
)
{
profile
->
acl
[
profile
->
acl_count
++
]
=
switch_core_strdup
(
profile
->
pool
,
val
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Max acl records of %d reached
\n
"
,
SOFIA_MAX_ACL
);
}
}
else
if
(
!
strcasecmp
(
var
,
"apply-register-acl"
))
{
if
(
profile
->
reg_acl_count
<
SOFIA_MAX_ACL
)
{
profile
->
reg_acl
[
profile
->
reg_acl_count
++
]
=
switch_core_strdup
(
profile
->
pool
,
val
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Max acl records of %d reached
\n
"
,
SOFIA_MAX_ACL
);
}
}
else
if
(
!
strcasecmp
(
var
,
"rfc2833-pt"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"rfc2833-pt"
))
{
profile
->
te
=
(
switch_payload_t
)
atoi
(
val
);
profile
->
te
=
(
switch_payload_t
)
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"cng-pt"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"cng-pt"
))
{
...
@@ -1173,6 +1205,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
...
@@ -1173,6 +1205,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
}
}
}
}
if
((
gateways_tag
=
switch_xml_child
(
xprofile
,
"gateways"
)))
{
if
((
gateways_tag
=
switch_xml_child
(
xprofile
,
"gateways"
)))
{
parse_gateways
(
profile
,
gateways_tag
);
parse_gateways
(
profile
,
gateways_tag
);
}
}
...
@@ -1333,6 +1366,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
...
@@ -1333,6 +1366,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile
->
tls_version
=
0
;
profile
->
tls_version
=
0
;
profile
->
mflags
=
MFLAG_REFER
|
MFLAG_REGISTER
;
profile
->
mflags
=
MFLAG_REFER
|
MFLAG_REGISTER
;
profile
->
rport_level
=
1
;
profile
->
rport_level
=
1
;
profile
->
pflags
|=
PFLAG_STUN_ENABLED
;
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
...
@@ -1392,6 +1426,18 @@ switch_status_t config_sofia(int reload, char *profile_name)
...
@@ -1392,6 +1426,18 @@ switch_status_t config_sofia(int reload, char *profile_name)
}
else
{
}
else
{
profile
->
pflags
&=
~
PFLAG_FUNNY_STUN
;
profile
->
pflags
&=
~
PFLAG_FUNNY_STUN
;
}
}
}
else
if
(
!
strcasecmp
(
var
,
"stun-enabled"
))
{
if
(
switch_true
(
val
))
{
profile
->
pflags
|=
PFLAG_STUN_ENABLED
;
}
else
{
profile
->
pflags
&=
~
PFLAG_STUN_ENABLED
;
}
}
else
if
(
!
strcasecmp
(
var
,
"stun-auto-disable"
))
{
if
(
switch_true
(
val
))
{
profile
->
pflags
|=
PFLAG_STUN_AUTO_DISABLE
;
}
else
{
profile
->
pflags
&=
~
PFLAG_STUN_AUTO_DISABLE
;
}
}
else
if
(
!
strcasecmp
(
var
,
"rfc2833-pt"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"rfc2833-pt"
))
{
profile
->
te
=
(
switch_payload_t
)
atoi
(
val
);
profile
->
te
=
(
switch_payload_t
)
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"cng-pt"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"cng-pt"
))
{
...
@@ -1680,6 +1726,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
...
@@ -1680,6 +1726,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile
->
dialplan
=
switch_core_strdup
(
profile
->
pool
,
"XML"
);
profile
->
dialplan
=
switch_core_strdup
(
profile
->
pool
,
"XML"
);
}
}
if
(
!
profile
->
context
)
{
profile
->
context
=
switch_core_strdup
(
profile
->
pool
,
"default"
);
}
if
(
!
profile
->
sipdomain
)
{
if
(
!
profile
->
sipdomain
)
{
profile
->
sipdomain
=
switch_core_strdup
(
profile
->
pool
,
profile
->
sipip
);
profile
->
sipdomain
=
switch_core_strdup
(
profile
->
pool
,
profile
->
sipip
);
}
}
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
c395c054
...
@@ -442,6 +442,12 @@ switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_
...
@@ -442,6 +442,12 @@ switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_
if
(
!
strncasecmp
(
sourceip
,
"stun:"
,
5
))
{
if
(
!
strncasecmp
(
sourceip
,
"stun:"
,
5
))
{
char
*
p
;
char
*
p
;
if
(
!
(
profile
->
pflags
&
PFLAG_STUN_ENABLED
))
{
*
ip
=
switch_core_strdup
(
pool
,
tech_pvt
->
profile
->
rtpip
);
return
SWITCH_STATUS_SUCCESS
;
}
stun_ip
=
strdup
(
sourceip
+
5
);
stun_ip
=
strdup
(
sourceip
+
5
);
if
((
p
=
strchr
(
stun_ip
,
':'
)))
{
if
((
p
=
strchr
(
stun_ip
,
':'
)))
{
...
@@ -483,6 +489,10 @@ switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_
...
@@ -483,6 +489,10 @@ switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_
if
(
tech_pvt
)
{
if
(
tech_pvt
)
{
if
(
myport
==
*
port
&&
!
strcmp
(
*
ip
,
tech_pvt
->
profile
->
rtpip
))
{
if
(
myport
==
*
port
&&
!
strcmp
(
*
ip
,
tech_pvt
->
profile
->
rtpip
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Stun Not Required ip and port match. [%s]:[%d]
\n
"
,
*
ip
,
*
port
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Stun Not Required ip and port match. [%s]:[%d]
\n
"
,
*
ip
,
*
port
);
if
(
profile
->
pflags
&
PFLAG_STUN_AUTO_DISABLE
)
{
profile
->
pflags
&=
~
PFLAG_STUN_ENABLED
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Stun completely disabled.
\n
"
);
}
}
else
{
}
else
{
tech_pvt
->
stun_ip
=
switch_core_session_strdup
(
tech_pvt
->
session
,
stun_ip
);
tech_pvt
->
stun_ip
=
switch_core_session_strdup
(
tech_pvt
->
session
,
stun_ip
);
tech_pvt
->
stun_port
=
stun_port
;
tech_pvt
->
stun_port
=
stun_port
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论