michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: MARIONETTE_TIMEOUT = 60000; michael@0: MARIONETTE_HEAD_JS = 'head.js'; michael@0: michael@0: let outNumber = "5555551111"; michael@0: let outgoingCall; michael@0: michael@0: function dial() { michael@0: log("Make an outgoing call."); michael@0: telephony.dial(outNumber).then(call => { michael@0: outgoingCall = call; michael@0: outgoingCall.onalerting = function onalerting(event) { michael@0: log("Received 'alerting' call event."); michael@0: answer(); michael@0: }; michael@0: }); michael@0: } michael@0: michael@0: function answer() { michael@0: log("Answering the outgoing call."); michael@0: michael@0: outgoingCall.onconnected = function onconnectedOut(event) { michael@0: log("Received 'connected' call event for the original outgoing call."); michael@0: // just some code to keep call active for awhile michael@0: callStartTime = Date.now(); michael@0: waitFor(cleanUp,function() { michael@0: callDuration = Date.now() - callStartTime; michael@0: log("Waiting while call is active, call duration (ms): " + callDuration); michael@0: return(callDuration >= 2000); michael@0: }); michael@0: }; michael@0: emulator.run("gsm accept " + outNumber); michael@0: } michael@0: michael@0: function cleanUp(){ michael@0: outgoingCall.hangUp(); michael@0: ok("passed"); michael@0: finish(); michael@0: } michael@0: michael@0: startTest(function() { michael@0: dial(); michael@0: });