Wednesday, 15 June 2016

Computers and Telephone Detail and Control

Computers and Telephone Control

Some telephones can be connected to a computer, sometimes via an RS-232 serial port, allowing information about calls to be sent to the computer and enabling the machine to take control of the telephone. The computer can answer calls like an answering machine or operate as a speakerphone.
  • Some G3-based Macs can only sample sounds at 44.1 kHz, which can make them incompatible with speakerphone software.
The Telephony Application Programming Interface, also known as Telephony API or TAPI, is built into Windows 95 and later systems, giving appropriate applications access to a connected telephone. Other operating systems often don’t include such a mechanism, although you may be able to use Java TAPI or JTAPI with selected applications on your machine.

Telephones in Detail

The information in this section is provided purely for reference.

Telephone Basics

A telephone allows speech to be conveyed over a pair of wires, the latter being of the same form as those used for older telegraph signals. Traditionally, an analogue signal is used, although digital technology is used in newer systems. The following diagram shows one very early form of telephone:-



Each carbon microphone consists of a capsule containing carbon granules that are attached to a diaphragm. When the latter vibrates with the sound of a speaker’s voice, the electrical resistance of the granules changes, causing variations in the electrical current flowing around the circuit. These variations can then be heard in both of the moving-coil earpieces.
The speaker can also hear his or her own voice, an effect known as sidetone. This is essential, since it confirms that the phone is working. However, in the simple circuit shown above, each speaker is almost deafened by the sidetone.
A later development is the field telephone, as shown below:-
This uses an anti-sidetone induction coil (ASTIC) to reduce sidetone. When someone speaks into the phone, the voltage across the resistor opposes that produced by the ASTIC. However, when signals are received from the line the two voltages help each other. Modern phones work in the same way, but employ more sophisticated technology in place of an ASTIC.
The field telephone uses a battery in both instruments, ensuring communication in at least one direction. For convenience, modern telephone exchanges contain a central battery, with telephones wired as shown in this simplified diagram:-

The retard coils prevent any speech signals from reaching the battery, whilst the pair of capacitors allow such signals to reach their destination via the exchange’s switching system. The exchange also sends a ringing signal to the phone as an alternating current (AC) signal, typically at 80 volts (V). In the UK, this is at a frequency of 17 Hz, often generated by a syncycle, which divides the domestic 50 Hz mains frequency by one-third.
Older telephone equipment uses pulse-dialling, involving repeated shorting-out of the phone line. The earliest devices have a rotary dial, although more modern instruments employ electronic circuitry. The diagram below shows the circuit of a standard rotary-dialling phone in simplified form:-

As you can see, the phone’s cradle switch disconnects much of the instrument when it’s not in use, whilst the dialler off-normal (DON) contacts prevent any unpleasant noises in the earpiece during dialling. The dialling contact is normally closed, but during dialling it opens for around 67 milliseconds (ms) with intervening opening periods of about 33 ms. As shown, the circuit used by the AC ringer is isolated from the direct current (DC)used for speech by means of a capacitor. The latter is usually fitted in the master socket (see below) and is shared by all the instruments on a line.
Fortunately, some of these complications are obviated by modern telephones and exchanges that support tone-dialling, where special tones are sent to the exchange for each number that’s dialled.
The following table shows the impedance of typical telephone components:-
ComponentImpedance (Ω)
Line Holding Coil750
Speech Retard Coil80 + 80 (Twin Coil) •
Internal Ringer or Indicator500
External Ringer or Indicator500 + 500 (Twin Coil)
Hand-ringing Generator500
 Slit nickel-ferrite sleeve wrapped around coils, ensuring high impedance at speech frequencies

Telephone Connections in Detail

The 6-way modular connector that’s used in the UK is shown below:-

The instrument cable fitted to such a plug is wired as shown below:-
PinWire ColourCircuit
1BlackBusiness Telephones only
2WhiteLine (B)
3GreenEarth (for recall button)
4BlueRinging (anti-tinkle)
5RedLine (A)
6OrangeBusiness Telephones only
although most devices are only wired onto pins 2 to 5. The corresponding socket should be connected to permanent cables, which are usually wired as follows:-
PinWire ColourCircuit
1Green with White ringsBusiness Telephones only
2Blue with White ringsLine (B)
3Orange with White ringsEarth (for recall button)
4White with Orange ringsRinging (anti-tinkle)
5White with Blue ringsLine (A)
6White with Green ringsBusiness Telephones only
Once again, pins 1 and 6 are frequently left unconnected.
The original Post Office Series 700 telephone, as used in the UK, contains two rows of connection tags; an upper row containing tags 1 to 9 and a lower row containing 10 to 19. These should be wired to the incoming cable as shown below:-
Wire ColourCircuitTags
WhiteLine (B)16, 17, 18 and 19
GreenEarth (for recall button)12
BlueRinging (anti-tinkle)5 and 6 •
RedLine (A)8
 3.3 kΩ resistor should be fitted between tags 4 and 5. No other links should be fitted.

Master and Slave Sockets

The incoming circuit to your premises is usually provided at a master socket or a special connection box. Usually this is owned by and installed by the telephone company, and is fitted with spark suppressors to give limited protection from the effects of lightning. In the UK, it also incorporates a capacitor and a resistor for the anti-tinkle feature.
Only one master socket should be fitted to a line. All other sockets should be secondary sockets, also known as slave sockets, that lack the extra components found in a master socket. The wiring from the master socket to all of the slave sockets should be made up using two-pair (four-core) or three-pair (six-core) unscreened twisted-pair cable.
  • Master and slave sockets come in single or twin versions in flush or surface-mounting styles.
  • A type 10/3A splitter allows two telephone instruments to share a single socket. To connect an answering machine or another device thatintercepts the phone line you can use a plug-and-socket device known as a Keats adaptor.
  • The number of instruments connected to a phone line is limited by the ringer equivalent number (REN) of all the devices. To find out your total REN simply get the REN for each device (often printed underneath the instrument or in its manual) and then add up the numbers for all the instruments. In the UK this number shouldn’t exceed 4. If your figure comes to more than this, your phones may not ring properly or their performance may be compromised.

Hayes Protocol

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:-
ATAttention
DDial a number…
T… using tone dialling
*70Dials *, 7 and 0 to disable call waiting
,Pauses for two seconds
777-2424Dials 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:-
ATAttention
DDial a number…
T… using tone dialling
9Dials 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, where nnnnn is 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#, where nnnnn is 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#, where nnnnn is 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 with 0845.
  • Dialling 1471 contacts whoever last rang you. Dialling 1571 gives 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:-
CodeCommand
AAnswer incoming call
C0Disable data compression
C1Enable data compression (default)
DPnnnnnDial number nnnnn using pulse dialling
DTnnnnnDial number nnnnn using tone dialling
E0Echo off (default)
E1Echo on (for person-to-person link only)
HHang up on caller
L0Modem speaker at lowest volume
L1Modem speaker at low volume
L2Modem speaker at medium volume
L3Modem speaker at high volume
M0Modem speaker off at all times
M1Modem speaker on whilst dialling
M2Modem speaker on at all times
OSwitch from command mode to normal operation
Q0Enable user's on-screen messages
S0 = nAnswer after n rings (if n = 0 you must use ATA command)
S6 = nWait n seconds for dial tone (default = 2)
S7 = nWait n seconds for other modem’s carrier tone (default = 30)
S8 = nPause n seconds for ‘,’ in dial string (default = 2)
S11 = nPause n milliseconds between each touch-tone dialling burst
V1Verbose messages (textual on-screen messages, not numbers)
WWait for dialling tone
X3Dial without confirming dial tone exists
X4Dial after confirming dial tone (‘CONNECT’ gives DTE speed)
ZReset modem to default settings
&A3Enable result codes for compression and protocol changes
&B1Look serial port speed to fixed rate (default)
&C1Use serial port CTS signal for flow control
&D0Ignore serial port DTR signal (default)
&D1Use serial port DTR signal
&D2Use serial port DTR signal to return to command mode
&D3Use serial port DTR signal to reset modem
&FReset modem to factory settings
&H1Enable serial port hardware flow control
&R2Use serial port RTS signal for flow control
&WSave 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:-
CodeEffect
^CAborts current operation (Interrupt, also End of Text or ETX)
^HDeletes last typed character (Backspace or BS)
^ICompletes file and folder names (Tab)
^OStops communication (Abort output)
^QContinues communication (XON)
^SPauses communication (XOFF)
^MTerminates entry and starts execution (Carriage Return or CR)
^ZMarks 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 RINGNO DIALTONENO CARRIERERRORBUSYNO ANSWER,CONNECTCARRIERPROTOCOL: LAPPROTOCOL: MNPPROTOCOL: ALTCOMPRESSION: VCOMPRESSION: MNP5COMPRESSIONDELAYEDRELARQCOMP,V4242BISV42bisMNPMNP5 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

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:-
  1. Locate the line of text that reads @LABEL 3.
  2. 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\13
    Now, if, for example, you want to set your modem’s volume to the lowest setting you should replace the L3 near the end of the string by L0.
  3. 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.