Telephony Application Programming Interface. This cool piece of Windows 95 lets you use
modems and other communication devices easier. Under TAPI, it's possible to change
devices, for example, and not have to re-configure every piece of software to work with
it. You can set up a single set of dialing rules, or multiple dialing rules based on your
location, and the apps are smart enough to dial long distance as required. You can run a
modem answering program, and quickly dial out or send a fax without having to shut down
the answering program.

I really like TAPI because of cool features like that. Microsoft extended TAPI to
include SmartRing (TM) compatibility and voice capability in UNIMODEM V, available with
the Win95 Service Pack. Super cool.

Install a "modem driver" first. To do this, run Control Panel/Modems and have
it look for your modem. Win95 will then send "AT" to all the COM ports and look
for an "OK" response. It will then query the modem's I registers to try to
identify it. Then it picks an appropriate driver and asks you to confirm it, and gives you
a chance to change it, or replace it with one from a disk. When all this finishes, a new
"Modems" class of devices will appear in Device Manager.

I use "driver" in quotes because the modem really doesn't need a piece of
program code unique to it. I refer to a "modem driver" as the .INF file which
describes how to communicate to the modem. Most standard data and fax modems only require
this info file. Non-standard modems and voice modems installed via UNIMODEM V, however,
will add extra software, libraries, and executables. In this case, "driver"
really refers to extra software.

Finally, if this is the very first time a modem found its way into your computer, Win95
will ask you about your location (what country, what area code, any special codes needed
to get to an outside line, etc). One thing: If you live in North America and you DON'T
live in the United States, PLEASE pick a different country besides "United States of
America". Pick your appropriate country. Sometimes, when you install a PnP modem for
the first time it doesn't let you define your location, so go to Control Panel / Modems
and set your location.

Now that you have the modem available, run any Win95 application that uses modems. For
a quickie test, run HyperTerminal, which comes with Win95. Immediately, this program asks
you for a connection name, and the modem you wish to connect with (If you have multiple
modems, you may pick one from the list). For this quickie test, when the "Dial"
requester comes up, just hit "Cancel". This goes to the terminal screen where
you can type "AT" yourself and expect an "OK" response. If this works,
great. You can then try calling your local BBS by feeding its number to the connection
setup and having it dial.

You probably noticed cool buttons like "Calling from:", "Dial
Properties", and the like. I get into all this cool stuff in the next sections.

This is the obvious thing to want if you use Win95 from your office. Run Control
Panel/Modems, hit Dialing Properties, and check out the "To access an outside
line" boxes. Type in the appropriate keys you'd normally press on your phone's keypad
into these boxes. Insert a comma after this code to insert a five second pause. For
example, "9," dials nine then waits five seconds before dialing the outside
number. Remember that "," because you need to let your phone system switch to an
outside line before you start dialing. The "," is typically a five second pause
but this may vary depending on the modem type.

If you have a unique code for dialing long distance in your office, you can put it in
there, but don't include the standard "1" because TAPI does this already.

Thanks to Wouter Pinkhof for verifying these rules in Belgum; they do work outside of
North America.

You probably noticed an area code box in the phone number requesters you get in Win95
modem apps. Normally the apps insert your current area code (the area code for your
current location). To make the program dial long distance, change the area code. Also make
sure you have "Use country code and area code" if the program has such a switch.
The app will automatically insert the "1" (or whatever your country code is) and
any pre-dial instructions needed to get to an outside line.

If the number you're dialing is long distance but in the same area code, use the
program's "Dial as a long distance call" switch. HyperTerminal, Dial-up
networking, and WinFax Pro 7.0 have switches like this. Other programs such as MS Fax let
you do this in the person's phone number entry (with a switch like "Dial area code
even though it's the same as mine") or set long distance rules by dial prefix. How a
program dials long distance for same-area-code numbers depends on the program.

Maybe you have the "Dial area code" or "Dial as a long distance
number" switch turned on for that connection or number. Check with the app's manual
for setting this switch. If you're dialing a local number, make sure you turn off this
switch.

You might've used a different area code in your dialing location than in the number
you're dialing. Check to see that the area codes match. This is the only way that Win95
knows how to distinguish a long distance call from a local one.

Also, and this is quite common in Canada, maybe you specified "United States"
as your country, either in your location properties or in the number itself. Set the
country appropriately. If the country is different, even if the country code and area code
are the same, it will try to dial the number as long distance. Apparently, 4.00.950B will
catch this mistake (as long as the country code matches, not necessarily the country
NAME).

Bring up dialing properties again, and hit the switch saying "Use calling
card". Then hit the "Calling card..." button. In the US and Canada, the
most common is "Calling card via zero" but Win95 comes with calling card
settings for most of the major long distance carriers. The calling card setting is great
if you're dialing from work, but you don't want to cost the company for your personal
calls.

Calling card settings are part of your dialing location, and each location may use a
different calling card setup. This is great for notebook users who may plug into a hotel's
phone system, or a branch office's system, or a customer's system so you don't make the
customer pay for your phone call.

A lot of weird long distance companies came out of the woodwork up here in Canada, and
many of them have bizarre calling card setups. To create a card setup for your long
distance company, first figure out what you'd have to do to dial the number normally (like
dial an (800) number or something, followed by a user code, followed by the number, or
whatever) including the length of time between blocks of numbers. Then in the Calling Card
requester from the last section, hit "New...". Give this new card a name.

Now you'll get three text fields to insert your dialing rules. Right-click on one of
them and hit "What's this..." to get a list of commands you can insert into
these boxes. Without a special dialing sequence (IE: Direct Dial), the defaults for these
would be:

Local Calls: G
Long Distance Calls: 1FG (This'll be "EFG" outside of North America)
International Calls: 011EFG (the "011" may be different outside of NA)

The "G" is the local number, the "F" is the area code, and the
"E" is a country code. The other keys you can use include dialable digits
(including the * and # keys), commas for pauses, a calling card number itself, and so on
and so on.

Use this basic sequence and insert the extra keys you need to press. For example, to
dial long distance calls with a calling card via zero, you would replace the "1"
in the long distance rule with a "0", then after the "G" you insert
some pauses and then the calling card number. Right-click on any of these boxes and hit
"What's this" to get a list of valid keys you can insert into these boxes.

Finally when you're satisfied, hit "OK" to save the card. You can go back and
edit this calling card later.

If the long distance company uses voice prompts, be extra sure to include pauses for
the duration of the voice prompts. Use commas "," to insert five second pauses.
Also, if you normally get a "Thank-you" message at the end, insert pauses at the
end so the modem doesn't try to recognize it as a voice answer and hang up on you.

Don't forget to tell the program that this number is a long distance number. Again,
this varies between programs. When you tell the program it's a long distance number, it
will use the long distance dialing rule instead of the local rule. MS Fax can do this by
number prefix; other programs let you do this per-number.

It's also possible you have a pre-release of Windows 95. Some early versions would only
just dial the "1" followed by the number, without inserting the area code. If
you get this symptom, you might have a pre-release, developer's, or other bogus copy of
Win95. Get your disks or CD replaced and re-install Win95 to fix this. Apps call on
TAPI.DLL or TAPI32.DLL to generate the string of digits.

If you have to use this broken copy of Win95, you can fake your own area code so it's
different than the number you're dialing, and then the app will insert the area code. I
don't recommend this kluge at all; you should replace your Win95 copy as soon as you can.

This is so the app (and TAPI.DLL) knows not to insert the "1" and area code
before the number. Apps will automatically insert your current location's area code for
you, so normally you don't have to worry about this.

If you need to dial long distance within your area code, tell the app that the number
is a long distance number, and it will insert the "1" and area code for you.
Proper Win95 programs offer a "Dial as long distance number" option for this.

To use all this advice and work outside of North America, swap the "1" with
your country code, and "Area Code" with your city code. Otherwise all the same
rules apply. Again, thanks to Wouter Pinkhof and Vu Tien Khang for input here.

In Calling Card setups you may have to be especially careful with the country code.
Substitute the "1" for your country code, or just use "E" which uses
your target's country code.

To create a new location, go to that Dialing Properties screen and hit "New
location". Many TAPI apps provide a Dialing Properties button which opens your
location's properties. Each new location can have its own area code, country code,
dial-out access rules, even calling cards. Be sure to set each of these when you create a
new location. This is pretty cool because you can keep the number entries themselves the
same, and TAPI knows to use different dialing rules depending on your location.

Apps will let you pick your dialing location just before you dial your number. When you
swap locations the digit string will change to reflect your current location. The one
exception is MS Fax, which asks you for your location when you run the New Fax Wizard.

To turn off call waiting for the duration of this call, bring up your dialing
properties and turn on "This location has Call Waiting, to disable it dial..."
and type the string needed to disable call waiting. The drop-down list gives many
variations of "*70" to choose from. Most tone-dial systems use *70, and most
pulse dial systems will use 1170.

I heard of some American communities that make you dial "204 555-1212"
(without the "1") to dial the local number "555-1212" for example.
Win95 doesn't support this right out of the box, but you can set up a bogus "calling
card" to enforce this ten-digit-dialing rule.

In your location properties, turn on "Dial using calling card..." and hit
"New" to make a new calling card. Use these dialing rules:

Local Calls: FG
Long Distance Calls: 1FG
International Calls: 011EFG

The "FG" in the local calls rule will insert the area code for all local
calls.

MS has other ten-digit-dialing suggestions in KB article Q129049, but
this one keeps the rest of the TAPI benefits, like turning off call waiting, or using dial
prefixes to get to outside lines, or using third party calling cards.

TAPI works both ways. Programs that dial out don't access the COM ports directly,
rather they access a TAPI device which communicates on behalf of the COM port.

This logic applies to answering programs too. Really, it's TAPI that detects the ring,
then alerts the answering program and then that program communicates via TAPI to pick up
the phone and start communicating. This has nothing to do with apps talking to COM ports.

Because the answering programs communicate via TAPI, an outside program can jump in and
use the TAPI device without the answering program even knowing about it. It's waiting for
a signal from TAPI to answer the phone, and that won't happen while the other program's
using the modem.

Only the newest class of modems (the voice modems) can do this. To do this, obtain one
such voice modem, and download UNIMODEM V from Microsoft's web site.

Once you installed all this, a little applet called "Operator Agent" will
invoke the appropriate app to answer the phone. Because the apps themselves are waiting
for TAPI signals, rather than signals from the COM port itself, Operator Agent can signal
the appropriate app depending on the ring. The Agent does its job by sending a voice
message to the caller, asking them to press a key from 1 to 3 for voice, fax, or data. It
then alerts the appropriate program.

Alternately, you can use Distinctive Ring instead of the Operator. If your modem
supports SmartRing (USR's Vi, Compaq's Presario modems, and IBM's MWAVE are some SmartRing
capable modems) and you have more than one phone number for your phone line, you can
configure what kind of program answers what kind of ring. Bring up the Modems control
panel and bring up properties for your modem. You'll notice two new tabs (if your modem
supports them): "Distinctive Ring", and "Call Forwarding".

Distinctive Ring lets you specify what kind of program (either Voice, Fax, or Data)
answers a particular ring. The ring choices may be as simple as "one ring, two rings,
three rings", or may use a kind of Morse Code (with intermixed long & short rings
if your modem supports that). Once you specified what ring goes with what kind of app, OK
it, then launch your answering apps. NOTE: TAPI apps identify themselves as one of
these three kinds of programs when they open a TAPI port, so you don't need to worry, for
example, if you replace MS Fax with WinFax Pro 7.0.

Call Forwarding lets you forward calls to a different number when you dial out using a
TAPI dial-out client (HyperTerminal, or for sending a fax, or for Dial-up Networking).
Specify here what kind of code you use to forward your calls, and hit OK. The system will
issue the call forwarding command when you dial-out, and undo it when you disconnect.

The Distinctive Ring options won't kick in until you launch more than one kind of
answering program. However, they don't require an external applet to monitor the phone
line with.

Yes. Depending on the kind of call, determined by Operator or SmartRing, TAPI will
alert the correct program.

NOTE: This is an interesting bug in UNIMODEM V. If you use Operator or SmartRing
without running some kind of voice message app, the system will patiently wait for a voice
messaging app to answer the phone. In fact, it will wait forever (or at least until you
try to dial-out, then it will reset the "Ring Monitor" and all is well again.)
If a call for Data or Fax comes in, it will answer correctly, until the next voice call
comes in.

I'm waiting for someone to write a "fake" voice messaging app that only
resets the ring monitor when a voice call comes in. This way, you can take advantage of
SmartRing or the Operator without shelling out big bucks for a voice mail app, or you can
answer the voice calls yourself, so the Fax and or Data servers can still operate.

Visit http://support.microsoft.com/support/kb/articles/q183/3/17.asp
to get the updates. To Install UNIMODEM V, use Add/Remove Programs/Windows Setup and Have
Disk... or find the UNIMDM.INF file, right-click on it and hit "Install". Then
you might want to try re-detecting your modem, or choose from the additions to the modem
list to find your voice modem.

Of all the clone modem chipsets UNIMODEM V supports, USR's Sportster Vi isn't among
them. However, USR does have an updated .inf file to install the Sportster Vi software,
which I point to at the bottom of this page.

4.00.950B users will already have UNIMODEM V built in. NT Workstation 4.0 also includes
it.

Microsoft has an ISDN Accelerator Pack that sets up an ISDN modem as a TAPI device,
allowing you to use dial-up networking over that connection. Visit the Service Pack 1 home
to download it. 4.00.950B users have this update already.

ISDN modems don't occupy a physical COM port like standard modems, so don't expect it
to work with non-Win95 apps. Getting ISDN into your home is tricky business too, depending
on some local phone company attitudes. BC Tel is quite touchy about the subject here in
Vancouver. Anyway, when you straighten out the needs with your phone company, you can get
any number of ISDN devices for your PC, and use this ISDN driver to use it.

This came up thanks to the efforts of Gordon McAndrew (gmcandrew@aec.env.gov.ab.ca),
who originally posted about using PPP over packet radio.

The solution was to use the null modem .INF file and issue commands directly to the
radio device in a dial-up script. Unfortunately, Win95 insisted in sending a phone number
string through the connection. They worked around this by inserting the user name into the
space normally reserved for the phone number. Strange, huh?

I don't know the command set used for packet radio modems, but I'd like to see a packet
radio .inf file made up one day. For example, enter the radio frequency in the phone
number box. Replace all the "AT" commands with appropriate ones for the radio.
Thanks to Gordon McAndrew's work, we already know that PPP and TAPI in general does work
over such a device.

I covered this already in Chapter 8, but I'll cover it here. There's a MDMCBX.INF file,
used to identify the device to Win95, that lets you install a Direct Connection driver on
a standard COM port. This can work with stuff besides dial-up networking. To install it,
use Add New Hardware or the Modems control panel, and hit "Have disk..." so you
can point to this .inf file.

These started cropping up. TAPI lets you use any kind of telephony device, not just COM
port based modems, so it became fashionable to make "software" modems, or
non-standard PnP modems that don't occupy a standard COM port address. To install this
class of modem, hit "Have disk..." and feed it the disk with the drivers for the
modem.

If you can live without Win 3.1 or DOS support for these devices, they will work just
fine with Win95 apps. In many cases they do create a DOS style device (like COM5: if you
happen to already have four COM ports) than you can access from DOS or OS-friendly Win 3.1
apps that support non-standard devices. In other cases they will just show up as a TAPI
device without any DOS support. Be prepared to stick with Win95 apps (a good idea in any
case) if you purchase such a modem.

The original COMM.DRV still exists, and if a Win 3.1 app opens a COM port through this
device, TAPI won't try to open it. You won't have any of the TAPI benefits with this app,
and you'll have to manually configure its dialing properties, manually close it so other
TAPI apps can use the modem, etc...

Non-standard COMM.DRV replacements usually won't interfere with TAPI, because TAPI does
not refer to this device at all. In fact, there are separate VxDs and SERIALXX.DLL files
(and the TAPI.DLLs of course) for 32-bit access to COM ports. The non-standard driver
better not be calling un-supported stuff in Win95 though.

In general, try to avoid Win 3.1 modem apps. As much as I lay the crap on WinFax Pro
7.0, for example, it's a far better solution than WinFax Pro 4.0 for Win 3.1. Hold out as
long as practical for Win95 voice mail apps too, so there's no argument between
non-standard apps trying to use the modem and conflicting with TAPI. Win95's supposed to
make using modems easier, and Win 3.1 modem apps don't help at all.

5.11.1. My Win 3.1 modem app claims to use TAPI. Will it work with Win95?

I haven't seen a 16-bit TAPI app yet. Apparently they exist, because one reader wrote
about it.

There are references in the Win95 resource kit to 16-bit TAPI programs, and the 16-bit
TAPI.DLL and TELEPHON.INI files. I gather that they will work as long as they use this
interface to communicate with the modem. Like Win95 TAPI apps, if this Win 3.1 app has an
auto-answer function, it should "nicely" give up the modem when you try to use
it for other connections, like Dial-up Networking. You also don't need to specify the COM
port where the modem lives; only its name from the list of installed modems.

This one reader's app comes with a version of TAPI designed for Win 3.1, and it seems
to interfere with Win95's Unimodem TAPI service. Microsoft documented in KB articles Q120221 and Q150280, how to
edit or rebuild the TELEPHON.INI file, and how to enable the Telephony control panel. In
particular, the Telephony control panel can remove 16-bit TAPI providers from your system,
allowing 16-bit TAPI apps to use the 32-bit Unimodem Service Provider.

Not to worry. Win95 apps will look in an entry in SYSTEM.INI called
"TelephonINIChanged=" followed by a date. If the app notices that this date is
later than the last time you changed any TAPI settings, it will ask you to re-confirm the
new settings.

Each TAPI device has a unique port ID with it. If you remove and add a modem, or you
remove and re-add the same modem driver, this port ID will change. Well written Win95
modem apps will check this and offer to let you select (or re-select) your modem. One
exception of course: WinFax Pro 7.0 does not do this. After you change your modem, go to
WinFax's modem config screen and re-select your TAPI modem to allow it to work again. MS
Fax does this re-selection automatically, and picks the first available TAPI device
without your intervention. If you want to use a different modem though, check the MS Fax
modem settings and select the modem you want to use.

Most likely because you changed your modem. Just make sure you select (or re-select)
the modem you want the app to use. The app will save this new modem choice (and its TAPI
port ID) and use it until the next time you change it.

In many cases, this is because the modem does not have a good description of itself in
its S registers. You can change the modem type during the Add Modem wizard by hitting the
"Change..." button and selecting your correct model. Win95 comes with a lot of
modem .INF files that otherwise fit into the "Standard modem" category.

If your modem isn't listed (like the newest voice modems), download UNIMODEM V from
MS's Web site, or check out the other modem .INF files available at the same site. Also
check the manufacturer's web site for updates. You can probably still use the modem with
the "Standard modem" driver (if it's a Hayes (TM) compatible modem) in the
meantime. Or if you feel really adventurous, try editing one of the existing .INF files to
create a descriptor for your modem, and save it with a unique name.

USR updated their web site to include FTP links to all their modem drivers, including a
WAVE driver for the Sportster Vi modem's voice record and playback. All these links go to
USR's FTP site at ftp.usr.com