Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
ece804c9
提交
ece804c9
authored
3月 31, 2019
作者:
lazedo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11741 [mod_kazoo] add compare to field option & json_history
上级
9eba3a9b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
291 行增加
和
85 行删除
+291
-85
kazoo.conf.xml
src/mod/event_handlers/mod_kazoo/kazoo.conf.xml
+29
-19
kazoo_commands.c
src/mod/event_handlers/mod_kazoo/kazoo_commands.c
+98
-0
kazoo_config.c
src/mod/event_handlers/mod_kazoo/kazoo_config.c
+10
-8
kazoo_ei.h
src/mod/event_handlers/mod_kazoo/kazoo_ei.h
+0
-4
kazoo_ei_config.c
src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c
+58
-16
kazoo_fields.h
src/mod/event_handlers/mod_kazoo/kazoo_fields.h
+4
-2
kazoo_message.c
src/mod/event_handlers/mod_kazoo/kazoo_message.c
+23
-4
kazoo_node.c
src/mod/event_handlers/mod_kazoo/kazoo_node.c
+3
-1
kazoo_tweaks.c
src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c
+66
-31
没有找到文件。
src/mod/event_handlers/mod_kazoo/kazoo.conf.xml
浏览文件 @
ece804c9
...
...
@@ -21,8 +21,6 @@
</settings>
<X-PRE-PROCESS
cmd=
"set"
data=
"UNIX_EPOCH_IN_GREGORIAN=62167219200"
/>
<variables>
<variable
name=
"UNIX_EPOCH_IN_GREGORIAN"
value=
"62167219200"
/>
</variables>
...
...
@@ -30,13 +28,37 @@
<definitions>
<definition
name=
"debug-call"
>
<filters>
<filter
name=
"
variable_debug_call"
type=
"ex
clude"
value=
"true"
/>
<filter
name=
"
${first-of(variable_debug_call|Call-Debug|#$${Call-Debug})}"
type=
"in
clude"
value=
"true"
/>
</filters>
<field
name=
"Call-Debug"
type=
"static"
serialize-as=
"object"
>
<fields
verbose=
"true"
/>
</field>
</definition>
<definition
name=
"transfer-history"
>
<filters>
<filter
name=
"variable_transfer_history"
type=
"include"
compare=
"exists"
/>
</filters>
<field
name=
"Transfer-History"
type=
"expand"
value=
"${kz_json_history(${variable_transfer_history})}"
serialize-as=
"raw"
/>
</definition>
<definition
name=
"transfer-source"
>
<filters>
<filter
name=
"variable_transfer_source"
type=
"include"
compare=
"exists"
/>
</filters>
<field
name=
"Transfer-Source"
type=
"expand"
value=
"${kz_json_history(variable_transfer_source)}"
serialize-as=
"raw"
/>
</definition>
<definition
name=
"interaction-id"
>
<field
name=
"variable_Call-Interaction-ID"
as=
"Call-Interaction-ID"
/>
<field
name=
"Call-Interaction-Is-Root"
type=
"static"
value=
"true"
serialize-as=
"boolean"
>
<filters>
<filter
name=
"variable_Call-Interaction-ID"
type=
"include"
compare=
"field"
value=
"variable_Original-Call-Interaction-ID"
/>
<field
name=
"${first-of(Event-Subclass|Event-Name|#none)}"
type=
"include"
compare=
"list"
value=
"CHANNEL_DESTROY|KZ_CDR"
/>
</filters>
</field>
</definition>
<definition
name=
"Metaflow-Control"
>
<field
name=
"Metaflow-Control"
type=
"static"
serialize-as=
"object"
>
<filters>
...
...
@@ -96,18 +118,9 @@
</filters>
</field>
<field
name=
"Call-Interaction-ID"
type=
"expand"
value=
"${expr(ceil((${Event-Date-Timestamp} / 1000000) + $${UNIX_EPOCH_IN_GREGORIAN}))}-${regex(${create_uuid()}|^([^-]*)|%1)}"
>
<filters>
<filter
name=
"Unique-ID"
type=
"include"
compare=
"exists"
/>
<filter
name=
"ecallmgr_Call-Interaction-ID"
type=
"exclude"
compare=
"exists"
/>
<filter
name=
"variable_ecallmgr_Call-Interaction-ID"
type=
"exclude"
compare=
"exists"
/>
<filter
name=
"variable_sip_h_X-ecallmgr_Call-Interaction-ID"
type=
"exclude"
compare=
"exists"
/>
</filters>
</field>
<!-- <field name="variable_Call-Interaction-ID" as="Call-Interaction-ID" /> -->
<field
name=
"interaction-id"
type=
"reference"
/>
<field
name=
"variable_presence_id"
as=
"Presence-ID"
/>
<field
name=
"redirect"
type=
"group"
>
...
...
@@ -671,6 +684,7 @@
<field
name=
"hangup-fields"
type=
"reference"
/>
<field
name=
"variable_Media-Recordings"
as=
"Media-Recordings"
/>
<field
name=
"debug-call"
type=
"reference"
/>
<field
name=
"transfer-history"
type=
"reference"
/>
</fields>
<filters>
...
...
@@ -1078,8 +1092,6 @@
<log
name=
"info"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"success"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"time"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"filtered-event"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"filtered-field"
value=
"SWITCH_LOG_INFO"
/>
</logging>
</profile>
...
...
@@ -1157,8 +1169,6 @@
<log
name=
"info"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"success"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"time"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"filtered-event"
value=
"SWITCH_LOG_INFO"
/>
<log
name=
"filtered-field"
value=
"SWITCH_LOG_INFO"
/>
</logging>
</profile>
...
...
src/mod/event_handlers/mod_kazoo/kazoo_commands.c
浏览文件 @
ece804c9
...
...
@@ -48,6 +48,103 @@
#define MAX_FIRST_OF 25
#define MAX_HISTORY 50
#define HST_ARRAY_DELIM "|:"
#define HST_ITEM_DELIM ':'
static
void
process_history_item
(
char
*
value
,
cJSON
*
json
)
{
char
*
argv
[
4
]
=
{
0
};
char
*
item
=
strdup
(
value
);
int
argc
=
switch_separate_string
(
item
,
HST_ITEM_DELIM
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
])));
cJSON
*
jitem
=
cJSON_CreateObject
();
char
*
epoch
=
NULL
,
*
callid
=
NULL
,
*
type
=
NULL
;
int
add
=
0
;
if
(
argc
==
4
)
{
add
=
1
;
epoch
=
argv
[
0
];
callid
=
argv
[
1
];
type
=
argv
[
2
];
if
(
!
strncmp
(
type
,
"bl_xfer"
,
7
))
{
char
*
split
=
strchr
(
argv
[
3
],
'/'
);
if
(
split
)
*
(
split
++
)
=
'\0'
;
cJSON_AddItemToObject
(
jitem
,
"Call-ID"
,
cJSON_CreateString
(
callid
));
cJSON_AddItemToObject
(
jitem
,
"Type"
,
cJSON_CreateString
(
"blind"
));
cJSON_AddItemToObject
(
jitem
,
"Extension"
,
cJSON_CreateString
(
argv
[
3
]));
}
else
if
(
!
strncmp
(
type
,
"att_xfer"
,
8
))
{
char
*
split
=
strchr
(
argv
[
3
],
'/'
);
if
(
split
)
{
*
(
split
++
)
=
'\0'
;
cJSON_AddItemToObject
(
jitem
,
"Call-ID"
,
cJSON_CreateString
(
callid
));
cJSON_AddItemToObject
(
jitem
,
"Type"
,
cJSON_CreateString
(
"attended"
));
cJSON_AddItemToObject
(
jitem
,
"Transferee"
,
cJSON_CreateString
(
argv
[
3
]));
cJSON_AddItemToObject
(
jitem
,
"Transferer"
,
cJSON_CreateString
(
split
));
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"TRANSFER TYPE '%s' NOT HANDLED => %s
\n
"
,
type
,
item
);
add
=
0
;
}
}
else
if
(
!
strncmp
(
type
,
"uuid_br"
,
7
))
{
cJSON_AddItemToObject
(
jitem
,
"Call-ID"
,
cJSON_CreateString
(
callid
));
cJSON_AddItemToObject
(
jitem
,
"Type"
,
cJSON_CreateString
(
"bridge"
));
cJSON_AddItemToObject
(
jitem
,
"Other-Leg"
,
cJSON_CreateString
(
argv
[
3
]));
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"TRANSFER TYPE '%s' NOT HANDLED => %s
\n
"
,
type
,
item
);
add
=
0
;
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"TRANSFER TYPE SPLIT ERROR %i => %s
\n
"
,
argc
,
item
);
}
if
(
add
)
{
cJSON_AddItemToObject
(
json
,
epoch
,
jitem
);
}
else
{
cJSON_Delete
(
jitem
);
}
switch_safe_free
(
item
);
}
SWITCH_STANDARD_API
(
kz_json_history
)
{
char
*
mycmd
=
NULL
,
*
argv
[
MAX_HISTORY
]
=
{
0
};
int
n
,
argc
=
0
;
cJSON
*
json
=
cJSON_CreateObject
();
char
*
output
=
NULL
;
switch_event_header_t
*
header
=
NULL
;
if
(
!
zstr
(
cmd
)
&&
(
mycmd
=
strdup
(
cmd
)))
{
if
(
!
strncmp
(
mycmd
,
"ARRAY::"
,
7
))
{
mycmd
+=
7
;
argc
=
switch_separate_string_string
(
mycmd
,
HST_ARRAY_DELIM
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
])));
for
(
n
=
0
;
n
<
argc
;
n
++
)
{
process_history_item
(
argv
[
n
],
json
);
}
}
else
if
(
strchr
(
mycmd
,
HST_ITEM_DELIM
))
{
process_history_item
(
mycmd
,
json
);
}
else
if
(
stream
->
param_event
)
{
header
=
switch_event_get_header_ptr
(
stream
->
param_event
,
mycmd
);
if
(
header
!=
NULL
)
{
if
(
header
->
idx
)
{
for
(
n
=
0
;
n
<
header
->
idx
;
n
++
)
{
process_history_item
(
header
->
array
[
n
],
json
);
}
}
else
{
process_history_item
(
header
->
value
,
json
);
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"TRANSFER HISTORY HEADER NOT FOUND => %s
\n
"
,
mycmd
);
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"TRANSFER HISTORY NOT PARSED => %s
\n
"
,
mycmd
);
}
}
output
=
cJSON_PrintUnformatted
(
json
);
stream
->
write_function
(
stream
,
"%s"
,
output
);
switch_safe_free
(
output
);
cJSON_Delete
(
json
);
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_STANDARD_API
(
kz_first_of
)
{
char
delim
=
'|'
;
char
*
mycmd
=
NULL
,
*
argv
[
MAX_FIRST_OF
]
=
{
0
};
...
...
@@ -413,5 +510,6 @@ void add_kz_commands(switch_loadable_module_interface_t **module_interface, swit
switch_console_set_complete
(
"add kz_uuid_setvar_encoded ::console::list_uuid"
);
SWITCH_ADD_API
(
api_interface
,
"kz_http_put"
,
KZ_HTTP_PUT_DESC
,
kz_http_put
,
KZ_HTTP_PUT_SYNTAX
);
SWITCH_ADD_API
(
api_interface
,
"first-of"
,
KZ_FIRST_OF_DESC
,
kz_first_of
,
KZ_FIRST_OF_SYNTAX
);
SWITCH_ADD_API
(
api_interface
,
"kz_json_history"
,
KZ_FIRST_OF_DESC
,
kz_json_history
,
KZ_FIRST_OF_SYNTAX
);
}
src/mod/event_handlers/mod_kazoo/kazoo_config.c
浏览文件 @
ece804c9
...
...
@@ -217,6 +217,8 @@ switch_status_t kazoo_config_filters(switch_memory_pool_t *pool, switch_xml_t cf
cur
->
compare
=
FILTER_COMPARE_EXISTS
;
}
else
if
(
!
strncmp
(
compare
,
"regex"
,
5
))
{
cur
->
compare
=
FILTER_COMPARE_REGEX
;
}
else
if
(
!
strncmp
(
compare
,
"field"
,
5
))
{
cur
->
compare
=
FILTER_COMPARE_FIELD
;
}
}
...
...
@@ -400,11 +402,11 @@ kazoo_config_ptr kazoo_config_event_handlers(kazoo_config_ptr definitions, switc
kazoo_config_event_handler
(
definitions
,
profiles
,
xml_profile
,
NULL
);
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"
U
nable to locate a event-handler profile for kazoo
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"
u
nable to locate a event-handler profile for kazoo
\n
"
);
}
}
else
{
destroy_config
(
&
profiles
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"
Unable to locate event-handlers section for kazoo
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"
unable to locate event-handlers section for kazoo, using default
\n
"
);
}
return
profiles
;
...
...
@@ -437,11 +439,11 @@ kazoo_config_ptr kazoo_config_fetch_handlers(kazoo_config_ptr definitions, switc
kazoo_config_fetch_handler
(
definitions
,
profiles
,
xml_profile
,
NULL
);
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"
U
nable to locate a fetch-handler profile for kazoo
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"
u
nable to locate a fetch-handler profile for kazoo
\n
"
);
}
}
else
{
destroy_config
(
&
profiles
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"
Unable to locate fetch-handlers section for kazoo
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"
unable to locate fetch-handlers section for kazoo, using default
\n
"
);
}
return
profiles
;
...
...
@@ -455,7 +457,7 @@ switch_status_t kazoo_config_definition(kazoo_config_ptr root, switch_xml_t cfg)
char
*
name
=
(
char
*
)
switch_xml_attr_soft
(
cfg
,
"name"
);
if
(
zstr
(
name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"
Failed to load kazoo profile. C
heck definition missing name attr
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"
failed to load kazoo profile, c
heck definition missing name attr
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
...
...
@@ -466,11 +468,11 @@ switch_status_t kazoo_config_definition(kazoo_config_ptr root, switch_xml_t cfg)
kazoo_config_fields_loop
(
root
,
root
->
pool
,
cfg
,
&
definition
->
head
);
if
(
switch_core_hash_insert
(
root
->
hash
,
name
,
(
void
*
)
definition
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"
F
ailed to insert new definition [%s] into kazoo definitions hash
\n
"
,
name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"
f
ailed to insert new definition [%s] into kazoo definitions hash
\n
"
,
name
);
return
SWITCH_STATUS_GENERR
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"
Definition[%s] S
uccessfully configured
\n
"
,
definition
->
name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"
definition[%s] s
uccessfully configured
\n
"
,
definition
->
name
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -499,7 +501,7 @@ kazoo_config_ptr kazoo_config_definitions(switch_xml_t cfg)
}
}
else
{
destroy_config
(
&
definitions
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
INFO
,
"no definitions section for kazoo
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
WARNING
,
"unable to locate definitions section for kazoo, using default
\n
"
);
}
return
definitions
;
...
...
src/mod/event_handlers/mod_kazoo/kazoo_ei.h
浏览文件 @
ece804c9
...
...
@@ -185,10 +185,6 @@ struct globals_s {
kazoo_json_term
json_encoding
;
int
enable_legacy
;
// char *profile_vars_prefixes[KZ_MAX_SEPARATE_STRINGS];
// char *kazoo_var_prefixes[KZ_MAX_SEPARATE_STRINGS];
// char *profile_vars_prefixes;
// char *kazoo_var_prefixes;
char
**
profile_vars_prefixes
;
char
**
kazoo_var_prefixes
;
...
...
src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c
浏览文件 @
ece804c9
...
...
@@ -113,7 +113,7 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) {
kazoo_globals
.
port
=
0
;
kazoo_globals
.
io_fault_tolerance
=
10
;
kazoo_globals
.
json_encoding
=
ERLANG_TUPLE
;
kazoo_globals
.
enable_legacy
=
SWITCH_
TRU
E
;
kazoo_globals
.
enable_legacy
=
SWITCH_
FALS
E
;
if
((
child
=
switch_xml_child
(
cfg
,
"settings"
)))
{
...
...
@@ -306,6 +306,7 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) {
switch_status_t
kazoo_config_handlers
(
switch_xml_t
cfg
)
{
switch_xml_t
def
=
NULL
;
switch_xml_t
child
,
param
;
char
*
xml
=
NULL
;
kazoo_config_ptr
definitions
=
NULL
,
fetch_handlers
=
NULL
,
event_handlers
=
NULL
;
kazoo_event_profile_ptr
events
=
NULL
;
...
...
@@ -316,19 +317,49 @@ switch_status_t kazoo_config_handlers(switch_xml_t cfg)
kz_xml_process
(
def
);
kz_xml_process
(
cfg
);
if
((
child
=
switch_xml_child
(
cfg
,
"variables"
)))
{
for
(
param
=
switch_xml_child
(
child
,
"variable"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
char
*
val
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"value"
);
if
(
var
&&
val
)
{
switch_core_set_variable
(
var
,
val
);
}
}
}
else
if
((
child
=
switch_xml_child
(
def
,
"variables"
)))
{
for
(
param
=
switch_xml_child
(
child
,
"variable"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
char
*
val
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"value"
);
if
(
var
&&
val
)
{
switch_core_set_variable
(
var
,
val
);
}
}
}
definitions
=
kazoo_config_definitions
(
cfg
);
if
(
definitions
==
NULL
)
{
definitions
=
kazoo_config_definitions
(
def
);
if
(
kazoo_globals
.
definitions
==
NULL
)
{
definitions
=
kazoo_config_definitions
(
def
);
}
else
{
definitions
=
kazoo_globals
.
definitions
;
}
}
fetch_handlers
=
kazoo_config_fetch_handlers
(
definitions
,
cfg
);
if
(
fetch_handlers
==
NULL
)
{
fetch_handlers
=
kazoo_config_fetch_handlers
(
definitions
,
def
);
if
(
kazoo_globals
.
fetch_handlers
==
NULL
)
{
fetch_handlers
=
kazoo_config_fetch_handlers
(
definitions
,
def
);
}
else
{
fetch_handlers
=
kazoo_globals
.
fetch_handlers
;
}
}
event_handlers
=
kazoo_config_event_handlers
(
definitions
,
cfg
);
if
(
event_handlers
==
NULL
)
{
event_handlers
=
kazoo_config_event_handlers
(
definitions
,
def
);
if
(
kazoo_globals
.
event_handlers
==
NULL
)
{
event_handlers
=
kazoo_config_event_handlers
(
definitions
,
def
);
}
else
{
event_handlers
=
kazoo_globals
.
event_handlers
;
}
}
if
(
event_handlers
!=
NULL
)
{
...
...
@@ -337,26 +368,37 @@ switch_status_t kazoo_config_handlers(switch_xml_t cfg)
if
(
events
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to get default handler for events
\n
"
);
destroy_config
(
&
event_handlers
);
destroy_config
(
&
fetch_handlers
);
destroy_config
(
&
definitions
);
if
(
kazoo_globals
.
event_handlers
!=
event_handlers
)
destroy_config
(
&
event_handlers
);
if
(
kazoo_globals
.
fetch_handlers
!=
fetch_handlers
)
destroy_config
(
&
fetch_handlers
);
if
(
kazoo_globals
.
definitions
!=
definitions
)
destroy_config
(
&
definitions
);
switch_xml_free
(
def
);
switch_safe_free
(
xml
);
return
SWITCH_STATUS_GENERR
;
}
bind_event_profiles
(
events
->
events
);
kazoo_globals
.
events
=
events
;
if
(
kazoo_globals
.
events
!=
events
)
{
bind_event_profiles
(
events
->
events
);
kazoo_globals
.
events
=
events
;
}
destroy_config
(
&
kazoo_globals
.
event_handlers
);
kazoo_globals
.
event_handlers
=
event_handlers
;
if
(
kazoo_globals
.
event_handlers
!=
event_handlers
)
{
kazoo_config_ptr
tmp
=
kazoo_globals
.
event_handlers
;
kazoo_globals
.
event_handlers
=
event_handlers
;
destroy_config
(
&
tmp
);
}
rebind_fetch_profiles
(
fetch_handlers
);
destroy_config
(
&
kazoo_globals
.
fetch_handlers
);
kazoo_globals
.
fetch_handlers
=
fetch_handlers
;
if
(
kazoo_globals
.
fetch_handlers
!=
fetch_handlers
)
{
kazoo_config_ptr
tmp
=
kazoo_globals
.
fetch_handlers
;
kazoo_globals
.
fetch_handlers
=
fetch_handlers
;
rebind_fetch_profiles
(
fetch_handlers
);
destroy_config
(
&
tmp
);
}
destroy_config
(
&
kazoo_globals
.
definitions
);
kazoo_globals
.
definitions
=
definitions
;
if
(
kazoo_globals
.
definitions
!=
definitions
)
{
kazoo_config_ptr
tmp
=
kazoo_globals
.
definitions
;
kazoo_globals
.
definitions
=
definitions
;
destroy_config
(
&
tmp
);
}
switch_xml_free
(
def
);
...
...
src/mod/event_handlers/mod_kazoo/kazoo_fields.h
浏览文件 @
ece804c9
...
...
@@ -78,7 +78,9 @@ typedef enum {
FILTER_COMPARE_LIST
,
FILTER_COMPARE_VALUE
,
FILTER_COMPARE_PREFIX
,
FILTER_COMPARE_EXISTS
FILTER_COMPARE_EXISTS
,
FILTER_COMPARE_FIELD
}
kazoo_filter_compare_type
;
typedef
enum
{
...
...
@@ -115,7 +117,7 @@ typedef enum {
FIELD_PREFIX
,
FIELD_OBJECT
,
FIELD_GROUP
,
FIELD_REFERENCE
,
FIELD_REFERENCE
}
kazoo_field_type
;
...
...
src/mod/event_handlers/mod_kazoo/kazoo_message.c
浏览文件 @
ece804c9
...
...
@@ -49,7 +49,7 @@ static int inline filter_compare(switch_event_t* evt, kazoo_filter_ptr filter)
{
switch_event_header_t
*
header
;
int
hasValue
=
0
,
n
;
char
*
value
;
char
*
value
=
NULL
,
*
expr
=
NULL
;
switch
(
filter
->
compare
)
{
...
...
@@ -58,8 +58,21 @@ static int inline filter_compare(switch_event_t* evt, kazoo_filter_ptr filter)
break
;
case
FILTER_COMPARE_VALUE
:
value
=
switch_event_get_header_nil
(
evt
,
filter
->
name
);
hasValue
=
!
strcmp
(
value
,
filter
->
value
);
if
(
*
filter
->
name
==
'$'
)
{
value
=
expr
=
kz_event_expand_headers
(
evt
,
filter
->
name
);
}
else
{
value
=
switch_event_get_header
(
evt
,
filter
->
name
);
}
hasValue
=
value
?
!
strcmp
(
value
,
filter
->
value
)
:
0
;
break
;
case
FILTER_COMPARE_FIELD
:
if
(
*
filter
->
name
==
'$'
)
{
value
=
expr
=
kz_event_expand_headers
(
evt
,
filter
->
name
);
}
else
{
value
=
switch_event_get_header
(
evt
,
filter
->
name
);
}
hasValue
=
value
?
!
strcmp
(
value
,
switch_event_get_header_nil
(
evt
,
filter
->
value
))
:
0
;
break
;
case
FILTER_COMPARE_PREFIX
:
...
...
@@ -72,7 +85,11 @@ static int inline filter_compare(switch_event_t* evt, kazoo_filter_ptr filter)
break
;
case
FILTER_COMPARE_LIST
:
value
=
switch_event_get_header
(
evt
,
filter
->
name
);
if
(
*
filter
->
name
==
'$'
)
{
value
=
expr
=
kz_event_expand_headers
(
evt
,
filter
->
name
);
}
else
{
value
=
switch_event_get_header
(
evt
,
filter
->
name
);
}
if
(
value
)
{
for
(
n
=
0
;
n
<
filter
->
list
.
size
;
n
++
)
{
if
(
!
strncmp
(
value
,
filter
->
list
.
value
[
n
],
strlen
(
filter
->
list
.
value
[
n
])))
{
...
...
@@ -90,6 +107,8 @@ static int inline filter_compare(switch_event_t* evt, kazoo_filter_ptr filter)
break
;
}
switch_safe_free
(
expr
);
return
hasValue
;
}
...
...
src/mod/event_handlers/mod_kazoo/kazoo_node.c
浏览文件 @
ece804c9
...
...
@@ -799,8 +799,10 @@ static switch_status_t handle_request_bind(ei_node_t *ei_node, erlang_pid *pid,
switch
(
section
)
{
case
SWITCH_XML_SECTION_CONFIG
:
add_fetch_handler
(
ei_node
,
pid
,
kazoo_globals
.
config_fetch_binding
);
if
(
!
kazoo_globals
.
config_fetched
)
if
(
!
kazoo_globals
.
config_fetched
)
{
kazoo_globals
.
config_fetched
=
1
;
fetch_config
();
}
break
;
case
SWITCH_XML_SECTION_DIRECTORY
:
add_fetch_handler
(
ei_node
,
pid
,
kazoo_globals
.
directory_fetch_binding
);
...
...
src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c
浏览文件 @
ece804c9
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论