Placing the Call

Once the application has opened the line device, it places the call with lineMakeCall, specifying the address (phone number and area code) in the lpszDestAddress parameter and the media mode (datamodem, in this case) in the lpCallParams parameter. This function returns a positive "request ID" if the function will be completed asynchronously, or a negative error number if an error has occurred. Negative return values describe specific error states. LINEERR_CALLUNAVAIL, for example, means that the line is probably in use (someone else already has an active call). If dialing completes successfully, messages are sent to the application to inform it about the call's progress. Applications typically use these messages to display status reports to the user.

Later, when the lineMakeCall function has successfully set up the call, the application receives a LINE_REPLY message (the asynchronous reply to lineMakeCall). At this point there is not necessarily a connection to the remote station, just an established call at the local endpics/TAPI00090000.gifperhaps indicated by a dial tone. This LINE_REPLY message informs the application that the call handle returned by lineMakeCall is valid.

TAPI's programming model treats data calls similarly to voice calls, as shown by the fact that the same function is used to make calls of both types. If LINEBEARERMODE_DATA is specified in a field of the lpCallParams parameter of lineMakeCall, the call is set up to send data. Speech transmission can be chosen by using a different value. And if NULL is specified, a default 3.1 kHz voice call is established, which can support the speech, fax, and modem media modes.

Note TAPI should not be used for fax transmissions. Instead, use the functions available through MAPI, the Microsoft Messaging API.

As the call is placed, it passes through a number of states, each of which results in a LINE_CALLSTATE message sent to the application. These states include dialtone, dialing, ringback, and, if connection succeeds, LINECALLSTATE_CONNECTED. (To see the complete list of call states, see the LINECALLSTATUS structure.) After the message indicating the connected state is received, the application can begin sending data.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples