Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a73583b5
提交
a73583b5
authored
9月 08, 2014
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-6806 #resolve
上级
678dc3dc
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
32 行增加
和
11 行删除
+32
-11
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+0
-7
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+1
-0
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+31
-4
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
a73583b5
...
...
@@ -5563,8 +5563,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_management_interface_t
*
management_interface
;
switch_application_interface_t
*
app_interface
;
struct
in_addr
in
;
struct
tm
tm
=
{
0
};
time_t
now
;
memset
(
&
mod_sofia_globals
,
0
,
sizeof
(
mod_sofia_globals
));
mod_sofia_globals
.
destroy_private
.
destroy_nh
=
1
;
...
...
@@ -5573,11 +5571,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
mod_sofia_globals
.
pool
=
pool
;
switch_mutex_init
(
&
mod_sofia_globals
.
mutex
,
SWITCH_MUTEX_NESTED
,
mod_sofia_globals
.
pool
);
now
=
switch_epoch_time_now
(
NULL
);
tm
=
*
(
localtime
(
&
now
));
mod_sofia_globals
.
presence_epoch
=
now
-
(
tm
.
tm_yday
*
86400
)
-
(
tm
.
tm_hour
*
60
*
60
)
-
(
tm
.
tm_min
*
60
)
-
tm
.
tm_sec
;
switch_find_local_ip
(
mod_sofia_globals
.
guess_ip
,
sizeof
(
mod_sofia_globals
.
guess_ip
),
&
mod_sofia_globals
.
guess_mask
,
AF_INET
);
in
.
s_addr
=
mod_sofia_globals
.
guess_mask
;
switch_set_string
(
mod_sofia_globals
.
guess_mask_str
,
inet_ntoa
(
in
));
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
a73583b5
...
...
@@ -369,6 +369,7 @@ struct mod_sofia_globals {
switch_thread_t
*
presence_thread
;
uint32_t
max_reg_threads
;
time_t
presence_epoch
;
int
presence_year
;
};
extern
struct
mod_sofia_globals
mod_sofia_globals
;
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
a73583b5
...
...
@@ -2105,17 +2105,44 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char *
return
0
;
}
#define SOFIA_PRESENCE_COLLISION_DELTA 50
#define SOFIA_PRESENCE_ROLLOVER_YEAR (86400 * 365 * SOFIA_PRESENCE_COLLISION_DELTA)
static
uint32_t
check_presence_epoch
(
void
)
{
struct
tm
tm
=
{
0
};
time_t
now
=
switch_epoch_time_now
(
NULL
);
uint32_t
callsequence
=
(
now
-
mod_sofia_globals
.
presence_epoch
)
*
SOFIA_PRESENCE_COLLISION_DELTA
;
if
(
!
mod_sofia_globals
.
presence_year
||
callsequence
>=
SOFIA_PRESENCE_ROLLOVER_YEAR
)
{
switch_mutex_lock
(
mod_sofia_globals
.
mutex
);
tm
=
*
(
localtime
(
&
now
));
if
(
tm
.
tm_year
!=
mod_sofia_globals
.
presence_year
)
{
mod_sofia_globals
.
presence_epoch
=
(
uint32_t
)
now
-
(
tm
.
tm_yday
*
86400
)
-
(
tm
.
tm_hour
*
60
*
60
)
-
(
tm
.
tm_min
*
60
)
-
tm
.
tm_sec
;
mod_sofia_globals
.
presence_year
=
tm
.
tm_year
;
callsequence
=
((
uint32_t
)
now
-
mod_sofia_globals
.
presence_epoch
)
*
SOFIA_PRESENCE_COLLISION_DELTA
;
}
switch_mutex_unlock
(
mod_sofia_globals
.
mutex
);
}
return
callsequence
;
}
uint32_t
sofia_presence_get_cseq
(
sofia_profile_t
*
profile
)
{
uint32_t
callsequence
;
uint32_t
now
=
(
uint32_t
)
switch_epoch_time_now
(
NULL
)
;
int
diff
=
0
;
switch_mutex_lock
(
profile
->
ireg_mutex
);
callsequence
=
(
now
-
mod_sofia_globals
.
presence_epoch
)
*
100
;
callsequence
=
check_presence_epoch
()
;
if
(
profile
->
last_cseq
&&
callsequence
<=
profile
->
last_cseq
)
{
callsequence
=
++
profile
->
last_cseq
;
if
(
profile
->
last_cseq
)
{
diff
=
callsequence
-
profile
->
last_cseq
;
if
(
diff
<
0
&&
diff
>
-
100000
)
{
callsequence
=
++
profile
->
last_cseq
;
}
}
profile
->
last_cseq
=
callsequence
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论