Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
10dfc377
提交
10dfc377
authored
12月 16, 2011
作者:
Marc Olivier Chouinard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3762 --resolve
I've had to add a missing include and do some formating cleanup.
上级
4f79b585
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
58 行增加
和
13 行删除
+58
-13
external.xml
conf/sip_profiles/external.xml
+2
-0
example.xml
conf/sip_profiles/external/example.xml
+4
-0
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+2
-0
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+50
-13
没有找到文件。
conf/sip_profiles/external.xml
浏览文件 @
10dfc377
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
<param
name=
"sip-trace"
value=
"no"
/>
<param
name=
"sip-trace"
value=
"no"
/>
<param
name=
"sip-capture"
value=
"no"
/>
<param
name=
"sip-capture"
value=
"no"
/>
<param
name=
"rfc2833-pt"
value=
"101"
/>
<param
name=
"rfc2833-pt"
value=
"101"
/>
<!-- RFC 5626 : Send reg-id and sip.instance -->
<!--<param name="enable-rfc-5626" value="true"/> -->
<param
name=
"sip-port"
value=
"$${external_sip_port}"
/>
<param
name=
"sip-port"
value=
"$${external_sip_port}"
/>
<param
name=
"dialplan"
value=
"XML"
/>
<param
name=
"dialplan"
value=
"XML"
/>
<param
name=
"context"
value=
"public"
/>
<param
name=
"context"
value=
"public"
/>
...
...
conf/sip_profiles/external/example.xml
浏览文件 @
10dfc377
...
@@ -31,4 +31,8 @@
...
@@ -31,4 +31,8 @@
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->
<!--</gateway>-->
<!--rfc5626 : Abilitazione rfc5626 ///-->
<!--<param name="rfc-5626" value="true"/>-->
<!--rfc5626 : extra sip params to send in the contact-->
<!--<param name="reg-id" value="1"/>-->
</include>
</include>
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
10dfc377
...
@@ -131,6 +131,7 @@ typedef struct private_object private_object_t;
...
@@ -131,6 +131,7 @@ typedef struct private_object private_object_t;
#include "sofia-sip/sip_parser.h"
#include "sofia-sip/sip_parser.h"
#include "sofia-sip/tport_tag.h"
#include "sofia-sip/tport_tag.h"
#include <sofia-sip/msg.h>
#include <sofia-sip/msg.h>
#include <sofia-sip/uniqueid.h>
typedef
enum
{
typedef
enum
{
DTMF_2833
,
DTMF_2833
,
...
@@ -203,6 +204,7 @@ typedef enum {
...
@@ -203,6 +204,7 @@ typedef enum {
PFLAG_WORKER_RUNNING
,
PFLAG_WORKER_RUNNING
,
PFLAG_UNREG_OPTIONS_FAIL
,
PFLAG_UNREG_OPTIONS_FAIL
,
PFLAG_DISABLE_TIMER
,
PFLAG_DISABLE_TIMER
,
PFLAG_ENABLE_RFC5626
,
PFLAG_DISABLE_100REL
,
PFLAG_DISABLE_100REL
,
PFLAG_AGGRESSIVE_NAT_DETECTION
,
PFLAG_AGGRESSIVE_NAT_DETECTION
,
PFLAG_RECIEVED_IN_NAT_REG_CONTACT
,
PFLAG_RECIEVED_IN_NAT_REG_CONTACT
,
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
10dfc377
...
@@ -1807,6 +1807,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
...
@@ -1807,6 +1807,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
switch_event_t
*
s_event
;
switch_event_t
*
s_event
;
int
use_100rel
=
!
sofia_test_pflag
(
profile
,
PFLAG_DISABLE_100REL
);
int
use_100rel
=
!
sofia_test_pflag
(
profile
,
PFLAG_DISABLE_100REL
);
int
use_timer
=
!
sofia_test_pflag
(
profile
,
PFLAG_DISABLE_TIMER
);
int
use_timer
=
!
sofia_test_pflag
(
profile
,
PFLAG_DISABLE_TIMER
);
int
use_rfc_5626
=
sofia_test_pflag
(
profile
,
PFLAG_ENABLE_RFC5626
);
const
char
*
supported
=
NULL
;
const
char
*
supported
=
NULL
;
int
sanity
;
int
sanity
;
switch_thread_t
*
worker_thread
;
switch_thread_t
*
worker_thread
;
...
@@ -1828,7 +1829,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
...
@@ -1828,7 +1829,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
goto
end
;
goto
end
;
}
}
supported
=
switch_core_sprintf
(
profile
->
pool
,
"%s%s
precondition, path, replaces"
,
use_100rel
?
"100rel, "
:
""
,
use_timer
?
"timer
, "
:
""
);
supported
=
switch_core_sprintf
(
profile
->
pool
,
"%s%s
%sprecondition, path, replaces"
,
use_100rel
?
"100rel, "
:
""
,
use_timer
?
"timer, "
:
""
,
use_rfc_5626
?
"outbound
, "
:
""
);
if
(
sofia_test_pflag
(
profile
,
PFLAG_AUTO_NAT
)
&&
switch_nat_get_type
())
{
if
(
sofia_test_pflag
(
profile
,
PFLAG_AUTO_NAT
)
&&
switch_nat_get_type
())
{
if
(
switch_nat_add_mapping
(
profile
->
sip_port
,
SWITCH_NAT_UDP
,
NULL
,
SWITCH_FALSE
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_nat_add_mapping
(
profile
->
sip_port
,
SWITCH_NAT_UDP
,
NULL
,
SWITCH_FALSE
)
==
SWITCH_STATUS_SUCCESS
)
{
...
@@ -2293,7 +2294,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
...
@@ -2293,7 +2294,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
if
((
gateway
=
switch_core_alloc
(
profile
->
pool
,
sizeof
(
*
gateway
))))
{
if
((
gateway
=
switch_core_alloc
(
profile
->
pool
,
sizeof
(
*
gateway
))))
{
const
char
*
sipip
,
*
format
;
const
char
*
sipip
,
*
format
;
switch_uuid_t
uuid
;
switch_uuid_t
uuid
;
uint32_t
ping_freq
=
0
,
extension_in_contact
=
0
,
distinct_to
=
0
;
uint32_t
ping_freq
=
0
,
extension_in_contact
=
0
,
distinct_to
=
0
,
rfc_5626
=
0
;
int
ping_max
=
1
,
ping_min
=
-
1
;
int
ping_max
=
1
,
ping_min
=
-
1
;
char
*
register_str
=
"true"
,
*
scheme
=
"Digest"
,
char
*
register_str
=
"true"
,
*
scheme
=
"Digest"
,
*
realm
=
NULL
,
*
realm
=
NULL
,
...
@@ -2308,7 +2309,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
...
@@ -2308,7 +2309,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
*
retry_seconds
=
"30"
,
*
retry_seconds
=
"30"
,
*
timeout_seconds
=
"60"
,
*
timeout_seconds
=
"60"
,
*
from_user
=
""
,
*
from_domain
=
NULL
,
*
outbound_proxy
=
NULL
,
*
register_proxy
=
NULL
,
*
contact_host
=
NULL
,
*
from_user
=
""
,
*
from_domain
=
NULL
,
*
outbound_proxy
=
NULL
,
*
register_proxy
=
NULL
,
*
contact_host
=
NULL
,
*
contact_params
=
NULL
,
*
params
=
NULL
,
*
register_transport
=
NULL
;
*
contact_params
=
NULL
,
*
params
=
NULL
,
*
register_transport
=
NULL
,
*
reg_id
=
NULL
,
*
str_rfc_5626
=
NULL
;
if
(
!
context
)
{
if
(
!
context
)
{
context
=
"default"
;
context
=
"default"
;
...
@@ -2431,6 +2433,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
...
@@ -2431,6 +2433,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
outbound_proxy
=
val
;
outbound_proxy
=
val
;
}
else
if
(
!
strcmp
(
var
,
"distinct-to"
))
{
}
else
if
(
!
strcmp
(
var
,
"distinct-to"
))
{
distinct_to
=
switch_true
(
val
);
distinct_to
=
switch_true
(
val
);
}
else
if
(
!
strcmp
(
var
,
"rfc-5626"
))
{
rfc_5626
=
switch_true
(
val
);
}
else
if
(
!
strcmp
(
var
,
"reg-id"
))
{
reg_id
=
val
;
}
else
if
(
!
strcmp
(
var
,
"contact-params"
))
{
}
else
if
(
!
strcmp
(
var
,
"contact-params"
))
{
contact_params
=
val
;
contact_params
=
val
;
}
else
if
(
!
strcmp
(
var
,
"register-transport"
))
{
}
else
if
(
!
strcmp
(
var
,
"register-transport"
))
{
...
@@ -2444,6 +2450,14 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
...
@@ -2444,6 +2450,14 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway
->
register_transport
=
transport
;
gateway
->
register_transport
=
transport
;
}
}
}
}
/* RFC 5626 enable in the GW profile and the UA profile */
if
(
rfc_5626
&&
sofia_test_pflag
(
profile
,
PFLAG_ENABLE_RFC5626
))
{
char
str_guid
[
su_guid_strlen
+
1
];
su_guid_t
guid
[
1
];
su_guid_generate
(
guid
);
su_guid_sprintf
(
str_guid
,
su_guid_strlen
+
1
,
guid
);
str_rfc_5626
=
switch_core_sprintf
(
gateway
->
pool
,
";reg-id=%s;+sip.instance=
\"
<urn:uuid:%s>
\"
"
,
reg_id
,
str_guid
);
}
if
(
ping_freq
)
{
if
(
ping_freq
)
{
if
(
ping_freq
>=
5
)
{
if
(
ping_freq
>=
5
)
{
...
@@ -2610,17 +2624,36 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
...
@@ -2610,17 +2624,36 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
}
}
if
(
extension_in_contact
)
{
if
(
extension_in_contact
)
{
format
=
strchr
(
sipip
,
':'
)
?
"<sip:%s@[%s]:%d%s>"
:
"<sip:%s@%s:%d%s>"
;
if
(
rfc_5626
)
{
gateway
->
register_contact
=
switch_core_sprintf
(
gateway
->
pool
,
format
,
extension
,
format
=
strchr
(
sipip
,
':'
)
?
"<sip:%s@[%s]:%d>%s"
:
"<sip:%s@%s:%d%s>%s"
;
sipip
,
gateway
->
register_contact
=
switch_core_sprintf
(
gateway
->
pool
,
format
,
extension
,
sofia_glue_transport_has_tls
(
gateway
->
register_transport
)
?
sipip
,
profile
->
tls_sip_port
:
profile
->
sip_port
,
params
);
sofia_glue_transport_has_tls
(
gateway
->
register_transport
)
?
profile
->
tls_sip_port
:
profile
->
sip_port
,
params
,
str_rfc_5626
);
}
else
{
format
=
strchr
(
sipip
,
':'
)
?
"<sip:%s@[%s]:%d%s>"
:
"<sip:%s@%s:%d%s%s>"
;
gateway
->
register_contact
=
switch_core_sprintf
(
gateway
->
pool
,
format
,
extension
,
sipip
,
sofia_glue_transport_has_tls
(
gateway
->
register_transport
)
?
profile
->
tls_sip_port
:
profile
->
sip_port
,
params
,
contact_params
);
}
}
else
{
}
else
{
format
=
strchr
(
sipip
,
':'
)
?
"<sip:gw+%s@[%s]:%d%s>"
:
"<sip:gw+%s@%s:%d%s>"
;
if
(
rfc_5626
)
{
gateway
->
register_contact
=
switch_core_sprintf
(
gateway
->
pool
,
format
,
gateway
->
name
,
format
=
strchr
(
sipip
,
':'
)
?
"<sip:gw+%s@[%s]:%d%s>%s"
:
"<sip:gw+%s@%s:%d%s>%s"
;
sipip
,
gateway
->
register_contact
=
switch_core_sprintf
(
gateway
->
pool
,
format
,
gateway
->
name
,
sofia_glue_transport_has_tls
(
gateway
->
register_transport
)
?
sipip
,
profile
->
tls_sip_port
:
profile
->
sip_port
,
params
);
sofia_glue_transport_has_tls
(
gateway
->
register_transport
)
?
profile
->
tls_sip_port
:
profile
->
sip_port
,
params
,
str_rfc_5626
);
}
else
{
format
=
strchr
(
sipip
,
':'
)
?
"<sip:gw+%s@[%s]:%d%s>"
:
"<sip:gw+%s@%s:%d%s>"
;
gateway
->
register_contact
=
switch_core_sprintf
(
gateway
->
pool
,
format
,
gateway
->
name
,
sipip
,
sofia_glue_transport_has_tls
(
gateway
->
register_transport
)
?
profile
->
tls_sip_port
:
profile
->
sip_port
,
params
);
}
}
}
gateway
->
expires_str
=
switch_core_strdup
(
gateway
->
pool
,
expire_seconds
);
gateway
->
expires_str
=
switch_core_strdup
(
gateway
->
pool
,
expire_seconds
);
...
@@ -4216,6 +4249,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
...
@@ -4216,6 +4249,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
if
(
!
switch_true
(
val
))
{
if
(
!
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_DISABLE_TIMER
);
sofia_set_pflag
(
profile
,
PFLAG_DISABLE_TIMER
);
}
}
}
else
if
(
!
strcasecmp
(
var
,
"enable-rfc-5626"
))
{
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_ENABLE_RFC5626
);
}
}
else
if
(
!
strcasecmp
(
var
,
"minimum-session-expires"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"minimum-session-expires"
))
{
profile
->
minimum_session_expires
=
atoi
(
val
);
profile
->
minimum_session_expires
=
atoi
(
val
);
/* per RFC 4028: minimum_session_expires must be > 90 */
/* per RFC 4028: minimum_session_expires must be > 90 */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论