Dial plan visualization tool

Hi,

I s there any tool to parse extensions.conf or any extensions conf custom made, and a produce a flowchart of how the call is flowing through various aspects of the dial plan ?

Thanks

Asterisk dialplan can modify branch destinations at run time, so I’m pretty sure that it is theoretically impossible to create a general purpose tool for this.

There is a visualiser for FreePBX generated dialplans, but it will will at the level of blocks of code, not individual lines.

If you remove the ability to set calculate branch destination priorities and labels, and other code that can be generated at run time, the standard problem, with all non-structured programming languages, is creating a good layout.

1 Like

How would a tool interpret this (from an actual dialplan):

	exten = _[123456],n,		goto(${PRODUCT-${EXTEN}-APPLICATION},s,1)

Yeap I know,
that is the issue i am facing , the current graphviz library cannot interpret such a complex line in the dial plan !

I’m pretty sure the Turing halting problem applies here, i.e. it may not even be possible to determine that it is possible to produce a finite flow chart.

1 Like

theoretically you could generate a user CEL event at each ā€œstepā€ you want to monitor.. presumably when a call gosubs, dials, runs an application etc… then go back after the fact and have a tool that would analyze the CEL data… we have customers that want ā€œsemi detailedā€ info on what happens to calls when they are forwarded, transferred, etc.. we didnt write a full flow chart as the customers really just want to see the top level steps (ie 4100 called 4200 and 4200 transferred to 4300 which went to voicemail) that type of thing.. the CEL data lands in an SQLite table where we grab it hourly and ship it to our cloud where its further processed and the customers can search / view their call data.. granted its after the fact, however it is a way t osee how a call went through the dialplan on a 100 foot level

1 Like

That’s pretty much what this 20 year old dialplan did.

The application was an ā€˜adult chat’ system.

Each ā€˜product’ was a context in the dialplan. Since you couldn’t tell when a call left a context, at the start of each context, an AGI would write out the billing details for the previous context – product, duration, and price per minute.

; start a product context
[s](!)
        exten = s,1,                    verbose(1,[${EXTEN}@${CONTEXT}])
        exten = s,n,                    agi(write-cdr)

; 1 on 1 chat
[1on1](h,i,s,max-timeout,digit-timeout)
        exten = s,n,                    background(${CUSTOMER}/menu/m1105)
        ...
        ...

at the end of the call (ā€˜h’), an AGI would sum up all the charges and submit the sale to the credit card processor.

You could follow a customer from product to product including menus (which were charged at the base rate for the DID).

While maybe not as bad as some examples; if your tool tried to interpret this literally without being able to know there was additional context going in to it…it would have a bad time.


[cart-player]
exten = _#X,1,Wait(.25)
same= n,Background(${aa}/${EXTEN:-1})
same = n,Goto(${c},s,return)
exten = _*XX,1,Wait(.25)
same= n,Background(${aa}/${EXTEN:-2})
same = n,Goto(${c},s,return)
exten = 0,1,Goto(${c},s,return)

[8track-player]
exten = _*XX,1,Set(tt=${IF($[${EXTEN:-2} < 10]?${EXTEN:-1}:${EXTEN:-2})})
same = n,Set(t=1)
same = n,Set(p=*)
same = n(lead),GoToIf($[${t} = 10]?tenplus)
same = n(hax),Background(${aa}/0${t})
same = n(next),Set(t=$[${t} + 1])
same = n,GoToIf($[${t} < ${tt}]?lead)
same = n,Goto(${c},s,goodbye)
same = n(tenplus),Set(p=#)
same = n,GoTo(#00,hax)
exten = _#XX,1,Set(tt=${IF($[${EXTEN:-2} < 10]?${EXTEN:-1}:${EXTEN:-2})})
same = n,Set(t=1)
same = n,Set(p=#)
same = n(hax),Background(${aa}/${t})
same = n(next),Set(t=$[${t} + 1])
same = n,GoToIf($[${t} < ${tt}]?hax)
same = n,Goto(${c},s,goodbye)

exten = 1,1,GoToIf($["${t}" = "1"]?wait)
same = n,Set(t=$[${t} - 1])
same = n(wait),Wait(.25)
same = n,Goto(${p}00,hax)
exten = 2,1,Wait(.25)
same = n,Goto(${p}00,hax)
exten = 3,1,Wait(.25)
same = n,Goto(${p}00,next)
exten = 0,1,Goto(${c},s,return)