diff options
-rw-r--r-- | include/asterisk.h | 7 | ||||
-rw-r--r-- | main/asterisk.c | 39 | ||||
-rw-r--r-- | main/pbx.c | 52 | ||||
-rw-r--r-- | rest-api/resources.json | 2 |
4 files changed, 55 insertions, 45 deletions
diff --git a/include/asterisk.h b/include/asterisk.h index ab2a3ddef..e509fbc39 100644 --- a/include/asterisk.h +++ b/include/asterisk.h @@ -288,4 +288,11 @@ struct ast_module *AST_MODULE_SELF_SYM(void); #endif +/*! + * \brief Retrieve the PBX UUID + * \param pbx_uuid A buffer of at least AST_UUID_STR_LEN (36 + 1) size to receive the UUID + * \param length The buffer length + */ +int ast_pbx_uuid_get(char *pbx_uuid, int length); + #endif /* _ASTERISK_H */ diff --git a/main/asterisk.c b/main/asterisk.c index 95f1b3ed0..850003b05 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -249,6 +249,7 @@ int daemon(int, int); /* defined in libresolv of all places */ #include "asterisk/codec.h" #include "asterisk/format_cache.h" #include "asterisk/media_cache.h" +#include "asterisk/astdb.h" #include "../defaults.h" @@ -590,6 +591,11 @@ void ast_unregister_thread(void *id) } } +int ast_pbx_uuid_get(char *pbx_uuid, int length) +{ + return ast_db_get("pbx", "UUID", pbx_uuid, length); +} + /*! \brief Give an overview of core settings */ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { @@ -597,6 +603,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c struct ast_tm tm; char eid_str[128]; struct rlimit limits; + char pbx_uuid[AST_UUID_STR_LEN]; switch (cmd) { case CLI_INIT: @@ -609,6 +616,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c } ast_eid_to_str(eid_str, sizeof(eid_str), &ast_eid_default); + ast_pbx_uuid_get(pbx_uuid, sizeof(pbx_uuid)); ast_cli(a->fd, "\nPBX Core settings\n"); ast_cli(a->fd, "-----------------\n"); @@ -647,6 +655,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c ast_cli(a->fd, " System: %s/%s built by %s on %s %s\n", ast_build_os, ast_build_kernel, ast_build_user, ast_build_machine, ast_build_date); ast_cli(a->fd, " System name: %s\n", ast_config_AST_SYSTEM_NAME); ast_cli(a->fd, " Entity ID: %s\n", eid_str); + ast_cli(a->fd, " PBX UUID: %s\n", pbx_uuid); ast_cli(a->fd, " Default language: %s\n", ast_defaultlanguage); ast_cli(a->fd, " Language prefix: %s\n", ast_language_is_prefix ? "Enabled" : "Disabled"); ast_cli(a->fd, " User name and group: %s/%s\n", ast_config_AST_RUN_USER, ast_config_AST_RUN_GROUP); @@ -4250,6 +4259,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou int num; char *buf; int moduleresult; /*!< Result from the module load subsystem */ + char pbx_uuid[AST_UUID_STR_LEN]; /* Set time as soon as possible */ ast_lastreloadtime = ast_startuptime = ast_tvnow(); @@ -4358,6 +4368,24 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou ast_el_read_default_histfile(); } +#ifdef AST_XML_DOCS + /* Load XML documentation. */ + ast_xmldoc_load_documentation(); +#endif + + if (astdb_init()) { + printf("Failed: astdb_init\n%s", term_quit()); + exit(1); + } + + ast_uuid_init(); + + if (ast_pbx_uuid_get(pbx_uuid, sizeof(pbx_uuid))) { + ast_uuid_generate_str(pbx_uuid, sizeof(pbx_uuid)); + ast_db_put("pbx", "UUID", pbx_uuid); + } + ast_verb(0, "PBX UUID: %s\n", pbx_uuid); + ast_json_init(); ast_ulaw_init(); ast_alaw_init(); @@ -4398,7 +4426,6 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou } ast_aoc_cli_init(); - ast_uuid_init(); if (ast_sorcery_init()) { printf("Failed: ast_sorcery_init\n%s", term_quit()); @@ -4425,11 +4452,6 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou exit(1); } -#ifdef AST_XML_DOCS - /* Load XML documentation. */ - ast_xmldoc_load_documentation(); -#endif - aco_init(); if (init_logger()) { /* Start logging subsystem */ @@ -4513,11 +4535,6 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou exit(1); } - if (astdb_init()) { - printf("Failed: astdb_init\n%s", term_quit()); - exit(1); - } - if (ast_msg_init()) { printf("Failed: ast_msg_init\n%s", term_quit()); exit(1); diff --git a/main/pbx.c b/main/pbx.c index f9fad0388..4d6d31ec4 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -7278,52 +7278,38 @@ static int ast_add_extension2_lockopt(struct ast_context *con, * so insert in the main list right before 'e' (if any) */ tmp->next = e; - if (el) { /* there is another exten already in this context */ - el->next = tmp; - tmp->peer_table = ast_hashtab_create(13, - hashtab_compare_exten_numbers, + tmp->peer_table = ast_hashtab_create(13, + hashtab_compare_exten_numbers, + ast_hashtab_resize_java, + ast_hashtab_newsize_java, + hashtab_hash_priority, + 0); + tmp->peer_label_table = ast_hashtab_create(7, + hashtab_compare_exten_labels, ast_hashtab_resize_java, ast_hashtab_newsize_java, - hashtab_hash_priority, + hashtab_hash_labels, 0); - tmp->peer_label_table = ast_hashtab_create(7, - hashtab_compare_exten_labels, - ast_hashtab_resize_java, - ast_hashtab_newsize_java, - hashtab_hash_labels, - 0); - if (label) { - ast_hashtab_insert_safe(tmp->peer_label_table, tmp); - } - ast_hashtab_insert_safe(tmp->peer_table, tmp); + + if (el) { /* there is another exten already in this context */ + el->next = tmp; } else { /* this is the first exten in this context */ - if (!con->root_table) + if (!con->root_table) { con->root_table = ast_hashtab_create(27, hashtab_compare_extens, ast_hashtab_resize_java, ast_hashtab_newsize_java, hashtab_hash_extens, 0); - con->root = tmp; - con->root->peer_table = ast_hashtab_create(13, - hashtab_compare_exten_numbers, - ast_hashtab_resize_java, - ast_hashtab_newsize_java, - hashtab_hash_priority, - 0); - con->root->peer_label_table = ast_hashtab_create(7, - hashtab_compare_exten_labels, - ast_hashtab_resize_java, - ast_hashtab_newsize_java, - hashtab_hash_labels, - 0); - if (label) { - ast_hashtab_insert_safe(con->root->peer_label_table, tmp); } - ast_hashtab_insert_safe(con->root->peer_table, tmp); - + con->root = tmp; + } + if (label) { + ast_hashtab_insert_safe(tmp->peer_label_table, tmp); } + ast_hashtab_insert_safe(tmp->peer_table, tmp); ast_hashtab_insert_safe(con->root_table, tmp); + if (lock_context) { ast_unlock_context(con); } diff --git a/rest-api/resources.json b/rest-api/resources.json index 4a098f51f..ecaf723b6 100644 --- a/rest-api/resources.json +++ b/rest-api/resources.json @@ -2,7 +2,7 @@ "_copyright": "Copyright (C) 2012 - 2013, Digium, Inc.", "_author": "David M. Lee, II <dlee@digium.com>", "_svn_revision": "$Revision$", - "apiVersion": "1.7.0", + "apiVersion": "1.10.0", "swaggerVersion": "1.1", "basePath": "http://localhost:8088/ari", "apis": [ |