Using variables in Asterisk dial plan

Variables are used to store information for later use in a dial plan.
Visual Dialplan recognizes global variables available in the whole dial plan and channel variables available only during the life of a channel (call). Each channel gets its own variable space, so there is no chance of collisions between different calls, and the variable is automatically trashed when the channel close (hangup).

How to create variable?
Simply go to Global Variables or Channel Variables view, right click on the right window panel and select New from the drop down menu.
Then type in the variable name and short description.


How to assign value to the variable?
Once you created the variable you are ready to use it in the dial plan.
To assign the value to the variable use the Set building block (Variables sheet).

Now you set the value 10 to variable MyVariable and you can use it later in the dial plan.

How to read the variable value?
The value of the variable MyVariable is ${MyVariabvle}.
Simply type ${} when you want to read the value of the variable.