[asterisk-dev] duplicate context entries (bug 6002)
Marta Carbone
wrig at tiscali.it
Fri May 25 15:36:06 MST 2007
Hi all,
I'm working with Luigi here trying to make some tests about the bug 6002,
it's about the regcontext features that generate duplicate context entries
in the contexts list. There are some examples on how to trigger the problem
in the bug report, and even if there are workarounds (e.g. using
store regexten-generated entries in a context with a unique name,
and 'include' it in the main context we want), the bug still remains
and can hit you in some cases.
The core of the problem, we believe, is that the function
__ast_context_destroy() does a lookup of the context using both
context-name and its registrar, so e.g. when called from chan_sip with
regcontext=foo, it installs a new context 'foo' with registrar 'sip'
even if another 'foo' already exists (e.g. created by 'pbx').
Given that the registrar is already an attribute of each extension,
we are wondering what is the point of having it as an attribute of
the context too. It does not help speeding up any operation, because
a context can contain entries (extensions) by other registrars,
so a deletion (e.g. on unload/reload) still needs to look into all
contexts.
Our suggestion would be the following:
step 1. don't use the registrar as a search key in the
__ast_context_destroy() function - this would
avoid the creation of duplicate contexts;
step 2. if it turns out that there is no good use for the registrar
field in the 'context' descriptor, we could as well remove
it (the info is still stored in individual extension entries).
Any thoughts?
marta carbone
More information about the asterisk-dev
mailing list