Pls have a look at the instructions below.
(extracted from a post of PhoneBoy on Voxilla forum. It is for Sipura 3000, but it has a lot of things in common with PAP2/SPA-2000. Sipura 3000 has gateways, but not in PAP2/SPA-2000)
=====
A general Sipura dial plan looks like (assume the numbers are subscripts)
(<a1:b1>c1<
gwX1>|<a2:b2>c2<
gwX2>|...)
<a:b> is basically a substitution syntax for stuff dialed at the beginning of the dial plan. OPTIONAL
Some examples include:
<8:1415> Replace a dialed "8" with "1415" (e.g. if user dials 84286511, we send 14154286511).
<:1415> Insert a "1415" into the number dialed
<9,:> When a 9 is dialed, present a second dialtone. The "9" is not sent.
<9:> If an initial 9 is dialed, don't send it.
c is a string of characters that restricts what digits can be dialed. THIS IS REQUIRED
These characters can be:
* means the star (asterisk) key
# means the pound (hash) key
x means a single digit (0 through 9)
[x-y] means any digits x through y.
[xy] means the digits x and y (can put any number of digits here)
. means repeat the previously listed digit type zero or more times. For example x. means "zero or more digits," xx. means "one or more digits."
S0 is usually used at the end of a dial plan string that says "immediately dial when matched." Used for things like 911.
! is used at the end of the dial plan and it means "immediately reject the number dialed." Used to block, say, 900 numbers.
A few examples:
[2-9]xxxxxx matches typical 7-digit dialing in the US.
011xx. matches North American style International dialing (011 followed by one or more digits)
[49]11S0 matches either 411 or 911 and immediately dials (doesn't wait for digit timeout)
<
gwX> is specific to the SPA-3000 and means "dial out this gateway." OPTIONAL
This is specific to the SPA-3000 and is optional. Basically it means "if you match the dial plan listed, dial out this gateway." If nothing is specified in this part of the SPA-3000 dial plan on line 1, dial out via the VoIP provider defined on Line 1. The gateways are defined in the Gateway Accounts section of the Line 1 tab. gw0 is special and means "dial out the PSTN port."
gwX can also be replaced by a list of parameters that represent what's listed in the Gateway Accounts section. See the SPA Users Guide for more details.
Examples
Now for an example from the SPA-3000 configuration Wizard, which uses most of these items
([2-79]11<
gw0>|xx.|*xx.|**xx.|<#1,:>xx.<
gw1>|<#9,:>xx.<
gw0>|<#9,:>*xx<
gw0>)
This breaks down as follows:
* 211, 311, 411, 511, 611, 711, and 911 are routed out the PSTN Line (gw0).
* An arbitrary number of digits, which will be routed out the Line 1 VoIP Provider configuration;
* dial * then dial one or more digits (routed out Line 1 VoIP Provider);
* dial ** then dial one or more digits (routed out Line 1 VoIP Provider);
* dial #1 then dial one or more digits (routed out Gateway 1 Provider (gw1));
* dial #9 then dial one or more digits (routed out PSTN Line);
* Dial #9* then two digits (routed out PSTN Line, i.e. for star codes).
Hopefully that's clear enough, but let me know if I'm missing something.