/trunk/Demo.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/MakeCall.dll |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/ReadMe.txt |
---|
0,0 → 1,37 |
ViaThinkSoft CallLib (MakeCall.dll) API |
======================================= |
The CallLib API is a minimal API for making calls over the TAPI line. |
It contains only two functions which are described below: |
GetTapiDevices |
============== |
Delphi: function GetTapiDevices(buf: PAnsiChar): integer; stdcall; |
C++: int __stdcall GetTapiDevices(AnsiChar* buf); |
GetTapiDevices lists all available TAPI devices. |
If buf is NULL, the result of the function is the number of bytes required to fill the buffer. |
If buf is not NULL, the names of the TAPI devices, separated by CR LF, with appended NUL |
character is written into buf, and the number of bytes written is returned. |
If the result is -1, an error occured. |
MakeCall |
======== |
Delphi: function MakeCall(phoneNumber: PAnsiChar; deviceId: integer): integer; stdcall; |
C++: int __stdcall MakeCall(AnsiChar* phoneNumber, int deviceId); |
MakeCall requests the telephone to make a call. |
phoneNumber is the number to be called. It should only contain numbers. |
deviceId is the index of the TAPI device, as listed in GetTapiDevices. |
If the result is 0, everything is OK. If the result is below 0, an error occured. |
-1 usually means that the TAPI device cannot be found. |
-2 usually means that the headset / telephone receiver is active and therefore the line is busy. |
/trunk/Src/Demo.dpr |
---|
0,0 → 1,14 |
program Demo; |
uses |
Forms, |
DemoMain in 'DemoMain.pas' {Form1}; |
{$R *.res} |
begin |
Application.Initialize; |
Application.MainFormOnTaskbar := True; |
Application.CreateForm(TForm1, Form1); |
Application.Run; |
end. |
/trunk/Src/Demo.dproj |
---|
0,0 → 1,72 |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
<PropertyGroup> |
<ProjectGuid>{0ba74e7c-e12f-4a00-b112-b44eb3072148}</ProjectGuid> |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler> |
<DCC_DependencyCheckOutputName>Demo.exe</DCC_DependencyCheckOutputName> |
<MainSource>Demo.dpr</MainSource> |
</PropertyGroup> |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
<Version>7.0</Version> |
<DCC_DebugInformation>False</DCC_DebugInformation> |
<DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols> |
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> |
<DCC_Define>RELEASE</DCC_Define> |
</PropertyGroup> |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
<Version>7.0</Version> |
<DCC_Define>DEBUG</DCC_Define> |
</PropertyGroup> |
<ProjectExtensions> |
<Borland.Personality>Delphi.Personality</Borland.Personality> |
<Borland.ProjectType /> |
<BorlandProject> |
<BorlandProject xmlns=""> <Delphi.Personality> <Parameters> |
<Parameters Name="UseLauncher">False</Parameters> |
<Parameters Name="LoadAllSymbols">True</Parameters> |
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters> |
</Parameters> |
<VersionInfo> |
<VersionInfo Name="IncludeVerInfo">False</VersionInfo> |
<VersionInfo Name="AutoIncBuild">False</VersionInfo> |
<VersionInfo Name="MajorVer">1</VersionInfo> |
<VersionInfo Name="MinorVer">0</VersionInfo> |
<VersionInfo Name="Release">0</VersionInfo> |
<VersionInfo Name="Build">0</VersionInfo> |
<VersionInfo Name="Debug">False</VersionInfo> |
<VersionInfo Name="PreRelease">False</VersionInfo> |
<VersionInfo Name="Special">False</VersionInfo> |
<VersionInfo Name="Private">False</VersionInfo> |
<VersionInfo Name="DLL">False</VersionInfo> |
<VersionInfo Name="Locale">1031</VersionInfo> |
<VersionInfo Name="CodePage">1252</VersionInfo> |
</VersionInfo> |
<VersionInfoKeys> |
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys> |
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys> |
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys> |
<VersionInfoKeys Name="InternalName"></VersionInfoKeys> |
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys> |
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys> |
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys> |
<VersionInfoKeys Name="ProductName"></VersionInfoKeys> |
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> |
<VersionInfoKeys Name="Comments"></VersionInfoKeys> |
</VersionInfoKeys> |
<Source> |
<Source Name="MainSource">Demo.dpr</Source> |
</Source> |
</Delphi.Personality> </BorlandProject></BorlandProject> |
</ProjectExtensions> |
<ItemGroup /> |
<ItemGroup> |
<DelphiCompile Include="Demo.dpr"> |
<MainSource>MainSource</MainSource> |
</DelphiCompile> |
<DCCReference Include="DemoMain.pas"> |
<Form>Form1</Form> |
</DCCReference> |
</ItemGroup> |
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> |
</Project> |
/trunk/Src/Demo.res |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/Src/DemoMain.dfm |
---|
0,0 → 1,61 |
object Form1: TForm1 |
Left = 0 |
Top = 0 |
BorderIcons = [biSystemMenu, biMinimize] |
BorderStyle = bsSingle |
Caption = 'Call Lib Demo' |
ClientHeight = 342 |
ClientWidth = 266 |
Color = clBtnFace |
Font.Charset = DEFAULT_CHARSET |
Font.Color = clWindowText |
Font.Height = -11 |
Font.Name = 'Tahoma' |
Font.Style = [] |
OldCreateOrder = False |
OnShow = FormShow |
PixelsPerInch = 96 |
TextHeight = 13 |
object Label1: TLabel |
Left = 8 |
Top = 8 |
Width = 112 |
Height = 13 |
Caption = 'Available TAPI devices:' |
end |
object Label2: TLabel |
Left = 8 |
Top = 256 |
Width = 73 |
Height = 13 |
Caption = 'Phone number:' |
end |
object DeviceListBox: TListBox |
Left = 8 |
Top = 27 |
Width = 250 |
Height = 221 |
ItemHeight = 13 |
TabOrder = 0 |
OnClick = DeviceListBoxClick |
end |
object CallBtn: TButton |
Left = 183 |
Top = 302 |
Width = 75 |
Height = 25 |
Caption = 'Make call' |
Default = True |
Enabled = False |
TabOrder = 2 |
OnClick = CallBtnClick |
end |
object PhoneNumberEdit: TEdit |
Left = 8 |
Top = 275 |
Width = 250 |
Height = 21 |
TabOrder = 1 |
OnChange = PhoneNumberEditChange |
end |
end |
/trunk/Src/DemoMain.pas |
---|
0,0 → 1,79 |
unit DemoMain; |
interface |
uses |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
Dialogs, StdCtrls, ExtCtrls; |
type |
TForm1 = class(TForm) |
DeviceListBox: TListBox; |
Label1: TLabel; |
CallBtn: TButton; |
PhoneNumberEdit: TEdit; |
Label2: TLabel; |
procedure FormShow(Sender: TObject); |
procedure DeviceListBoxClick(Sender: TObject); |
procedure CallBtnClick(Sender: TObject); |
procedure PhoneNumberEditChange(Sender: TObject); |
private |
procedure ListDevices; |
end; |
var |
Form1: TForm1; |
implementation |
{$R *.dfm} |
function GetTapiDevices(buf: PAnsiChar): integer; stdcall; external 'MakeCall.dll'; |
function MakeCall(phoneNumber: PAnsiChar; deviceId: integer): integer; stdcall; external 'MakeCall.dll'; |
type |
TAnsiCharArray = array of AnsiChar; |
function ArrayToString(const a: TAnsiCharArray): string; |
begin |
if Length(a)>0 then |
SetString(Result, PChar(@a[0]), Length(a)) |
else |
Result := ''; |
end; |
procedure TForm1.CallBtnClick(Sender: TObject); |
var |
s: AnsiString; |
begin |
s := PhoneNumberEdit.Text; |
MakeCall(PAnsiChar(s), DeviceListBox.ItemIndex); |
end; |
procedure TForm1.FormShow(Sender: TObject); |
begin |
ListDevices; |
end; |
procedure TForm1.DeviceListBoxClick(Sender: TObject); |
begin |
CallBtn.Enabled := (DeviceListBox.ItemIndex <> -1) and (PhoneNumberEdit.Text <> ''); |
end; |
procedure TForm1.PhoneNumberEditChange(Sender: TObject); |
begin |
CallBtn.Enabled := (DeviceListBox.ItemIndex <> -1) and (PhoneNumberEdit.Text <> ''); |
end; |
procedure TForm1.ListDevices; |
var |
len: integer; |
buf: TAnsiCharArray; |
begin |
len := GetTapiDevices(nil); |
SetLength(buf, len+1); |
GetTapiDevices(PAnsiChar(buf)); |
DeviceListBox.Items.Text := ArrayToString(buf); |
end; |
end. |
/trunk/Src/MakeCall.dpr |
---|
0,0 → 1,70 |
library MakeCall; |
uses |
SysUtils, |
hbTAPI; |
{$R *.res} |
function GetTapiDevices(buf: PAnsiChar): integer; stdcall; |
var |
mTapiLine: TTapiLine; |
len: Integer; |
s: string; |
begin |
mTapiLine := TTapiLine.Create(nil); |
try |
try |
mTapiLine.Active := false; |
s := mTapiLine.DeviceList.Text; |
len := Length(s); |
if buf <> nil then |
begin |
FillChar(buf^, len+1{NUL}, 0); |
StrPCopy(buf, s); |
result := 0; |
end; |
result := len+1{NUL}; |
except |
result := -1; |
end; |
finally |
FreeAndNil(mTapiLine); |
end; |
end; |
function Call(phoneNumber: PAnsiChar; deviceId: integer): integer; stdcall; |
var |
mTapiLine: TTapiLine; |
begin |
mTapiLine := TTapiLine.Create(nil); |
try |
mTapiLine.Active := false; |
mTapiLine.CallParams.Flags := 0; |
mTapiLine.DeviceID := deviceId; |
mTapiLine.Active := true; |
if not mTapiLine.Active then |
begin |
// Usually "TAPI device not available" |
result := -1; |
exit; |
end; |
try |
mTapiLine.MakeCall(AnsiString(phoneNumber)); |
except |
// This can tappen when the headset is active, so the line is busy |
result := -2; |
exit; |
end; |
result := 0; |
finally |
FreeAndNil(mTapiLine); |
end; |
end; |
exports |
Call name 'MakeCall', |
GetTapiDevices; |
begin |
end. |
/trunk/Src/MakeCall.dproj |
---|
0,0 → 1,33 |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
<PropertyGroup> |
<ProjectGuid>{80c4fbc1-1277-4318-9b1f-914a81116547}</ProjectGuid> |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler> |
<DCC_DependencyCheckOutputName>MakeCall.dll</DCC_DependencyCheckOutputName> |
<MainSource>MakeCall.dpr</MainSource> |
</PropertyGroup> |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
<Version>7.0</Version> |
<DCC_DebugInformation>False</DCC_DebugInformation> |
<DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols> |
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> |
<DCC_Define>RELEASE</DCC_Define> |
</PropertyGroup> |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
<Version>7.0</Version> |
<DCC_Define>DEBUG</DCC_Define> |
</PropertyGroup> |
<ProjectExtensions> |
<Borland.Personality>Delphi.Personality</Borland.Personality> |
<Borland.ProjectType /> |
<BorlandProject> |
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters><Parameters Name="HostApplication">Demo.exe</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1031</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">ViaThinkSoft</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Phone call library</VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName">CallLib</VersionInfoKeys><VersionInfoKeys Name="LegalCopyright">(C) 2018 ViaThinkSoft</VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename">MakeCall.dll</VersionInfoKeys><VersionInfoKeys Name="ProductName">ViaThinkSoft CallLib</VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">MakeCall.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject> |
</ProjectExtensions> |
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> |
<ItemGroup> |
<DelphiCompile Include="MakeCall.dpr"> |
<MainSource>MainSource</MainSource> |
</DelphiCompile> |
</ItemGroup> |
</Project> |
/trunk/Src/MakeCall.groupproj |
---|
0,0 → 1,44 |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
<PropertyGroup> |
<ProjectGuid>{4dceecb3-656c-4af2-859c-3769559c4f60}</ProjectGuid> |
</PropertyGroup> |
<ItemGroup /> |
<ItemGroup> |
<Projects Include="Demo.dproj" /> |
<Projects Include="MakeCall.dproj" /> |
</ItemGroup> |
<ProjectExtensions> |
<Borland.Personality>Default.Personality</Borland.Personality> |
<Borland.ProjectType /> |
<BorlandProject> |
<BorlandProject xmlns=""> <Default.Personality> </Default.Personality> </BorlandProject></BorlandProject> |
</ProjectExtensions> |
<Target Name="Demo"> |
<MSBuild Projects="Demo.dproj" Targets="" /> |
</Target> |
<Target Name="Demo:Clean"> |
<MSBuild Projects="Demo.dproj" Targets="Clean" /> |
</Target> |
<Target Name="Demo:Make"> |
<MSBuild Projects="Demo.dproj" Targets="Make" /> |
</Target> |
<Target Name="MakeCall"> |
<MSBuild Projects="MakeCall.dproj" Targets="" /> |
</Target> |
<Target Name="MakeCall:Clean"> |
<MSBuild Projects="MakeCall.dproj" Targets="Clean" /> |
</Target> |
<Target Name="MakeCall:Make"> |
<MSBuild Projects="MakeCall.dproj" Targets="Make" /> |
</Target> |
<Target Name="Build"> |
<CallTarget Targets="Demo;MakeCall" /> |
</Target> |
<Target Name="Clean"> |
<CallTarget Targets="Demo:Clean;MakeCall:Clean" /> |
</Target> |
<Target Name="Make"> |
<CallTarget Targets="Demo:Make;MakeCall:Make" /> |
</Target> |
<Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" /> |
</Project> |
/trunk/Src/MakeCall.res |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |