]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
pbx.c: Print new context count when reloading dialplan.
authorNaveen Albert <asterisk@phreaknet.org>
Mon, 17 Nov 2025 21:16:59 +0000 (16:16 -0500)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Wed, 19 Nov 2025 17:19:51 +0000 (17:19 +0000)
When running "dialplan reload", the number of contexts reported
is initially wrong, as it is the old context count. Running
"dialplan reload" a second time returns the correct number of
contexts that are loaded. This can confuse users into thinking
that the reload didn't work successfully the first time.

This counter is currently only incremented when iterating the
old contexts prior to the context merge; at the very end, get
the current number of elements in the context hash table and
report that instead. This way, the count is correct immediately
whenever a reload occurs.

Resolves: #1599

main/pbx.c

index 21f042d9e0e1c85c12f8a2c5d4c43fd1621b7ea9..7f97e1821abc83ec225e90fa06883afb7113ae57 100644 (file)
@@ -6614,6 +6614,10 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_
        /* Create all applicable autohint contexts */
        context_table_create_autohints(contexts_table);
 
+       /* ctx_count is still the number of old contexts before the merge,
+        * use the new count when we tell the user how many contexts exist. */
+       ctx_count = ast_hashtab_size(contexts_table);
+
        ao2_unlock(hints);
        ast_unlock_contexts();