INCLUDE rtcu.inc
VAR_OUTPUT
connected : BOOL;
offhook : BOOL;
END_VAR;
VAR
state : SINT := 1;
incoming: gsmIncomingCall;
END_VAR;
PROGRAM voicemsg;
fsMediaOpen(media:=1);
gsmPower(power:=ON);
BEGIN
incoming();
connected := gsmConnected();
CASE state OF
1:
IF incoming.status > 0 THEN
DebugMsg(message:="Incoming call, answering");
gsmAnswer();
state:=2;
END_IF;
2:
voiceTalk(message:="B:\voice\babbage.ogg",pause:=1000);
IF dtmfGetKey(timeout:=5000)<>-1 THEN
gsmHangup();
END_IF;
END_CASE;
offhook := gsmOffHook();
IF NOT offhook THEN
state:=1;
END_IF;
END;
END_PROGRAM;
|