Hayes Protocol
An intelligent modem or terminal adaptor can be controlled using special commands sent from the computer. Most devices recognise a standard set of commands known as the Hayes protocol, although this comes in numerous variations.
Most of the time your computer software and modem uses these codes without you knowing about it. However, in a communications application you can send commands to your modem manually. Each command string sent by the computer begins with
AT so as to bring the modem to attention.Dialling a Number
Here’s an example instruction that tells the modem to dial a number:-
ATDT*70,777-2424
These instructions are explained as follows:-
| AT | Attention |
| D | Dial a number… |
| T | … using tone dialling |
| *70 | Dials *, 7 and 0 to disable call waiting |
| , | Pauses for two seconds |
| 777-2424 | Dials number 777-2424 |
in which the letter
T could be replaced by a P for pulse dialling.
Here’s another example:-
ATDT9,1(323)444-7487
which breaks up into:-
| AT | Attention |
| D | Dial a number… |
| T | … using tone dialling |
| 9 | Dials 9 for outside line from office exchange |
| , | Pauses for two seconds |
| 1(323)4… | Dials number 13234447487, ignoring other characters |
Special Dialling Codes
Some telephone systems employ call waiting, a mechanism that alerts you to another incoming call by generating a bleep in the background. This is a potential nuisance if it happens whilst you’re using a modem. Depending on your country of origin, you can disable call waiting by using one of the following dialling sequences:-
ATDT*70nnnnn
ATDT*70,,nnnnn
ATDP1170nnnnn
ATDP1170,,nnnnn
where
nnnnn represents the number you’re dialling. The commas can be added if your phone system needs pauses in the dialling sequence. The letter Wshould be added at the end of a sequence if you need to persuade your modem to wait for dialling tone before actually dialling the number.
The following information applies to the United Kingdom:-
- Dialling
ATDT#43#nnnnn, wherennnnnis the phone number, disables call waiting. You can enable it again by dialling*43#. To find out if it’s enabled you can dial*#43#. - Dialling
*40*nnnnn#, wherennnnnis the phone number, makes a call as normal. However, the exchange rings you back afterwards, giving information about the time taken and the cost. - Dialling
1470,nnnnn#, wherennnnnis the phone number, ensures caller ID information is sent. This is necessary if your number is normally withheld but you use an ISP that provides a free service financed from call charges. Such ISPs usually have a number starting with0845. - Dialling
1471contacts whoever last rang you. Dialling1571gives you access to BT Answer, a free ‘answering machine’ service that stores up to ten messages for up to twenty days.
Initialisation and Other Strings
A command string that sets up a modem for particular software is an initialisation string, whilst a string that temporarily modifies the settings for a particular call is a pre-dial initialisation string or pre-dial init. Finally, a deinitialiastion string is used by an application to restore those settings in a modem that existed before it received an initialisation string.
Standard Commands
Every Hayes protocol instruction consists of
AT followed by a succession of letters and numbers, all of which should be understood by the modem. For example, sending the following message:
ATA
and then pressing the Return key, instructs the modem to answer an incoming phone call.
There are many different commands, often varying with the type of modem. The following common commands must be preceded by
AT and followed by Return to make them work:-| Code | Command |
|---|---|
| A | Answer incoming call |
| C0 | Disable data compression |
| C1 | Enable data compression (default) |
| DPnnnnn | Dial number nnnnn using pulse dialling |
| DTnnnnn | Dial number nnnnn using tone dialling |
| E0 | Echo off (default) |
| E1 | Echo on (for person-to-person link only) |
| H | Hang up on caller |
| L0 | Modem speaker at lowest volume |
| L1 | Modem speaker at low volume |
| L2 | Modem speaker at medium volume |
| L3 | Modem speaker at high volume |
| M0 | Modem speaker off at all times |
| M1 | Modem speaker on whilst dialling |
| M2 | Modem speaker on at all times |
| O | Switch from command mode to normal operation |
| Q0 | Enable user's on-screen messages |
| S0 = n | Answer after n rings (if n = 0 you must use ATA command) |
| S6 = n | Wait n seconds for dial tone (default = 2) |
| S7 = n | Wait n seconds for other modem’s carrier tone (default = 30) |
| S8 = n | Pause n seconds for ‘,’ in dial string (default = 2) |
| S11 = n | Pause n milliseconds between each touch-tone dialling burst |
| V1 | Verbose messages (textual on-screen messages, not numbers) |
| W | Wait for dialling tone |
| X3 | Dial without confirming dial tone exists |
| X4 | Dial after confirming dial tone (‘CONNECT’ gives DTE speed) |
| Z | Reset modem to default settings |
| &A3 | Enable result codes for compression and protocol changes |
| &B1 | Look serial port speed to fixed rate (default) |
| &C1 | Use serial port CTS signal for flow control |
| &D0 | Ignore serial port DTR signal (default) |
| &D1 | Use serial port DTR signal |
| &D2 | Use serial port DTR signal to return to command mode |
| &D3 | Use serial port DTR signal to reset modem |
| &F | Reset modem to factory settings |
| &H1 | Enable serial port hardware flow control |
| &R2 | Use serial port RTS signal for flow control |
| &W | Save current settings as default |
As you can see, the commands come in two broad groups. Firstly, there are those that contain a letter, such as
M0 or H, often followed by a number. Within this group there are special commands that start with S followed by = and another number. Typically, the value of the number n ranges from 0to 27, although higher values are often used. Secondly, there are commands that begin with an &, followed by a letter, again often followed by a number.
A typical initialisation string contains a combination of the above letters and numbers in any order, although some modems may use numbers that aren’t mentioned above. Here’s a typical string:-
ATE0Q0V1X4&C1&D0M0
This makes slightly more sense when divided up as follows:-
AT E0 Q0 V1 X4 &C1 &D0 M0
Here are some other strings for you to consider:-
ATE1V1C0
AT&FE0&B1&H1&R1X4&A3S0=04S7=60&D2
AT&FE0W1Q0V1X4&C1&K3S95=1&D3S7=75S0=0
Your modem should also accept a pre-dial init that temporarily sets it up for a particular service. This kind of string ends with a
& and can look something like this:-
AT&F1S0=0E1M1V1X3W2&
In this example the code
X3 tells the modem to disregard dialling tone. This is necessary in countries such as Italy where the phone system doesn’t always provide such a tone.
Some modems accept commands for special services, such as this ‘Page me’ init string:-
AT&F0S37=5S4
Finally, if you really want to know the current settings of your modem you can enter:-
AT&V
A really horrible list of information then appears in the window of your communications application.
Special Commands
When working online you can send
AT commands to the modem by switching it into command mode. Just type +++, enter your commands and then return to online mode or normal mode by entering ATO. Similarly, if you want to make the modem hang up you can type +++ followed by ATH.
In addition, some types of modem accept really strange commands, such as:-
AT%C0
which turns off modem compression.
Those of a technical disposition may want to send control codes to the modem, as in:-
ATE1V1^M
where
^M represents Control-M, which is actually a standard CR (carriage return). The common codes are as follows:-| Code | Effect |
|---|---|
| ^C | Aborts current operation (Interrupt, also End of Text or ETX) |
| ^H | Deletes last typed character (Backspace or BS) |
| ^I | Completes file and folder names (Tab) |
| ^O | Stops communication (Abort output) |
| ^Q | Continues communication (XON) |
| ^S | Pauses communication (XOFF) |
| ^M | Terminates entry and starts execution (Carriage Return or CR) |
| ^Z | Marks End of file for text file (EOF) |
Messages
Most modems can send messages to the user or to the software that’s controlling the modem. In most instances the modem will be set up to createverbose messages that actually mean something in English, including phrases such as
RING, NO DIALTONE, NO CARRIER, ERROR, BUSY, NO ANSWER,CONNECT, CARRIER, PROTOCOL: LAP, PROTOCOL: MNP, PROTOCOL: ALT, COMPRESSION: V, COMPRESSION: MNP5, COMPRESSION, DELAYED, REL, ARQ, COMP,V42, 42BIS, V42bis, MNP, MNP5 or any speed rate expressed in bit/s. With most modern software you don’t actually see these messages but they’re acted on by the application that’s in use. In order to force your modem to send verbose messages you should send it a V1 command.Modem Scripts in the Classic Mac OS
A modem script, also known as Connection Control Language (CCL) script, can be used to automate the setup and control of a particular type of modem or terminal adaptor. In the Classic Mac OS, each script file must go in the Modem Scripts folder, inside the Extensions folder in the System Folder. It then appears in the menus inside the Remote Access or Modem control panels and also in any application that uses Apple’s standardCommunications Toolbox (CTB). Such a file will also appear in the PPP control panel used in older versions of the Classic Mac OS. Note that some older applications may prefer to store these scripts as loose items in the Extensions folder.
In most instances you’ll find that a modem script for your modem has already been provided along with the system. If not, you should be able to get one from the supplier of your modem, assuming they support the Mac OS. Failing this, you may have to create a modem script of your own. To do this you can use Apple’s Modem Script Generator application.
You can also modify a script using a suitable text editor, although to be on the safe side you should work on a copy of the original file. Unfortunately, some editors can’t open modem script files, since they have a type code of
mlts. To fix this problem you can use a file utility such as FileTyper to change the code to TEXT. Having done this, you should be able to view the contents in your editor. To modify the modem initialisation string you should proceed as follows:-- Locate the line of text that reads
@LABEL 3. - Find the line beneath the above that begins with
AT, ignoring all of the ‘comments’ lines that begin with!. You should see something like this:AT&F1&D0&H1&R1&B1S0=0EOV1Q0&A3S7=60L3\13Now, if, for example, you want to set your modem’s volume to the lowest setting you should replace theL3near the end of the string byL0. - Having made any necessary changes you can save the file. If you’ve changed the file’s type code you’ll need to use the file utility one more time to change it back again.
Distinctive Ring Service
Some phone companies provide a Distinctive Ring Service (DSR), where different phone numbers operate over a single phone line but with a different ring. Mac OS X 10.3, when used with a compatible modem, can identify such rings and use them, for example, to identify all fax calls. This behaviour is set by the fax configuration script at
/usr/bin/fax, which you can edit in the Terminal application by means of pico or a similar text editor. First, enter the following:-
sudo pico /usr/bin/fax
You should then locate the following line (usually line 209):-
INIT="-iZ -i&FE0&D2S7=120 -i&C0"
which contains a normal modem initialisation string. You should change this to
INIT="-iZ -i&FE0&D2S7=120 -i&C0-SDR=n"
where
n must be replaced by a number, usually 1 for a normal ring, 2 for the first distinctive ring, and so on.
No comments:
Post a Comment