diff options
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | apps/app_macro.c | 36 | ||||
-rw-r--r-- | apps/app_queue.c | 11 | ||||
-rw-r--r-- | main/channel.c | 2 | ||||
-rw-r--r-- | main/pbx.c | 25 | ||||
-rw-r--r-- | res/res_pjsip/config_global.c | 26 |
6 files changed, 82 insertions, 24 deletions
@@ -48,6 +48,12 @@ res_pjsip when set will override the default user set on Contact headers in outgoing requests. + * If you are using a sorcery realtime backend to store global res_pjsip + options (ps_globals table) then you now have to do a res_pjsip reload for + changes to these options to take effect. If you are using pjsip.conf to + configure these options then you already had to do a reload after making + changes. + ------------------------------------------------------------------------------ --- Functionality changes from Asterisk 13 to Asterisk 14 -------------------- ------------------------------------------------------------------------------ diff --git a/apps/app_macro.c b/apps/app_macro.c index 26e4262b1..61f3ab722 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -245,7 +245,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive int setmacrocontext=0; int autoloopflag, inhangup = 0; struct ast_str *tmp_subst = NULL; - + const char *my_macro_exten = NULL; char *save_macro_exten; char *save_macro_context; char *save_macro_priority; @@ -306,12 +306,32 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive } snprintf(fullmacro, sizeof(fullmacro), "macro-%s", macro); - if (!ast_exists_extension(chan, fullmacro, "s", 1, - S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { - if (!ast_context_find(fullmacro)) - ast_log(LOG_WARNING, "No such context '%s' for macro '%s'. Was called by %s@%s\n", fullmacro, macro, ast_channel_exten(chan), ast_channel_context(chan)); - else - ast_log(LOG_WARNING, "Context '%s' for macro '%s' lacks 's' extension, priority 1\n", fullmacro, macro); + + /* first search for the macro */ + if (!ast_context_find(fullmacro)) { + ast_log(LOG_WARNING, "No such context '%s' for macro '%s'. Was called by %s@%s\n", + fullmacro, macro, ast_channel_exten(chan), ast_channel_context(chan)); + return 0; + } + + /* now search for the right extension */ + if (ast_exists_extension(chan, fullmacro, "s", 1, + S_COR(ast_channel_caller(chan)->id.number.valid, + ast_channel_caller(chan)->id.number.str, NULL))) { + /* We have a normal macro */ + my_macro_exten = "s"; + } else if (ast_exists_extension(chan, fullmacro, "~~s~~", 1, + S_COR(ast_channel_caller(chan)->id.number.valid, + ast_channel_caller(chan)->id.number.str, NULL))) { + /* We have an AEL generated macro */ + my_macro_exten = "~~s~~"; + } + + /* do we have a valid exten? */ + if (!my_macro_exten) { + ast_log(LOG_WARNING, + "Context '%s' for macro '%s' lacks 's' extension, priority 1\n", + fullmacro, macro); return 0; } @@ -363,7 +383,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive ast_set_flag(ast_channel_flags(chan), AST_FLAG_SUBROUTINE_EXEC); /* Setup environment for new run */ - ast_channel_exten_set(chan, "s"); + ast_channel_exten_set(chan, my_macro_exten); ast_channel_context_set(chan, fullmacro); ast_channel_priority_set(chan, 1); diff --git a/apps/app_queue.c b/apps/app_queue.c index a5cb12640..f9dd86b67 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -4102,6 +4102,17 @@ static void hangupcalls(struct queue_ent *qe, struct callattempt *outgoing, stru ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE); } ast_channel_publish_dial(qe->chan, outgoing->chan, outgoing->interface, "CANCEL"); + + /* When dialing channels it is possible that they may not ever + * leave the not in use state (Local channels in particular) by + * the time we cancel them. If this occurs but we know they were + * dialed we explicitly remove them from the pending members + * container so that subsequent call attempts occur. + */ + if (outgoing->member->status == AST_DEVICE_NOT_INUSE) { + pending_members_remove(outgoing->member); + } + ast_hangup(outgoing->chan); } oo = outgoing; diff --git a/main/channel.c b/main/channel.c index 1f18d53b1..94505ad0e 100644 --- a/main/channel.c +++ b/main/channel.c @@ -6093,7 +6093,7 @@ struct ast_channel *ast_request(const char *type, struct ast_format_cap *request if (set_security_requirements(requestor, c)) { ast_log(LOG_WARNING, "Setting security requirements failed\n"); - c = ast_channel_release(c); + ast_hangup(c); *cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL; return NULL; } diff --git a/main/pbx.c b/main/pbx.c index 63385f91f..7cd420adb 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -5794,7 +5794,8 @@ static void manager_dpsendack(struct mansession *s, const struct message *m) static int manager_show_dialplan_helper(struct mansession *s, const struct message *m, const char *actionidtext, const char *context, const char *exten, struct dialplan_counters *dpc, - const struct ast_include *rinclude) + const struct ast_include *rinclude, + int includecount, const char *includes[]) { struct ast_context *c; int res = 0, old_total_exten = dpc->total_exten; @@ -5876,7 +5877,24 @@ static int manager_show_dialplan_helper(struct mansession *s, const struct messa if (exten) { /* Check all includes for the requested extension */ - manager_show_dialplan_helper(s, m, actionidtext, ast_get_include_name(i), exten, dpc, i); + if (includecount >= AST_PBX_MAX_STACK) { + ast_log(LOG_WARNING, "Maximum include depth exceeded!\n"); + } else { + int dupe = 0; + int x; + for (x = 0; x < includecount; x++) { + if (!strcasecmp(includes[x], ast_get_include_name(i))) { + dupe++; + break; + } + } + if (!dupe) { + includes[includecount] = ast_get_include_name(i); + manager_show_dialplan_helper(s, m, actionidtext, ast_get_include_name(i), exten, dpc, i, includecount + 1, includes); + } else { + ast_log(LOG_WARNING, "Avoiding circular include of %s within %s\n", ast_get_include_name(i), context); + } + } } else { if (!dpc->total_items++) manager_dpsendack(s, m); @@ -5932,6 +5950,7 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m) { const char *exten, *context; const char *id = astman_get_header(m, "ActionID"); + const char *incstack[AST_PBX_MAX_STACK]; char idtext[256]; /* Variables used for different counters */ @@ -5947,7 +5966,7 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m) exten = astman_get_header(m, "Extension"); context = astman_get_header(m, "Context"); - manager_show_dialplan_helper(s, m, idtext, context, exten, &counters, NULL); + manager_show_dialplan_helper(s, m, idtext, context, exten, &counters, NULL, 0, incstack); if (!ast_strlen_zero(context) && !counters.context_existence) { char errorbuf[BUFSIZ]; diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c index 975c5eefe..1d0c11c35 100644 --- a/res/res_pjsip/config_global.c +++ b/res/res_pjsip/config_global.c @@ -48,6 +48,15 @@ #define DEFAULT_MWI_TPS_QUEUE_LOW -1 #define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED 0 +/*! + * \brief Cached global config object + * + * \details + * Cached so we don't have to keep asking sorcery for the config. + * We could ask for it hundreds of times a second if not more. + */ +static AO2_GLOBAL_OBJ_STATIC(global_cfg); + static char default_useragent[256]; struct global_config { @@ -135,23 +144,14 @@ static int global_apply(const struct ast_sorcery *sorcery, void *obj) ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1); ast_sip_add_global_request_header("User-Agent", cfg->useragent, 1); ast_sip_add_global_response_header("Server", cfg->useragent, 1); + + ao2_t_global_obj_replace_unref(global_cfg, cfg, "Applying global settings"); return 0; } static struct global_config *get_global_cfg(void) { - struct global_config *cfg; - struct ao2_container *globals; - - globals = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "global", - AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL); - if (!globals) { - return NULL; - } - - cfg = ao2_find(globals, NULL, 0); - ao2_ref(globals, -1); - return cfg; + return ao2_global_obj_ref(global_cfg); } char *ast_sip_global_default_outbound_endpoint(void) @@ -462,6 +462,8 @@ int ast_sip_destroy_sorcery_global(void) ast_sorcery_instance_observer_remove(sorcery, &observer_callbacks_global); + ao2_t_global_obj_release(global_cfg, "Module is unloading"); + return 0; } |