Unwanted warning about Same File included more than once!


I’m running Asterisk 13.6 and I wonder how to make this warning disappear:

WARNING[32344]: config.c:354 ast_include_new: '/etc/asterisk/Custom_Acceuil_8310.conf', line 276:  Same File included more than once! This data will be saved in Custom_Ringgroup.conf~~1 if saved back to disk.

I have a file named Custom_Ringgroup.conf that is included in 2 different context.
It’s working without any problem but I get the warning every time I do a dialplan reload.

;> extension.conf
> ;Context 1:
> [Internal]

> #include "Custom_Ringgroup.conf"

> ;Context 2:

> #include "Custom_Acceuil_8310.conf"

> ;Inside Custom_Acceuil_8310.conf there's my second include:

> #include "Custom_Ringgroup.conf"

The inside of the included file look like this:

> exten => 3180,1,Gosub(Sub_Ringgroup,start,1(3180,3181))

The file must be included in both context, and I do not want to create two files under different names.
I could understand the warning if the file was included twice in the same context, but context are not same…
It’s a large dialplan, so I’m only giving you part of what is in the file, so it’s easier to read.

It’s a WARNING for a reason. What you are doing will break certain functionality - namely the ability to save information back to the .conf files using a dialplan save.

If Asterisk is WARNING you, the correct thing to do is to stop making it warn you. If you don’t care that you are doing something Asterisk doesn’t like, then you have to just ignore the WARNING.

I have never used dialplan save, and it’s not clear to me what it does exactly.
I’d really like to ged rid of it, but I’m running out of ideas. The extensions in Custom_Ringgroup.conf must be present in both context calls coming from the PRI and internal calls.

The “#include” functionality isn’t meant to be used like that. It’s meant to be included once, and the entire contents are merged with the file it is included into. That is why the WARNING appears. For example if the first file has a context named ‘test’ and the second has a context named ‘test’ then the contents of each are merged together. It is also for organizing and storing other contexts elsewhere separately. I’m actually surprised it’s working like you are using, but that could be functionality which is quite old and I am unfamiliar with.

What most people would do is put the extension logic in their own context and use normal dialplan “include =>” to include it in the context.

1 Like

How about if I do it this way:

If I include the file after Globals, and put both context inside the file it will merge properly.

#include “Custom_Ringgroup.conf”

;Inside of Custom_Ringgroup.conf

exten => 2243,1,Gosub(Sub_Ringgroup,start,1(2243,2648))

exten => 2243,1,Gosub(Sub_Ringgroup,start,1(2243,2648))

It’s working, and I do not get any warning. But If there’s a better way to do it with the include => statement,
I’d like to know how. I cannot get it to work.I cannot put the extension in it’s own context because Asterisk
will look at the first context Internals and will find Pattern Matching, so it will never get to the new context created.

The ordering of include statements in contexts determines the order in which they are checked, you can have an entire context of includes which allows you to split up sections but also control ordering.

I’m surprised, I was following the wiki:


Asterisk will always try to find a matching extension in the current context first, and only follow the include statement to a new context if there isn’t anything that matches in the current context.

Correct. Instead of having extensions in the context you can put them in another context and include it, and then control matching by the ordering of includes.

Thanx a lot for your help

The article you are referring to refers to include => context not to #inlcude “filename”.