Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c61a1195
提交
c61a1195
authored
7月 20, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add caller table to fifo
上级
b4773504
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
67 行增加
和
3 行删除
+67
-3
mod_fifo.c
src/mod/applications/mod_fifo/mod_fifo.c
+67
-3
没有找到文件。
src/mod/applications/mod_fifo/mod_fifo.c
浏览文件 @
c61a1195
...
...
@@ -264,6 +264,11 @@ struct fifo_node {
typedef
struct
fifo_node
fifo_node_t
;
static
void
fifo_caller_add
(
fifo_node_t
*
node
,
switch_core_session_t
*
session
);
static
void
fifo_caller_del
(
const
char
*
uuid
);
struct
callback
{
char
*
buf
;
size_t
len
;
...
...
@@ -411,6 +416,8 @@ static void node_remove_uuid(fifo_node_t *node, const char *uuid)
node
->
start_waiting
=
0
;
}
fifo_caller_del
(
uuid
);
return
;
}
...
...
@@ -920,7 +927,6 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
return
SWITCH_STATUS_SUCCESS
;
}
static
void
add_outbound_call
(
const
char
*
key
,
switch_call_cause_t
*
cancel_cause
)
{
switch_mutex_lock
(
globals
.
orig_mutex
);
...
...
@@ -944,6 +950,9 @@ static void cancel_outbound_call(const char *key, switch_call_cause_t cause)
*
cancel_cause
=
cause
;
}
switch_mutex_unlock
(
globals
.
orig_mutex
);
fifo_caller_del
(
key
);
}
static
void
*
SWITCH_THREAD_FUNC
ringall_thread_run
(
switch_thread_t
*
thread
,
void
*
obj
)
...
...
@@ -1781,7 +1790,7 @@ SWITCH_STANDARD_APP(fifo_track_call_function)
col2
=
"manual_calls_out_total_count"
;
}
sql
=
switch_mprintf
(
"update fifo_outbound set start_time=%ld,outbound_fail_count=0,use_count=use_count+1,%s=%s+1,%s=%s+1 where uuid='%q'"
,
sql
=
switch_mprintf
(
"update fifo_outbound set st
op_time=0,st
art_time=%ld,outbound_fail_count=0,use_count=use_count+1,%s=%s+1,%s=%s+1 where uuid='%q'"
,
(
long
)
switch_epoch_time_now
(
NULL
),
col1
,
col1
,
col2
,
col2
,
data
);
fifo_execute_sql
(
sql
,
globals
.
sql_mutex
);
switch_safe_free
(
sql
);
...
...
@@ -1808,6 +1817,41 @@ SWITCH_STANDARD_APP(fifo_track_call_function)
switch_core_event_hook_add_state_change
(
session
,
hanguphook
);
}
static
void
fifo_caller_add
(
fifo_node_t
*
node
,
switch_core_session_t
*
session
)
{
char
*
sql
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
sql
=
switch_mprintf
(
"insert into fifo_callers (fifo_name,uuid,caller_caller_id_name,caller_caller_id_number,timestamp) "
"values ('%q','%q','%q','%q',%ld)"
,
node
->
name
,
switch_core_session_get_uuid
(
session
),
switch_str_nil
(
switch_channel_get_variable
(
channel
,
"caller_id_name"
)),
switch_str_nil
(
switch_channel_get_variable
(
channel
,
"caller_id_number"
)),
switch_epoch_time_now
(
NULL
));
fifo_execute_sql
(
sql
,
globals
.
sql_mutex
);
switch_safe_free
(
sql
);
}
static
void
fifo_caller_del
(
const
char
*
uuid
)
{
char
*
sql
;
if
(
uuid
)
{
sql
=
switch_mprintf
(
"delete from fifo_callers where uuid='%q'"
,
uuid
);
}
else
{
sql
=
switch_mprintf
(
"delete from fifo_callers"
,
uuid
);
}
fifo_execute_sql
(
sql
,
globals
.
sql_mutex
);
switch_safe_free
(
sql
);
}
typedef
enum
{
STRAT_MORE_PPL
,
STRAT_WAITING_LONGER
,
...
...
@@ -2017,6 +2061,8 @@ SWITCH_STANDARD_APP(fifo_function)
fifo_queue_push
(
node
->
fifo_list
[
p
],
call_event
);
fifo_caller_add
(
node
,
session
);
call_event
=
NULL
;
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
fifo_queue_size
(
node
->
fifo_list
[
p
]));
switch_channel_set_variable
(
channel
,
"fifo_position"
,
tmp
);
...
...
@@ -2343,6 +2389,11 @@ SWITCH_STANDARD_APP(fifo_function)
}
}
if
(
pop
)
{
fifo_caller_del
(
switch_str_nil
(
switch_event_get_header
(
pop
,
"unique-id"
)));
}
if
(
pop
&&
!
node_consumer_wait_count
(
node
))
{
switch_mutex_lock
(
node
->
mutex
);
node
->
start_waiting
=
0
;
...
...
@@ -2531,7 +2582,7 @@ SWITCH_STANDARD_APP(fifo_function)
}
if
(
outbound_id
)
{
sql
=
switch_mprintf
(
"update fifo_outbound set start_time=%ld,use_count=use_count+1,outbound_fail_count=0 where uuid='%s'"
,
sql
=
switch_mprintf
(
"update fifo_outbound set st
op_time=0,st
art_time=%ld,use_count=use_count+1,outbound_fail_count=0 where uuid='%s'"
,
switch_epoch_time_now
(
NULL
),
outbound_id
);
fifo_execute_sql
(
sql
,
globals
.
sql_mutex
);
switch_safe_free
(
sql
);
...
...
@@ -3356,6 +3407,16 @@ const char bridge_sql[] =
");
\n
"
;
const
char
callers_sql
[]
=
"create table fifo_callers (
\n
"
" fifo_name varchar(255) not null,
\n
"
" uuid varchar(255) not null,
\n
"
" caller_caller_id_name varchar(255),
\n
"
" caller_caller_id_number varchar(255),
\n
"
" timestamp integer
\n
"
");
\n
"
;
static
void
extract_fifo_outbound_uuid
(
char
*
string
,
char
*
uuid
,
switch_size_t
len
)
...
...
@@ -3437,6 +3498,7 @@ static switch_status_t load_config(int reload, int del_all)
switch_cache_db_test_reactive
(
dbh
,
"delete from fifo_outbound where static = 1 or taking_calls < 0 or stop_time < 0"
,
"drop table fifo_outbound"
,
outbound_sql
);
switch_cache_db_test_reactive
(
dbh
,
"delete from fifo_bridge"
,
"drop table fifo_bridge"
,
bridge_sql
);
switch_cache_db_test_reactive
(
dbh
,
"delete from fifo_callers"
,
"drop table fifo_callers"
,
callers_sql
);
switch_cache_db_release_db_handle
(
&
dbh
);
fifo_execute_sql
(
"update fifo_outbound set start_time=0,stop_time=0,ring_count=0,use_count=0,"
...
...
@@ -3633,6 +3695,8 @@ static switch_status_t load_config(int reload, int del_all)
goto
top
;
}
}
fifo_caller_del
(
NULL
);
switch_mutex_unlock
(
globals
.
mutex
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论