diff options
author | Richard Mudgett <rmudgett@digium.com> | 2012-02-01 17:42:15 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2012-02-01 17:42:15 +0000 |
commit | 797d633139a52a87736c04b71e31b1cb66e21e08 (patch) | |
tree | ed8848795a995d9e2986bdd30a867d1a8f3b7044 /main/cel.c | |
parent | a99b3c817baf50cf4edc70e991c0395c3d6d0311 (diff) |
Remove inconsistency in CEL eventtype for user defined events.
The CEL eventtype field for ODBC and PGSQL backends should be USER_DEFINED
instead of the user defined event name supplied by the CELGenUserEvent
application. If the field is output as a number, the user defined name
does not have a value and is always output as 21 for USER_DEFINED and the
userdeftype field would be required to supply the user defined name.
The following CEL backends (cel_odbc, cel_pgsql, cel_custom, cel_manager,
and cel_sqlite3_custom) can be independently configured to remove this
inconsistency.
* Allows cel_manager, cel_custom, and cel_sqlite3_custom to behave the
same way.
(closes issue ASTERISK-17189)
Reported by: Bryant Zimmerman
Review: https://reviewboard.asterisk.org/r/1669/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353648 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/cel.c')
-rw-r--r-- | main/cel.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/main/cel.c b/main/cel.c index 6e8215f20..f7e28f0ef 100644 --- a/main/cel.c +++ b/main/cel.c @@ -402,6 +402,7 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event { struct varshead *headp; struct ast_var_t *newvariable; + const char *mixed_name; char timebuf[30]; struct ast_channel *tchan; struct ast_cel_event_record record = { @@ -422,7 +423,9 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event } /* next, fill the channel with their data */ - if ((newvariable = ast_var_assign("eventtype", record.event_name))) { + mixed_name = (record.event_type == AST_CEL_USER_DEFINED) + ? record.user_defined_name : record.event_name; + if ((newvariable = ast_var_assign("eventtype", mixed_name))) { AST_LIST_INSERT_HEAD(headp, newvariable, entries); } @@ -439,6 +442,9 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event AST_LIST_INSERT_HEAD(headp, newvariable, entries); } + if ((newvariable = ast_var_assign("eventenum", record.event_name))) { + AST_LIST_INSERT_HEAD(headp, newvariable, entries); + } if ((newvariable = ast_var_assign("userdeftype", record.user_defined_name))) { AST_LIST_INSERT_HEAD(headp, newvariable, entries); } @@ -598,13 +604,11 @@ int ast_cel_fill_record(const struct ast_event *e, struct ast_cel_event_record * r->event_time.tv_sec = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TIME); r->event_time.tv_usec = ast_event_get_ie_uint(e, AST_EVENT_IE_CEL_EVENT_TIME_USEC); - r->user_defined_name = ""; - + r->event_name = ast_cel_get_type_name(r->event_type); if (r->event_type == AST_CEL_USER_DEFINED) { r->user_defined_name = ast_event_get_ie_str(e, AST_EVENT_IE_CEL_USEREVENT_NAME); - r->event_name = r->user_defined_name; } else { - r->event_name = ast_cel_get_type_name(r->event_type); + r->user_defined_name = ""; } r->caller_id_name = S_OR(ast_event_get_ie_str(e, AST_EVENT_IE_CEL_CIDNAME), ""); |