A Basic Dialplan to Test Your Devices

We’re not going to dive too deeply into the dialplan just yet, but an initial dialplan that you can use to test your newly registered devices will be helpful. Place the following contents in /etc/asterisk/extensions.conf:

[LocalSets]

exten => 100,1,Dial(SIP/0000FFFF0001) ; Replace 0000FFFF0001 with your device name

exten => 101,1,Dial(SIP/0000FFFF0002) ; Replace 0000FFFF0002 with your device name

;
; These will allow you to dial each of the 4 analog phones configured
; in the previous section.
;
exten => 102,1,Dial(DAHDI/1)
exten => 103,1,Dial(DAHDI/2)
exten => 104,1,Dial(DAHDI/3)
exten => 105,1,Dial(DAHDI/4)

exten => 200,1,Answer()
    same => n,Playback(hello-world)
    same => n,Hangup()

This basic dialplan will allow you to dial your SIP devices using extensions 100 and 101. The four lines of the analog card can be dialed with extensions 102 through 105, respectively. You can also listen to the hello-world prompt that was created for this book by dialing extension 200. All of these extensions are arbitrary numbers, and could be anything you want. Also, this is by no means a complete dialplan; we’ll develop it further in later chapters.

You will need to reload your dialplan before changes will take effect in Asterisk. You can reload it from the Linux shell:

$ sudo asterisk -rx "dialplan reload"

or from the Asterisk CLI:

*CLI> dialplan reload

You should now be able to dial between your two new extensions. Open up the CLI in order to see the call progression. You should see something like this (and the set you are calling should ring):

    -- Executing [100@LocalSets:1] Dial("SIP/0000FFFF0001-0000000c", 
       "SIP/0000FFFF0001") in new stack
    -- Called 0000FFFF0001
    -- SIP/0000FFFF0001-0000000d is ringing

If this does not happen, you are going to need to review your configuration and ensure you have not made any typos.