Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
192030c5
提交
192030c5
authored
5月 30, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add metadata col to internal registrations table
上级
82b00ecb
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
46 行增加
和
18 行删除
+46
-18
switch_core.h
src/include/switch_core.h
+3
-1
skinny_server.c
src/mod/endpoints/mod_skinny/skinny_server.c
+2
-1
sofia_reg.c
src/mod/endpoints/mod_sofia/sofia_reg.c
+6
-1
switch_core_sqldb.c
src/switch_core_sqldb.c
+35
-15
没有找到文件。
src/include/switch_core.h
浏览文件 @
192030c5
...
@@ -2300,10 +2300,12 @@ SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number)
...
@@ -2300,10 +2300,12 @@ SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number)
\param [in] network_ip
\param [in] network_ip
\param [in] network_port
\param [in] network_port
\param [in] network_proto - one of tls, tcp, udp
\param [in] network_proto - one of tls, tcp, udp
\param [in] metadata - generic metadata supplied by module
\param [out] err - Error if it exists
\param [out] err - Error if it exists
*/
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_core_add_registration
(
const
char
*
user
,
const
char
*
realm
,
const
char
*
token
,
const
char
*
url
,
uint32_t
expires
,
SWITCH_DECLARE
(
switch_status_t
)
switch_core_add_registration
(
const
char
*
user
,
const
char
*
realm
,
const
char
*
token
,
const
char
*
url
,
uint32_t
expires
,
const
char
*
network_ip
,
const
char
*
network_port
,
const
char
*
network_proto
);
const
char
*
network_ip
,
const
char
*
network_port
,
const
char
*
network_proto
,
const
char
*
metadata
);
/*!
/*!
\brief Delete user registration
\brief Delete user registration
\param [in] user
\param [in] user
...
...
src/mod/endpoints/mod_skinny/skinny_server.c
浏览文件 @
192030c5
...
@@ -1007,6 +1007,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
...
@@ -1007,6 +1007,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
const
char
*
value
=
switch_xml_attr_soft
(
xbutton
,
"value"
);
const
char
*
value
=
switch_xml_attr_soft
(
xbutton
,
"value"
);
if
(
type
==
SKINNY_BUTTON_LINE
)
{
if
(
type
==
SKINNY_BUTTON_LINE
)
{
const
char
*
caller_name
=
switch_xml_attr_soft
(
xbutton
,
"caller-name"
);
const
char
*
caller_name
=
switch_xml_attr_soft
(
xbutton
,
"caller-name"
);
const
char
*
reg_metadata
=
switch_xml_attr_soft
(
xbutton
,
"registration-metadata"
);
uint32_t
ring_on_idle
=
atoi
(
switch_xml_attr_soft
(
xbutton
,
"ring-on-idle"
));
uint32_t
ring_on_idle
=
atoi
(
switch_xml_attr_soft
(
xbutton
,
"ring-on-idle"
));
uint32_t
ring_on_active
=
atoi
(
switch_xml_attr_soft
(
xbutton
,
"ring-on-active"
));
uint32_t
ring_on_active
=
atoi
(
switch_xml_attr_soft
(
xbutton
,
"ring-on-active"
));
uint32_t
busy_trigger
=
atoi
(
switch_xml_attr_soft
(
xbutton
,
"busy-trigger"
));
uint32_t
busy_trigger
=
atoi
(
switch_xml_attr_soft
(
xbutton
,
"busy-trigger"
));
...
@@ -1030,7 +1031,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
...
@@ -1030,7 +1031,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
token
=
switch_mprintf
(
"skinny/%q/%q/%q:%d"
,
profile
->
name
,
value
,
request
->
data
.
reg
.
device_name
,
request
->
data
.
reg
.
instance
);
token
=
switch_mprintf
(
"skinny/%q/%q/%q:%d"
,
profile
->
name
,
value
,
request
->
data
.
reg
.
device_name
,
request
->
data
.
reg
.
instance
);
url
=
switch_mprintf
(
"skinny/%q/%q"
,
profile
->
name
,
value
);
url
=
switch_mprintf
(
"skinny/%q/%q"
,
profile
->
name
,
value
);
switch_core_add_registration
(
value
,
profile
->
domain
,
token
,
url
,
0
,
network_ip
,
network_port_c
,
"tcp"
);
switch_core_add_registration
(
value
,
profile
->
domain
,
token
,
url
,
0
,
network_ip
,
network_port_c
,
"tcp"
,
reg_metadata
);
switch_safe_free
(
token
);
switch_safe_free
(
token
);
switch_safe_free
(
url
);
switch_safe_free
(
url
);
}
}
...
...
src/mod/endpoints/mod_sofia/sofia_reg.c
浏览文件 @
192030c5
...
@@ -1028,6 +1028,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
...
@@ -1028,6 +1028,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
sip_contact_t
const
*
contact
=
NULL
;
sip_contact_t
const
*
contact
=
NULL
;
char
*
sql
;
char
*
sql
;
switch_event_t
*
s_event
;
switch_event_t
*
s_event
;
const
char
*
reg_meta
=
NULL
;
const
char
*
to_user
=
NULL
;
const
char
*
to_user
=
NULL
;
const
char
*
to_host
=
NULL
;
const
char
*
to_host
=
NULL
;
char
*
mwi_account
=
NULL
;
char
*
mwi_account
=
NULL
;
...
@@ -1485,6 +1486,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
...
@@ -1485,6 +1486,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
to_user
=
var
;
to_user
=
var
;
}
}
if
(
v_event
&&
*
v_event
&&
(
var
=
switch_event_get_header
(
*
v_event
,
"registration_metadata"
)))
{
reg_meta
=
var
;
}
if
(
v_event
&&
*
v_event
&&
(
mwi_account
=
switch_event_get_header
(
*
v_event
,
"mwi-account"
)))
{
if
(
v_event
&&
*
v_event
&&
(
mwi_account
=
switch_event_get_header
(
*
v_event
,
"mwi-account"
)))
{
dup_mwi_account
=
strdup
(
mwi_account
);
dup_mwi_account
=
strdup
(
mwi_account
);
switch_assert
(
dup_mwi_account
!=
NULL
);
switch_assert
(
dup_mwi_account
!=
NULL
);
...
@@ -1559,7 +1564,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
...
@@ -1559,7 +1564,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
url
=
switch_mprintf
(
"sofia/%q/sip:%q"
,
profile
->
name
,
sofia_glue_strip_proto
(
contact
));
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
)
switch_epoch_time_now
(
NULL
)
+
(
long
)
exptime
+
60
,
network_ip
,
network_port_c
,
is_tls
?
"tls"
:
is_tcp
?
"tcp"
:
"udp"
);
network_ip
,
network_port_c
,
is_tls
?
"tls"
:
is_tcp
?
"tcp"
:
"udp"
,
reg_meta
);
switch_safe_free
(
url
);
switch_safe_free
(
url
);
switch_safe_free
(
contact
);
switch_safe_free
(
contact
);
...
...
src/switch_core_sqldb.c
浏览文件 @
192030c5
...
@@ -1713,7 +1713,8 @@ static char create_registrations_sql[] =
...
@@ -1713,7 +1713,8 @@ static char create_registrations_sql[] =
" network_ip VARCHAR(256),
\n
"
" network_ip VARCHAR(256),
\n
"
" network_port VARCHAR(256),
\n
"
" network_port VARCHAR(256),
\n
"
" network_proto VARCHAR(256),
\n
"
" network_proto VARCHAR(256),
\n
"
" hostname VARCHAR(256)
\n
"
" hostname VARCHAR(256),
\n
"
" metadata VARCHAR(256)
\n
"
");
\n
"
;
");
\n
"
;
...
@@ -1843,7 +1844,8 @@ static char basic_calls_sql[] =
...
@@ -1843,7 +1844,8 @@ static char basic_calls_sql[] =
SWITCH_DECLARE
(
switch_status_t
)
switch_core_add_registration
(
const
char
*
user
,
const
char
*
realm
,
const
char
*
token
,
const
char
*
url
,
uint32_t
expires
,
SWITCH_DECLARE
(
switch_status_t
)
switch_core_add_registration
(
const
char
*
user
,
const
char
*
realm
,
const
char
*
token
,
const
char
*
url
,
uint32_t
expires
,
const
char
*
network_ip
,
const
char
*
network_port
,
const
char
*
network_proto
)
const
char
*
network_ip
,
const
char
*
network_port
,
const
char
*
network_proto
,
const
char
*
metadata
)
{
{
char
*
sql
;
char
*
sql
;
...
@@ -1860,19 +1862,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
...
@@ -1860,19 +1862,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
}
}
switch_queue_push
(
sql_manager
.
sql_queue
[
0
],
sql
);
switch_queue_push
(
sql_manager
.
sql_queue
[
0
],
sql
);
sql
=
switch_mprintf
(
"insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) "
if
(
!
zstr
(
metadata
)
)
{
"values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')"
,
sql
=
switch_mprintf
(
"insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname,metadata) "
switch_str_nil
(
user
),
"values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%q')"
,
switch_str_nil
(
realm
),
switch_str_nil
(
user
),
switch_str_nil
(
token
),
switch_str_nil
(
realm
),
switch_str_nil
(
url
),
switch_str_nil
(
token
),
expires
,
switch_str_nil
(
url
),
switch_str_nil
(
network_ip
),
expires
,
switch_str_nil
(
network_port
),
switch_str_nil
(
network_ip
),
switch_str_nil
(
network_proto
),
switch_str_nil
(
network_port
),
switch_core_get_switchname
()
switch_str_nil
(
network_proto
),
);
switch_core_get_switchname
(),
metadata
);
}
else
{
sql
=
switch_mprintf
(
"insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) "
"values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')"
,
switch_str_nil
(
user
),
switch_str_nil
(
realm
),
switch_str_nil
(
token
),
switch_str_nil
(
url
),
expires
,
switch_str_nil
(
network_ip
),
switch_str_nil
(
network_port
),
switch_str_nil
(
network_proto
),
switch_core_get_switchname
()
);
}
switch_queue_push
(
sql_manager
.
sql_queue
[
0
],
sql
);
switch_queue_push
(
sql_manager
.
sql_queue
[
0
],
sql
);
...
@@ -2007,6 +2025,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
...
@@ -2007,6 +2025,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
switch_cache_db_test_reactive
(
dbh
,
"delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'"
,
switch_cache_db_test_reactive
(
dbh
,
"delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'"
,
"DROP TABLE registrations"
,
create_registrations_sql
);
"DROP TABLE registrations"
,
create_registrations_sql
);
switch_cache_db_test_reactive
(
dbh
,
"select metadata from registrations"
,
NULL
,
"ALTER TABLE registrations ADD COLUMN metadata VARCHAR(256)"
);
switch
(
dbh
->
type
)
{
switch
(
dbh
->
type
)
{
case
SCDB_TYPE_ODBC
:
case
SCDB_TYPE_ODBC
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论