After the line device has been selected and activated successfully
with monitoring privileges,
you are able to receive call state events. A new incoming call will cause
the OnOffering
and OnCallState
(Offering) events to be triggered.
Use the calls Answer
method to answer the call. May you need to check the ownership
of the call prior to answer it.
Example:
procedure TForm1.Create(Sender: TObject);
begin
hbTapiLine1.DeviceName := 'Sample Line Device';
hbTapiLine1.MediaModes := LINEMEDIAMODE_INTERACTIVEVOICE;
hbTapiLine1.Privileges.Owner := True;
hbTapiLine1.Privileges.Monitor := True;
try
hbTapiLine1.Active := True;
except
on EhbTapiError do
MessageDlg('Initialization failed!'
+ E.Message, mtError, [mbOk], 0);
end;
end;
procedure TForm1.hbTapiLine1CallState(Sender: ThbTapiLine; Call: ThbTapiCall;
CallState: Cardinal);
begin
case CallState of
LINECALLSTATE_OFFERING :
begin
try
if not Call.Owner then
Call.Owner
:= True;
Call.Answer;
except