Asterisk - The Open Source Telephony Project GIT-master-a63eec2
|
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 | |
#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 = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .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 = AST_MUTEX_INIT_VALUE |
static struct psql_columns | psql_columns = AST_RWLIST_HEAD_INIT_VALUE |
static PGresult * | result = NULL |
static char * | schema |
static char * | table |
static int | usegmtime = 0 |
PostgreSQL CEL logger.
Definition in file cel_pgsql.c.
#define CEL_SHOW_USERDEF_DEFAULT 0 |
show_user_def is off by default
Definition at line 76 of file cel_pgsql.c.
#define DATE_FORMAT "%Y-%m-%d %T.%6q" |
Definition at line 53 of file cel_pgsql.c.
#define LENGTHEN_BUF | ( | size, | |
var_sql | |||
) |
Definition at line 97 of file cel_pgsql.c.
#define LENGTHEN_BUF1 | ( | size | ) | LENGTHEN_BUF(size, sql); |
Definition at line 111 of file cel_pgsql.c.
#define LENGTHEN_BUF2 | ( | size | ) | LENGTHEN_BUF(size, sql2); |
Definition at line 113 of file cel_pgsql.c.
#define PGSQL_BACKEND_NAME "CEL PGSQL backend" |
Definition at line 55 of file cel_pgsql.c.
#define PGSQL_MIN_VERSION_SCHEMA 70300 |
Definition at line 57 of file cel_pgsql.c.
#define SEP (first ? "" : ",") |
|
static |
Definition at line 709 of file cel_pgsql.c.
|
static |
Definition at line 709 of file cel_pgsql.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 709 of file cel_pgsql.c.
|
static |
|
static |
Definition at line 665 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(), process_my_load_module(), and reload().
Referenced by load_module(), and reload().
|
static |
Definition at line 400 of file cel_pgsql.c.
References ast_cel_backend_unregister(), ast_free, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, conn, current, 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 145 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, first, LENGTHEN_BUF1, LENGTHEN_BUF2, ast_cel_event_record::linked_id, 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 116 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 454 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, columns::type, unload_module(), usegmtime, var, and version.
Referenced by my_load_module().
|
static |
Definition at line 697 of file cel_pgsql.c.
References my_load_module().
Referenced by my_load_module().
|
static |
Definition at line 449 of file cel_pgsql.c.
References my_unload_module().
Referenced by process_my_load_module().
|
static |
Definition at line 709 of file cel_pgsql.c.
|
static |
Definition at line 709 of file cel_pgsql.c.
|
static |
TRUE if we should set the eventtype field to USER_DEFINED on user events.
Definition at line 79 of file cel_pgsql.c.
Referenced by pgsql_log(), and process_my_load_module().
|
static |
Definition at line 59 of file cel_pgsql.c.
Referenced by my_load_module().
|
static |
Definition at line 83 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 pgsql_log(), and process_my_load_module().
|
static |
Definition at line 72 of file cel_pgsql.c.
Referenced by pgsql_log().
|
static |
Definition at line 72 of file cel_pgsql.c.
Referenced by pgsql_log().
|
static |
Definition at line 65 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 62 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 66 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 63 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 61 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 64 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), pgsql_reconnect(), and process_my_load_module().
|
static |
Definition at line 81 of file cel_pgsql.c.
Referenced by pgsql_log().
|
static |
|
static |
Definition at line 84 of file cel_pgsql.c.
Referenced by __ast_channel_alloc(), __ast_channel_alloc_with_initializers(), __ast_string_field_alloc_space(), __astman_get_header(), _pgsql_exec(), acf_meetme_info(), action_updateconfig(), aeap_transaction_end(), ast_app_parse_timelen(), ast_apply_ha(), ast_ari_callback(), ast_build_string(), ast_build_string_va(), ast_channel_publish_varset(), ast_config_internal_load(), ast_config_internal_load(), ast_config_load2(), ast_db_exists(), ast_dns_resolve(), ast_dns_resolve_ipv6_and_ipv4(), ast_dns_result_free(), ast_dns_result_get_answer(), ast_dns_result_get_bogus(), ast_dns_result_get_canonical(), ast_dns_result_get_lowest_ttl(), ast_dns_result_get_rcode(), ast_dns_result_get_records(), ast_dns_result_get_secure(), ast_dnsmgr_get(), ast_dnsmgr_get_family(), ast_dnsmgr_lookup(), ast_dnsmgr_lookup_cb(), ast_format_cap_get_compatible(), ast_format_cap_get_compatible_format(), ast_format_cap_get_format_framing(), ast_geoloc_civicaddr_validate_varlist(), ast_geoloc_eprofile_to_uri(), ast_geoloc_gml_validate_varlist(), ast_geoloc_validate_result_to_str(), ast_get_encoded_char(), ast_get_encoded_str(), ast_gethostbyname(), ast_msg_has_destination(), ast_parse_arg(), ast_privacy_check(), ast_rtp_instance_available_formats(), ast_sip_str_to_dtmf(), ast_sip_will_uri_survive_restart(), ast_sockaddr_apply_netmask(), ast_speech_results_free(), ast_str_substitute_variables_full2(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), ast_translate_available_formats(), ast_websocket_client_connect(), ast_websocket_client_create(), ast_websocket_client_create_with_options(), ast_websocket_result_to_str(), ast_xml_query(), ast_xml_query_with_namespaces(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), chan_pjsip_get_codec(), chan_rtp_get_codec(), chat(), check_add_remove_channel(), check_eval(), check_match(), check_translation_path(), cli_complete_registration(), cli_notify(), conf_find_bridge_profile(), conf_find_menu_entry_by_sequence(), conf_find_user_profile(), config_module(), config_mysql(), config_pgsql(), configuration_parse_unsigned_integer(), db_get_common(), destroy_pgsql(), detect_callback(), detzcode(), detzcode64(), dial_exec_full(), dns_naptr_sort(), dns_query_recurring_resolution_callback(), dns_srv_sort(), dtmf_to_str(), dundi_lookup(), 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(), filter_cmp_fn(), find_result(), find_table(), find_table(), function_db_keys(), gen_match_to_pattern(), generic_fax_exec(), geoloc_config_cli_reload(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_config_load(), geoloc_config_show_profiles(), geoloc_location_apply_handler(), geoloc_profile_apply_handler(), getremainingfilelength(), gmtsub(), handle_msg_cb(), handle_results(), handle_speechrecognize(), handle_standard_bridge_enter_message(), handle_updates(), iax2_codec_pref_index(), inform(), internal_dnsmgr_lookup(), invalid_record_test(), launch_ha_netscript(), ldap_loadentry(), lintocodec2_frameout(), lintogsm_frameout(), lintoilbc_frameout(), lintolpc10_frameout(), lintospeex_frameout(), listfilter(), loadresult2str(), localized_config_load(), localized_config_load_with_comments(), localsub(), mallocconcat(), malloccopy(), mwi_thread(), nominal_test(), odbc_datastore_free(), off_nominal_test(), ogg_speex_open(), ogg_vorbis_open(), ooh323_get_codec(), op_func(), outbound_session_handler_thread(), P3(), parse_double(), parse_node(), parse_srv(), parsedoublearg(), parsefilearg(), parsefreq(), parseintarg(), parsetime(), parsetimearg(), parsevolarg(), parsevolume(), pgsql_exec(), pgsql_log(), pgsql_log(), phoneprov_callback(), process_my_load_module(), process_text_line(), publish_async_exec_end(), publish_load_message(), publish_reload_message(), radius_log(), radius_log(), read_credentials(), read_mf_digits(), read_packet(), read_sf_digits(), realtime_arguments_to_fields2(), realtime_ldap_base_ap(), realtime_multi_mysql(), realtime_multi_pgsql(), realtime_mysql(), realtime_pgsql(), receivefax_exec(), require_pgsql(), rfcomm_read_and_append_char(), rfcomm_read_and_expect_char(), say(), scan_exec(), sdp_crypto_alloc(), sendfax_exec(), set_id_from_hdr(), should_send_event(), sorcery_memory_cache_complete_name(), sorcery_memory_cache_complete_object_name(), sort_result(), speech_grammar(), speech_read(), speech_score(), speech_text(), stasis_message_type_create(), store_pgsql(), t30_phase_e_handler(), test_expected_result(), test_results(), testtime_write(), tmcomp(), transaction_end(), typeof(), tzload(), update2_pgsql(), update_pgsql(), validate_location_info(), wait_exec(), wait_for_answer(), webchan_call(), websocket_client_args_create(), and websocket_client_create().
|
static |
Definition at line 68 of file cel_pgsql.c.
Referenced by load_config(), my_unload_module(), and process_my_load_module().
|
static |
Definition at line 67 of file cel_pgsql.c.
Referenced by my_unload_module(), pgsql_log(), and process_my_load_module().
|
static |
Definition at line 73 of file cel_pgsql.c.
Referenced by pgsql_log(), and process_my_load_module().