gsmIncomingCall (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All with voice/DTMF capability

Firmware version:

1.00 / 1.00.00


Use this function block to check if there is an incoming voice call on the GSM module.

 

gsmIncomingCall() indicates that an incoming call is pending. Technically it will be 1 or 2 when RING has been received from the GSM module, and it will be cleared when the VPL application has called gsmIncomingCall(). To use it, gsmIncomingCall() should be called periodically (frequency will dictate the answer delay period), and when it returns 1 or 2, the call may be answered.

 

Input:

None.

 

Output:

status : INT (0..2)

0

If no call.

1

If call contains a caller id ("number" contains caller id).

2

If call does not contain a caller id.

 

phonenumber : STRING

Caller id of the caller (if status is 1).

 

Declaration:

FUNCTION_BLOCK gsmIncomingCall;
VAR_OUTPUT
  status     : INT;  
  phonenumber : STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
VAR
  incoming : gsmIncomingCall;
END_VAR;
 
// Turn on power to the GSM module, use no pin code
gsmPower(power := TRUE);
 
BEGIN
  incoming();
  ...
  // Check for incoming calls
  IF incoming.status = 1 THEN
     // Somebody is calling us with a callerid
     // Answer incoming call
    gsmAnswer();
    // Play the "Hello" message
    voiceTalk(message := "Hello");
    // Hangup the phone
    gsmHangup();
     ...
  END_IF;
END;
 
END_PROGRAM;