procedure TMainForm.xCall0;
var
InDevice, OutDevice: Cardinal;
begin
Stage := 0;
Repeat
//1
Stage := Stage +1;
CC := 0;
//xCheckIfAccountIsExausted;
//J := J +1;
InDevice := AudioInDeviceNameToDeviceID(waveInDevice.Items[waveInDevice.ItemIndex]);
OutDevice := AudioInDeviceNameToDeviceID(waveOutDevice.Items[waveOutDevice.ItemIndex]);
CallPack[0] := SimpleSip1.AddCall(CurrentAccount, PhoneEdit.Text, InDevice, OutDevice);
CallPack[0]._AddRef;
ListCalls.items[0]:='CALLING : '+PhoneEdit.Text+'...';
xConnecting0;
Delay(9000);
//2
Stage := Stage +1;
ListCalls.items[0]:= 'Sending Pin';
SimpleSip1.PlayWavFile(CallPack[0], ExtractFilePath(ParamStr(0))+'ben pin.wav');
Memo1.Lines.Add('PIN: ******');
Delay(6000);
//3..........................................CHECK
Stage := Stage +1;
xCheck0;
Delay(2000);
//------------------------------------------------------------------------------
until Stage = 3;
end;
//------------------------------------------------------------------------------
procedure TMainForm.xConnecting0;
begin
CC := 0;
repeat
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call.';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call..';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call...';
Delay(300);
until (CallPack[0].State = csActive) or (CallPack[0].active = false);
if not (CallPack[0].State = csActive) then xCall0;
end;
procedure TMainForm.xConnectionCount0;
begin
CC := CC +1;
if CC = 100 then
begin
CC := 0;
SimpleSip1.EndCall(CallPack[0]);
ListCalls.items[0]:='AUTO DROPPED CALL';
Delay(2000);
xManagerBAD;
Delay(3000);
xCall0;
end;
end;
procedure TMainForm.xCheck0;
Begin
if (CallPack[0].State = csActive) then
begin
N := N +1;//------------------------------------(N)
ListCalls.Items[0]:='ACTIVE';
Delay(3000);
end
else
//if (CallPack[0].active = False) then
if not (CallPack[0].State = csActive) then
begin
ListCalls.Items[0]:='X';
xCall0;
end;
end;