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.disconnectedReasonRead only
- A DOMStringindicating the reason why the call was disconnected (either because there was an error somewhere, or the call ended or wasn't answered.)
- TelephonyCall.emergencyRead only
- A Booleanindicating whether the number being called is an emergency number.
- TelephonyCall.groupRead only
- A DOMStringindicating theTelephonyCallGroup(multi-person call) the call belongs to, if any.
- TelephonyCall.idRead only
- A DOMStringindicating the phone number corresponding to the call.
- TelephonyCall.secondIdRead only
- A DOMStringindicating the second phone number in the case of a CDMA network where you have a 2nd waiting call.
- TelephonyCall.mergeableRead only
- A Booleanindicating whether the current call can be added into aTelephonyCallGroup(multi-person call.)
- TelephonyCall.serviceIdRead only
- A DOMStringIndicating which service the call comes from.
- TelephonyCall.stateRead only
- A DOMStringindicating the status of the call.
- TelephonyCall.switchableRead only
- A Booleanindicating 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 thereforeTelephonyCall.groupproperty) 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 stateof the call changes.
Obsolete properties
- TelephonyCall.errorRead only
- A DOMStringindicating 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 effectiveTelephonyCall.disconnectedReason.
- TelephonyCall.numberRead only
- A DOMStringindicating the phone number corresponding to the call. Replaced byTelephonyCall.idin Firefox OS 2.0+.
- TelephonyCall.secondNumberRead only
- A DOMStringindicating the second phone number in the case of a CDMA network where you have a 2nd waiting call. Replaced byTelephonyCall.SecondIdin 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
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 | No support | No support | No support | No support | No support | 
| Feature | Android | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | 
|---|---|---|---|---|---|---|
| Basic support | No support | 12.0 (12.0) | 1.0.1 | No support | No support | No support | 
| idandsecondId | No support | 30.0 (30.0) | 2.0 | No support | No support | No support | 
| disconnectedReason | No support | 37.0 (37.0) | 2.2 | No support | No support | No support | 
See also
Document Tags and Contributors
    
    Tags: 
    
  
                    
                       Contributors to this page: 
        chrisdavidmills, 
        teoli, 
        fscholz, 
        MHasan, 
        hsinyi, 
        kscarfone, 
        Jeremie, 
        Sheppy
                    
                    
                       Last updated by:
                      chrisdavidmills,