mozilla
Your Search Results

    TelephonyCall

    This article is in need of a technical review.

    Non-standard
    This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

    This API is available on Firefox OS for internal applications only.

    The TelephonyCall interface of the Web Telephony API represents one telephone call, providing information about the call and offering mechanisms for controlling it and detecting changes to its status.

    Properties

    TelephonyCall.disconnectedReason Read only
    A DOMString indicating the reason why the call was disconnected (either because there was an error somewhere, or the call ended or wasn't answered.)
    TelephonyCall.emergency Read only
    A Boolean indicating whether the number being called is an emergency number.
    TelephonyCall.group Read only
    A DOMString indicating the TelephonyCallGroup (multi-person call) the call belongs to, if any.
    TelephonyCall.id Read only
    A DOMString indicating the phone number corresponding to the call.
    TelephonyCall.secondId Read only
    A DOMString indicating the second phone number in the case of a CDMA network where you have a 2nd waiting call.
    TelephonyCall.mergeable Read only
    A Boolean indicating whether the current call can be added into a TelephonyCallGroup (multi-person call.)
    TelephonyCall.serviceId Read only
    A DOMString Indicating which service the call comes from.
    TelephonyCall.state Read only
    A DOMString indicating the status of the call.
    TelephonyCall.switchable Read only
    A Boolean indicating whether the current call can be switched between "connected" and "held" states.

    Event Handlers

    TelephonyCall.onalerting
    A function to be called when the call alerts, while awaiting a connection with a carrier.
    TelephonyCall.onconnected
    A function to be called once the call is connected.
    TelephonyCall.onconnecting
    A function to be called after dialing, while awaiting acceptance by the remote party.
    TelephonyCall.ondialing
    A function to be called when the call begins dialing the number.
    TelephonyCall.ondisconnected
    A function to be called after the call has finished disconnecting.
    TelephonyCall.ondisconnecting
    A function to be called when the call begins to disconnect.
    TelephonyCall.ongroupchange
    A function to call when the call's TelephonyCallGroup (and therefore TelephonyCall.group property) changes.
    TelephonyCall.onholding
    A function to be called when an instruction has been issued to put the call on hold.
    TelephonyCall.onheld
    A function to be called when the call has been held.
    TelephonyCall.onresuming
    A function to call when a previously held call resumes.
    TelephonyCall.onstatechange
    A function to be called when the state of the call changes.

    Obsolete properties

    TelephonyCall.error Read only
    A DOMString indicating a returned error when a call does connect successfully. This is being obsoleted as the error messages being returned were confusing, replaced by the more semantically effective TelephonyCall.disconnectedReason.
    TelephonyCall.number Read only
    A DOMString indicating the phone number corresponding to the call. Replaced by TelephonyCall.id in Firefox OS 2.0+.
    TelephonyCall.secondNumber Read only
    A DOMString indicating the second phone number in the case of a CDMA network where you have a 2nd waiting call. Replaced by TelephonyCall.SecondId in Firefox OS 2.0+.

    Obsolete event handlers

    TelephonyCall.onerror
    A function to be called when the call does not succeed due to error. This is being obsoleted as it is very similar to TelephonyCall.ondisconnected, but semantically more narrow and therefore not as useful.
    TelephonyCall.onincoming
    A function to call when an incoming call is detected.

    Methods

    TelephonyCall also inherits methods from the EventTarget interface.

    TelephonyCall.answer()
    Answers an incoming call.
    TelephonyCall.hangUp()
    Hangs up the call.
    TelephonyCall.hold()
    Allows you to put a call on hold.
    TelephonyCall.resume()
    Allows you to resume a call that was previously put on hold.

    Examples

    // Telephony object
    var tel = navigator.mozTelephony;
    
    // Place a call
    var call = tel.dial("123456789").then(function(call) {
      call.number;
    });
    
    // Receive a call
    tel.onincoming = function (e) {
      var incomingCall = e.call;
    
      // Get the id/number of the incoming call
      console.log(incomingCall.id);
    
      // Answer the call
      incomingCall.answer();
    };

    Specifications

    Specification Status Comment
    Web Telephony Draft Draft

    Browser compatibility

    For obvious reasons, support is primarily expected on mobile browsers.

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support Not supported Not supported Not supported Not supported Not supported
    Feature Android Firefox Mobile (Gecko) Firefox OS (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support Not supported 12.0 (12.0) 1.0.1 Not supported Not supported Not supported
    id and secondId Not supported 30.0 (30.0) 2.0 Not supported Not supported Not supported
    disconnectedReason Not supported 37.0 (37.0) 2.2 Not supported Not supported Not supported

    See also

    Document Tags and Contributors

    Contributors to this page: Sheppy, MHasan, fscholz, teoli, chrisdavidmills, kscarfone, Jeremie, hsinyi
    Last updated by: chrisdavidmills,
    Hide Sidebar