# How to use include statement the right way?

**URL:** <https://community.asterisk.org/t/how-to-use-include-statement-the-right-way/48670>\
**Category:** Asterisk Support\
**Created:** [April 14, 2015, 3:55am UTC](https://community.asterisk.org/t/how-to-use-include-statement-the-right-way/48670 "2015-04-14T03:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![loidangthanh](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/loidangthanh/32/9646_2.png) [@loidangthanh](https://community.asterisk.org/u/loidangthanh)\
**Post date:** [April 14, 2015, 3:55am UTC](https://community.asterisk.org/t/how-to-use-include-statement-the-right-way/48670/1 "2015-04-14T03:55:22Z")

</div>

Hi guys, I’m new to asterisk, and I have an issue about using include statement.  
I have a context named app-calltrace-perform from FreePBX used when people press \*69 to trace their call. The app-calltrace-perform written in extensions\_additional.conf which will be overwritten when users submit something about dialplan on the Web gui.

```auto
[app-calltrace-perform]
include => app-calltrace-perform-custom
exten => s,1,Answer
...
exten => t,n,Macro(hangupcall,)
```

So I write my own app-calltrace-perform-custom in extensions\_custom.conf to make the dialplan get to my custom way

```auto
[app-calltrace-perform-custom]
exten => s,1,Answer()
      same => n,VERBOSE("Something here")
      same => n,Playback(hello-world)
      same => n,Hangup()
```

Then I do “dialplan reload” and try again, but dialplan do not play my context at all (no verbose, no play hello-world).

I’ve found something useful in [https://wiki.asterisk.org/wiki/display/AST/Include+Statements+Basics](https://wiki.asterisk.org/wiki/display/AST/Include+Statements+Basics)

> [@](#):
>
> 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

So now I’m wondering how to use my custom context for stuffs like this, if you have any idea, please guide me. 😄😄

Note that extensions\_additional.conf and extensions\_custom.conf was already included in extensions.conf by FreePBX

Thanks in advance  
Loi Dang

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [April 14, 2015, 6:49am UTC](https://community.asterisk.org/t/how-to-use-include-statement-the-right-way/48670/2 "2015-04-14T06:49:21Z")

</div>

For FreePBX aspects, use [community.freepbx.org/](http://community.freepbx.org/) as we have no expertise on FreePBX here.

The passage you quote is a correct explanation of “include =\>” in Asterisk.
