I have been working all day and now it is 3:38 AM and still I am faced by the very problem I tried to get around at first.
Let me try to explain:
I have built a program to call a phone line, some times the call drops so I have made a procedure which checks if the call is active or not.
//this procedure is broken XXX
procedure TMainForm.xCheck1;//this is suppost to check if call is active (but instead it always restarts the call)
Begin
if (CallPack[1].State = csActive) then
L1.Caption := 'ACTIVE'
else
if (CallPack[1].active = False) then
L1.Caption := 'X';
xCall1;//restart call
end;
//this procedure is broken XXX
There must be some thing wrong with my procedure because it always re-starts the call regardless of weather it is active or not (it will always jump to 'else')
I know that my procedure is set out wrong because; While the call is connecting it goes through the xConnecting1 procedure and this procedure repeats until the call is ether active or dropped.
procedure TMainForm.xConnecting1;//waits to connect
begin
CC := 0;
repeat
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1';
Delay(300);
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1.';
Delay(300);
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1..';
Delay(300);
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1...';
Delay(300);
until (CallPack[1].State = csActive) or (CallPack[1].active = false);
end;
I am STILL unsure of how to construct conditional procedures even after reading everything (and I mean EVERY THING) that I could find on delphi!
seriously this is the only thing in my code now that doesn't work (seen as I have dropped referring to the whole array at once lol I can get it working on a test program but not this perticular one lol)
this code almost works, and I am sure that it is my mistake with the construction of the argument in the xCheck1 procedure that is wrong! else why would the call be allowed to continue after the xConnecting1 procedure wich would continually repeat (if not csActive or dropped) were it not for the xConnectionCount1 procedure that hangs up the call if the CC count gets to 50 so I know that by the time the xCheck1 is done the call is ether active or dropped!!!
procedure TMainForm.xConnectionCount1;//if the call takes too long to connect ...hang up!
begin
CC := CC +1;
if CC = 50 then
SimpleSip1.EndCall(CallPack[1]);
end;
So my xCheck1 must be wrong other wise it wouldnt always re-call!
You get me? lol
Let me try to explain:
I have built a program to call a phone line, some times the call drops so I have made a procedure which checks if the call is active or not.
//this procedure is broken XXX
procedure TMainForm.xCheck1;//this is suppost to check if call is active (but instead it always restarts the call)
Begin
if (CallPack[1].State = csActive) then
L1.Caption := 'ACTIVE'
else
if (CallPack[1].active = False) then
L1.Caption := 'X';
xCall1;//restart call
end;
//this procedure is broken XXX
There must be some thing wrong with my procedure because it always re-starts the call regardless of weather it is active or not (it will always jump to 'else')
I know that my procedure is set out wrong because; While the call is connecting it goes through the xConnecting1 procedure and this procedure repeats until the call is ether active or dropped.
procedure TMainForm.xConnecting1;//waits to connect
begin
CC := 0;
repeat
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1';
Delay(300);
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1.';
Delay(300);
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1..';
Delay(300);
xConnectionCount1;
ACTIONL.Caption := 'Connecting Call 1...';
Delay(300);
until (CallPack[1].State = csActive) or (CallPack[1].active = false);
end;
I am STILL unsure of how to construct conditional procedures even after reading everything (and I mean EVERY THING) that I could find on delphi!
seriously this is the only thing in my code now that doesn't work (seen as I have dropped referring to the whole array at once lol I can get it working on a test program but not this perticular one lol)
this code almost works, and I am sure that it is my mistake with the construction of the argument in the xCheck1 procedure that is wrong! else why would the call be allowed to continue after the xConnecting1 procedure wich would continually repeat (if not csActive or dropped) were it not for the xConnectionCount1 procedure that hangs up the call if the CC count gets to 50 so I know that by the time the xCheck1 is done the call is ether active or dropped!!!
procedure TMainForm.xConnectionCount1;//if the call takes too long to connect ...hang up!
begin
CC := CC +1;
if CC = 50 then
SimpleSip1.EndCall(CallPack[1]);
end;
So my xCheck1 must be wrong other wise it wouldnt always re-call!
You get me? lol