Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
827b680a
提交
827b680a
authored
11月 27, 2012
作者:
Michael Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix regressions in sql stuff
上级
92945f8a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
29 行增加
和
20 行删除
+29
-20
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+4
-1
sofia_reg.c
src/mod/endpoints/mod_sofia/sofia_reg.c
+17
-14
switch_core_sqldb.c
src/switch_core_sqldb.c
+8
-5
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
827b680a
...
...
@@ -859,6 +859,9 @@ struct callback_t {
switch_size_t
len
;
switch_console_callback_match_t
*
list
;
int
matches
;
time_t
time
;
const
char
*
contact_str
;
long
exptime
;
};
typedef
enum
{
...
...
@@ -1189,7 +1192,7 @@ switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *sess
char
*
sofia_glue_get_multipart
(
switch_core_session_t
*
session
,
const
char
*
prefix
,
const
char
*
sdp
,
char
**
mp_type
);
void
sofia_glue_tech_simplify
(
private_object_t
*
tech_pvt
);
switch_console_callback_match_t
*
sofia_reg_find_reg_url_multi
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
);
switch_console_callback_match_t
*
sofia_reg_find_reg_url_with_positive_expires_multi
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
);
switch_console_callback_match_t
*
sofia_reg_find_reg_url_with_positive_expires_multi
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
,
time_t
reg_time
,
const
char
*
contact_str
,
long
exptime
);
switch_bool_t
sofia_glue_profile_exists
(
const
char
*
key
);
void
sofia_glue_global_siptrace
(
switch_bool_t
on
);
void
sofia_glue_global_capture
(
switch_bool_t
on
);
...
...
src/mod/endpoints/mod_sofia/sofia_reg.c
浏览文件 @
827b680a
...
...
@@ -524,7 +524,11 @@ int sofia_reg_find_reg_with_positive_expires_callback(void *pArg, int argc, char
long
int
expires
;
char
*
contact
=
NULL
;
expires
=
atol
(
argv
[
1
])
-
60
-
(
long
)
switch_epoch_time_now
(
NULL
);
if
(
argv
[
0
]
&&
cbt
->
contact_str
&&
!
strcasecmp
(
argv
[
0
],
cbt
->
contact_str
))
{
expires
=
cbt
->
exptime
;
}
else
{
expires
=
atol
(
argv
[
1
])
-
60
-
(
long
)
cbt
->
time
;
}
if
(
expires
>
0
)
{
dst
=
sofia_glue_get_destination
(
argv
[
0
]);
...
...
@@ -930,7 +934,7 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *p
}
switch_console_callback_match_t
*
sofia_reg_find_reg_url_with_positive_expires_multi
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
)
switch_console_callback_match_t
*
sofia_reg_find_reg_url_with_positive_expires_multi
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
,
time_t
reg_time
,
const
char
*
contact_str
,
long
exptime
)
{
struct
callback_t
cbt
=
{
0
};
char
*
sql
;
...
...
@@ -947,6 +951,10 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_with_positive_expires_mu
sql
=
switch_mprintf
(
"select contact,expires from sip_registrations where sip_user='%q'"
,
user
);
}
cbt
.
time
=
reg_time
;
cbt
.
contact_str
=
contact_str
;
cbt
.
exptime
=
exptime
;
sofia_glue_execute_sql_callback
(
profile
,
profile
->
ireg_mutex
,
sql
,
sofia_reg_find_reg_with_positive_expires_callback
,
&
cbt
);
free
(
sql
);
...
...
@@ -1075,6 +1083,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
int
send_pres
=
0
;
int
is_tls
=
0
,
is_tcp
=
0
;
char
expbuf
[
35
]
=
""
;
time_t
reg_time
=
switch_epoch_time_now
(
NULL
);
if
(
v_event
&&
*
v_event
)
pres_on_reg
=
switch_event_get_header
(
*
v_event
,
"send-presence-on-register"
);
...
...
@@ -1577,7 +1587,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
contact
=
sofia_glue_get_url_from_contact
(
contact_str
,
1
);
url
=
switch_mprintf
(
"sofia/%q/sip:%q"
,
profile
->
name
,
sofia_glue_strip_proto
(
contact
));
switch_core_add_registration
(
to_user
,
reg_host
,
call_id
,
url
,
(
long
)
switch_epoch_time_now
(
NULL
)
+
(
long
)
exptime
+
60
,
switch_core_add_registration
(
to_user
,
reg_host
,
call_id
,
url
,
(
long
)
reg_time
+
(
long
)
exptime
+
60
,
network_ip
,
network_port_c
,
is_tls
?
"tls"
:
is_tcp
?
"tcp"
:
"udp"
,
reg_meta
);
switch_safe_free
(
url
);
...
...
@@ -1590,7 +1600,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
"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
:
""
,
contact_str
,
reg_desc
,
rpid
,
(
long
)
switch_epoch_time_now
(
NULL
)
+
(
long
)
exptime
+
60
,
contact_str
,
reg_desc
,
rpid
,
(
long
)
reg_time
+
(
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
);
}
else
{
...
...
@@ -1602,7 +1612,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
sub_host
,
network_ip
,
network_port_c
,
profile
->
presence_hosts
?
profile
->
presence_hosts
:
""
,
guess_ip4
,
guess_ip4
,
mod_sofia_globals
.
hostname
,
mod_sofia_globals
.
hostname
,
(
long
)
switch_epoch_time_now
(
NULL
)
+
(
long
)
exptime
+
60
,
(
long
)
reg_time
+
(
long
)
exptime
+
60
,
to_user
,
username
,
reg_host
,
contact_str
);
}
...
...
@@ -1794,7 +1804,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
TAG_IF
(
!
zstr
(
expbuf
),
SIPTAG_EXPIRES_STR
(
expbuf
)),
NUTAG_WITH_THIS_MSG
(
de
->
data
->
e_msg
),
SIPTAG_DATE_STR
(
date
),
TAG_END
());
}
else
if
((
contact_list
=
sofia_reg_find_reg_url_with_positive_expires_multi
(
profile
,
from_user
,
reg_host
)))
{
}
else
if
((
contact_list
=
sofia_reg_find_reg_url_with_positive_expires_multi
(
profile
,
from_user
,
reg_host
,
reg_time
,
contact_str
,
exptime
)))
{
/* all + 1 tag_i elements initialized as NULL - last one implies TAG_END() */
switch_zmalloc
(
contact_tags
,
sizeof
(
*
contact_tags
)
*
(
contact_list
->
count
+
1
));
i
=
0
;
...
...
@@ -2358,7 +2368,6 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
if
(
zstr
(
np
))
{
nonce_cb_t
cb
=
{
0
};
long
nc_long
=
0
;
int
sanity
=
0
;
first
=
1
;
...
...
@@ -2374,13 +2383,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
switch_assert
(
sql
!=
NULL
);
do
{
if
(
sanity
)
{
switch_yield
(
100000
*
sanity
);
}
sofia_glue_execute_sql_callback
(
profile
,
profile
->
ireg_mutex
,
sql
,
sofia_reg_nonce_callback
,
&
cb
);
}
while
(
nc_long
<
2
&&
++
sanity
<
10
&&
zstr
(
np
));
sofia_glue_execute_sql_callback
(
profile
,
profile
->
ireg_mutex
,
sql
,
sofia_reg_nonce_callback
,
&
cb
);
free
(
sql
);
//if (!sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, np, nplen)) {
...
...
src/switch_core_sqldb.c
浏览文件 @
827b680a
...
...
@@ -1706,11 +1706,14 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
check
:
if
((
lc
=
qm_ttl
(
qm
))
<
qm
->
max_trans
/
4
)
{
switch_yield
(
500000
);
if
((
lc
=
qm_ttl
(
qm
))
==
0
)
{
switch_thread_cond_wait
(
qm
->
cond
,
qm
->
cond_mutex
);
}
if
((
lc
=
qm_ttl
(
qm
))
==
0
)
{
switch_thread_cond_wait
(
qm
->
cond
,
qm
->
cond_mutex
);
}
i
=
4
;
while
(
--
i
>
0
&&
(
lc
=
qm_ttl
(
qm
))
<
qm
->
max_trans
/
4
)
{
switch_yield
(
50000
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论