mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
cel: add publish user event helper
Add a wrapper function around ast_cel_publish_event that
packs event and extras into a blob before publishing
Resolves:#330
(cherry picked from commit 4592f97c36
)
This commit is contained in:
committed by
Asterisk Development Team
parent
d01b047de3
commit
f9efc9c681
15
main/cel.c
15
main/cel.c
@@ -1689,6 +1689,21 @@ static int reload_module(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ast_cel_publish_user_event(struct ast_channel *chan,
|
||||
const char *event,
|
||||
const char *extra)
|
||||
{
|
||||
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
|
||||
|
||||
blob = ast_json_pack("{s: s, s: {s: s}}",
|
||||
"event", event,
|
||||
"extra", "extra", S_OR(extra, ""));
|
||||
if (!blob) {
|
||||
return;
|
||||
}
|
||||
ast_cel_publish_event(chan, AST_CEL_USER_DEFINED, blob);
|
||||
}
|
||||
|
||||
void ast_cel_publish_event(struct ast_channel *chan,
|
||||
enum ast_cel_event_type event_type,
|
||||
struct ast_json *blob)
|
||||
|
Reference in New Issue
Block a user