asterisk dialplan, how to use includes in contexts right

55 Views Asked by At

In an asterisk dialplan, say one had:

[ext-miscdests]
include => ext-miscdests-custom
exten => 5,1,Noop(MiscDest: [some destination])
exten => 5,n,Goto(from-internal,[some number],1)

and wanted to squeeze in as the second step:

exten => 5,2,Log("NOTICE", "some notice")

how would one do that in context [ext-mistdests-custom]?

(this follows up on How to use asterisk Include statement the right way?)

1

There are 1 best solutions below

0
arheops On

You should understand how asterisk do matching.

Asterisk does not rewrite rules in current context with include. It will APPEND rules.

So. If you have like this

[ext-miscdests]
include => ext-miscdests-custom
exten => 5,1,Noop(MiscDest: [some destination])
exten => 5,n,Goto(from-internal,[some number],1)
[ext-miscdests-custom]
exten => 5,1,Noop

that is equivalent of :

[ext-miscdests]
exten => 5,1,Noop(MiscDest: [some destination])
exten => 5,n,Goto(from-internal,[some number],1)
; includes append always AFTER direct lines.
exten => 5,1,Noop; this line will not work in most asterisk version due to already have same line

If you need override context, use *_ovveride*.conf files, not *_custom.conf files. Ovveride files added BEFORE other files in freepbx.