! $Id: dialrules-ger-fub,v 1.1 1993/10/06 15:31:07 ferincz Exp ferincz $
!
! FlexFAX Dialing String Processing Rules.
!
! This file describes how to process user-specified dialing strings
! to create two items:
!
! CanonicalNumber: a unique string that is derived from all dialing
! strings to the same destination phone number.  This string is used
! by the fax server for ``naming'' the destination. 
!
! DialString: the string passed to the modem for use in dialing the
! telephone.  This string should be void of any characters that might
! confuse the modem.
!
! For local use at FUB, Berlin, Germany.
! Adapted by ferincz@chemie.fu-berlin.de (Jozsef Ferincz), 1993.
!
Area=${AreaCode}		! local area code
Country=${CountryCode}		! local country code
IDPrefix=${InternationalPrefix}	! prefix for placing an international call
LDPrefix=${LongDistancePrefix}	! prefix for placing a long distance call
BPrefix=0			! prefix for Berlin from inside of the FUB
OPrefix=8			! prefix for outside of Berlin from the FUB
SPrefix=9			! prefix for the net of senate from the FUB
FUB=838				! Free University of Berlin (FUB): 838-0
Digit6=[0-9][0-9][0-9][0-9][0-9][0-9]	! external: up to 6 digits
Senate=SenatsNetz		! net of senate
Internal=Internal		! FUB call
External=External		! not FUB call
Delay=","			! 2 sec. delay for modem
!
WS=" 	"			! our notion of white space
!
! Convert a phone number to a canonical format:
!
!    +<country><areacode><rest>
!
! by (possibly) stripping off leading dialing prefixes for
! long distance and/or international dialing.
!
! Only the callnumbers for the phone net of the senate should be
! given with the ``9,'' prefix in this format:
!    <sprefix>,<rest>
! The canonical format  for this numbers will be:
!    +<country><areacode>SenatsNetz<rest> 
! The other callnumbers may be given with or without
! the prefix ``0,'' or ``8,''. If some of the ``0'', ``8'', ``9''
! prefixes is given, it should be followed by a ``,''!
!
CanonicalNumber := [
#.*			=			! strip calling card stuff
[^+${Delay}0-9]+	=			! strip white space etc.
^${BPrefix}${Delay}	=			! strip BPref. and modem delay
^${OPrefix}${Delay}	=			! strip OPref. and modem delay
^${SPrefix}${Delay}	= ${Senate}		! strip SPref. and modem delay
^${Digit6}		= ${External}&		! mark the external numbers
^[0-9]			= ${FUB}&		! insert the main digits of FUB
^${External}		=			! strip the mark
^${IDPrefix}		= +			! replace int. dialing code
^${LDPrefix}		= +${Country}		! replace l.d. dialing code
^[^+]			= +${Country}${Area}&	! otherwise, insert canon form
]
!
! Process a dialing string according to local requirements.
!
DialString := [
[-${WS}.]+		=			! strip syntactic sugar
^${BPrefix}${Delay}	=			! strip BPref. and modem delay
^${OPrefix}${Delay}	=			! strip OPref. and modem delay
^${SPrefix}${Delay}	= ${Senate}		! strip SPref. and modem delay
^${Digit6}		= ${External}&		! mark the external numbers
^[0-9]			= ${FUB}&		! insert the main digits of FUB
^${External}		=			! strip the mark
^${IDPrefix}		= +			! replace int. dialing code
^${LDPrefix}		= +${Country}		! replace l.d. dialing code
^[^+]			= +${Country}${Area}&	! otherwise, insert canon form
!
! Process the canonical number
!
^[+]${Country} 		= ${LDPrefix} 		! in-country
^${LDPrefix}${Area}	= 		   	! in-area
^${FUB}			=			! in-FUB
^${Senate}		= ${SPrefix}${Delay}	! net of senate
^[+]			= ${IDPrefix}		! international call
^${IDPrefix}	= ${OPrefix}${Delay}${IDPrefix} ! OPref.+modem delay for i.d.
^${LDPrefix}	= ${OPrefix}${Delay}${LDPrefix} ! OPref.+modem delay for l.d.
^${Digit6}		= ${BPrefix}${Delay}&	! BPref.+modem delay for local
]
!
! Construct the display number
!
DisplayNumber := [
[-${WS}.]+		=			! strip syntactic sugar
^${BPrefix}${Delay}	=			! strip BPref. and modem delay
^${OPrefix}${Delay}	=			! strip OPref. and modem delay
^${SPrefix}${Delay}	= ${Senate}		! strip SPref. and modem delay
^${Digit6}		= ${External}&		! mark the external numbers
^[0-9]			= ${FUB}&		! insert the main digits of FUB
^${External}		=			! strip the mark
^${IDPrefix}		= +			! replace int. dialing code
^${LDPrefix}		= +${Country}		! replace l.d. dialing code
^[^+]			= +${Country}${Area}&	! otherwise, insert canon form
!
! Process the canonical number
!
^[+]${Country} 		= ${LDPrefix} 		! in-country
^${LDPrefix}${Area}	= 		   	! in-area
^${FUB}			=			! in-FUB
^${Senate}		= ${SPrefix}${Delay}	! net of senate
^[+]			= ${IDPrefix}		! international call
^${IDPrefix}	= ${OPrefix}${Delay}${IDPrefix} ! OPref.+modem delay for i.d.
^${LDPrefix}	= ${OPrefix}${Delay}${LDPrefix} ! OPref.+modem delay for l.d.
^${Digit6}		= ${BPrefix}${Delay}&	! BPref.+modem delay for local
]
!
! Results: (e.g.)
!
! 1234						! in-FUB
! 12345						! in-FUB
! 0,1234567					! in-Berlin
! 8,01234567890					! in-Germany
! 8,00123456789012				! international
! 9,123456					! net of senate
!
