Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b3b33ea9
提交
b3b33ea9
authored
1月 26, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3794 please test this version
上级
62dc3050
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
528 行增加
和
348 行删除
+528
-348
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+1
-1
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+2
-1
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+2
-2
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+59
-12
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+461
-286
sofia_reg.c
src/mod/endpoints/mod_sofia/sofia_reg.c
+3
-46
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
b3b33ea9
...
...
@@ -4175,7 +4175,7 @@ SWITCH_STANDARD_API(sofia_function)
}
if
(
strstr
(
argv
[
2
],
"sla"
))
{
mod_sofia_globals
.
debug_sla
=
1
;
mod_sofia_globals
.
debug_sla
=
1
0
;
stream
->
write_function
(
stream
,
"+OK Debugging sla
\n
"
);
}
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
b3b33ea9
...
...
@@ -828,6 +828,7 @@ typedef struct {
int
network_port
;
const
char
*
is_nat
;
int
is_auto_nat
;
int
fs_path
;
}
sofia_nat_parse_t
;
...
...
@@ -1140,7 +1141,7 @@ switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, swi
void
sofia_glue_build_vid_refresh_message
(
switch_core_session_t
*
session
,
const
char
*
pl
);
void
sofia_glue_check_dtmf_type
(
private_object_t
*
tech_pvt
);
void
sofia_glue_parse_rtp_bugs
(
switch_rtp_bug_flag_t
*
flag_pole
,
const
char
*
str
);
char
*
sofia_glue_gen_contact_str
(
sofia_profile_t
*
profile
,
sip_t
const
*
sip
,
sofia_dispatch_event_t
*
de
,
sofia_nat_parse_t
*
np
);
char
*
sofia_glue_gen_contact_str
(
sofia_profile_t
*
profile
,
sip_t
const
*
sip
,
nua_handle_t
*
nh
,
sofia_dispatch_event_t
*
de
,
sofia_nat_parse_t
*
np
);
void
sofia_glue_pause_jitterbuffer
(
switch_core_session_t
*
session
,
switch_bool_t
on
);
void
sofia_process_dispatch_event
(
sofia_dispatch_event_t
**
dep
);
char
*
sofia_glue_get_host
(
const
char
*
str
,
switch_memory_pool_t
*
pool
);
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
b3b33ea9
...
...
@@ -91,7 +91,7 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
if
(
status
>=
300
&&
sip
&&
sip
->
sip_call_id
&&
(
!
sofia_private
||
!
sofia_private
->
is_call
))
{
char
*
sql
;
sql
=
switch_mprintf
(
"
update sip_subscriptions set expires=%ld where call_id='%q'"
,
(
long
)
switch_epoch_time_now
(
NULL
)
,
sip
->
sip_call_id
->
i_id
);
sql
=
switch_mprintf
(
"
delete from sip_subscriptions where call_id='%q'"
,
sip
->
sip_call_id
->
i_id
);
switch_assert
(
sql
!=
NULL
);
sofia_glue_execute_sql
(
profile
,
&
sql
,
SWITCH_TRUE
);
nua_handle_destroy
(
nh
);
...
...
@@ -3686,7 +3686,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile
->
contact_user
=
SOFIA_DEFAULT_CONTACT_USER
;
sofia_set_pflag
(
profile
,
PFLAG_PASS_CALLEE_ID
);
sofia_set_pflag
(
profile
,
PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER
);
sofia_set_pflag
(
profile
,
PFLAG_PRESENCE_ON_FIRST_REGISTER
);
//sofia_set_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER);
sofia_set_pflag
(
profile
,
PFLAG_SQL_IN_TRANS
);
profile
->
shutdown_type
=
"false"
;
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
b3b33ea9
...
...
@@ -5139,6 +5139,14 @@ char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup)
{
char
*
url
=
NULL
,
*
e
;
while
((
e
=
strchr
(
buf
,
'"'
)))
{
buf
=
e
+
1
;
}
while
(
*
buf
==
' '
)
{
buf
++
;
}
if
((
url
=
strchr
(
buf
,
'<'
))
&&
(
e
=
strchr
(
url
,
'>'
)))
{
url
++
;
if
(
to_dup
)
{
...
...
@@ -6504,9 +6512,14 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
nua_handle_t
*
nh
;
sofia_destination_t
*
dst
=
NULL
;
char
*
contact_str
,
*
contact
,
*
user_via
=
NULL
;
char
*
route_uri
=
NULL
;
char
*
route_uri
=
NULL
,
*
p
;
contact
=
sofia_glue_get_url_from_contact
((
char
*
)
o_contact
,
1
);
if
((
p
=
strstr
(
contact
,
";fs_"
)))
{
*
p
=
'\0'
;
}
if
(
!
zstr
(
network_ip
)
&&
sofia_glue_check_nat
(
profile
,
network_ip
))
{
char
*
ptr
=
NULL
;
//const char *transport_str = NULL;
...
...
@@ -6744,7 +6757,7 @@ void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str
}
}
char
*
sofia_glue_gen_contact_str
(
sofia_profile_t
*
profile
,
sip_t
const
*
sip
,
sofia_dispatch_event_t
*
de
,
sofia_nat_parse_t
*
np
)
char
*
sofia_glue_gen_contact_str
(
sofia_profile_t
*
profile
,
sip_t
const
*
sip
,
nua_handle_t
*
nh
,
sofia_dispatch_event_t
*
de
,
sofia_nat_parse_t
*
np
)
{
char
*
contact_str
=
NULL
;
const
char
*
contact_host
;
//, *contact_user;
...
...
@@ -6841,7 +6854,8 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof
np
->
is_nat
=
"No contact host"
;
}
if
(
np
->
is_nat
)
{
if
(
np
->
is_nat
&&
!
np
->
fs_path
)
{
contact_host
=
np
->
network_ip
;
switch_snprintf
(
new_port
,
sizeof
(
new_port
),
":%d"
,
np
->
network_port
);
port
=
NULL
;
...
...
@@ -6853,17 +6867,50 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof
}
ipv6
=
strchr
(
contact_host
,
':'
);
if
(
contact
->
m_url
->
url_params
)
{
contact_str
=
switch_mprintf
(
"%s <sip:%s@%s%s%s%s;%s>%s"
,
display
,
contact
->
m_url
->
url_user
,
ipv6
?
"["
:
""
,
contact_host
,
ipv6
?
"]"
:
""
,
new_port
,
contact
->
m_url
->
url_params
,
np
->
is_nat
?
";fs_nat=yes"
:
""
);
if
(
np
->
is_nat
&&
np
->
fs_path
)
{
char
*
full_contact
=
sip_header_as_string
(
nh
->
nh_home
,
(
void
*
)
contact
);
char
*
full_contact_dup
;
char
*
path_encoded
;
int
path_encoded_len
;
char
*
path_val
;
const
char
*
tp
;
full_contact_dup
=
sofia_glue_get_url_from_contact
(
full_contact
,
1
);
if
((
tp
=
switch_stristr
(
"transport="
,
full_contact_dup
)))
{
tp
+=
10
;
}
if
(
zstr
(
tp
))
{
tp
=
"udp"
;
}
path_val
=
switch_mprintf
(
"sip:%s:%d;transport=%s"
,
np
->
network_ip
,
np
->
network_port
,
tp
);
path_encoded_len
=
(
int
)(
strlen
(
path_val
)
*
3
)
+
1
;
switch_zmalloc
(
path_encoded
,
path_encoded_len
);
switch_copy_string
(
path_encoded
,
";fs_path="
,
10
);
switch_url_encode
(
path_val
,
path_encoded
+
9
,
path_encoded_len
-
9
);
contact_str
=
switch_mprintf
(
"%s <%s;fs_nat=yes%s>"
,
display
,
full_contact_dup
,
path_encoded
);
free
(
full_contact_dup
);
free
(
path_encoded
);
free
(
path_val
);
}
else
{
contact_str
=
switch_mprintf
(
"%s <sip:%s@%s%s%s%s>%s"
,
display
,
contact
->
m_url
->
url_user
,
ipv6
?
"["
:
""
,
contact_host
,
ipv6
?
"]"
:
""
,
new_port
,
np
->
is_nat
?
";fs_nat=yes"
:
""
);
if
(
contact
->
m_url
->
url_params
)
{
contact_str
=
switch_mprintf
(
"%s <sip:%s@%s%s%s%s;%s>%s"
,
display
,
contact
->
m_url
->
url_user
,
ipv6
?
"["
:
""
,
contact_host
,
ipv6
?
"]"
:
""
,
new_port
,
contact
->
m_url
->
url_params
,
np
->
is_nat
?
";fs_nat=yes"
:
""
);
}
else
{
contact_str
=
switch_mprintf
(
"%s <sip:%s@%s%s%s%s>%s"
,
display
,
contact
->
m_url
->
url_user
,
ipv6
?
"["
:
""
,
contact_host
,
ipv6
?
"]"
:
""
,
new_port
,
np
->
is_nat
?
";fs_nat=yes"
:
""
);
}
}
return
contact_str
;
}
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
b3b33ea9
差异被折叠。
点击展开。
src/mod/endpoints/mod_sofia/sofia_reg.c
浏览文件 @
b3b33ea9
...
...
@@ -1521,7 +1521,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
"user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,"
"mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host) "
"values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q')"
,
call_id
,
to_user
,
reg_host
,
profile
->
presence_hosts
?
profile
->
presence_hosts
:
reg_host
,
call_id
,
to_user
,
reg_host
,
profile
->
presence_hosts
?
profile
->
presence_hosts
:
""
,
contact_str
,
reg_desc
,
rpid
,
(
long
)
switch_epoch_time_now
(
NULL
)
+
(
long
)
exptime
+
60
,
agent
,
from_user
,
guess_ip4
,
profile
->
name
,
mod_sofia_globals
.
hostname
,
network_ip
,
network_port_c
,
username
,
realm
,
mwi_user
,
mwi_host
,
guess_ip4
,
mod_sofia_globals
.
hostname
,
sub_host
);
...
...
@@ -1553,7 +1553,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"profile-name"
,
profile
->
name
);
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"from-user"
,
to_user
);
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"from-host"
,
reg_host
);
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"presence-hosts"
,
profile
->
presence_hosts
?
profile
->
presence_hosts
:
reg_host
);
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"presence-hosts"
,
profile
->
presence_hosts
?
profile
->
presence_hosts
:
"n/a"
);
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"contact"
,
contact_str
);
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"call-id"
,
call_id
);
switch_event_add_header_string
(
s_event
,
SWITCH_STACK_BOTTOM
,
"rpid"
,
rpid
);
...
...
@@ -1576,38 +1576,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
"Register:
\n
From: [%s@%s]
\n
Contact: [%s]
\n
Expires: [%ld]
\n
"
,
to_user
,
reg_host
,
contact_str
,
(
long
)
exptime
);
}
#if 0
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent",
(sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
switch_event_fire(&event);
}
if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) ||
(reg_count == 1 && sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER))) {
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "sip");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, sub_host);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_subtype", "probe");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
switch_event_fire(&event);
}
}
#endif
}
else
{
int
send
=
1
;
...
...
@@ -1629,18 +1597,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"event_type"
,
"presence"
);
switch_event_fire
(
&
event
);
}
#if 0
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "sip");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s+%s@%s", SOFIA_CHAT_PROTO, to_user, sub_host);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "unavailable");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
switch_event_fire(&event);
}
#endif
if
(
multi_reg
)
{
char
*
icontact
,
*
p
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论