DIALER.RULES(5) BSD Programmer's Manual DIALER.RULES(5)NAMEdialer.rules - phone number dialing rules
SYNOPSIS
/etc/dialer.rules
/etc/dialer.rules.local
DESCRIPTION
The /etc/dialer.rules file contains rules for breaking down a phone num-
ber, classifying the number, and producing a number suitable to be passed
to a dialing script (see gettyd(8)).
There are 4 types of entries in /etc/dialer.rules.
#include <filename>
Include the specified filename at the current location in the
file.
<SPECIAL>=c
Indicate the the special sequence is denoted by the character c.
Special sequences are are strings like <PAUSE>. The are typically
mapped to individual characters to ease the writing of numbers.
Since <PAUSE> is typically mapped to , (comma), the following two
numbers would be considered the same: 123<PAUSE>456 and 123,456.
The standard mappings of special characters are:
<DIALTONE>=% # Wait for dialtone
<FLASH>=! # Flash hook
<PAUSE>=, # Pause (typically for 2 seconds)
<PULSE>=^ # Use pulse dialing
<REVERSE>=~ # Dial an originate only modem
<SILENCE>=@ # Wait for silence
<TONE>=: # Use touch tone dialing
VARIABLE=value
Assign a value to a variable. If the = is replaced by ?= then
the value will only be assigned if the variable does not already
have a value. Standard values used are:
INTL_ACCESS_CODE
The access code for dialing international numbers. De-
faults to 011, which is direct access code in the United
States.
LOCAL_COUNTRY_CODE
The country code for the local country. Defaults to 1,
which is the country code for the United States.
LOCAL_CITY_CODE
The local city code (or area code). Defaults to 612,
which is the area code for central Minnesota.
LPREFIX
The access code for dialing national long distance num-
bers. Defaults to 1, which is the direct dial access
code in the United States.
RULE
The ruleset which should be used to classify a phone num-
ber. Defaults to Default-Rules.
RULESET {
...
} Defines the specified ruleset. Note that the placement of the {
and } are critical. The opening { must be on the same line on
the ruleset. The closing } must be on a line by itself.
Comments are introduced by the ; (semicolon) character.
RULESETS
As mentioned above, a ruleset has the form of:
name {
rule
...
}
Rules are newline delimited and hence must each be on a line of their
own. All rules have the form:
[label:] pattern actions
The number being processed is compared against pattern. If the number
matches pattern then actions are applied. The portion of the number
which matched the pattern is stripped.
Patterns and actions, as well as the original number being processed, are
subject to variable expansion. A variable is indicated by enclosing it
within { }. For instance, the string {LPREFIX} would replaced by the val-
ue of the LPREFIX variable, if any.
The normal character used consists of the 10 digits ( 0, 1, 2, 3, 4, 5,
6, 7, 8, and 9) as well as +, #, and *. As indicated above, variables are
introduced by {. Variable names, which are case sensitive, are limited to
the alpha-numeric characters as well as _ and -. When processing a number
or a pattern, alphabetic characters may be used to represent number, as
on a phone: A, B, and C map to 2; D, E, and F map to 3; G, H, and I map
to 4; J, K, and L map to 5; M, N, and O map to 6; P, R, and S map to 7;
T, U, and V map to 8; and W, X, and Y map to 9. This allows numbers to
specified such as: 1-800-GO-TWINS. When processing the number, any other
character, other than +, <, >, {, }, ?, [, ], and - are expanded, if pos-
sible, into the special sequence defined for it. (For instance, , would
expand to <PAUSE>). When processing a pattern there are several wild
cards available:
[abc] Matches any character contained within the set abc.
[a-c] Matches any character between a and c inclusive. The string
[#-9] will match any character.
? Matches any digit. Same as [0-9].
$ Matches the end of the number, or <EXT>.
- Matches the null string. This pattern always matches and does
not cause any characters to be stripped from the number.
When a special sequence is encountered, it is passed through with the
preceeding normal character (or the following normal character if the
special sequence comes before any normal character). The only exception
to this rule is that <EXT> terminates a phone number. All following
characters are assumed to be part of an extension to be dialed. For ex-
ample, the pattern "123" matches all of:
123
123<SPECIAL>
<SPECIAL>123
<SPECIAL>1<SPECIAL>2<SPECIAL>3<SPECIAL>
but does not match:
12<EXT>3
Actions normally consist of variable assignment: VARIABLE=name. Typically
a ruleset will start by reseting internal variables used by the ruleset.
For example:
- NATIONAL=NATIONAL INTL=INTL
- CARRIER= PREFIX= IPREFIX= LPREFIX=
The NUMBER variable is always undefined when a ruleset starts. When the
ruleset is finished, NUMBER must contain the number to dial, including
<EXT> and anything following it.
When the action field is parsed, the following symbols have special mean-
ings:
& Replaced by the characters which matched the pattern
$ Replaced by all characters following the characters which matched
the pattern, including <EXT> and the characters following it.
Besides variable assignment, an action may also be one of the following
directives:
goto label Continue processing from label.
prepend value Prepend value to the remaining number. This has the
effect of mapping the matched pattern to value. For in-
stance:
+ prepend 011
has the effect of replacing a leading + with 011.
reject Reject this number.
resolved type The number has been resolved. NUMBER contains the num-
ber to dial, which is of type. By convention, the fol-
lowing types are used:
DIRECT Everything was after <EXT>
LOCAL A local call
NATIONAL A national long distance call
INTL An international long distance
call
ASSISTED-NATIONAL A national operator assisted call
ASSISTED-INTL An international operator assisted
call
While it is not proper to fall out the bottom of a ruleset, if the final
rule processed is not a resolved or reject directive then the number is
assumed to be rejected.
The default distributed ruleset is simply:
;
; Default Rules
; Very permissive (everything is a local call except for direct calls)
;
default-Rules {
;
; If there is no number then this is a DIRECT call
;
$ NUMBER=$ resolved DIRECT
- NUMBER=$ resolved LOCAL
}
SEE ALSOgettyd(8)BSDI BSD/OS June 11, 1996 4