Asterisk - The Open Source Telephony Project
18.5.0
|
MYSQL dialplan application. More...
#include "asterisk.h"
#include <mysql/mysql.h>
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/linkedlists.h"
#include "asterisk/chanvars.h"
#include "asterisk/lock.h"
#include "asterisk/options.h"
#include "asterisk/app.h"
#include "asterisk/config.h"
Go to the source code of this file.
Data Structures | |
struct | ast_MYSQL_id |
struct | MYSQLidshead |
Macros | |
#define | AST_MYSQL_ID_CONNID 1 |
#define | AST_MYSQL_ID_DUMMY 0 |
#define | AST_MYSQL_ID_FETCHID 3 |
#define | AST_MYSQL_ID_RESID 2 |
#define | EXTRA_LOG 0 |
#define | MYSQL_CONFIG "app_mysql.conf" |
#define | MYSQL_CONFIG_OLD "mysql.conf" |
Enumerations | |
enum | { NULLSTRING, NULLVALUE, EMPTYSTRING } |
Functions | |
static int | add_identifier (struct ast_channel *chan, int identifier_type, void *data) |
static int | add_identifier_and_set_asterisk_int (struct ast_channel *chan, char *varname, int identifier_type, void *data) |
static int | aMYSQL_clear (struct ast_channel *chan, const char *data) |
static int | aMYSQL_connect (struct ast_channel *chan, const char *data) |
static int | aMYSQL_disconnect (struct ast_channel *chan, const char *data) |
static int | aMYSQL_fetch (struct ast_channel *chan, const char *data) |
static int | aMYSQL_nextresult (struct ast_channel *chan, const char *data) |
static int | aMYSQL_query (struct ast_channel *chan, const char *data) |
static int | aMYSQL_set (struct ast_channel *chan, const char *data) |
AST_MODULE_INFO_STANDARD_DEPRECATED (ASTERISK_GPL_KEY, "Simple Mysql Interface") | |
static int | del_identifier (int identifier, int identifier_type) |
static void * | find_identifier (int identifier, int identifier_type) |
static int | load_module (void) |
Load the module. More... | |
static void | mysql_ds_destroy (void *data) |
static void | mysql_ds_fixup (void *data, struct ast_channel *oldchan, struct ast_channel *newchan) |
static int | MYSQL_exec (struct ast_channel *chan, const char *data) |
static int | safe_scan_int (char **data, char *delim, int def) |
static int | set_asterisk_int (struct ast_channel *chan, char *varname, int id) |
static int | unload_module (void) |
Variables | |
struct MYSQLidshead | _mysql_ids_head |
static ast_mutex_t | _mysql_mutex = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static const char | app [] = "MYSQL" |
struct ast_MYSQL_id * | ast_MYSQL_id |
static int | autoclear = 0 |
static const char | descrip [] |
static const struct ast_datastore_info | mysql_ds_info |
enum { ... } | nullvalue = NULLSTRING |
static const char | synopsis [] = "Do several mySQLy things" |
MYSQL dialplan application.
Definition in file app_mysql.c.
#define AST_MYSQL_ID_CONNID 1 |
Definition at line 109 of file app_mysql.c.
Referenced by aMYSQL_connect(), aMYSQL_disconnect(), aMYSQL_nextresult(), aMYSQL_query(), mysql_ds_destroy(), and mysql_ds_fixup().
#define AST_MYSQL_ID_DUMMY 0 |
Definition at line 108 of file app_mysql.c.
#define AST_MYSQL_ID_FETCHID 3 |
Definition at line 111 of file app_mysql.c.
#define AST_MYSQL_ID_RESID 2 |
Definition at line 110 of file app_mysql.c.
Referenced by aMYSQL_clear(), aMYSQL_fetch(), aMYSQL_nextresult(), aMYSQL_query(), mysql_ds_destroy(), and mysql_ds_fixup().
#define EXTRA_LOG 0 |
Definition at line 58 of file app_mysql.c.
#define MYSQL_CONFIG "app_mysql.conf" |
Definition at line 106 of file app_mysql.c.
Referenced by load_module().
#define MYSQL_CONFIG_OLD "mysql.conf" |
Definition at line 107 of file app_mysql.c.
Referenced by load_module().
anonymous enum |
Enumerator | |
---|---|
NULLSTRING | |
NULLVALUE | |
EMPTYSTRING |
Definition at line 60 of file app_mysql.c.
|
static |
Definition at line 211 of file app_mysql.c.
References _mysql_ids_head, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_malloc, ast_MYSQL_id::data, ast_MYSQL_id::entries, ast_MYSQL_id::identifier, ast_MYSQL_id::identifier_type, LOG_WARNING, NULL, and ast_MYSQL_id::owner.
Referenced by add_identifier_and_set_asterisk_int().
|
static |
Definition at line 277 of file app_mysql.c.
References add_identifier(), and set_asterisk_int().
Referenced by aMYSQL_connect(), aMYSQL_nextresult(), and aMYSQL_query().
|
static |
Definition at line 525 of file app_mysql.c.
References ast_log, AST_MYSQL_ID_RESID, ast_strdupa, del_identifier(), find_identifier(), id, LOG_WARNING, NULL, parse(), safe_scan_int(), and strsep().
Referenced by MYSQL_exec().
|
static |
Definition at line 321 of file app_mysql.c.
References add_identifier_and_set_asterisk_int(), args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_MYSQL_ID_CONNID, AST_NONSTANDARD_APP_ARGS, ast_strdupa, dbcharset, dbhost, dbname, dbpass, dbuser, LOG_WARNING, mysql, NULL, parse(), pbx_builtin_getvar_helper(), and timeout.
Referenced by MYSQL_exec().
|
static |
Definition at line 543 of file app_mysql.c.
References ast_log, AST_MYSQL_ID_CONNID, ast_strdupa, del_identifier(), find_identifier(), id, LOG_WARNING, mysql, NULL, parse(), safe_scan_int(), and strsep().
Referenced by MYSQL_exec().
|
static |
Definition at line 473 of file app_mysql.c.
References args, AST_APP_ARG, ast_debug, AST_DECLARE_APP_ARGS, ast_log, AST_MYSQL_ID_RESID, AST_NONSTANDARD_APP_ARGS, ast_strdupa, EMPTYSTRING, find_identifier(), LOG_WARNING, NULL, NULLSTRING, nullvalue, parse(), pbx_builtin_setvar_helper(), set_asterisk_int(), and strsep().
Referenced by MYSQL_exec().
|
static |
Definition at line 432 of file app_mysql.c.
References add_identifier_and_set_asterisk_int(), args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_MYSQL_ID_CONNID, AST_MYSQL_ID_RESID, AST_NONSTANDARD_APP_ARGS, ast_strdupa, find_identifier(), LOG_WARNING, mysql, and parse().
Referenced by MYSQL_exec().
|
static |
Definition at line 390 of file app_mysql.c.
References add_identifier_and_set_asterisk_int(), args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_MYSQL_ID_CONNID, AST_MYSQL_ID_RESID, AST_NONSTANDARD_APP_ARGS, ast_strdupa, find_identifier(), LOG_WARNING, mysql, and parse().
Referenced by MYSQL_exec().
|
static |
Definition at line 295 of file app_mysql.c.
References args, ast_alloca, AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_NONSTANDARD_APP_ARGS, ast_strdupa, parse(), pbx_builtin_setvar_helper(), tmp(), value, and var.
Referenced by MYSQL_exec().
AST_MODULE_INFO_STANDARD_DEPRECATED | ( | ASTERISK_GPL_KEY | , |
"Simple Mysql Interface" | |||
) |
Referenced by load_module().
|
static |
Definition at line 237 of file app_mysql.c.
References _mysql_ids_head, ast_free, AST_LIST_LOCK, AST_LIST_REMOVE, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_MYSQL_id::entries, ast_MYSQL_id::identifier, ast_MYSQL_id::identifier_type, and LOG_WARNING.
Referenced by aMYSQL_clear(), and aMYSQL_disconnect().
|
static |
Definition at line 185 of file app_mysql.c.
References _mysql_ids_head, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_MYSQL_id::data, ast_MYSQL_id::entries, ast_MYSQL_id::identifier, ast_MYSQL_id::identifier_type, LOG_WARNING, and NULL.
Referenced by aMYSQL_clear(), aMYSQL_disconnect(), aMYSQL_fetch(), aMYSQL_nextresult(), and aMYSQL_query().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 633 of file app_mysql.c.
References _mysql_ids_head, app, ast_config_destroy(), ast_config_load, AST_LIST_HEAD_INIT, ast_log, AST_MODULE_INFO_STANDARD_DEPRECATED(), ast_register_application, ast_true(), ast_variable_retrieve(), ASTERISK_GPL_KEY, autoclear, descrip, EMPTYSTRING, LOG_WARNING, MYSQL_CONFIG, MYSQL_CONFIG_OLD, MYSQL_exec(), NULLSTRING, NULLVALUE, nullvalue, and synopsis.
Referenced by load_values_config().
|
static |
Definition at line 134 of file app_mysql.c.
References _mysql_ids_head, ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log, AST_MYSQL_ID_CONNID, AST_MYSQL_ID_RESID, ast_MYSQL_id::data, ast_MYSQL_id::entries, ast_MYSQL_id::identifier_type, LOG_WARNING, and ast_MYSQL_id::owner.
|
static |
Definition at line 159 of file app_mysql.c.
References _mysql_ids_head, ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log, AST_MYSQL_ID_CONNID, AST_MYSQL_ID_RESID, ast_MYSQL_id::data, ast_MYSQL_id::entries, ast_MYSQL_id::identifier_type, LOG_WARNING, and ast_MYSQL_id::owner.
|
static |
Definition at line 561 of file app_mysql.c.
References _mysql_mutex, aMYSQL_clear(), aMYSQL_connect(), aMYSQL_disconnect(), aMYSQL_fetch(), aMYSQL_nextresult(), aMYSQL_query(), aMYSQL_set(), ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, autoclear, ast_datastore::data, LOG_WARNING, NULL, pbx_builtin_setvar_helper(), and result.
Referenced by load_module().
|
static |
Definition at line 282 of file app_mysql.c.
Referenced by aMYSQL_clear(), and aMYSQL_disconnect().
|
static |
Definition at line 266 of file app_mysql.c.
References ast_debug, id, and pbx_builtin_setvar_helper().
Referenced by add_identifier_and_set_asterisk_int(), and aMYSQL_fetch().
|
static |
Definition at line 618 of file app_mysql.c.
References app, and ast_unregister_application().
struct MYSQLidshead _mysql_ids_head |
Referenced by add_identifier(), del_identifier(), find_identifier(), load_module(), mysql_ds_destroy(), and mysql_ds_fixup().
|
static |
Definition at line 104 of file app_mysql.c.
Referenced by MYSQL_exec().
|
static |
Definition at line 62 of file app_mysql.c.
Referenced by __stasis_app_register(), action_originate(), add_extension(), answer_exec_enable(), app_create(), app_dtor(), app_hash(), append_json(), append_name(), applicationmap_handler(), ari_originate_dial(), ari_set_debug(), ari_show_app(), ari_show_apps(), ast_ari_applications_filter(), ast_ari_callback(), ast_bridge_transfer_attended(), ast_complete_applications(), AST_TEST_DEFINE(), attended_transfer_bridge(), bridge_attended_transfer_handler(), bridge_blind_transfer_handler(), bridge_merge_handler(), bridge_subscription_change_handler(), cel_track_app(), check_pval_item(), cleanup_cb(), complete_ari_app(), endpoint_state_cb(), event_session_alloc(), event_session_shutdown(), exec_exec(), execif_exec(), handle_cli_dialplan_add_extension(), handle_cli_status(), handle_show_application(), is_empty(), load_module(), lua_pbx_exec(), message_received_handler(), page_exec(), pbx_builtin_execiftime(), realtime_exec(), run_app_helper(), stasis_app_event_allowed(), stasis_app_exec(), stasis_app_get_debug_by_name(), stasis_app_send(), stasis_app_set_debug_by_name(), stasis_app_set_global_debug(), stasis_app_to_json(), stasis_app_unregister(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_default_handler(), sub_endpoint_update_handler(), sub_subscription_change_handler(), tryexec_exec(), and unload_module().
struct ast_MYSQL_id * ast_MYSQL_id |
|
static |
Definition at line 113 of file app_mysql.c.
Referenced by load_module(), and MYSQL_exec().
|
static |
Definition at line 66 of file app_mysql.c.
Referenced by load_module().
|
static |
Definition at line 118 of file app_mysql.c.
enum { ... } nullvalue |
Referenced by aMYSQL_fetch(), and load_module().
|
static |
Definition at line 64 of file app_mysql.c.
Referenced by acf_retrieve_docs(), ast_xmldoc_regenerate_doc_item(), handle_cli_agi_show(), handle_show_function(), handle_showmancmd(), init_acf_query(), load_module(), print_event_instance(), and xmldoc_build_documentation_item().