Call library
Provides functionality for detecting incoming call or originating outgoing call. Call library has only one instance, there is no constructor.
This library can be initialized
var call = require('call');
Functions
Originate phone call
call (phoneNumber, timeout);
String phoneNumber
Number timeout
Function originates call to specified phone number in international format +420777111111. Timeout sets (in seconds) how long call is active before hangup.
Hangup phone call
hangup (type);
Number type
When incoming call is indicated, you can close it by hangup(). Parameter type sets type of call closing.
Use values which are described bellow.
call.HANGUP_BUSY
call.HANGUP_NORMAL_UNSPECIFIED
call.HANGUP_OUT_OF_ORDER
call.HANGUP_NORMAL_CLEARING
call.HANGUP_NOT_RESPONDING
call.HANGUP_UNASSIGNED_NUMBER
Incoming phone call control
When incoming call is coming, function incomingCall() is invoked from modem. Replace it body for incoming call processing.
incomingCall (number, status, type, count);
String number - caller phone number in international format
Number status - contains call.CALL_TYPE_INCOMING
Number type - contains type of call. It can be DATA, FAX, VOICE, UNSPECIFIED
Number count - contains number of ringings
Call api example - Incoming call and outgoing call
var sys = require('system');
var call = require('call');
call.incomingCall = function(number , status , type , count){
sys.println("num:"+number+" status:"+status+" type:"+type+" ringing_counter:"+c
if (count==5) {
call.hangup(call.HANGUP_BUSY);
}
}
//call to the number 10 seconds
call.call("+420111111111",10);