Asterisk - The Open Source Telephony Project
18.5.0
|
PostgreSQL CEL logger. More...
#include "asterisk.h"
#include <libpq-fe.h>
#include "asterisk/config.h"
#include "asterisk/options.h"
#include "asterisk/channel.h"
#include "asterisk/cel.h"
#include "asterisk/module.h"
#include "asterisk/logger.h"
Go to the source code of this file.
Data Structures | |
struct | columns |
struct | psql_columns |
Macros | |
#define | CEL_SHOW_USERDEF_DEFAULT 0 |
show_user_def is off by default More... | |
#define | DATE_FORMAT "%Y-%m-%d %T.%6q" |
#define | LENGTHEN_BUF(size, var_sql) |
#define | LENGTHEN_BUF1(size) LENGTHEN_BUF(size, sql); |
#define | LENGTHEN_BUF2(size) LENGTHEN_BUF(size, sql2); |
#define | PGSQL_BACKEND_NAME "CEL PGSQL backend" |
#define | PGSQL_MIN_VERSION_SCHEMA 70300 |
#define | SEP (first ? "" : ",") |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | load_module (void) |
static int | my_load_module (int reload) |
static int | my_unload_module (void) |
static void | pgsql_log (struct ast_event *event) |
static void | pgsql_reconnect (void) |
static int | process_my_load_module (struct ast_config *cfg) |
static int | reload (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PostgreSQL CEL Backend" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cel", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static unsigned char | cel_show_user_def |
static char * | config = "cel_pgsql.conf" |
static PGconn * | conn = NULL |
static int | connected = 0 |
static int | maxsize = 512 |
static int | maxsize2 = 512 |
static char * | pgappname |
static char * | pgdbname |
static char * | pgdbport |
static char * | pgdbuser |
static char * | pghostname |
static char * | pgpassword |
static ast_mutex_t | pgsql_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static struct psql_columns | psql_columns = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static PGresult * | result = NULL |
static char * | schema |
static char * | table |
static int | usegmtime = 0 |
PostgreSQL CEL logger.
See also
Definition in file cel_pgsql.c.
#define CEL_SHOW_USERDEF_DEFAULT 0 |
show_user_def is off by default
Definition at line 80 of file cel_pgsql.c.
Referenced by process_my_load_module().
#define DATE_FORMAT "%Y-%m-%d %T.%6q" |
Definition at line 57 of file cel_pgsql.c.
Referenced by pgsql_log().
#define LENGTHEN_BUF | ( | size, | |
var_sql | |||
) |
Definition at line 101 of file cel_pgsql.c.
#define LENGTHEN_BUF1 | ( | size | ) | LENGTHEN_BUF(size, sql); |
Definition at line 115 of file cel_pgsql.c.
Referenced by pgsql_log().
#define LENGTHEN_BUF2 | ( | size | ) | LENGTHEN_BUF(size, sql2); |
Definition at line 117 of file cel_pgsql.c.
Referenced by pgsql_log().
#define PGSQL_BACKEND_NAME "CEL PGSQL backend" |
Definition at line 59 of file cel_pgsql.c.
Referenced by my_load_module(), and my_unload_module().
#define PGSQL_MIN_VERSION_SCHEMA 70300 |
Definition at line 61 of file cel_pgsql.c.
Referenced by process_my_load_module().
#define SEP (first ? "" : ",") |
Referenced by pgsql_log().
|
static |
Definition at line 713 of file cel_pgsql.c.
|
static |
Definition at line 713 of file cel_pgsql.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 713 of file cel_pgsql.c.
|
static |
|
static |
Definition at line 669 of file cel_pgsql.c.
References ast_cel_backend_register(), ast_config_destroy(), ast_config_load, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, config, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, LOG_WARNING, my_unload_module(), NULL, PGSQL_BACKEND_NAME, pgsql_log(), and process_my_load_module().
Referenced by load_module(), and reload().
|
static |
Definition at line 404 of file cel_pgsql.c.
References ast_cel_backend_unregister(), ast_free, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, conn, columns::list, NULL, pgappname, pgdbname, pgdbport, pgdbuser, pghostname, pgpassword, PGSQL_BACKEND_NAME, schema, and table.
Referenced by my_load_module(), and unload_module().
|
static |
Definition at line 149 of file cel_pgsql.c.
References ast_cel_event_record::account_code, ast_cel_event_record::amaflag, ast_cel_event_record::application_data, ast_cel_event_record::application_name, AST_CEL_EVENT_RECORD_VERSION, ast_cel_fill_record(), AST_CEL_USER_DEFINED, ast_debug, ast_free, ast_localtime(), ast_log, ast_malloc, ast_mutex_lock, ast_mutex_unlock, ast_realloc, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_str_strlen(), ast_strftime(), buf, ast_cel_event_record::caller_id_ani, ast_cel_event_record::caller_id_dnid, ast_cel_event_record::caller_id_name, ast_cel_event_record::caller_id_num, ast_cel_event_record::caller_id_rdnis, cel_show_user_def, ast_cel_event_record::channel_name, conn, connected, ast_cel_event_record::context, DATE_FORMAT, ast_cel_event_record::event_name, ast_cel_event_record::event_time, ast_cel_event_record::event_type, ast_cel_event_record::extension, ast_cel_event_record::extra, columns::first, LENGTHEN_BUF1, LENGTHEN_BUF2, ast_cel_event_record::linked_id, columns::list, LOG_ERROR, LOG_NOTICE, LOG_WARNING, maxsize, maxsize2, columns::name, NULL, ast_cel_event_record::peer, ast_cel_event_record::peer_account, pgdbname, pgdbuser, pghostname, pgpassword, pgsql_lock, pgsql_reconnect(), result, SEP, table, columns::type, ast_cel_event_record::unique_id, usegmtime, ast_cel_event_record::user_defined_name, ast_cel_event_record::user_field, value, and ast_cel_event_record::version.
Referenced by my_load_module().
|
static |
Definition at line 120 of file cel_pgsql.c.
References ast_free, ast_log, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_strlen_zero, conn, LOG_ERROR, NULL, pgappname, pgdbname, pgdbport, pgdbuser, pghostname, and pgpassword.
Referenced by pgsql_log(), and process_my_load_module().
|
static |
Definition at line 458 of file cel_pgsql.c.
References ast_alloca, ast_calloc, ast_debug, ast_free, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_RWLIST_INSERT_TAIL, ast_strdup, ast_strlen_zero, ast_true(), ast_variable_browse(), ast_variable_retrieve(), ast_verb, cel_show_user_def, CEL_SHOW_USERDEF_DEFAULT, conn, connected, DEBUG_ATLEAST, columns::hasdefault, columns::len, columns::list, LOG_DEBUG, LOG_ERROR, LOG_WARNING, columns::name, columns::notnull, NULL, pgappname, pgdbname, pgdbport, pgdbuser, pghostname, pgpassword, PGSQL_MIN_VERSION_SCHEMA, pgsql_reconnect(), result, schema, table, tmp(), columns::type, unload_module(), usegmtime, var, and version.
Referenced by my_load_module().
|
static |
Definition at line 701 of file cel_pgsql.c.
References AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CDR_DRIVER, AST_MODULE_INFO(), AST_MODULE_SUPPORT_EXTENDED, ASTERISK_GPL_KEY, load_module(), my_load_module(), and unload_module().
|
static |
Definition at line 453 of file cel_pgsql.c.
References my_unload_module().
Referenced by process_my_load_module(), and reload().
|
static |
Definition at line 713 of file cel_pgsql.c.
|
static |
Definition at line 713 of file cel_pgsql.c.
|
static |
TRUE if we should set the eventtype field to USER_DEFINED on user events.
Definition at line 83 of file cel_pgsql.c.
Referenced by pgsql_log(), and process_my_load_module().
|
static |
Definition at line 63 of file cel_pgsql.c.
Referenced by my_load_module().
|
static |
Definition at line 87 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 74 of file cel_pgsql.c.
Referenced by pgsql_log(), and process_my_load_module().
|
static |
Definition at line 76 of file cel_pgsql.c.
Referenced by pgsql_log().
|
static |
Definition at line 76 of file cel_pgsql.c.
Referenced by pgsql_log().
|
static |
Definition at line 69 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 66 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 70 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 67 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 65 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 68 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 85 of file cel_pgsql.c.
Referenced by pgsql_log().
|
static |
|
static |
Definition at line 88 of file cel_pgsql.c.
Referenced by __ast_channel_alloc(), __ast_string_field_alloc_space(), __astman_get_header(), acf_meetme_info(), action_updateconfig(), ast_build_string(), ast_build_string_va(), ast_config_internal_load(), ast_config_load2(), ast_format_cap_get_compatible_format(), ast_format_cap_get_format_framing(), ast_get_encoded_str(), ast_msg_has_destination(), ast_parse_arg(), ast_privacy_check(), ast_sip_str_to_dtmf(), ast_sip_will_uri_survive_restart(), ast_sockaddr_stringify_port(), ast_speech_results_free(), ast_stir_shaken_add_verification(), AST_TEST_DEFINE(), ast_websocket_client_create(), ast_xml_query(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), async_callback(), blackfilter_cmp_fn(), chat(), check_eval(), check_sip_domain(), cli_complete_registration(), complete_sip_peer(), complete_sip_registered_peer(), complete_sip_user(), conf_find_bridge_profile(), conf_find_user_profile(), config_module(), config_mysql(), config_pgsql(), cops_connect(), db_get_common(), destroy_pgsql(), detect_callback(), detzcode(), detzcode64(), dial_exec_full(), dns_query_recurring_resolution_callback(), dtmf_to_str(), dundi_lookup_internal(), error(), evaluate_history_entry(), evaluate_like(), fax_detect_framehook(), fax_gateway_attach(), fax_gateway_detect_t38(), fax_gateway_framehook(), fax_gateway_start(), find_result(), find_table(), gen_match_to_pattern(), generic_fax_exec(), gmtsub(), handle_msg_cb(), handle_request_invite(), handle_skinny_set_debug(), handle_speechrecognize(), handle_standard_bridge_enter_message(), handle_updates(), iax2_codec_pref_index(), inform(), invalid_record_test(), launch_ha_netscript(), ldap_loadentry(), lintocodec2_frameout(), lintogsm_frameout(), lintoilbc_frameout(), lintolpc10_frameout(), lintospeex_frameout(), listfilter(), localized_config_load(), localized_config_load_with_comments(), localsub(), mallocconcat(), malloccopy(), match_filter(), mgcpsock_read(), mwi_thread(), my_connect_db(), MYSQL_exec(), nominal_sync_run(), nominal_test(), odbc_datastore_free(), off_nominal_async_callback(), off_nominal_sync_run(), off_nominal_test(), ogg_speex_open(), ogg_vorbis_open(), op_func(), P3(), parsefilearg(), pgsql_log(), process_my_load_module(), radius_log(), read_credentials(), read_mf_digits(), read_packet(), read_sf_digits(), realtime_ldap_base_ap(), realtime_multi_mysql(), realtime_multi_pgsql(), realtime_mysql(), realtime_pgsql(), receivefax_exec(), require_pgsql(), rtp_address_is_ice_blacklisted(), say(), sdp_crypto_alloc(), sendfax_exec(), sip_report_security_event(), sip_resolve_callback(), sorcery_memory_cache_complete_name(), sorcery_memory_cache_complete_object_name(), speech_grammar(), speech_read(), speech_score(), speech_text(), store_pgsql(), str2tech(), stun_address_is_blacklisted(), subscription_statistics_complete_name(), t30_phase_e_handler(), test_dtmf_amplitude_sweep(), test_dtmf_twist_sweep(), test_execute(), test_results(), test_tone_amplitude_sweep(), test_tone_freq_sweep(), testtime_write(), tmcomp(), topic_statistics_complete_name(), tzload(), update2_pgsql(), update_pgsql(), wait_exec(), and whitefilter_cmp_fn().
|
static |
Definition at line 72 of file cel_pgsql.c.
Referenced by load_config(), my_unload_module(), and process_my_load_module().
|
static |
Definition at line 71 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), and process_my_load_module().
|
static |
Definition at line 77 of file cel_pgsql.c.
Referenced by pgsql_log(), and process_my_load_module().