Subject: What is the easiest way to use phone numbers with BSD/OS's gettyd?
Date: 09/14/97

The easiest way to store and use phone numbers with BSD/OS is to use the /etc/phones and /etc/dialer/rules.local files. Enter fully qualified phone numbers in /etc/phones, such as

information	1-612-555-1212

Edit the /etc/dialer/rules.local and set the INTL_ACCESS_CODE, LOCAL_COUNTRY_CODE, LOCAL_CITY_CODE (area code), and LPREFIX entries to match your current calling area. If you have a dialing prefix you need to use, such as pressing 9 to get out, or dialing *70 to turn off call waiting, add a line such as:

DIAL_PREFIX=	9<DIALTONE>

or

DIAL_PREFIX=	*70<DIALTONE>

In addition, if you need to insert a pause and then a credit card number after dialing the number, you can add something like:

DIAL_SUFFIX=	<PAUSE><PAUSE>55512345671234

or

DIAL_PREFIX=	<SILENCE>55512345671234

The first example waits a specific amount of time after dialing the number (typically 2 seconds per <PAUSE>) before sending the credit card number. The second example waits for silence on the line and then sends the credit card number.

Modify the RULE entry to have the value LocalRules and add the following rule after that:

LocalRules {
        ;
        ; If there is no number then this is a DIRECT call
        ;
        $               NUMBER=$ resolved DIRECT
        {STRIP}
        -               NUMBER={DIAL_PREFIX}${DIAL_SUFFIX} resolved LOCAL
}

The first rule is optional and allows for empty phone numbers. The second rule strips the local prefixes. The third, and final rule, prepends and dial prefix and suffix and resolves the number (always as local).

Now to use the phone number associated with information in /etc/phones simply use the string @information. This may be used from ppp(8), tip(1) or any place else that gettyd is used.

Note that you can also add entries like <PAUSE> to the number in /etc/phones. For instance, if the information number waited many rings before answering, too long for the timeout on the modem, you could add several <PAUSE> entries after it:

information	1-612-555-1212<PAUSE><PAUSE><PAUSE>

Now, if you find yourself in a different dialing area, just edit the LOCAL_CITY_CODE, DIAL_PREFIX, and DIAL_SUFFIX entries to match your new area. You should be able to continue to use your existing phone book and calls that used to be local will now be long distance and long distance calls that are now local should become local!

You do not need to restart gettyd to use the new rules, it will automatically re-read them if they have changed. (Except for earlier releases of gettyd, which did not automatically re-read the /etc/dialer/rules.local file.)

A complete /etc/dialer/rules.local might look like:

; Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved.
; The Berkeley Software Design Inc. software License Agreement specifies
; the terms and conditions for redistribution.
;
;       BSDI $Id: dialer.rules.local,v 1.1 1996/06/05 19:47:02 prb Exp $

; Make all local changes here, including local rules sets

; Adjust these values as needed

INTL_ACCESS_CODE=       011             ; US standard access code
LOCAL_COUNTRY_CODE=     1               ; North America
LOCAL_CITY_CODE=        612             ; Central Minnesota

LPREFIX=                1               ; Default long distance calling prefix
DIAL_PREFIX=            *70<DIALTONE>   ; how to get an outside line
DIAL_SUFFIX=                            ; no dialing suffix here
STRIP=                  {LPREFIX}{LOCAL_CITY_CODE}

; The RULE variable must be set to the name of the ruleset to use to parse
; the phone number.  The Default-Rules set is very permissive

RULE=                   LocalRules      ; Default rule to process number with

LocalRules {
        ;
        ; If there is no number then this is a DIRECT call
        ;
        $               NUMBER=$ resolved DIRECT
        {STRIP}
        -               NUMBER={DIAL_PREFIX}${DIAL_SUFFIX} resolved LOCAL
}