208 static const char CONF_FILE[] =
"cel.conf";
211 #define CEL_AMI_ENABLED_DEFAULT 0
213 static int enablecel;
216 #define CEL_SHOW_USERDEF_DEFAULT 0
218 #define MANAGER_BACKEND_NAME "Manager Event Logging"
226 char start_time[80] =
"";
227 char user_defined_header[160];
228 const char *event_name;
244 event_name = record.event_name;
245 user_defined_header[0] =
'\0';
248 snprintf(user_defined_header,
sizeof(user_defined_header),
249 "UserDefType: %s\r\n", record.user_defined_name);
251 event_name = record.user_defined_name;
257 "AccountCode: %s\r\n"
258 "CallerIDnum: %s\r\n"
259 "CallerIDname: %s\r\n"
260 "CallerIDani: %s\r\n"
261 "CallerIDrdnis: %s\r\n"
262 "CallerIDdnid: %s\r\n"
266 "Application: %s\r\n"
274 "PeerAccount: %s\r\n"
279 record.caller_id_num,
280 record.caller_id_name,
281 record.caller_id_ani,
282 record.caller_id_rdnis,
283 record.caller_id_dnid,
287 record.application_name,
288 record.application_data,
300 static int load_config(
int reload)
302 const char *cat = NULL;
310 if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
314 if (cfg == CONFIG_STATUS_FILEINVALID) {
315 ast_log(LOG_WARNING,
"Configuration file '%s' is invalid. CEL manager Module not activated.\n",
320 ast_log(LOG_WARNING,
"Failed to load configuration file. CEL manager Module not activated.\n");
326 if (strcasecmp(cat,
"manager")) {
330 for (v = ast_variable_browse(cfg, cat); v; v = v->
next) {
331 if (!strcasecmp(v->
name,
"enabled")) {
333 }
else if (!strcasecmp(v->
name,
"show_user_defined")) {
336 ast_log(LOG_NOTICE,
"Unknown option '%s' specified "
337 "for cel_manager.\n", v->
name);
345 if (enablecel && !newenablecel) {
347 }
else if (!enablecel && newenablecel) {
349 ast_log(LOG_ERROR,
"Unable to register Asterisk Call Manager CEL handling\n");
352 enablecel = newenablecel;
357 static int unload_module(
void)
363 static int load_module(
void)
365 if (load_config(0)) {
372 static int reload(
void)
374 return load_config(1);
377 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER,
"Asterisk Manager Interface CEL Backend",
378 .support_level = AST_MODULE_SUPPORT_CORE,
380 .unload = unload_module,
struct ast_variable * next
Helper struct for getting the fields out of a CEL event.
Asterisk main include file. File version handling, generic pbx functions.
int ast_cel_backend_register(const char *name, ast_cel_backend_cb backend_callback)
Register a CEL backend.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Structure for variables, used for configurations and for channel variables.
const char * ast_channel_amaflags2string(enum ama_flags flags)
Convert the enum representation of an AMA flag to a string representation.
#define CEL_AMI_ENABLED_DEFAULT
AMI CEL is off by default.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define CEL_SHOW_USERDEF_DEFAULT
show_user_def is off by default
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
General Asterisk PBX channel definitions.
static unsigned char cel_show_user_def
uint32_t version
struct ABI version
int ast_cel_backend_unregister(const char *name)
Unregister a CEL backend.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
Support for logging to various files, console and syslog Configuration in file logger.conf.
Module has failed to load, may be in an inconsistent state.
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
#define AST_CEL_EVENT_RECORD_VERSION
struct ABI version
Structure used to handle boolean flags.
a user-defined event, the event name field should be set
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
Asterisk module definitions.
int ast_cel_fill_record(const struct ast_event *event, struct ast_cel_event_record *r)
Fill in an ast_cel_event_record from a CEL event.