Summary:ASTERISK-09176: AEL doesn't load default context at first time
Reporter:Pierre CHRETIEN (pierrec)Labels:
Date Opened:2007-04-03 16:59:38Date Closed:2007-06-21 18:04:42
Versions:Frequency of
Environment:Attachments:( 0) extensions.ael
Description:I am using the following context definition in extensions.conf :

include => parkedcalls
include => internal;
include => predialed_outgoing;
include => outgoing;
include => incoming;

If I try to switch the whole extention config to AEL, with the following syntax (where contexts are defined in AEL) :

context default {
     includes {

AEL does not load the default context the first time the AEL compiler is executed. If Asterisk is started from scratch, or after a "reload" instruction, the extensions defined in default context are not reachable, and I receive the following message :
[Apr  3 23:37:22] NOTICE[2845]: chan_iax2.c:7171 socket_process: Rejected connect attempt from, request '610@default' does not exist

These extensions become reachable after an AEL reload instruction.
This is a problem in case of a cold start of the machine after a power failure, because the Asterisk would not be operational before a manual invervention.

This problem can be solved by keeping the default context definition in the extensions.conf file, and the rest of the extension confi in the AEL file.
Comments:By: Chad Wallace (cmdrwalrus) 2007-04-05 13:57:46

I am experiencing a similar problem, with asterisk 1.4.2 on Debian/amd64, and I suspect it is the same issue.

I have a context "internal" that includes "default".  After "module reload", the extensions from "default" are not available to "internal"--Asterisk returns 404 when you try to dial them from a phone in "internal".  

Other extensions in the "internal" context are available, but not the ones that are included from "default".

If I do "ael reload" after "module reload", those extensions work just fine.

Now, on a hunch, I just renamed the "default" context to "hooligan" (and changed "internal" to include "hooligan"), and now all the extensions work like a charm, regardless of whether I do "module reload" or "ael reload".  So, it is caused by the context being named "default".  Are we not supposed to define a "default" context?  Is it a reserved word, or something like that?

Oh, one thing to note...  I also have a voicemail context called "default".

I'll attach a simplified extensions.ael that causes this problem.  After "module reload" extensions 203 and 451, etc. don't work, but 853 does.  After "ael reload" they all work.

By: Chad Wallace (cmdrwalrus) 2007-04-05 14:05:16

I just noticed the output of "module reload".  It looks like pbx_config.so is being loaded just after pbx_ael.so, and it is redefining the "default" context, even though the word "default" doesn't appear in extensions.conf at all.

After moving the "load=pbx_ael.so" line in modules.conf below "load=pbx_config.so", everything works as it should.  

So, I guess the only problem here is that pbx_config.so defines a "default" context even if there isn't one in extensions.conf.

By: Pierre CHRETIEN (pierrec) 2007-04-05 16:37:06

You're probably right cmdwalrus : if I take the default context off the extensions.conf, and reload modules, then the "dialplan show" command has the following output :

[ Context 'default' created by 'pbx_config' ]

followed by all the AEL context declarations, including this one :
[ Context 'default' created by 'pbx_ael' ]
 Include =>        'parkedcalls'                                 [pbx_ael]
 Include =>        'internal'                                    [pbx_ael]
 Include =>        'predialed_outgoing'                          [pbx_ael]
 Include =>        'outgoing'                                    [pbx_ael]
 Include =>        'incoming'                                    [pbx_ael]
which is not taken into consideration.

After AEL reload, the dialplan show is modified and shows :

[ Context 'default' created by 'pbx_ael' ]
 Include =>        'parkedcalls'                                 [pbx_ael]
 Include =>        'internal'                                    [pbx_ael]
 Include =>        'predialed_outgoing'                          [pbx_ael]
 Include =>        'outgoing'                                    [pbx_ael]
 Include =>        'incoming'                                    [pbx_ael]

[ Context 'default' created by 'pbx_config' ]

and there, the default context created in AEL in interpreted.

So the problem could be solved :
- either by removing the default context creation in the pbx_config, when default is not a context of extensions.conf
- or by documenting the point and recommending a default context to be created inside extentions.conf, which could include ael_default in extensions.ael if prefered.

By: Joshua C. Colp (jcolp) 2007-06-21 16:45:49

This has to do with duplicate contexts being created which is being addressed in another bug. Since you've located a workaround though I'm closing this one out.

By: Steve Murphy (murf) 2007-06-21 18:04:42

I'll try to document that using default as a context name is a bad idea
in AEL in the docs... Or, if I get lotsa complaints, I'll not allow 'default'
as a context name....

Which would be a better/easier solution than trying to mod the load order...?