Has anybody put together a database of dialrules that deals with the issues

of local vs long distance dialing by area code and exchange?

Yes many times for different areas.

Our local dialrules file is about 400 lines of mappings, some of which are

mapping exchanges that were in our 206 area code to new area codes, but

most of them are used to remove the ``1'' prefix from prefixes in other

area codes that are local calls, and the rest add the ``1'' to exchanges in

the 206 area code that are long distance calls.

Your clients are going to, if they don't typo, enter in either a 7-digit, a 10-digit, or an 11-digit number for domestic calls.(In areas like Seattle dialing with a 7-digit number is, in my opinion, unsafe unless you're absolutely sure what area code the line is in that will be used to place the call.But nonetheless clients will still send 7-digit numbers.)If, you don't want to make an assumption about an area code then you can reject calls with DestControls that don't have 10 digits:

Otherwise, you can use dialrules to add the area code for you (see below).

First off, you want to learn to use dialtest in order to work through the fine-tuning of your dialrules.

dialtest -a 206 /var/spool/hylafax/etc/dialrules

Then start provide it possible numbers that clients may submit and see if dialrules accomplishes what you need.If not, then adjust dialrules and try again.So let's say that my area code is 206 and that my telco requires 10-digit dialing and that I am okay with assuming that 7-digit numbers refer to area code 206 and that the only exchanges that are local to me are 444 and 555 (yes, I know that this is an absurdly short local exchange list).Then the dialstring portion of my dialrules file may look like this:

What this does is it does the usual whitespace stripping and alpha conversions.Then, if the number is 10-digits it adds a "1" to the beginning of it - because requiring people to know when to use a 1 and when not to use a 1 is silly - so everyone will dial 10-digits.If it happens to be a 206444 or 206555 number then it will get processed further, otherwise there will be no more processing of this number. Then if the number is 7-digits it adds the area code to the front of that.There is no further processing of that number.Now it takes all numbers that at this point say 1206444 or 1206555 and it strips off the 1.At that point it's essentially done - replacing the country code wit hthe long distance code probably means nothing in your situation.The last rule, international, probably is useless since nobody ever dials with canonical format.

Now, you probably can take that as-is but replace the two exchange examples with the hundred or so exchanges that are local to you.

This wouldn't be a problem if the telco's switches were programmed to dial

local numbers with a ``1'' prefix, stripping it for calls local to the

exchange.

In my experience telcos very rarely support dialing long distance without the 1 or dialing local with the 1.That's there way of making sure that you're aware that you're gonna get charged for the call.

I haven't even been able to find anybody in our telco that could

give me documentation on what's long distance, and what's local from our

exchange.

Getting that list is an absolute MUST.When I was up in King County I found most of this list from the front of the big thick tree-killer that they called a phone book.However, if you want to include (you probably don't as they're not likely to be fax) wireless numbers you're probably going to have to get this by requesting it by phoning them over and over and over until you get in touch with someone that can get it to you.Sometimes it takes me days of phone calls at various times in order to locate an employee competent enough to get that to me.Usually the numbers in the front of the phone book are enough to get you going.

Getting the dialrules file right has always been one of the biggest issues

when installing hylafax at a new location.

It's not fun, no.I'm not sure that there's a better way, though.

I've thought it would be nice to have xmlrpc server(s) which would return

the proper prefix when passed the local and destination area codes and

exchanges.

Another option might be to have the hylafax send program call an external

program, specified in the config file, that would take the called number as

an argument, and return the proper dial string.

In any case you still have to obtain a list of exchanges.I'm not sure that coding in dialrules is any harder than coding in shell or whatever.