A Simple Dialplan(ASTERISK)

Rate this post

“A Simple Dialplan”

Open up the file /etc/asterisk/extensions.conf, and let’s take a look at your first dialplan.

Hello World

In the first priority of our extension, we answer the call. In the second, we play a sound file named hello-world, and in the third we hang up the call. The code we are interested in for this example looks like this:
exten => 200,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()
you’ll already have a channel or two configured, as well as the sample dialplan that contains this code. If not, what you need is an extensions.conf file in your /etc/asterisk directory that contains the following code:
[LocalSets] ; this is the context name
exten => 100,1,Dial(SIP/0000FFFF0001) ; Replace 0000FFFF0001 with your device name
exten => 101,1,Dial(SIP/0000FFFF0002) ; Replace 0000FFFF0002 with your device name
exten => 200,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()
If you don’t have this dialplan code built yet, you’ll need to add it and reload the dialplan with this CLI command:
*CLI>dialplan reload
or from the shell with:
$ sudo /usr/sbin/asterisk -rx “dialplan reload”
Calling extension 200 from either of your configured phones should reward you with the voice of Allison Smith saying “Hello, world.”
If it doesn’t work, check the Asterisk console for error messages, and make sure your channels are assigned to the LocalSets context.
Even though this example is very short and simple, it emphasizes the core concepts of contexts, extensions, priorities, and applications. You now have the fundamental knowledge on which all dialplans are built.

 

For any query or issue, feel free to discuss on http://discuss.eduguru.in
%d bloggers like this: