Asterisk - The Open Source Telephony Project GIT-master-80b953f
Loading...
Searching...
No Matches
getters_cel.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2026, Sangoma Technologies Corporation
5 *
6 * George Joseph <gjoseph@sangoma.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*!
20 * \file
21 * \author George Joseph <gjoseph@sangoma.com>
22 *
23 * \brief CEL Getters
24 *
25 */
26
27#include "cdrel.h"
28#include "asterisk/cel.h"
29
30static int cel_get_string(void *record, struct cdrel_config *config,
31 struct cdrel_field *field, struct cdrel_value *value)
32{
33 struct ast_event *event = record;
34 value->data_type = cdrel_type_string;
35 value->field_name = field->name;
36 value->values.string = (char *)ast_event_get_ie_str(event, field->field_id);
37 return 0;
38}
39
40static int cel_get_literal(void *record, struct cdrel_config *config,
41 struct cdrel_field *field, struct cdrel_value *value)
42{
43 value->data_type = cdrel_type_string;
44 value->field_name = field->name;
45 value->values.string = field->data;
46 return 0;
47}
48
49static int cel_get_timeval(void *record, struct cdrel_config *config,
50 struct cdrel_field *field, struct cdrel_value *value)
51{
52 struct ast_event *event = record;
53 value->data_type = cdrel_type_timeval;
54 value->field_name = field->name;
57 return 0;
58}
59
60static int cel_get_uint32(void *record, struct cdrel_config *config,
61 struct cdrel_field *field, struct cdrel_value *value)
62{
63 struct ast_event *event = record;
64 value->data_type = cdrel_type_uint32;
65 value->field_name = field->name;
66 value->values.uint32 = ast_event_get_ie_uint(event, field->field_id);
67 return 0;
68}
69
70static int cel_get_event_type(void *record, struct cdrel_config *config,
71 struct cdrel_field *field, struct cdrel_value *value)
72{
73 struct ast_event *event = record;
74 const char *val = NULL;
75 value->data_type = cdrel_type_string;
76 value->field_name = field->name;
77
80 } else {
82 }
83 value->values.string = (char *)val;
84 return 0;
85}
86
87static int cel_get_event_enum(void *record, struct cdrel_config *config,
88 struct cdrel_field *field, struct cdrel_value *value)
89{
90 struct ast_event *event = record;
91 value->data_type = cdrel_type_string;
92 value->field_name = field->name;
94 return 0;
95}
96
98{
99 struct ast_event *event = data;
100
102}
103
Private header for res_cdrel_custom.
@ cdrel_type_event_type
Definition cdrel.h:79
@ cdrel_type_event_enum
Definition cdrel.h:80
@ cdrel_type_literal
Definition cdrel.h:75
@ cdrel_type_string
Definition cdrel.h:73
@ cdrel_type_timeval
Definition cdrel.h:74
@ cdrel_type_uint32
Definition cdrel.h:84
cdrel_dummy_channel_alloc cdrel_dummy_channel_allocators[cdrel_format_type_end]
cdrel_field_getter cdrel_field_getters[cdrel_record_type_end][cdrel_data_type_end]
Call Event Logging API.
@ AST_CEL_USER_DEFINED
a user-defined event, the event name field should be set
Definition cel.h:70
struct ast_channel * ast_cel_fabricate_channel_from_event(const struct ast_event *event)
Create a fake channel from data in a CEL event.
Definition cel.c:717
const char * ast_cel_get_type_name(enum ast_cel_event_type type)
Get the name of a CEL event type.
Definition cel.c:514
static const char config[]
uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has an integer payload.
Definition event.c:294
const char * ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has a string payload.
Definition event.c:303
@ AST_EVENT_IE_CEL_EVENT_TIME
Channel Event Time (seconds) Used by: AST_EVENT_CEL Payload type: UINT.
Definition event_defs.h:139
@ AST_EVENT_IE_CEL_USEREVENT_NAME
Channel Event User Event Name Used by: AST_EVENT_CEL Payload type: STR.
Definition event_defs.h:151
@ AST_EVENT_IE_CEL_EVENT_TIME_USEC
Channel Event Time (micro-seconds) Used by: AST_EVENT_CEL Payload type: UINT.
Definition event_defs.h:145
@ AST_EVENT_IE_CEL_EVENT_TYPE
Channel Event Type Used by: AST_EVENT_CEL Payload type: UINT.
Definition event_defs.h:133
int load_cel(void)
static int cel_get_event_type(void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value)
Definition getters_cel.c:70
static int cel_get_event_enum(void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value)
Definition getters_cel.c:87
static struct ast_channel * dummy_chan_alloc_cel(struct cdrel_config *config, void *data)
Definition getters_cel.c:97
static int cel_get_literal(void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value)
Definition getters_cel.c:40
static int cel_get_uint32(void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value)
Definition getters_cel.c:60
static int cel_get_string(void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value)
Definition getters_cel.c:30
static int cel_get_timeval(void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value)
Definition getters_cel.c:49
#define ast_debug(level,...)
Log a DEBUG message.
@ cdrel_record_cel
#define NULL
Definition resample.c:96
Main Channel structure associated with a channel.
const char * data
An event.
Definition event.c:81
int field_id
Definition cdrel.h:272
char data[1]
Definition cdrel.h:277
char * name
Definition cdrel.h:273
int value
Definition syslog.c:37