The Telephony API allows applications to manage the full lifecycle of telephone calls.
An example of use is provided below:
            var telCall = navigator.telephony.dial('+34638883076');
            telCall.onstatechange = function(e) {
              if (e.target.state == 'connected')
                window.console.log('Connected!');
            }
            telCall.onerror = function(e) {
              window.console.error(e);
            }
      
    This specification defines conformance criteria that apply to a single product: the user agent that implements the interfaces that it contains.
Implementations that use ECMAScript to implement the APIs defined in this specification MUST implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]], as this specification uses that specification and terminology.
The  EventHandler
      interface represents a callback used for event handlers as defined in [[!HTML5]].
      
The concepts queue a task and fire a simple event are defined in [[!HTML5]].
The terms event handler and event handler event types are defined in [[!HTML5]].
An active call is a Telephony Call in the connected state and bound
      to the input and output devices (microphone, speaker and tone generator).
This API must be only exposed to trusted content
The NavigatorTelephony interface is exposed on the Navigator object.
      
The Telephony interface represents the initial entry point for getting access to telephony services.
The IDL attribute speakerEnabled MUST
      return true/false when the speakers are respectively enabled/disabled.
      
The IDL attribute headsetEnabled MUST
      return true/false when the headset is respectively enabled/disabled.
      
The IDL attribute audioVolume MUST return the normalized volume of the active audio output
      (speaker or headset) ranging from 0.0 (silent) to 1.0 (loudest).
      
The IDL attribute audioMuted MUST return true/false
      when the active audio output (speaker or headset) is respectively muted/unmuted.
      
The IDL attribute micVolume MUST return the normalized value of the microphone input level
      ranging from 0.0 (silent) to 1.0 (loudest).
      
The IDL attribute micMuted MUST return true/false
      when the microphone is respectively muted/unmuted.
      
The IDL attribute ownTelNumbers MUST return the  telephone number (MSISDN) associated to
      this subscription to the Telephony service, or a list thereof (e.g. in case of Dual SIM with two associated numbers).
      
The IDL attribute emergencyNumbers MUST return the number of the emergency service in current
      geographical area, or a list thereof.
      
The IDL attribute active MUST return a TelephonyCall
      object if there is an active call. Otherwise it MUST return null.
      
The IDL attribute calls MUST return an array of all
      TelephonyCall objects present in the system. Otherwise it must return an empty list.
      
Whenever there is a change in the calls array the user agent MUST queue a task to
      fire a simple event named callschanged at Telephony object.
      
Whenever there is a change in the active TelephonyCall, the user agent MUST
      set the active attribute  to the new active call.
      
 The dial method when invoked MUST run the following steps:
        
TelephonyCall objectnumber of telCall to the telephone number specified
              in the number parameter
         calls already contains a TelephonyCall object associated to the number parameter,
         then go to error steps.
         number parameter. According to the value of the displayNumber in
                    the params parameter, own number is requested to be either displayed, hidden
                    or otherwise the default system configuration to this regard is requested to be followed.
                    If the request progress successfully, then
                calls array
                  state of telCall to dialing.
                  statechange at the telCall object.
                  dialing at the telCall object.
                  TCallControl MUST listen to any event (originated by API client operations or by the telephony system itself) that results in a disconnection not caused by the remote party, and in that case the following steps MUST be run:
state of telCall to disconnected.
        statechange at the telCall object.
        disconnected at the telCall object.
        calls array at Telephony.
      Upon a new incoming call, the user agent MUST:
TelephonyCall.
          state of incomingCall to incoming in case
          there is no other call in connected state or otherwise to
          waiting 
          calls array
          statechange at the incomingCall object.
          incoming at the incomingCall object and
          
          The incoming event has to be defined according to DOM4.
      
The startTone method when invoked MUST make a request to the telephony system
      to start sending the tone passed in the tone parameter to the active TelephonyCall object.
      If the request is acknowledged then return to the caller. If there is an error queue a task
      to fire a simple event named error at the Telephony object.
      
The stopTone method when invoked MUST make a request to the telephony system
      to stop sending tones to the active TelephonyCall object. If the request is acknowledged then return to the caller.
      If there is an error queue a task to fire a simple event
      named error at the Telephony object.
      
The  
         The following are the event handlers (and their corresponding event handler types)
        that MUST be supported as attributes by the Telephony object:
        sendTone method when invoked MUST make a request to the telephony system
      to send the tone passed in the tone parameter to the active TelephonyCall object with a default duration.
      If the request is acknowledged then return to the caller. If there is an error queue a task
      to fire a simple event named error at the Telephony object.
      Error Steps
        Event handlers
        
          
            
      
               
          
          
            event handler 
              event handler event type 
            
               
            onincomingincoming
               
          
        oncallschangedcallschanged
disconnected call state:
        "unknown", "local" (caller hung up), "remote" (remote party hung up, or is busy), "network" (network unreachable
        or busy, or error happened).The IDL attribute state MUST return the current status of the call.
      It MUST be one of the following values:
      
dialing (string value 'dialing')connecting (string value 'connecting')alerting (string value 'alerting')connected (string value 'connected')disconnecting (string value 'disconnecting')disconnected (string value 'disconnected')incoming (string value 'incoming')waiting (string value 'waiting')accepted (string value 'accepted')holding (string value 'holding')held (string value 'held')resuming (string value 'resuming')redirecting (string value 'redirecting')The following figure depicts the state diagram for inbound calls, i.e. calls that are received
 
      The following figure depicts the state diagram for outbound calls, i.e. calls that are dialed out
 
      It needs to be discussed whether the above figures as well as the textual description of the state transitions are normative or not.
Whenever there is a change in the state attribute the user agent MUST:
        
statechange
        When TCallControl is notified that a dialed call is in the process of being connected,
      it MUST set state to connecting
      
When TCallControl is notified that call alerting tones are being sent it MUST
      set state to alerting.
      
When TCallControl is informed that the connection has been established,
      it MUST set state to connected.
      
If there is any error during call progressing then the error steps MUST be executed.
The disconnect method when invoked MUST issue a request to the telephony system to disconnect the call. If the request is acknowledged,
      then set state to disconnecting.
      
When TCallControl is notified of actual call disconnection it MUST set state
      to disconnected.
      
The hold method when invoked MUST run the following steps:
      
state is not equal to connected
              raise an ILLEGAL_STATE exception
              state to holding.
      When TCallControl is notified that the call has been put on hold it MUST set state
      to held.
      
The resume method when invoked MUST run the following steps:
      
state is not equal to held raise an
          ILLEGAL_STATE exception
          state to resuming.
      When TCallControl detects that the call has being actually resumed it MUST set state to
      connected.
      
The answer method when invoked MUST run the following steps:
      
state is not equal to incoming or
              waiting raise an ILLEGAL_STATE exception
              state to accepted.
      The redirect method when invoked MUST run the following steps:
      
state is not equal to incoming
              raise an ILLEGAL_STATE exception
              redirectNumber parameter. If the request is acknowledged then set state to
              redirecting.
      When TCallControl is notified that the call has been successfully redirected it MUST set  
          The following are the event handlers (and their corresponding event handler event types)
          that MUST be supported as attributes by the TelephonyCall object:
        state
      to disconnected.
      
      Event handlers
        
          
            
      
               
          
          
            event handler 
              event handler event type 
            
               
            onstatechangestatechange
               
            ondialingdialing
               
            onalertingalerting
               
            onacceptedaccepted
               
            onconnectingonconnecting
               
            onconnectedconnected
               
            ondisconnectingdisconnecting
               
            ondisconnecteddisconnected
               
            onincomingincoming
               
            onholdingholding
               
            onheldheld
               
            onresumingresuming
               
            onredirectingredirecting
               
          
        onerrorerror
Multiparty calls have to be specified.
The editors would like to express their gratitude to the Mozilla B2G Team for their technical guidance, implementation work and support