[Home]

Summary:ASTERISK-26719: pbx: Only up to 127 includes in a dialplan context (AST_PBX_MAX_STACK - 1)
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2017-01-15 03:44:06.000-0600Date Closed:2022-03-29 16:01:38
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/PBX
Versions:13.13.1 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) gen_include
Description:I'm not sure if this is a bug or a legitimate limitations. Looking at the code, I'm not really sure. Following some issues of a customer and some toying I noticed that whereas it's OK to have a context with arbitrary number of includes (and have its content be properly reported via 'dialplan show exten-foo@context-bar') I fail to originate a call from such an extension.

I created a script to generate a context with arbitrary number of includes. It will be attached to the bug report. For example, here is the output of the script for two extensions:
{code}
[context-no-1]
exten => exten-no-1,1,Answer()

[context-no-2]
exten => exten-no-2,1,Answer()

[context-all]
include => context-no-1
include => context-no-2
{code}

I #include-d the output of that script into extensions.conf, reloaded the dialplan, and tried:
{code}
asterisk -rx 'dialplan originate Local/exten-no-NN@context-all application Wait'
{code}
If I generated a context larger than 127 extensions, I started getting the error message:
{code}
WARNING[15164][C-0000000a]: pbx.c:2461 pbx_find_extension: Maximum PBX stack exceeded
{code}
one for each include beyond 127. Furthermore, if the number (NN) I try is beyond 127, I fail to originate the channel.

Looking at the code, I'm not completely sure if this is indeed how it is supposed to work. Are all includes supposed to be on the stack?

And anyway, the error message is confusing. Maybe: "Maximum PBX stack exceeded. Too many includes while looking for $exten@$context"?
Comments:By: Asterisk Team (asteriskteam) 2017-01-15 03:44:09.693-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Tzafrir Cohen (tzafrir) 2017-01-15 03:46:51.116-0600

A script to generate example dialplan. ./gen_include >some_file and #include some_file ; into extensions.conf

By: Joshua C. Colp (jcolp) 2017-01-17 09:43:31.399-0600

There appears to code to explicitly use the stack when it comes to includes, to try to prevent duplicate checking it seems. Since there's code for it I wouldn't say it's a bug but it should be better documented and have a better message.

By: Friendly Automation (friendly-automation) 2022-03-29 16:01:39.320-0500

Change 18217 merged by Friendly Automation:
pbx.c: Warn if there are too many includes in a context.

[https://gerrit.asterisk.org/c/asterisk/+/18217|https://gerrit.asterisk.org/c/asterisk/+/18217]

By: Friendly Automation (friendly-automation) 2022-03-29 16:02:11.953-0500

Change 18223 merged by Friendly Automation:
pbx.c: Warn if there are too many includes in a context.

[https://gerrit.asterisk.org/c/asterisk/+/18223|https://gerrit.asterisk.org/c/asterisk/+/18223]

By: Friendly Automation (friendly-automation) 2022-03-29 16:05:27.785-0500

Change 18218 merged by Kevin Harwell:
pbx.c: Warn if there are too many includes in a context.

[https://gerrit.asterisk.org/c/asterisk/+/18218|https://gerrit.asterisk.org/c/asterisk/+/18218]

By: Friendly Automation (friendly-automation) 2022-03-29 16:06:10.130-0500

Change 18188 merged by Kevin Harwell:
pbx.c: Warn if there are too many includes in a context.

[https://gerrit.asterisk.org/c/asterisk/+/18188|https://gerrit.asterisk.org/c/asterisk/+/18188]