I have an example asterisk dial plan below.It just the main (no extension or start) and it has 3 priorities.In the first priority of our extension, we’ll answer the call. In the second, we’ll play a sound file named hello-world.gsm, and in the third we’ll hang up the call
One example on the web seem to suggest the below format
[incoming]
exten => s,1,Answer()
exten => s,n,Playback(hello-world)
exten => s,n,Hangup()
instead of
[incoming]
exten => s,1,Answer()
exten => s,2,Playback(hello-world)
exten => s,3,Hangup()
why is that? what exactly is a priority ? and what does ‘n’ signify
Asterisk executes each priority in numerical order,
and like in BASIC, you can jump to those Priorities with
Goto.Since Asterisk 1.2 you have the ability to use the
npriority.The
npriority adds 1 to the previous Prioritiy.That makes you more flexible, you could add a Line, without the need to care about the Priorities.
Another Benefit of the
npriority is that you can use thenPriority with optional Labels and jump to that Label, instead of messing arround with the priorities Counter.See GotoIf for more examples.