REDIRECTING TO moshe.im/blog...

Thoughts, tips and ideas on next-gen technology by: Moshe Brevda

2008/10/28

Howto: list Asterisk contexts and includes

After all our discussions of asterisk contexts, you my be looking for a simple way to list all your asterisk contexts and their includes. Just type (or copy and paste) the following at you're Linux CLI:

asterisk -rx 'dialplan show' | \
awk -F"'" '
BEGIN {printf "digraph dialplan {\n";};
/^\[ Context/ {context=$2};
/^ Include =>/ {printf "\t%s -> %s\n",context,$2};
END {printf "}\n"}
'

(please note: there should be TWO spaces before the word Include)
After pressing enter, you will see something like this:

from-pstn -> from-pstn-custom
from-pstn -> ext-did
from-pstn -> ext-did-post-custom
from-pstn -> from-did-direct


Got a better way to list your asterisk includes? Show it in the comments!

Moshe Brevda, FreePBX Development Team

Found this tip useful? Don't forget to donate by click the donate button on the right!