unit MyService;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.SvcMgr,
Vcl.Dialogs, AsteriskDataModul;
type
TTelephoneControl = class(TService)
procedure ServiceAfterInstall(Sender: TService);
procedure ServiceExecute(Sender: TService);
procedure ServiceStart(Sender: TService; var Started: Boolean);
procedure ServiceStop(Sender: TService; var Stopped: Boolean);
private
{ Private-Deklarationen }
AsteriskCallControlModule: Tbc_Asterisk_CallControl;
public
function GetServiceController: TServiceController; override;
{ Public-Deklarationen }
end;
var
TelephoneControl: TTelephoneControl; // ausAsteriskDataModul;
implementation
{$R *.dfm}
procedure ServiceController(CtrlCode: DWord); stdcall;
begin
TelephoneControl.Controller(CtrlCode);
end;
function TTelephoneControl.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TTelephoneControl.ServiceAfterInstall(Sender: TService);
begin
//
end;
procedure TTelephoneControl.ServiceExecute(Sender: TService);
begin
//
end;
procedure TTelephoneControl.ServiceStart(Sender: TService; var Started: Boolean);
begin
if not(assigned(AsteriskCallControlModule)) then
begin
AsteriskCallControlModule := Tbc_Asterisk_CallControl.Create(nil);
end;
Started := True;
end;
procedure TTelephoneControl.ServiceStop(Sender: TService; var Stopped: Boolean);
begin
FreeAndNil(AsteriskCallControlModule);
Stopped := True;
end;
end.