Re: Dialing Telephone Numbers
From: Chris Willig (chris_nospam__at_5thelephant.com)
Date: 12/11/03
- Previous message: Dittmar, Thorsten: "Window XP "web-like" application?"
- In reply to: Kursat: "Dialing Telephone Numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 11 Dec 2003 08:07:17 -0600
Kursat wrote:
> Hi,
> I want to add phone dialing feature to my existing project. As I know, two
> possible solutions exist;
> 1- Sending AT commands to Modem
> 2- Using TAPI
>
> Which one should I use and how to dial a number?
>
> Thanks for help
>
>
unit TAPI;
interface
uses
Windows, Messages, SysUtils, Variants, Classes;
function tapiRequestMakeCall(lpszDestAddress,
lpszAppName,
lpszCalledParty,
lpszComment:LPCSTR): Longint; stdcall;
external 'tapi32.dll';
function tapiGetLocationInfo(lpszCountryCode,
lpszCityCode:LPCSTR): Longint; stdcall;
external 'tapi32.dll';
const
TAPIERR_CONNECTED =0;
TAPIERR_DROPPED =-1;
TAPIERR_NOREQUESTRECIPIENT =-2;
TAPIERR_REQUESTQUEUEFULL =-3;
TAPIERR_INVALDESTADDRESS =-4;
TAPIERR_INVALWINDOWHANDLE =-5;
TAPIERR_INVALDEVICECLASS =-6;
TAPIERR_INVALDEVICEID =-7;
TAPIERR_DEVICECLASSUNAVAIL =-8;
TAPIERR_DEVICEIDUNAVAIL =-9;
TAPIERR_DEVICEINUSE =-10;
TAPIERR_DESTBUSY =-11;
TAPIERR_DESTNOANSWER =-12;
TAPIERR_DESTUNAVAIL =-13;
TAPIERR_UNKNOWNWINHANDLE =-14;
TAPIERR_UNKNOWNREQUESTID =-15;
TAPIERR_REQUESTFAILED =-16;
TAPIERR_REQUESTCANCELLED =-17;
TAPIERR_INVALPOINTER =-18;
TAPIMAXDESTADDRESSSIZE =80;
TAPIMAXAPPNAMESIZE =40;
TAPIMAXCALLEDPARTYSIZE =40;
TAPIMAXCOMMENTSIZE =80;
TAPIMAXDEVICECLASSSIZE =40;
TAPIMAXDEVICEIDSIZE =40;
function TapiDialNumber(const PhoneNumber: string; var ErrMsg: string):
longint;
implementation
function TapiDialNumber(const PhoneNumber: string; var ErrMsg: string):
longint;
begin
result := tapiRequestMakeCall( PChar(PhoneNumber), nil, nil, nil);
if result < 0 then begin
case result of
TAPIERR_NOREQUESTRECIPIENT : ErrMsg := 'TAPI: No request recipient.';
TAPIERR_INVALDESTADDRESS : ErrMsg := 'TAPI: Invalid number.';
TAPIERR_REQUESTQUEUEFULL : ErrMsg := 'TAPI: Request queue full.';
TAPIERR_INVALPOINTER : ErrMsg := 'TAPI: Invalid pointer.';
else
ErrMsg := '';
end;
end;
{
Return Values
Returns zero if the request succeeds or a negative error number if an
error occurs. Possible error return value are:
TAPIERR_NOREQUESTRECIPIENT, TAPIERR_INVALDESTADDRESS,
TAPIERR_REQUESTQUEUEFULL, TAPIERR_INVALPOINTER.
Remarks
A telephony-enabled application can request that a call be placed on its
behalf by invoking tapiRequestMakeCall, providing only the destination
address for the call. This request is forwarded to the user's
call-control
application, which places the call on behalf of the original application.
A default call-control application is provided as part of Telephony.
Users can replace this with a call-control application of their choice.
Invoking tapiRequestMakeCall when no call control application is running
returns the TAPIERR_NOREQUESTRECIPIENT error indication. If the call
control application is not running, TAPI attempts to launch the
highest-priority call control application (which is listed for
RequestMakeCall in the registry). Invoking this function when the
Assisted TAPI request queue is full returns the TAPIERR_REQUESTQUEUEFULL
error.
}
end;
end.
- Previous message: Dittmar, Thorsten: "Window XP "web-like" application?"
- In reply to: Kursat: "Dialing Telephone Numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|