Examples - Voice Message HQ

Top  Previous  Next

//----------------------------------------------------------------------------
// Simple program that plays HQ audio for the caller.
//----------------------------------------------------------------------------
INCLUDE rtcu.inc
 
VAR_OUTPUT
connected : BOOL; | Connected to GSM Basestation.
offhook   : BOOL; | off-hook signal
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: // Waiting for incoming call:
  IF incoming.status > 0 THEN
    DebugMsg(message:="Incoming call, answering");
    gsmAnswer();
    state:=2;
  END_IF;
 
  2: // Play part of an audio book
  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;