Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
fc77d19b
提交
fc77d19b
authored
1月 03, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
presence.... again....
上级
8b7fd76d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
29 行增加
和
1 行删除
+29
-1
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+1
-0
sofia_reg.c
src/mod/endpoints/mod_sofia/sofia_reg.c
+28
-1
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
fc77d19b
...
...
@@ -1035,6 +1035,7 @@ void sofia_profile_destroy(sofia_profile_t *profile);
switch_status_t
sip_dig_function
(
_In_opt_z_
const
char
*
cmd
,
_In_opt_
switch_core_session_t
*
session
,
_In_
switch_stream_handle_t
*
stream
);
const
char
*
sofia_gateway_status_name
(
sofia_gateway_status_t
status
);
void
sofia_reg_fire_custom_gateway_state_event
(
sofia_gateway_t
*
gateway
,
int
status
,
const
char
*
phrase
);
uint32_t
sofia_reg_reg_count
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
);
void
sofia_glue_copy_t38_options
(
switch_t38_options_t
*
t38_options
,
switch_core_session_t
*
session
);
switch_t38_options_t
*
sofia_glue_extract_t38_options
(
switch_core_session_t
*
session
,
const
char
*
r_sdp
);
char
*
sofia_glue_get_multipart
(
switch_core_session_t
*
session
,
const
char
*
prefix
,
const
char
*
sdp
,
char
**
mp_type
);
...
...
src/mod/endpoints/mod_sofia/sofia_reg.c
浏览文件 @
fc77d19b
...
...
@@ -817,6 +817,19 @@ void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t
switch_safe_free
(
auth_str
);
}
uint32_t
sofia_reg_reg_count
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
)
{
char
buf
[
32
]
=
""
;
char
*
sql
;
sql
=
switch_mprintf
(
"select count(*) from sip_registrations where profile_name='%q' and "
"sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')"
,
profile
->
name
,
user
,
host
,
host
);
sofia_glue_execute_sql2str
(
profile
,
profile
->
ireg_mutex
,
sql
,
buf
,
sizeof
(
buf
));
switch_safe_free
(
sql
);
return
atoi
(
buf
);
}
uint8_t
sofia_reg_handle_register
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sip_t
const
*
sip
,
sofia_regtype_t
regtype
,
char
*
key
,
uint32_t
keylen
,
switch_event_t
**
v_event
,
const
char
*
is_nat
)
{
...
...
@@ -1298,6 +1311,12 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
}
if
(
sofia_reg_reg_count
(
profile
,
to_user
,
reg_host
)
==
1
)
{
sql
=
switch_mprintf
(
"delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'"
,
to_user
,
reg_host
,
profile
->
name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"DELETE PRESENCE SQL: %s
\n
"
,
sql
);
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
}
switch_mutex_unlock
(
profile
->
ireg_mutex
);
...
...
@@ -1361,8 +1380,16 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
}
else
{
int
send
=
1
;
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_PRESENCE_IN
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
multi_reg
)
{
if
(
sofia_reg_reg_count
(
profile
,
to_user
,
sub_host
)
>
0
)
{
send
=
0
;
}
}
if
(
send
&&
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
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论