[Home]

Summary:ASTERISK-12287: ast_merge_contexts_and_delete() does not merge switches and includes properly
Reporter:Matthew Nicholson (mnicholson)Labels:
Date Opened:2008-06-30 14:14:27Date Closed:2008-07-15 18:28:33
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/PBX
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) extensions.ael
( 1) extensions.conf
Description:When using pbx_config and pbx_ael at the same time, if  context exists in both pbx_config and pbx_ael, the includes and switches from that context are not properly merged.  Which ever module was loaded/reloaded last takes precedence.

This only seems to be a problem if two modules are sharing a context.

****** ADDITIONAL INFORMATION ******

To reproduce this:

1. Use the attached extensions.conf and extensions.ael and start asterisk.
2. Run 'dialplan show' and note the contents of the default context (it should have one include and no switches).
3. Run 'module reload pbx_ael.so'.
4. Run 'dialplan show' again and note the contents of the default context (it should have a different include and one switch).
5. Run 'module reload pbx_config.so'.
6. Repeat steps 2 through 5 at will.
Comments:By: Digium Subversion (svnbot) 2008-07-11 13:17:32

Repository: asterisk
Revision: 130145

U   trunk/main/pbx.c

------------------------------------------------------------------------
r130145 | murf | 2008-07-11 13:17:12 -0500 (Fri, 11 Jul 2008) | 40 lines

(closes issue ASTERISK-12352)
Reported by: eliel
Tested by: murf

(closes issue ASTERISK-12287)
Reported by: mnicholson

In this 'omnibus' fix, I **think** I solved both
the problem in 13041, where unloading pbx_ael.so
caused crashes, or incomplete removal of previous
registrar'ed entries. And I added code to completely
remove all includes, switches, and ignorepats that
had a matching registrar entry, which should
appease 12960.

I also added a lot of seemingly useless brackets
around single statement if's, which helped debug
so much that I'm leaving them there.

I added a routine to check the correlation between
the extension tree lists and the hashtab
tables. It can be amazingly helpful when you have
lots of dialplan stuff, and need to narrow
down where a problem is occurring. It's ifdef'd
out by default.

I cleaned up the code around the new CIDmatch code.
It was leaving hanging extens with bad ptrs, getting confused
over which objects to remove, etc. I tightened
up the code and changed the call to remove_exten
in the merge_and_delete code.

I added more conditions to check for empty context
worthy of deletion. It's not empty if there are
any includes, switches, or ignorepats present.

If I've missed anything, please re-open this bug,
and be prepared to supply example dialplan code.


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=130145

By: Matthew Nicholson (mnicholson) 2008-07-11 14:05:31

Testing with 130170, I still see this issue.

By: Digium Subversion (svnbot) 2008-07-15 18:28:32

Repository: asterisk
Revision: 131129

U   trunk/main/pbx.c

------------------------------------------------------------------------
r131129 | murf | 2008-07-15 18:28:31 -0500 (Tue, 15 Jul 2008) | 21 lines


(closes issue ASTERISK-12287)
Reported by: mnicholson

Spent most of the day on this bug, and the
solution was so simple. Just had to find and
understand the problem.

The problem was, that the routine to copy
the existing switches, includes, and ignorepats
from the old context to the new one, wasn't
getting called when the context is already
existent. (In other words, if AEL is adding
a new context to the mix, they get copied,
but if pbx_config already defined a context,
then the copy wasn't happening. This made
no sense, so I moved the call to copy the
includes & etc, no matter the case.



------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=131129