⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch23.htm

📁 MAPI__SAPI__TAPI
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<html>

<head>
<title>Chapter 23 -- TAPI Architecture</title>
<meta NAME="GENERATOR" CONTENT="Microsoft FrontPage 3.0">
</head>

<body TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<!-- Spidersoft WebZIP Ad Banner Insert -->
<!-- End of Spidersoft WebZIP Ad Banner Insert-->

<h1><font COLOR="#FF0000">Chapter 23</font></h1>

<h1><b><font SIZE="5" COLOR="#FF0000">TAPI Architecture</font></b> </h1>

<hr WIDTH="100%">

<h3 ALIGN="CENTER"><font SIZE="+2" COLOR="#000000">CONTENTS<a NAME="CONTENTS"></a> </font></h3>

<ul>
  <li><a HREF="#AssistedTelephonyServices">Assisted Telephony Services</a> </li>
  <li><a HREF="#BasicTelephonyServices">Basic Telephony Services</a> <ul>
      <li><a HREF="#TheBasicTelephonyLineDeviceAPISet">The Basic Telephony Line Device API Set</a> 
      </li>
      <li><a HREF="#TheBasicTelephonyLineDeviceStructur">The Basic Telephony Line Device 
        Structures</a> </li>
      <li><a HREF="#BasicTelephonyLineDeviceMessages">Basic Telephony Line Device Messages</a> </li>
    </ul>
  </li>
  <li><a HREF="#SupplementalTelephonyServices">Supplemental Telephony Services</a> <ul>
      <li><a HREF="#SupplementalTelephonyAPIforLineDevi">Supplemental Telephony API for Line 
        Devices</a> </li>
      <li><a HREF="#SupplementalTelephonyAPIforPhoneDev">Supplemental Telephony API for Phone 
        Devices</a> </li>
      <li><a HREF="#TheSupplementalTelephonyPhoneDevice">The Supplemental Telephony Phone Device 
        Structures</a> </li>
      <li><a HREF="#TheupplementalTelephonyPhoneDeviceM">The Supplemental Telephony Phone Device 
        Messages</a> </li>
    </ul>
  </li>
  <li><a HREF="#ExtendedTelephonyServices">Extended Telephony Services</a> </li>
  <li><a HREF="#Summary">Summary</a> </li>
</ul>

<hr>

<p><font COLOR="#000000">In this chapter, you'll learn how the Telephony API is organized 
and how its various function calls are used to provide TAPI services to Windows 
applications. You'll learn about the four different levels of TAPI services:</font> 

<ul>
  <li><i>Assisted Telephony</i>-This is the simplest form of TAPI service. </li>
  <li><i>Basic Telephony</i>-This provides basic in- and outbound telephony services for a 
    single-line phone. </li>
  <li><i>Supplemental Telephony</i>-This provides advanced telephone services such as hold, 
    park, conference, and so on, to single and multiline phones. </li>
  <li><i>Extended Telephony</i>-This provides a direct interface between Windows programs and 
    vendor-specific TAPI services. </li>
</ul>

<p>You'll also learn how these levels of service are implemented using API calls and how 
they work together to provide complete TAPI services, from a simple <tt><font
FACE="Courier">Dial</font></tt> button, through handling inbound and outbound calls, to 
acting as a switchboard in a multiline setting, and finally to providing access to 
vendor-specific features of telephony cards. </p>

<p>When you complete this chapter you'll understand how the Telephony API is organized and 
how you can use it to add telephony services to your Windows applications. </p>

<h2><a NAME="AssistedTelephonyServices"><font SIZE="5" COLOR="#FF0000">Assisted Telephony 
Services</font></a></h2>

<p>The simplest form of TAPI service is <i>Assisted Telephony</i>. Under the Assisted 
Telephony interface, programmers can place outbound calls and check the current dialing 
location of the workstation. This type of telephony service can be used to provide a 
simple <tt><font FACE="Courier">Dial</font></tt> button to existing applications or add 
dialing capabilities to new applications that will use telephony as an added service. </p>

<p>In fact, the Assisted Telephony model only provides access for programs to request the <i>placement</i> 
of an outbound call. The actual dialing of the call is handled by another Windows/TAPI 
application. The default application is <tt><font FACE="Courier">DIALER.EXE</font></tt>. 
This application ships with the Windows TAPI SDK and is part of the Windows 95 operating 
system. </p>

<p>There are two API calls used to provide Assisted TAPI services. Table 23.1 shows the 
two calls, their parameters, and descriptions of what they do and how they can be used.<br>
</p>

<p align="center"><b>Table 23.1. The Assisted Telephony API.</b> </p>
<div align="center"><center>

<table BORDERCOLOR="#000000" BORDER="1" WIDTH="80%">
  <tr>
    <td><i>API Call</i></td>
    <td WIDTH="132"><i>Parameters</i> </td>
    <td WIDTH="262"><i>Comments</i></td>
  </tr>
  <tr>
    <td WIDTH="153"><tt><font FACE="Courier">TapiRequestMakeCall</font></tt> </td>
    <td WIDTH="132"><tt><font FACE="Courier">DestAddress</font></tt>, <tt><font FACE="Courier">AppName</font></tt>, 
    <tt><font FACE="Courier">CalledParty</font></tt>, <tt><font FACE="Courier">Comment</font></tt> 
    </td>
    <td WIDTH="262">Use this function to request an outbound call placement. Only the <tt><font
    FACE="Courier">DestAddress</font></tt> is required. </td>
  </tr>
  <tr>
    <td WIDTH="153"><tt><font FACE="Courier">TapiGetLocationInfo</font></tt> </td>
    <td WIDTH="132"><tt><font FACE="Courier">CountryCode</font></tt>, <p><tt><font
    FACE="Courier">CityCode</font></tt> </td>
    <td WIDTH="262">Use this function to return the current country code and city code of 
    theworkstation. These values are stored in the <tt><font FACE="Courier">TELEPHON.INI</font></tt>file. 
    </td>
  </tr>
</table>
</center></div>

<p>The <tt><font FACE="Courier">TapiRequestMakeCall</font></tt> has four parameters. Only 
the <tt><font FACE="Courier">DestAddess</font></tt> is required. The <tt><font
FACE="Courier">DestAddress</font></tt> is a string of numbers that represents the 
telephone number to dial. For example, &quot;999-555-1212&quot; is a valid <tt><font
FACE="Courier">DestAddress</font></tt> in the United States format. The <tt><font
FACE="Courier">AppName</font></tt> parameter is the name of the application that requested 
the TAPI service. This would be the name of your application. The <tt><font FACE="Courier">CalledParty</font></tt> 
is a string that represents the name of the person you are calling. This information could 
be used by the <tt><font FACE="Courier">DIALER.EXE</font></tt> application to log the 
person called. The <tt><font FACE="Courier">Comment</font></tt> parameter could contain a 
string of text describing the reason for the call. </p>

<p>The <tt><font FACE="Courier">TapiGetLocation</font></tt> function returns two 
parameters: the <tt><font FACE="Courier">CountryCode</font></tt> and <tt><font
FACE="Courier">CityCode</font></tt> of the current location set by the Windows control 
panel TAPI applet. These two parameters are stored in the <tt><font FACE="Courier">TELEPHON.INI</font></tt> 
file in the Windows folder of the workstation. The country code is a value used to place 
out-of-country calls. The country code for the United States is &quot;1.&quot; The <tt><font
FACE="Courier">CityCode</font></tt> is known as the <i>area code</i> in the United States. 
The combination of the country code and the city code is used to determine how the TAPI 
dialer will place the requested call. </p>

<p>For example, if the requested call contained &quot;1-312-555-1212&quot; and the current 
workstation location indicated a country code of &quot;1&quot; and a city code of 
&quot;312,&quot; then the TAPI <tt><font FACE="Courier">DIALER.EXE</font></tt> program 
would attempt to place the call without including the country or city codes: 
&quot;555-1212.&quot; If, however, the requested call contained &quot;43-80-12 33 45&quot; 
then the <tt><font FACE="Courier">DIALER</font></tt> program would assume that the user 
was attempting to place an out-of-country call and would use the appropriate dialing 
prefixes. </p>
<div align="center"><center>

<table BORDERCOLOR="#000000" BORDER="1" WIDTH="80%">
  <tr>
    <td><b>Note</b></td>
  </tr>
  <tr>
    <td><blockquote>
      <p>You'll learn more about the dialing prefixes and how they are used in <a
      HREF="ch27.htm">Chapter 27</a>, &quot;TAPI Behind the Scenes-The <tt><font FACE="Courier">TELEPHON.INI</font></tt> 
      File.&quot; For now it is only important to know that TAPI uses the location information 
      stored in <tt><font FACE="Courier">TELEPHON.INI</font></tt> to determine how to place a 
      requested call. </p>
    </blockquote>
    </td>
  </tr>
</table>
</center></div>

<h2><a NAME="BasicTelephonyServices"><font SIZE="5" COLOR="#FF0000">Basic Telephony 
Services</font></a></h2>

<p>Basic Telephony is the next level up in the TAPI service model. Basic Telephony 
function calls allow programmers to create applications that can provide basic in- and 
outbound voice and data calls over a single-line analog telephone. The analog phone line 
most often used for this level of service is often referred to as a <i>POTS</i> or<i> 
Plain Old Telephone Service</i> line. The Basic Telephony API set can also be used with 
more sophisticated lines such as T1, ISDN, or digital lines. However, the added features 
of these advanced line devices (such as call forwarding, park, hold, conference, and so 
on) are not available when using the Basic Telephony API set. </p>

<p>The Basic Telephony level of service focuses on the use of a <i>line device</i> as a 
means of transporting information from one place to the next. A line device to TAPI can be 
a handset, a fax board, a data modem, a telephony card, or any other physical device that 
can be attached to a telephone line, But it is treated as a virtual device, not a physical 
one. </p>

<p>Line devices are not associated directly with any physical telephone line. This way, 
TAPI can &quot;see&quot; multiple TAPI devices on the same machine (data modem, handset, 
and fax board) while there is only one physical telephone line attached to the workstation 
(see Figure 23.1). </p>

<p><a HREF="f23-1.gif"><b>Figure 23.1 : </b><i>The relationship between TAPI line devices 
and physical phone lines </i></a></p>

<p>One of the primary functions of the TAPI interface is to handle multiple TAPI service 
requests from the workstation. It is possible that several applications running on the 
workstation may request TAPI services at some time. The call control application (<tt><font
FACE="Courier">DIALER.EXE</font></tt>) accepts each request and places them in a queue for 
processing in the requested order. </p>

<h3><a NAME="TheBasicTelephonyLineDeviceAPISet">The Basic Telephony Line Device API Set</a></h3>

<p>The Basic Telephony service model has several API calls for handling and fulfilling 
service requests. These calls can be collected into logical groups: 

<ul>
  <li><i>Basic line-handling calls</i> handle the initialization and opening and closing of 
    TAPI lines. </li>
  <li><i>Line settings and status</i> calls handle the reading and writing of various 
    parameter values that control the behavior of the line device. </li>
  <li><i>Outbound and inbound functions</i> handle the details of placing an outbound voice or 
    data call and answering an inbound voice or data call. </li>
  <li><i>Addressing functions</i> handle the details of recognizing, translating, and/or 
    building telephone &quot;addresses&quot; or dialing strings. </li>
  <li><i>Miscellaneous features</i> handle other TAPI-related functions, such as managing 
    call-monitoring privileges and manipulating call handles. </li>
</ul>

<p>Table 23.2 shows the Basic Telephony API calls, sorted by functional group, along with 
a short description of their use. You'll learn more about how these API calls can be used 
in a program in <a HREF="ch30.htm">Chapter 30</a>, &quot;Creating TAPI-Enabled 
Applications.&quot;<br>
</p>

<p align="center"><b>Table 23.2. The Basic Telephony line device API set.</b> </p>
<div align="center"><center>

<table BORDERCOLOR="#000000" BORDER="1" WIDTH="80%">
  <tr>
    <td><i>Function Group</i></td>
    <td WIDTH="153"><i>API Call</i> </td>
    <td WIDTH="249"><i>Description</i></td>
  </tr>
  <tr>
    <td WIDTH="139">Basic line-handling</td>
    <td WIDTH="153"><tt><font FACE="Courier">lineInitialize</font></tt> </td>
    <td WIDTH="249">Initializes the Telephony API line abstraction for use by the invoking 
    application. </td>
  </tr>
  <tr>
    <td WIDTH="139"> </td>
    <td WIDTH="153"><tt><font FACE="Courier">lineShutdown</font></tt> </td>
    <td WIDTH="249">Shuts down the application's use of the Telephony API line. </td>
  </tr>
  <tr>
    <td WIDTH="139"> </td>
    <td WIDTH="153"><tt><font FACE="Courier">lineNegotiateAPIVersion</font></tt> </td>
    <td WIDTH="249">Allows an application to negotiate an API version to use. </td>
  </tr>
  <tr>
    <td WIDTH="139"> </td>
    <td WIDTH="153"><tt><font FACE="Courier">lineOpen</font></tt> </td>
    <td WIDTH="249">Opens a specified line device for providing subsequent monitoring and/or 
    control of the line. </td>
  </tr>
  <tr>
    <td WIDTH="139"> </td>
    <td WIDTH="153"><tt><font FACE="Courier">lineClose</font></tt> </td>
    <td WIDTH="249">Closes a specified opened line device.</td>
  </tr>
  <tr>
    <td WIDTH="139"> </td>
    <td WIDTH="153"><tt><font FACE="Courier">lineDrop</font></tt> </td>
    <td WIDTH="249">Disconnects a call, or abandons a call attempt in progress. </td>
  </tr>
  <tr>
    <td WIDTH="139"> </td>
    <td WIDTH="153"><tt><font FACE="Courier">lineDeallocateCall</font></tt> </td>
    <td WIDTH="249">De-allocates the specified call handle.</td>
  </tr>
  <tr>
    <td WIDTH="139">Line settings and status</td>
    <td WIDTH="153"><tt><font FACE="Courier">lineGetDevCaps</font></tt> </td>
    <td WIDTH="249">Returns the capabilities of a given line device. </td>
  </tr>
  <tr>
    <td WIDTH="139"> </td>
    <td WIDTH="153"><tt><font FACE="Courier">lineGetDevConfig</font></tt> </td>
    <td WIDTH="249">Returns the configuration of a media stream device. </td>
  </tr>
  <tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -