!
! 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.
!
! Dialing rules for Norway are that all numbers are eight digits -- two digit fylke
! (area) code followed by a 6 digit telephone number.  Even local calls within the same 
! fylke must have the two digit code appended.
!
! Adapted from a dilerules file distributed by Dirk Husemann. For local use at
! BSC, Bergen, Norway.
!
Telefon         = "[0-9][0-9][0-9][0-9][0-9][0-9]"	! base telephone number
Fylke           = 55 	  	! local area code
Country         = 47 		! local country code
!
External        = 
International   = 095
Canonic         = "+"
!
LOCAL           = "LOCAL"
LONGDISTANCE    = "LONGDISTANCE"
INTERNATIONAL   = "INTERNATIONAL"
!
WS=" 	"			! our notion of white space
!==========================  CANONICAL  =================================
!
! Convert a phone number to a canonical format:
!
!    +<country><fylke><rest>
!
! by (possibly) stripping off leading dialing prefixes for
! long distance and/or international dialing.
!
CanonicalNumber := [
#.*			=			! strip calling card stuff
[^+0-9x]+		=			! strip white space etc.
!
! local calls
!
! ^[^0+IL]                                       = ${LOCAL}&
^${Telefon}$				       = ${LOCAL}&
^${Fylke}		                       = ${LOCAL}
^${International}${Country}${Fylke}             = ${LOCAL}
^[+]${Country}${Fylke}                          = ${LOCAL}
!
! long distance & international calls
!
^${International}${Country}                    = ${LONGDISTANCE}
^${International}                              = ${INTERNATIONAL}
^[+]${Country}                                 = ${LONGDISTANCE}
^[+]                                           = ${INTERNATIONAL}
!
! now construct appropriate canonical strings
!
^${LOCAL}         = ${Canonic}${Country}${Fylke}
^${LONGDISTANCE}  = ${Canonic}${Country}
^${INTERNATIONAL} = ${Canonic}
]
!==========================  DIALSTRING  =================================
!
! Process a dialing string according to local requirements.
! These rules do only one transformation: they convert in-country
! international calls to long-distance calls.
!
DialString := [
[-${WS}.]+		=			! strip syntactic sugar
!
! local calls
!
^${Telefon}$				       = ${LOCAL}&
^${Fylke}    		                       = ${LOCAL}
^${International}${Country}${Fylke}             = ${LOCAL}
^[+]${Country}${Fylke}                          = ${LOCAL}
!
! long distance & international calls
!
^${International}${Country}                    = ${LONGDISTANCE}
^${International}                              = ${INTERNATIONAL}
^[+]${Country}                                 = ${LONGDISTANCE}
^[+]                                           = ${INTERNATIONAL}
!
! now construct appropriate dialing strings
!
^${LOCAL}          = ${External}${Fylke}
^${LONGDISTANCE}   = ${External}
^${INTERNATIONAL}  = ${External}${International}
]
