A connect-script for diald

A rant about freeserve, first

At the moment, while waiting for ADSL, I'm connecting to the Internet via Freeserve. Aside from the 2hr disconnects (which seem to be pretty standard in the UK), they seemed to be a suitable bunch for connecting a small network with a Linux machine running diald with ipchains-based masquerading.

Then came the bad news. The "Freeserve Connection Kit". Available for people running windows, and mac. But not Linux. Freeserve say they're reducing capacity on the numbers they were issuing, presumably to coerce everyone into using the connection kit. Of course, first reaction was to ignore it. Next was to notice that it was starting to take annoyingly long times to establish a dial-up session; which doesn't bode well for keeping up with a conversation on IRC.

The solution

Well, a few things have mitigated the situation somewhat. 1) I'm running diald on linux, a notoriously open system, and 2) diald allows (well, requires) you to specify an external command to dial the modem.

So, all you do, is write a connect script that will try a series of numbers, and find the numbers. Said numbers can be found on the Unofficial Frequently Asked Questions page.

I have written a suitable script, reasonably trivially, here. As with some of the other miniscule stuff I've felt the desire to release, it can be used/abused under the terms of the GPL. I also don't expect to update it; it works for me. If you need further flexibility, might I suggest you look at diald v2?

No README or anything is included; inside the bzip2ed tarball is 3 files. One is a list of the 0808 numbers from the UFAQ site, the next is the connect script. The pertinent option in diald.conf is "connect". You should edit the first few lines of the script to specify where you want the script to read the numbers from, and where you want the script to maintain the sequence file. Probably, the sequence file should be in /var, the script in a /usr/sbin/, and only the list of numbers in /etc; pure laziness led me to stick everything in /etc/diald. Looking at the script, you'll see it needs awk, chat, logger, as well as cat, echo, and expr. The chat manpage documents the \T substitution; basically take the chat-script you're using now, and replace the telephone number with \T. The last file is the script I happen to use with a US Robotics Sportster Flash.

At the time of writing, the release version of diald is version 1. version 2 pre-release code can be found in their CVS repository.

Bugs? Well, the error handling stinks; an error will merely cause it to move onto the next number. If for any reason, the sequence file doesn't get created, it will continually use the first number. The sequence file isn't created if the first number always works. Read the logs to see what's going on; you should be able to figure it out from there. Comments or extra white space in the numbers file isn't handled; you may dial odd numbers. Neither is comments in the sequence file. I strongly advise you check what it's doing very carefully until you're convince it's working stably. killall chat will simulate a failure. This should appear in the log. No handling is done to dial another number should all the listed numbers fail; it'll just keep going round in loops. Neither will it automatically move on if one number keeps succeeding; putting a pay-per-minute number in the list is probably a terribly bad idea!

If you want to e-mail me, please visit my contact page.

Iains Page