[asterisk-users] AEL #include file

Steve Murphy murf at parsetree.com
Fri Mar 9 15:44:10 MST 2007


On Fri, 2007-03-09 at 22:21 +0100, Philipp Kempgen wrote:
> Steve Murphy wrote:
> 
> > On Fri, 2007-03-09 at 20:42 +0100, Philipp Kempgen wrote:
> >> Tzafrir Cohen wrote:
> >>
> >>> On Fri, Mar 09, 2007 at 07:49:45PM +0100, Philipp Kempgen wrote:
> >>>> Hi,
> >>>>
> >>>> Does anyone know how to include a file in AEL using the
> >>>> #include "filename"
> >>>> syntax in .conf files?
> >>> Yes, it is supported.
> > 
> > Correct. It should assume that files are in /etc/asterisk, if that's
> > what the config file dir is. If they are somewhere, use absolute paths.
> 
> Sure.
> 
> >>> (Technically: It is not part of the ael syntax. #include and #exec are 
> >>> preprocessing done before the ael parser gets to read the text.)
> > Well, mostly true; the #include directives are obeyed at the lexical
> > level of the AEL parser, which is underneath the parser.
> 
> Ok. Thanks.
> 
> >> Is there a way to include a .conf file from within .ael?
> >> Or the other way round?
> > 
> > No, there isn't. the extensions.conf format is entirely different than
> > the AEL format, and the AEL parser will not read in extensions.conf
> > formatted files.
> 
> Ok, that's what I tried to do. Now I understand how things
> are processed.
> 
> >> BTW: Never heard of #exec. What does that do? Shell exec?
> > 
> > The #exec option is available in the extensions.conf (and all config
> > files, for that matter). It basically will run the command provided, and
> > the output from it had better be the config file it wants to read in.
> 
> Found it on the bug tracker. This seems really old but it's
> not well known, is it?
> 

I can't really judge how known it is; but when it's handy, it can be
REAL handy. At Digium, for instance, we keep all our config files under
SVN, and the config
files are just #exec's for svn checkouts. All the admins have to do is
commit a change to the configs, and they will be loaded the next time
asterisk is reloaded or restarted....

> This is what I do:
> 
> in extensions.conf:
> 
> context voicemail
> {
> 	mailbox => {
> 		VoiceMailMain(${user_name},s);
> 	}
> 	#include "e-number-vmm.ael"
> }
> 
> in e-number-vmm.ael:
> 
> 80 => jump mailbox;
> 
> So if the user wants to change the number to reach VoicemailMain
> - provided they use a web interface for that - e-number-vmm.ael
> can easily be parsed and adjusted accordingly by some script.
> 

Just one little mistake I hadn't pointed out earlier; the
extensions.conf would probably really be extensions.ael ! Ignoring this,
the above is perfectly valid use of #include; just remember that the
include
would only happen when asterisk loads, reloads, or AEL is reloaded. 
and, hehe, you can rotate the vmm hourly/daily to keep your users on
their toes!


> 
> Regards,
>   Philipp
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3239 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070309/44b149f9/smime.bin


More information about the asterisk-users mailing list