B2G/gecko/dom/telephony/test/marionette/test_swap_held_and_active.js
// Hang-up original outgoing (now active) call
Hang-up original outgoing (now active) call
Hang - up original outgoing ( now active ) call
function hangUpOutgoing() {
  log("Hanging up the original outgoing (now active) call.");
  let gotDisconnecting = false;
  outgoingCall.ondisconnecting = function ondisconnectingOut(event) {
    log("Received 'disconnecting' call event for original outgoing call.");
    is(outgoingCall, event.call);
    is(outgoingCall.state, "disconnecting");
    gotDisconnecting = true;
  };
  outgoingCall.ondisconnected = function ondisconnectedOut(event) {
    log("Received 'disconnected' call event for original outgoing call.");
    is(outgoingCall, event.call);
    is(outgoingCall.state, "disconnected");
    ok(gotDisconnecting);
    is(telephony.calls.length, 1);
    is(incomingCall.state, "held");
    runEmulatorCmd("gsm list", function(result) {
      log("Call list is now: " + result);
      is(result[0], "inbound from " + inNumber + " : held");
      is(result[1], "OK");
      hangUpIncoming();
    });
  };
  outgoingCall.hangUp();
}
function hangUpOutgoing ( ) { log ( "Hanging up the original outgoing (now active) call." ) ; let gotDisconnecting = false ; outgoingCall . ondisconnecting = function ondisconnectingOut ( event ) { log ( "Received 'disconnecting' call event for original outgoing call." ) ; is ( outgoingCall , event . call ) ; is ( outgoingCall . state , "disconnecting" ) ; gotDisconnecting = true ; } ; outgoingCall . ondisconnected = function ondisconnectedOut ( event ) { log ( "Received 'disconnected' call event for original outgoing call." ) ; is ( outgoingCall , event . call ) ; is ( outgoingCall . state , "disconnected" ) ; ok ( gotDisconnecting ) ; is ( telephony . calls . length , 1 ) ; is ( incomingCall . state , "held" ) ; runEmulatorCmd ( "gsm list" , function ( result ) { log ( "Call list is now: " + result ) ; is ( result [ 0 ] , "inbound from " + inNumber + " : held" ) ; is ( result [ 1 ] , "OK" ) ; hangUpIncoming ( ) ; } ) ; } ; outgoingCall . hangUp ( ) ; }
Hang-up original outgoing (now active) call
Hang - up original outgoing ( now active ) call
// Back to one call now