Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f869fb30
提交
f869fb30
authored
2月 17, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3917
上级
5e66db63
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
68 行增加
和
62 行删除
+68
-62
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+68
-62
没有找到文件。
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
f869fb30
...
@@ -899,89 +899,95 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
...
@@ -899,89 +899,95 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
}
}
if
(
event
->
event_id
==
SWITCH_EVENT_ROSTER
)
{
if
(
event
->
event_id
==
SWITCH_EVENT_ROSTER
)
{
struct
presence_helper
helper
=
{
0
};
if
(
!
mod_sofia_globals
.
profile_hash
)
{
return
;
}
if
(
from
)
{
sql
=
switch_mprintf
(
"update sip_subscriptions set version=version+1 where hostname='%q' and profile_name='%q' and "
"sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'"
,
mod_sofia_globals
.
hostname
,
profile
->
name
,
from
);
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"PRES SQL %s
\n
"
,
sql
);
}
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sql
=
switch_mprintf
(
"select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
"sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
"sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
"sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
",1,'%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'','','','','sip',"
" sip_subscriptions.full_to,sip_subscriptions.network_ip,sip_subscriptions.network_port "
"from sip_subscriptions left join sip_presence on "
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
"sip_subscriptions.profile_name=sip_presence.profile_name and sip_presence.profile_name=sip_subscriptions.profile_name) "
"where sip_subscriptions.hostname='%q' and sip_subscriptions.profile_name='%q' and "
"sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'"
,
switch_str_nil
(
status
),
switch_str_nil
(
rpid
),
mod_sofia_globals
.
hostname
,
profile
->
name
,
from
);
}
else
{
sql
=
switch_mprintf
(
"update sip_subscriptions set version=version+1 where hostname='%q' and profile_name='%q' and "
"sip_subscriptions.event='presence'"
,
mod_sofia_globals
.
hostname
,
profile
->
name
);
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"PRES SQL %s
\n
"
,
sql
);
}
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sql
=
switch_mprintf
(
"select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
"sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
"sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
"sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
",1,'%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'','','','','sip',"
"sip_subscriptions.full_to,sip_subscriptions.network_ip,sip_subscriptions.network_port "
"from sip_subscriptions left join sip_presence on "
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
"sip_subscriptions.profile_name=sip_presence.profile_name and sip_subscriptions.hostname = sip_presence.hostname) "
"where sip_subscriptions.hostname='%q' and sip_subscriptions.profile_name='%q' and "
"sip_subscriptions.event='presence'"
,
switch_str_nil
(
status
),
switch_str_nil
(
rpid
),
mod_sofia_globals
.
hostname
,
profile
->
name
);
}
switch_assert
(
sql
!=
NULL
);
if
(
list_profiles_full
(
NULL
,
NULL
,
&
matches
,
SWITCH_FALSE
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
list_profiles_full
(
NULL
,
NULL
,
&
matches
,
SWITCH_FALSE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_console_callback_match_node_t
*
m
;
switch_console_callback_match_node_t
*
m
;
for
(
m
=
matches
->
head
;
m
;
m
=
m
->
next
)
{
for
(
m
=
matches
->
head
;
m
;
m
=
m
->
next
)
{
if
((
profile
=
sofia_glue_find_profile
(
m
->
val
)))
{
if
((
profile
=
sofia_glue_find_profile
(
m
->
val
)))
{
if
(
profile
->
pres_type
!=
PRES_TYPE_FULL
)
{
if
(
profile
->
pres_type
!=
PRES_TYPE_FULL
)
{
if
(
!
mod_sofia_globals
.
profile_hash
)
{
return
;
}
if
(
from
)
{
sql
=
switch_mprintf
(
"update sip_subscriptions set version=version+1 where hostname='%q' and profile_name='%q' and "
"sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'"
,
mod_sofia_globals
.
hostname
,
profile
->
name
,
from
);
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"PRES SQL %s
\n
"
,
sql
);
}
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sql
=
switch_mprintf
(
"select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
"sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
"sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
"sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
",1,'%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'','','','','sip',"
" sip_subscriptions.full_to,sip_subscriptions.network_ip,sip_subscriptions.network_port "
"from sip_subscriptions left join sip_presence on "
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and "
"sip_subscriptions.sub_to_host=sip_presence.sip_host and "
"sip_subscriptions.profile_name=sip_presence.profile_name and "
"sip_presence.profile_name=sip_subscriptions.profile_name) "
"where sip_subscriptions.hostname='%q' and sip_subscriptions.profile_name='%q' and "
"sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'"
,
switch_str_nil
(
status
),
switch_str_nil
(
rpid
),
mod_sofia_globals
.
hostname
,
profile
->
name
,
from
);
}
else
{
sql
=
switch_mprintf
(
"update sip_subscriptions set version=version+1 where hostname='%q' and profile_name='%q' and "
"sip_subscriptions.event='presence'"
,
mod_sofia_globals
.
hostname
,
profile
->
name
);
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"PRES SQL %s
\n
"
,
sql
);
}
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sql
=
switch_mprintf
(
"select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
"sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
"sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
"sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
",1,'%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'','','','','sip',"
"sip_subscriptions.full_to,sip_subscriptions.network_ip,sip_subscriptions.network_port "
"from sip_subscriptions left join sip_presence on "
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and "
"sip_subscriptions.sub_to_host=sip_presence.sip_host and "
"sip_subscriptions.profile_name=sip_presence.profile_name and "
"sip_subscriptions.hostname = sip_presence.hostname) "
"where sip_subscriptions.hostname='%q' and sip_subscriptions.profile_name='%q' and "
"sip_subscriptions.event='presence'"
,
switch_str_nil
(
status
),
switch_str_nil
(
rpid
),
mod_sofia_globals
.
hostname
,
profile
->
name
);
}
switch_assert
(
sql
!=
NULL
);
if
(
mod_sofia_globals
.
debug_presence
>
0
)
{
if
(
mod_sofia_globals
.
debug_presence
>
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"%s is passive, skipping
\n
"
,
(
char
*
)
profile
->
name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"%s is passive, skipping
\n
"
,
(
char
*
)
profile
->
name
);
}
}
sofia_glue_release_profile
(
profile
);
sofia_glue_release_profile
(
profile
);
continue
;
continue
;
}
}
memset
(
&
helper
,
0
,
sizeof
(
helper
));
helper
.
profile
=
profile
;
helper
.
profile
=
profile
;
helper
.
event
=
NULL
;
helper
.
event
=
NULL
;
sofia_glue_execute_sql_callback
(
profile
,
profile
->
ireg_mutex
,
sql
,
sofia_presence_sub_callback
,
&
helper
);
sofia_glue_execute_sql_callback
(
profile
,
profile
->
ireg_mutex
,
sql
,
sofia_presence_sub_callback
,
&
helper
);
switch_safe_free
(
sql
);
sofia_glue_release_profile
(
profile
);
sofia_glue_release_profile
(
profile
);
}
}
}
}
switch_console_free_matches
(
&
matches
);
switch_console_free_matches
(
&
matches
);
}
}
free
(
sql
);
switch_safe_
free
(
sql
);
return
;
return
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论