Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
eb08eef0
提交
eb08eef0
authored
9月 05, 2016
作者:
Luis Azedo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9480 [mod_kazoo] add api enhancements
上级
3a933050
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
308 行增加
和
28 行删除
+308
-28
kazoo_node.c
src/mod/event_handlers/mod_kazoo/kazoo_node.c
+239
-21
kazoo_utils.c
src/mod/event_handlers/mod_kazoo/kazoo_utils.c
+60
-6
mod_kazoo.h
src/mod/event_handlers/mod_kazoo/mod_kazoo.h
+9
-1
没有找到文件。
src/mod/event_handlers/mod_kazoo/kazoo_node.c
浏览文件 @
eb08eef0
差异被折叠。
点击展开。
src/mod/event_handlers/mod_kazoo/kazoo_utils.c
浏览文件 @
eb08eef0
...
...
@@ -32,12 +32,6 @@
* ei_helpers.c -- helper functions for ei
*
*/
#include <switch.h>
#include <ei.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include "mod_kazoo.h"
/* Stolen from code added to ei in R12B-5.
...
...
@@ -634,6 +628,66 @@ switch_hash_t *create_default_filter() {
return
filter
;
}
static
void
*
SWITCH_THREAD_FUNC
fetch_config_filters_exec
(
switch_thread_t
*
thread
,
void
*
obj
)
{
char
*
cf
=
"kazoo.conf"
;
switch_xml_t
cfg
,
xml
,
child
,
param
;
switch_event_t
*
params
;
switch_memory_pool_t
*
pool
=
(
switch_memory_pool_t
*
)
obj
;
switch_event_create
(
&
params
,
SWITCH_EVENT_REQUEST_PARAMS
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"Action"
,
"request-filter"
);
if
(
!
(
xml
=
switch_xml_open_cfg
(
cf
,
&
cfg
,
params
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to open configuration file %s
\n
"
,
cf
);
}
else
if
((
child
=
switch_xml_child
(
cfg
,
"event-filter"
)))
{
switch_hash_t
*
filter
;
switch_hash_t
*
old_filter
;
switch_core_hash_init
(
&
filter
);
for
(
param
=
switch_xml_child
(
child
,
"header"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
switch_core_hash_insert
(
filter
,
var
,
"1"
);
}
old_filter
=
globals
.
event_filter
;
globals
.
config_filters_fetched
=
1
;
globals
.
event_filter
=
filter
;
if
(
old_filter
)
{
switch_core_hash_destroy
(
&
old_filter
);
}
switch_xml_free
(
xml
);
}
if
(
params
)
switch_event_destroy
(
&
params
);
switch_core_destroy_memory_pool
(
&
pool
);
return
NULL
;
}
void
fetch_config_filters
()
{
switch_memory_pool_t
*
pool
;
switch_thread_t
*
thread
;
switch_threadattr_t
*
thd_attr
=
NULL
;
switch_uuid_t
uuid
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"fetching kazoo filters
\n
"
);
switch_core_new_memory_pool
(
&
pool
);
switch_threadattr_create
(
&
thd_attr
,
pool
);
switch_threadattr_detach_set
(
thd_attr
,
1
);
switch_threadattr_stacksize_set
(
thd_attr
,
SWITCH_THREAD_STACKSIZE
);
switch_uuid_get
(
&
uuid
);
switch_thread_create
(
&
thread
,
thd_attr
,
fetch_config_filters_exec
,
pool
,
pool
);
}
/* For Emacs:
* Local Variables:
* mode:c
...
...
src/mod/event_handlers/mod_kazoo/mod_kazoo.h
浏览文件 @
eb08eef0
#include <switch.h>
#include <switch_event.h>
#include <ei.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#define MAX_ACL 100
#define CMD_BUFLEN 1024 * 1000
#define MAX_QUEUE_LEN 25000
#define MAX_MISSED 500
#define MAX_PID_CHARS 255
#define VERSION "mod_kazoo v1.
2.10-14
"
#define VERSION "mod_kazoo v1.
3.0-1
"
#define API_COMMAND_DISCONNECT 0
#define API_COMMAND_REMOTE_IP 1
...
...
@@ -112,6 +117,7 @@ struct globals_s {
int
send_msg_batch
;
short
event_stream_framing
;
switch_port_t
port
;
int
config_filters_fetched
;
};
typedef
struct
globals_s
globals_t
;
extern
globals_t
globals
;
...
...
@@ -162,6 +168,8 @@ void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switc
#define _ei_x_encode_string(buf, string) { ei_x_encode_binary(buf, string, strlen(string)); }
void
fetch_config_filters
();
/* For Emacs:
* Local Variables:
* mode:c
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论