Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
65b4782d
提交
65b4782d
authored
8月 01, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revert
上级
98473085
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
98 行删除
+9
-98
switch_core_sqldb.c
src/switch_core_sqldb.c
+9
-98
没有找到文件。
src/switch_core_sqldb.c
浏览文件 @
65b4782d
...
...
@@ -1419,8 +1419,7 @@ static void core_event_handler(switch_event_t *event)
{
const
char
*
callee_cid_name
,
*
callee_cid_num
,
*
direction
;
char
*
func_name
;
char
*
aleg_uuid
,
*
bleg_uuid
;
direction
=
switch_event_get_header
(
event
,
"other-leg-direction"
);
if
(
direction
&&
!
strcasecmp
(
direction
,
"outbound"
))
{
...
...
@@ -1443,15 +1442,6 @@ static void core_event_handler(switch_event_t *event)
func_name
=
"call_function"
;
}
aleg_uuid
=
switch_event_get_header_nil
(
event
,
"caller-unique-id"
);
bleg_uuid
=
switch_event_get_header_nil
(
event
,
"Other-Leg-unique-id"
);
new_sql
()
=
switch_mprintf
(
"update channels set originatee='%s' where uuid='%s'"
,
bleg_uuid
,
aleg_uuid
);
new_sql
()
=
switch_mprintf
(
"update channels set originator='%s' where uuid='%s'"
,
aleg_uuid
,
bleg_uuid
);
new_sql
()
=
switch_mprintf
(
"insert into calls (call_uuid,call_created,call_created_epoch,%s,caller_cid_name,"
"caller_cid_num,caller_dest_num,caller_chan_name,caller_uuid,callee_cid_name,"
"callee_cid_num,callee_dest_num,callee_chan_name,callee_uuid,hostname) "
...
...
@@ -1465,13 +1455,12 @@ static void core_event_handler(switch_event_t *event)
switch_event_get_header_nil
(
event
,
"caller-caller-id-number"
),
switch_event_get_header_nil
(
event
,
"caller-destination-number"
),
switch_event_get_header_nil
(
event
,
"caller-channel-name"
),
aleg_uuid
,
switch_event_get_header_nil
(
event
,
"caller-unique-id"
)
,
callee_cid_name
,
callee_cid_num
,
switch_event_get_header_nil
(
event
,
"Other-Leg-destination-number"
),
switch_event_get_header_nil
(
event
,
"Other-Leg-channel-name"
),
bleg_uuid
,
switch_core_get_switchname
()
switch_event_get_header_nil
(
event
,
"Other-Leg-unique-id"
),
switch_core_get_switchname
()
);
}
break
;
...
...
@@ -1481,10 +1470,6 @@ static void core_event_handler(switch_event_t *event)
new_sql
()
=
switch_mprintf
(
"delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'"
,
uuid
,
uuid
,
switch_core_get_switchname
());
new_sql
()
=
switch_mprintf
(
"update channels set originator=null,originatee=null where uuid='%s' or originator='%s' or originatee='%s'"
,
uuid
,
uuid
,
uuid
);
break
;
}
case
SWITCH_EVENT_SHUTDOWN
:
...
...
@@ -1632,15 +1617,10 @@ static char create_channels_sql[] =
" callee_name VARCHAR(1024),
\n
"
" callee_num VARCHAR(256),
\n
"
" callee_direction VARCHAR(5),
\n
"
" call_uuid VARCHAR(256),
\n
"
" originator VARCHAR(256),
\n
"
" originatee VARCHAR(256)
\n
"
" call_uuid VARCHAR(256)
\n
"
");
\n
"
"create index ch_hn_index on channels (hostname);
\n
"
"create index uuindex on channels (uuid);
\n
"
"create index uuindex2 on channels (call_uuid);
\n
"
"create index uuindex3 on channels (originator);
\n
"
"create index uuindex4 on channels (originatee);
\n
"
;
"create index uuindex on channels (uuid,hostname);
\n
"
"create index uuindex2 on channels (call_uuid,hostname);
\n
"
;
static
char
create_calls_sql
[]
=
"CREATE TABLE calls (
\n
"
...
...
@@ -1660,10 +1640,9 @@ static char create_calls_sql[] =
" callee_uuid VARCHAR(256),
\n
"
" hostname VARCHAR(256)
\n
"
");
\n
"
"create index ca_hn_index on calls (hostname);
\n
"
"create index eruuindex on calls (caller_uuid);
\n
"
"create index eeuuindex on calls (callee_uuid);
\n
"
"create index eeuuindex2 on calls (call_uuid);
\n
"
;
"create index eruuindex on calls (caller_uuid,hostname);
\n
"
"create index eeuuindex on calls (callee_uuid,hostname);
\n
"
"create index eeuuindex2 on calls (call_uuid,hostname);
\n
"
;
static
char
create_interfaces_sql
[]
=
"CREATE TABLE interfaces (
\n
"
...
...
@@ -1709,69 +1688,6 @@ static char create_registrations_sql[] =
"create index regindex1 on registrations (reg_user,realm,hostname);
\n
"
;
static
char
view_sql
[]
=
"create view detailed_calls as select "
"a.uuid uuid,
\n
"
"a.direction direction,
\n
"
"a.created created,
\n
"
"a.created_epoch created_epoch,
\n
"
"a.name name,
\n
"
"a.state state,
\n
"
"a.cid_name cid_name,
\n
"
"a.cid_num cid_num,
\n
"
"a.ip_addr ip_addr,
\n
"
"a.dest dest,
\n
"
"a.application application,
\n
"
"a.application_data application_data,
\n
"
"a.dialplan dialplan,
\n
"
"a.context context,
\n
"
"a.read_codec read_codec,
\n
"
"a.read_rate read_rate,
\n
"
"a.read_bit_rate read_bit_rate,
\n
"
"a.write_codec write_codec,
\n
"
"a.write_rate write_rate,
\n
"
"a.write_bit_rate write_bit_rate,
\n
"
"a.secure secure,
\n
"
"a.hostname hostname,
\n
"
"a.presence_id presence_id,
\n
"
"a.presence_data presence_data,
\n
"
"a.callstate callstate,
\n
"
"a.callee_name callee_name,
\n
"
"a.callee_num callee_num,
\n
"
"a.callee_direction callee_direction,
\n
"
"a.call_uuid call_uuid,
\n
"
"b.uuid b_uuid,
\n
"
"b.direction b_direction,
\n
"
"b.created b_created,
\n
"
"b.created_epoch b_created_epoch,
\n
"
"b.name b_name,
\n
"
"b.state b_state,
\n
"
"b.cid_name b_cid_name,
\n
"
"b.cid_num b_cid_num,
\n
"
"b.ip_addr b_ip_addr,
\n
"
"b.dest b_dest,
\n
"
"b.application b_application,
\n
"
"b.application_data b_application_data,
\n
"
"b.dialplan b_dialplan,
\n
"
"b.context b_context,
\n
"
"b.read_codec b_read_codec,
\n
"
"b.read_rate b_read_rate,
\n
"
"b.read_bit_rate b_read_bit_rate,
\n
"
"b.write_codec b_write_codec,
\n
"
"b.write_rate b_write_rate,
\n
"
"b.write_bit_rate b_write_bit_rate,
\n
"
"b.secure b_secure,
\n
"
"b.hostname b_hostname,
\n
"
"b.presence_id b_presence_id,
\n
"
"b.presence_data b_presence_data,
\n
"
"b.callstate b_callstate,
\n
"
"b.callee_name b_callee_name,
\n
"
"b.callee_num b_callee_num,
\n
"
"b.callee_direction b_callee_direction,
\n
"
"b.call_uuid b_call_uuid
\n
"
"from channels a left join channels b on a.originatee = b.uuid where a.originator is null"
;
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
)
{
...
...
@@ -1911,7 +1827,6 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
case
SCDB_TYPE_CORE_DB
:
{
switch_cache_db_execute_sql
(
dbh
,
"drop table channels"
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
"drop view detailed_calls"
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
"drop table calls"
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
"drop table interfaces"
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
"drop table tasks"
,
NULL
);
...
...
@@ -1937,8 +1852,6 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
{
char
*
err
;
switch_cache_db_test_reactive
(
dbh
,
"select call_uuid, read_bit_rate from channels"
,
"DROP TABLE channels"
,
create_channels_sql
);
switch_cache_db_test_reactive
(
dbh
,
"select * from detailed_calls"
,
NULL
,
view_sql
);
if
(
runtime
.
odbc_dbtype
==
DBTYPE_DEFAULT
)
{
switch_cache_db_test_reactive
(
dbh
,
"select call_uuid from calls"
,
"DROP TABLE calls"
,
create_calls_sql
);
}
else
{
...
...
@@ -1971,8 +1884,6 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
case
SCDB_TYPE_CORE_DB
:
{
switch_cache_db_execute_sql
(
dbh
,
create_channels_sql
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
view_sql
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
create_calls_sql
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
create_interfaces_sql
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
create_tasks_sql
,
NULL
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论