HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Dialrules



On Tue, 22 Feb 2005, Thom Paine wrote:

Does someone have an example dialrules config I can see to get the idea
on setting up all the local / long distance numbers.

Here in Ontario we have local and long distance numbers in the 519 area
code, and as I recall I need to list which ones are local, and which
ones are long distance.

This is what I use. It's function isn't such much as to figure out local and long distance, but rather to know when to add *remove* an area code. - Mike Porter PGP Fingerprint: F4 AE E1 9F 67 F7 DA EA 2F D2 37 F3 99 ED D1 C2


! $Id: dialrules,v 1.7 1996/06/24 02:59:32 sam Rel $
!
! HylaFAX (tm) 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.
!
Area=${AreaCode} ! local area code
Country=${CountryCode} ! local country code
Exchange="831" ! local UofD exchange


! Enter the list of local exchanges we don't want to dial long
! distance for.  This is needed because when Verizon customers
! switch to Cavalier, and the call remains with the Newark switch,
! something often screws up and numbers dialed as:
! 9-1-302-737-0684 often times don't work for screwy reasons when
! number is a Cavalier customer.  If the number is dialed as
! 9-737-0684, it works fine.  So, we will *not* dial Newark
! numbers with a leading 1-302.

LocalExchange="224|266|283|286|292|294|318|355|366|368|369|391|444|451|452|453|454|455|456|457|458|506|525|533|565|602|607|623|631|709|722|731|733|737|738|781|831|837|861|894"

IDPrefix=${InternationalPrefix}	! prefix for placing an international call
LDPrefix=${LongDistancePrefix}	! prefix for placing a long distance call
Out="9"
!
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.
!
CanonicalNumber := [
#.*			=			! strip calling card stuff
[-${WS}.]+		=			! strip syntactic sugar
[abcABC]		= 2			! these convert alpha to numbers
[defDEF]		= 3
[ghiGHI]		= 4
[jklJKL]		= 5
[mnoMNO]		= 6
[prsPRS]		= 7
[tuvTUV]		= 8
[wxyWXY]		= 9
[^+0-9]+		=			! strip white space etc.

! 4 -> 11 digits (1234 -> 13028311234)
^([0-9]{4})$  = ${LDPrefix}${Area}${Exchange}\1

! 7 -> 11 digits (7370684 -> 13027370684)
^([0-9]{7})$  = ${LDPrefix}${Area}\1

! 8 -> 11 digits (97370684 -> 13027370684)
^${Out}([0-9]{7})$  = ${LDPrefix}${Area}\1

! 8 -> 11 digits (17370684 -> 13027370684)
^${LDPrefix}([0-9]{7})$  = ${LDPrefix}${Area}\1

! 10 -> 11 digits (3027370684 -> 13027370684)
^([0-9]{10})$  = ${LDPrefix}\1

! Remaining cases are either malformed or 12 digits. Drop dial out

^${Out} = ! replace dial out

^${IDPrefix}		= +			! replace int. dialing code
^${LDPrefix}		= +${Country}		! replace l.d. dialing code
^[^+]			= +${Country}${Area}&	! otherwise, insert canon form
^911			= ""
]
!
! 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
[abcABC]		= 2			! these convert alpha to numbers
[defDEF]		= 3
[ghiGHI]		= 4
[jklJKL]		= 5
[mnoMNO]		= 6
[prsPRS]		= 7
[tuvTUV]		= 8
[wxyWXY]		= 9

! Hide all international from any mangling at all.
! International are numbers starting with 011 with at
! least 5 more digits, or 9-011...

^${IDPrefix}([0-9]{5,}$)	= +\1
^${Out}${IDPrefix}([0-9]{1,})	= +\1

! 7 -> 8 digits (234-4567 -> 9-234-4567)
^([0-9]{7})$ = ${Out}\1

! 8->9 digits (1 234-5678 -> 9 1 234-5678)
^${LDPrefix}([0-9]{7})$ = ${Out}${LDPrefix}\1

! 10 -> 12 digits (302 234 5678 -> 9 1 302...)
^([0-9]{10})$ = ${Out}${LDPrefix}\1

! 11 -> 12 digits (1 302 234 5678 -> 9 1 302...)
^${LDPrefix}([0-9]{10})$ = ${Out}${LDPrefix}\1

! Remove our country code
^[+]${Country}([0-9]{5,})$	= ${Out}${LDPrefix}\1

^[+] = ${Out}${IDPrefix} ! international call

! But, clean up all campus calls.
! 9831
! 91302831

^${Out}${Exchange}([0-9]{4})$	= \1
^${Out}${LDPrefix}${Area}${Exchange}([0-9]{4})$	= \1

! And remove 1302 for local calls.
^${Out}${LDPrefix}${Area}(${LocalExchange})	= ${Out}\1

^911			= ""
]


! ! This should always be a copy of DialString, in my opinion. ! That way, we know what's being dialed. !

DisplayNumber := [
[-${WS}.]+		=			! strip syntactic sugar
[abcABC]		= 2			! these convert alpha to numbers
[defDEF]		= 3
[ghiGHI]		= 4
[jklJKL]		= 5
[mnoMNO]		= 6
[prsPRS]		= 7
[tuvTUV]		= 8
[wxyWXY]		= 9

! Hide all international from any mangling at all.
! International are numbers starting with 011 with at
! least 5 more digits, or 9-011...

^${IDPrefix}([0-9]{5,}$)	= +\1
^${Out}${IDPrefix}([0-9]{1,})	= +\1

! 7 -> 8 digits (234-4567 -> 9-234-4567)
^([0-9]{7})$ = ${Out}\1

! 8->9 digits (1 234-5678 -> 9 1 234-5678)
^${LDPrefix}([0-9]{7})$ = ${Out}${LDPrefix}\1

! 10 -> 12 digits (302 234 5678 -> 9 1 302...)
^([0-9]{10})$ = ${Out}${LDPrefix}\1

! 11 -> 12 digits (1 302 234 5678 -> 9 1 302...)
^${LDPrefix}([0-9]{10})$ = ${Out}${LDPrefix}\1

! Remove our country code
^[+]${Country}([0-9]{5,})$	= ${Out}${LDPrefix}\1

^[+] = ${Out}${IDPrefix} ! international call

! But, clean up all campus calls.
! 9831
! 91302831

^${Out}${Exchange}([0-9]{4})$	= \1
^${Out}${LDPrefix}${Area}${Exchange}([0-9]{4})$	= \1

! And remove 1302 for local calls.
^${Out}${LDPrefix}${Area}(${LocalExchange})	= ${Out}\1

! Lines to make the phone number nice!
! 9-234-5678
! 9-1-234-5678
! 9-1-302-234-5678

^${Out}([0-9]{3})([0-9]{4})$	= ${Out}-\1-\2
^${Out}${LDPrefix}([0-9]{3})([0-9]{4})$	= ${Out}-${LDPrefix}-\1-\2
^${Out}${LDPrefix}([0-9]{3})([0-9]{3})([0-9]{4})$ = ${Out}-${LDPrefix}-\1-\2-\3

^911			= ""
]


Thanks.

-=/>Thom



____________________ HylaFAX(tm) Users Mailing List _______________________
 To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
 *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*



____________________ HylaFAX(tm) Users Mailing List _______________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*




Project hosted by iFAX Solutions