Receive Call TAPI3 with delphi
-
hi, When I program tapi3 in delphi 7 using the code below, I can make a outgoing call, but I can't catch any events. Has anybody face the same problem ? Wensheng
unit Unit10;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, TAPI3Lib_TLB, StdCtrls, ActiveX, ComObj, OleServer;
{
type
TTapiEventsSink = class( TObject, IConnectionPointContainer, I)
procedure TAPI1Event(ASender: TObject; TapiEvent: TOleEnum;
const pEvent: IDispatch);
end;
}
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Button3: TButton;
Edit2: TEdit;
Button4: TButton;
TAPI1: TTAPI;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure TAPI1Event(ASender: TObject; TapiEvent: TOleEnum;
const pEvent: IDispatch);
private
{ Private declarations }
public
{ Public declarations }
tapi3 : ITTAPI;
addr : ITAddress;
media : ITMediaSupport;
addrs : IEnumAddress;
term : ITTerminal;
terminalSupport : ITTerminalSupport;
basicall :ITBasicCallControl;
dir : TOleEnum;streamControl : ITStreamControl; enumStream : IEnumStream; stream : ITStream; mediatype : Integer; direct : TERMINAL\_DIRECTION; lAddressType : Integer; bHold : Boolean; event : ITCallNotificationEvent; tapievent : ITTAPIEventNotification; unknown : IUnknown;
end;
const TAPI3_CALL_EVENTS =
TE_CALLMEDIA OR
TE_CALLNOTIFICATION OR
TE_CALLSTATE;
const
TAPIMEDIATYPE_AUDIO = $8;
TAPIMEDIATYPE_VEDIO = $8000;
TAPIMEDIATYPE_DATEMODEM = $10;
TAPIMEDIATYPE_G3FAX = $20;
LINEADDRESSTYPE_PHONENUMBER = $00000001;
EVENT_FILTER =
TE_TAPIOBJECT OR
TE_ADDRESS OR
TE_CALLNOTIFICATION OR
TE_CALLSTATE OR
TE_CALLMEDIA OR
TE_CALLHUB OR
TE_CALLINFOCHANGE OR
TE_PRIVATE OR
TE_REQUEST OR
TE_AGENT OR
TE_AGENTSESSION OR
TE_QOSEVENT OR
TE_AGENTHANDLER OR
TE_ACDGROUP OR
TE_QUEUE OR
TE_DIGITEVENT OR
TE_GENERATEEVENT;var
Form1: TForm1;implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
lwCeltFetched : Cardinal;
cookievar : Integer;
begin
bHold := false;tapi1.Initialize;
tapi1.C