This document includes material copied from the W3C Editor's Draft of the Telephony API from 14 October 2014. Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and permissive document license rules apply.
This specification defines an API to manage telephone calls. A typical use case of the Web Telephony API is the implementation of a 'Dialer' application supporting multiparty calls and multiple telephony services.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document was produced by the System Applications Working Group. Members of this Working Group have agreed not to progress the Telephony API specification further as a Recommendation track document, electing instead to publish it as an informative Working Group Note under a permissive license with a view to enabling it to form the basis of further work by others, e.g. in a W3C Community Group.
This document was published by the System Applications Working Group as a Working Group Note. If you wish to make comments regarding this document, please send them to public-sysapps@w3.org (subscribe, archives). All comments are welcome.
W3C makes this document available under the terms of the W3C Software and Document License pursuant to W3C's policy for Relicensing Unfinished W3C Specifications. Publication as a Working Group Note does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 1 August 2014 W3C Process Document.
Navigator
objectTelephonyManager
InterfaceCallState
enumTelephonyCall
InterfacecallId
attributeconferenceId
attributeremoteParty
attributeserviceId
attributestate
attributestateReason
attributetechnology
propertyaccept()
methodhold()
methodresume()
methoddisconnect
methoddeflect()
methodsplit()
methodCallManager
InterfaceToneManager
InterfaceEmergencyManager
InterfaceThis section is non-normative.
The Web Telephony API allows applications to manage interaction with telephony call signaling, but does not handle audio channels management and volume control.
For managing telephony calls, a call state handler needs to be defined, which defines actions on the call states, usually updating the user interface elements enabling interaction with the call, according to what user input different call states require. An example of making and receiving a telephony call is provided below.
var number = '+1234567890'; navigator.telephony.dial(number).then( function(call) { console.log("The call to " + number + " is controlled by TelephonyCall object with id: " + call.callId); console.log("Now hanging up..."); call.disconnect(); }, function (err) { console.log("Error making the call: " + err.message); });
// handle the state changes of both received and dialed calls function stateHandler(event) { var call = event.call; var state = call.state; if (state == 'incoming' || state == 'waiting') { // new TelephonyCall object has been created and added to CallManager // display the dialog for incoming/waiting call // wait for user input: accept, hangup, hold, deflect console.log(state + ' call...'); } else if (state == 'dialing') { console.log('Call is dialing'); } else if (state == 'alerting') { console.log('Outgoing call is alerting the remote party'); } else if (state == 'ringing') { console.log('Incoming call is ringing'); // wait for user input: accept, hangup, hold, deflect } else if (state == 'accepted') { console.log('Incoming call is accepted'); } else if (state == 'held') { console.log('Call is on hold'); } else if (state == 'active') { console.log('Call is active'); if (call.conferenceId) console.log('Call is part of a conference call'); } else if(state == 'disconnected') { // the TelephonyCall object has been removed from the CallManager list // update call history console.log('Call disconnected: ' + call.stateReason); } } navigator.telephony.addEventListener("callstatechange", stateHandler);
The use cases for this specification are collected in the wiki page of this API.
The following specifications informed the design of the Web Telephony API: for GSM the [GSM-CALL] suite, for IMS/SIP the [IMS] suite, for XMPP the [JINGLE] specification. Note, however, that IMS/SIP and XMPP are not supported in this version.
It is likely that the same API would work also for SIP and XMPP calls with the exception of multiparty call handling, which is modeled after the cellular multiparty calls. Future versions of this specification will probably add SIP and XMPP conference support.
It is under discussion whether a system message should be propagated when a CDMA telephony call is active, since not all CDMA networks support concurrent services. Therefore, many applications will lose their data connection when the end user is in a voice call.
This section is non-normative.
This API conforms to the permission model defined for System Applications.
The permission model is not finished yet and it will affect on how to expose lower vs higher privilege functionality in this API.
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, RECOMMENDED, SHOULD, and SHOULD NOT are to be interpreted as described in [RFC2119].
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.
This specification depends on the following interfaces and concepts defined in other specifications.
The following dependencies are defined in [HTML]:
EventHandler
interface, queue
a task, event
handler, origin,
task
source.
The following dependencies are defined in [DOM4]: the Event
and
the Promise
interfaces, the concepts of a resolver,
fire an
event.
The task source for all tasks queued in this specification is the telephony task source.
A telephony network is the infrastructure providing telephony functionality in a given geographical area, to which the device running the user agent is registered with at the point of operation.
A subscriber identity identifies and authenticates the user in the telephony network. In cellular telephony, subscriber identity is associated with the SIM card (Subscriber Identity Module). A given subscriber identity can be used in different, but interoperable telephony networks.
A telephony provider is the company operating the telephony network. A telephony provider can have multiple telephony networks.
A telephony modem is the software and hardware entity which implements the telephony protocols needed for interacting with the telephony networks, and which exposes an API which is used for implementing this API specification. A modem can be local to the device, or can be a remote modem, used e.g. via a paired Bluetooth device.
A telephony service is an abstract concept used in this API to denote the tuple of a given subscriber identity, and a given telephony modem. If any of these elements is changed, it means a different telephony service. Note that when a device is moving, and eventually changes the telephony network, it continues to see the same telephony service. A telephony service can use different protocols for telephony signaling and media (e.g. GSM, CDMA, VoLTE, etc.) with the same subscriber identity. There may be multiple SIM cards registered with the same provider, which will map to different telephony services.
Note the difference between dual-SIM and multiple-SIM card use cases. In dual-SIM use case the subscriber has two identities, which both can be active in the same time, i.e. could make and receive calls. In the multiple SIM card use case the subscriber has multiple identities, but only one can be active at a given time. These constraints are not exposed by this API, and implementations are expected to encapsulate them.
A user agent can access zero or more telephony services. Each telephony service has a unique telephony service id at any given moment, but it is not required to uniquely identify services in call history. In other words, the identifiers MAY be reused as services appear and disappear. Service identifiers SHOULD NOT be saved in call history, only displayable service names.
Access to a telephony service by any origin is restricted by a security policy. See the Security and privacy considerations section for more details.
It is strongly RECOMMENDED that implementations do not use use the MSISDN as the telephony service id. The MSISDN cannot guarantee uniqueness. For telephony services that make use of a SIM card, it is RECOMMENDED that the ICC-ID is used for the service identifier. For reducing fingerprinting, implementations SHOULD choose to use opaque UUID's or SHA signatures as service identifiers, associated in the implementation to the internal service identifiers such as ICC-ID.
The selected telephony service is the telephony service that is used as default for the origin for the methods of this API.
Implementations are not required to initialize a selected service at
startup. Instead, clients of this API may choose the preferred moment of initializing the telephony system by invoking the
navigator.telephony.service.getServices()
(if implemented)
or the navigator.telephony.getCalls()
, or the
navigator.telephony.dial()
methods.
If there is no selected telephony service set for the origin, the user agent SHOULD use the underlying system's default telephony service, if available. On implementations that have access to a hardware modem, regulations require supporting emergency number dialing from PIN dialog or dialer interface even in the absence of a SIM card.
A telephony call means a connected communication link between two or more call participants in a given a telephony service. From an application's point of view, a telephony call is an object which exposes properties and methods to monitor and control telephony calls. A telephony call involving more than two parties are referred to as a conference call or a multiparty call.
A remote party id, e.g. as a phone number, uniquely identifies a remote participant in a telephony call in the given telephony service.
Telephony calls initiated by the user using a telephony service in the system is an outbound call. Conversely, a telephony call from a remote party is an inbound call.
Every telephony call has a call id, which is a string that uniquely identifies the call among the other calls in progress. It is not required that the call id be unique across call history. Clients SHOULD NOT save the call id in call history, but SHOULD maintain their own id space, e.g. using start time and remote party information.
A call state represents the state of interaction between a telephony service, the user agent, and one or more remote parties. In the process of establishing and maintaining a connection between multiple parties, a telephony call transitions through various call states. A telephony call is always in a defined call state, which can only be changed by using methods of this API, or by the telephony service.
in GSM, there are 3 types of call states:
Instead of using a 3-dimensional call state space, this API uses a one dimensional call state model, in which call states map to valid combinations in of 3-dimensional states, and are able to describe valid state transitions.
An active call is a telephony call in the active state representing a connected call which is bound to the media input and output devices (e.g. microphone, speaker, tone generator). Note that a call on hold is also connected from a call signaling point of view, but it is not bound to media input and output devices.
A conference call is a telephony call with multiple remote party participants. The way conference calls are handled are quite different depending on the telephony protocol.
This of the API version supports GSM multiparty calls and CDMA 3-way calls. Supporting SIP and XMPP conferences is possible in the future, and would require additional method parameters to conference creation.
Note that the terms "GSM" and "CDMA" refer to the type of interaction needed with the telephony network, rather than the radio technology itself. For instance, 3G and 4G GSM is also using CDMA radio technology, but expose a GSM type interface.
Creating GSM multiparty calls involve the following user interaction:
In CDMA, only a limited form of conference call is supported, called 3-way call, which is usually mapped to multiple presses of the 'Call' button, which in background uses modem AT commands (ATD, ATH and Flash) to achieve the desired action. Handling 3-way calls involve the following user interactions:
The common way to support these user interactions by this API, there is possible programmatic support for the following actions:
dial()
method
createConference()
methoddisconnect()
method on the second call
objectThis API has been designed so that conference calls could be controlled using the same type object as with a single telephony call.
Every conference call has a conference id that uniquely identifies a conference call in the system.
This section is non-normative.
This API has been designed to facilitate typical telephony interaction scenarios, such as:
The technical use cases requiring elevated permissions are the following:
Further telephony use cases which are currently not explicitly handled by this version of the API, but may be supported in the future:
TelephonyManager
InterfaceThe TelephonyManager interface provides access to telephony functionality related to telephony call management, sending [DTMF] tones, and handling emergency numbers and calls.
TelephonyManager
implements CallManager
;
TelephonyManager
implements ToneManager
;
TelephonyManager
implements EmergencyManager
;
interface TelephonyManager {
readonly attribute ServiceManager
? service;
};
The service
property MUST return the
ServiceManager
object exposing functionality
concerning telephony services, or null
if not
supported.
The rest of TelephonyManager
properties are
described by the CallManager
,
ToneManager
and
EmergencyManager
interfaces.
CallState
enum
Within the API, the call states are represented by the
CallState
enum.
enum CallState {
"dialing",
"connecting",
"alerting",
"ringing",
"active",
"conference",
"incoming",
"waiting",
"accepted",
"held",
"disconnected",
"holding",
"resuming",
"redirecting",
"transferring",
"disconnecting"
};
The meaning of the call states referenced in this API is the following:
TelephonyCall
objects controlling
conference calls, when created.
alerting
state.
The call state reason is used primarily for the
disconnected
state, known as the
disconnect reason.
In this API the disconnection reasons are represented by
the DisconnectReason
enum.
DisconnectReason
enumenum DisconnectReason {
"local",
"remote",
"network",
"busy",
"rejected",
"redirected",
"unreachable",
"no-answer",
"network-unreachable",
"barred",
"no-service",
"invalid-number"
};
The meaning of the disconnect reasons in this API is the following:
Since call state transitions depend on protocol, network equipment, modem, etc., the implementation SHOULD always re-synchronize any eventual internal states to the current call state reported by the telephony system. The implementation SHOULD NOT set the call state to any other value than specified in the descriptions of the methods of this interface.
Since call states can have slightly
different semantics depending on the telephony protocol, the
protocol
property of TelephonyCall
can be used for interpreting the call state in the implementation.
See issue
125.
The device can receive phone calls from any active telephony service, even simultaneously, in which case the user agent arbitrates the calls either by a policy, or by the user by choosing which call to accept.
For call setup on received calls, the following call states SHOULD be supported in this order:
On received calls, telephony protocols use the
"ringing"
state, set by the mobile terminal when
local call alerting starts, in order to notify the remote party about
the ongoing alerting (ringing can actually be e.g. a beep, ring tone,
or vibration pattern). If the modem expects this state to be set,
implementations SHOULD make sure to set it.
CDMA cannot report all these states in the expected sequence. The ‘connected’ network state (i.e. when the mobile station send the Service Connect Completion Message or Connect Order, depending on whether the call is mobile originated or terminated) is immediately followed by voice media transmission – there is no transition to ‘active’ before the media arrives. Therefore it should be up to the implementation to determine which events to fire and in which order. Dialer applications need to be prepared to handle such cases.
For making a call, the telephony service transitions through the following states in order. Errors can occur at each state, which are handled by the telephony network, and may result in the call becoming disconnected:
On the telephony services which support the 'connecting'
call state (e.g. GSM and CDMA, for call routing, forwarding, voicemail
handling etc), implementations SHOULD support this state too.
Valid state transitions for a conference call are:
'connecting'
to
'active'
'active'
to
'holding'
to 'held'
'held'
to 'resuming'
to 'active'
'disconnected'
.Promise
objects are used for tracking the
protocol transactions (e.g. GSM multiparty states), resolving either to
success or error.
TelephonyCall
InterfaceDefines the object structure for controlling calls, including conference calls.
interface TelephonyCall {
readonly attribute DOMString? callId;
readonly attribute DOMString? conferenceId;
readonly attribute DOMString? remoteParty;
readonly attribute DOMString serviceId;
readonly attribute CallState
state;
readonly attribute DOMString stateReason;
readonly attribute TelephonyTechnology
technology;
Promise accept ();
Promise hold ();
Promise resume ();
Promise disconnect ();
Promise deflect (DOMString remoteParty);
Promise split ();
};
In the methods implementation the user agent MAY choose to make an early validation of preconditions and parameters, or defer those checks to the underlying telephony system.
callId
attribute
When getting the callId
attribute, the user agent MUST return the unique call id.
After construction, the value MUST be null
.
The implementation MUST assign a non-null value when the
state
property is assigned a value different from
'initializing'
.
conferenceId
attribute
When getting the
conferenceId
attribute, the user agent MUST return the value of the
callId
attribute of the conference call
to which this call is part of, or null
if it is not
part of any conference call. If the callId
and
the conferenceId
values are equal and not
null
, then the TelephonyCall
object is
controlling a conference call.
remoteParty
attribute
When getting the
remoteParty attribute,
the user agent MUST return the remote party id (e.g. telephone
number) of the call participant. If not available (e.g. callerId has
been hidden), return null
.
serviceId
attributeWhen getting the serviceId attribute, the user agent MUST return the telephony service id of the telephony service associated with this call.
state
attribute
When getting the state
attribute, the user agent MUST return the CallState
value that
represents the state of for the telephony call.
stateReason
attributeWhen getting the stateReason attribute, the user agent MUST return:
DisconnectReason
value if the call state
is "disconnected"
","inbound"
for calls that started with
the "incoming"
or "waiting"
state"outbound"
for calls that started with
the "dialing"
state.technology
property
When getting the
attribute, the user agent MUST return the current technology used by
the telephony provider, if available, or otherwise
null
.
enum TelephonyTechnology {
"gsm",
"cdma",
"edge",
"umts",
"hspa",
"lte"
};
The following values are supported as telephony technologies:
"gsm"
: used for GSM protocols"cdma"
: used for CDMA and related protocols"edge"
: used for EDGE protocol"umts"
: used for UMTS protocols"hspa"
: used for HSPA and HSPA+ protocols"lte"
: used for LTE protocolsaccept()
methodThe accept() method accepts an incoming or waiting telephony call. When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
state
property is not equal to
incoming
or waiting
, then
optionally call resolver's reject(value)
method with the value argument set to a new
DOMError
object whose name is set to
"InvalidStateError"
, and terminate this algorithm.
state
of the callstate
of the
call to the call state on the modem. Then,
call resolver's reject(value)
method with
the value argument set to a new DOMError
object whose name is set to
"NoModificationAllowedError"
, and terminate
this algorithm.
state
to
accepted
, execute the
state change steps and
queue a task to invoke resolver's
accept()
method.
hold()
methodThe hold() method requests the telephony system put the call on hold. When invoked, the user agent MUST run the following hold steps:
Promise
object and resolver its associated resolver.
state
property is not equal to
active
, then optionally call
resolver's reject(value)
method with the value argument set to a new
DOMError
object whose name is set to
"InvalidStateError"
, and terminate this algorithm.
state
of the call to holding
state
of the
call to the call state on the modem. Then call resolver's
reject(value)
method with the value argument
set to a new DOMError
object whose name is
set to "NoModificationAllowedError"
, and terminate
this algorithm.
state
to
held
, execute the
state change steps and
queue a task to invoke
resolver's accept()
method.
resume()
methodThe resume() method requests the telephony system to resume resume a held call. When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
state
is not equal to held
,
optionally call resolver's reject(value)
method with the value argument set to a new
DOMError
object whose name is set to
"InvalidStateError"
, and terminate this algorithm.
state
of the call to
resuming
state
of the
call to the call state on the modem.
Then call resolver's reject(value)
method
with the value argument
set to a new DOMError
object whose name is
set to "NoModificationAllowedError"
, and terminate
this algorithm.
state
to
active
, execute the
state change steps and
queue a task to invoke
resolver's accept()
method.
disconnect
method
The disconnect
method, if invoked on a TelephonyCall
which is not
controlling a conference call (i.e. its callId
is
different from its conferenceId
), it initiates releasing
of the telephony call. If the call is controlling a conference call,
then initiates releasing the conference call, including each
participating TelephonyCall
object.
Promise
object and resolver its associated resolver.
state
of the call to
disconnecting
state
of the
call to the call state on the modem.
Then call resolver's
reject(value)
method with the value argument
set to a new DOMError
object whose name is
set to "NoModificationAllowedError"
, and terminate
this algorithm.
accept()
method.
Depending on the protocol, there may be restrictions on methods. For instance, GSM does not permit disconnecting a held call. Also, disconnecting a participant in a held GSM multiparty call is not supported. Also, if the controlling party disconnects a call participating in a IS-41 3-way call in CDMA which is not the last dialed call, then all parties are disconnected (other participants should choose to hang up).
deflect()
methodThe telephony service in use needs to have the call deflection feature enabled in order for this method to succeed. For instance, in GSM, the Call Deflection supplementary service needs to be active.
The redirect() method initiates deflecting an incoming or waiting telephone call to a remote party. The method takes one argument, which represents the remote party to which the call is redirected. When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
state
is not incoming
or
waiting
, then optionally
call resolver's reject(value)
method with the value argument set to a new
DOMError
object whose name is set to
"InvalidStateError"
, and terminate this algorithm.
reject(value)
method with
the value argument set to a new DOMError
object whose name is set to NotSupportedError
, and terminate these steps.state
of the call to
redirecting
state
of the
call to the call state on the modem.
Then call resolver's reject(value)
method
with the value argument set to a new
DOMError
object whose name is set to
"NoModificationAllowedError"
or
"NotSupportedError"
, and terminate these steps.
accept()
method.
split()
method
The split()
method requests the telephony system to split the
TelephonyCall
object from the
conference call it is participating, activate it and put the
conference call on hold. When invoked, the
user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
conferenceId
property is null
,
or does not match to a conference call in progress, then
optionally
set conferenceId
to null
,
call resolver's reject(value)
method with
the value argument set to a new DOMError
object whose name is set to
"InvalidModificationError"
, and terminate this
algorithm.
reject(value)
method with
the value argument set to a new DOMError
object whose name is set to NotSupportedError
, and terminate these steps.TelephonyCall
object controlling the conference call, whose
callId
and conferenceId
property is equal
to the conferenceId
property.
state
of the call and
set the state of confCall to
splitting.
state
of the
call to the call state on the modem.
Then call resolver's
reject(value)
method with the value argument
set to a new DOMError
object whose name is
set to "NoModificationAllowedError"
or
NotSupportedError
, and terminate these steps.
conferenceId
of the split call to null
.
The telephony system has by now put the conference call on hold and
activated the split call.
accept()
method.
In CDMA, only the last dialed call can be split off the 3-way call. For other call participants, calling this method MUST fail.
CallManager
Interface
The CallManager
interface provides access to telephony
functionality related to given telephony services, and manages
the lifecycle of the TelephonyCall
objects.
A TelephonyCall
object can be created in the
following ways:
dial
()
method, returned as a parameter
to the accept()
method of the returned
Promise
object, as explained in the
dialing steps.
createConference()
method, returned as a
parameter to the accept()
method of the returned
Promise
object, as explained in the
conference creation steps.
The same object will be received as a property to the
TelephonyCallStateEvent
corresponding to the
'connecting'
' state.
TelephonyCall
object is
created and passed as a property exposed in the
TelephonyCallStateEvent
event which is fired at
the CallManager
object
navigator.telephony. This is explained at the
inbound call steps.
TelephonyCallStateEvent
event.
interface CallManager {
readonly attribute TelephonyCall
? activeCall;
Promise getCalls ();
Promise dial (DOMString remoteParty, DialOptions options);
Promise transfer ();
Promise createConference ();
Promise getParticipantCalls (DOMString conferenceId);
attribute EventHandler
oncallstatechange;
attribute EventHandler
onactivecallchange;
};
The following are the event handlers implemented by the
CallManager
interface.
event handler | event name | event type | description |
---|---|---|---|
onactivecallchange
|
activecallchange |
Event | handles a change in the active call |
oncallstatechange
|
statechange |
TelephonyCallStateEvent |
handles a change in a call state |
activecallchange
eventWhen a telephony call becames the active call, the user agent MUST run the following steps:
TelephonyCall
object which has become active.activeCall
property of all
instances of CallManager
, to call.
activecallchange
at all the instances of
CallManager
.
callstatechange
event
The callstatechange
event is used for tracking
TelephonyCall
objects and based on the current
state, applications decide how to change the user interface elements
connected to method of this API in order to control the call.
TelephonyCallStateEvent
Interface
Defines telephony events for TelephonyCall
state changes, including handling incoming and waiting calls, and
conference call creation.
interface TelephonyCallStateEvent : Event {
readonly attribute TelephonyCall
call;
};
call
attribute
When getting the call
attribute, the
user agent MUST return the
TelephonyCall
object that triggered the
event, on which the state
property indicates the
state which has triggered the event.
Whenever there is a change in the state
attribute of a
TelephonyCall
object, the user agent
MUST run the following steps:
callstatechange
of type
TelephonyCallStateEvent
, to the
CallManager
object
navigator.telephony.
Upon a new incoming or waiting call the user agent MUST execute the following onincoming steps:
TelephonyCall
.
state
of call
to incoming
in case the underlying telephony
system reports that state (which happens when there is no other call
in active
state),
state
of call to
waiting
, in case the underlying telephony system
reports that state (which happens if the call waiting service is
active and there is already an active call),
state
of call has been set
to either incoming
or
waiting
, then add call to the
list of calls managed by CallManager
.
callstatechange
of type
TelephonyCallStateEvent
to all instances of
the CallManager
object, with call
passed as a property.
When a telephony call telCall is disconnected, the user agent MUST run the following steps:
CallManager
state
of telCall to
"disconnected".
TelephonyCallStateEvent
named statechange
at all the
CallManager
objects,
with the call
property set to call,
whose stateReason
property is set to the
DisconnectReason
. At least the
following values MUST be supported for the disconnect reason:
"local", "remote" and "network".
The rest of the DisconnectReason
values SHOULD be
supported.
activeCall
attribute
When getting the activeCall attribute, the
user agent MUST return the TelephonyCall
object
that represents the active call. If there is no active call,
return null
.
getCalls()
method
When the getCalls()
method is
invoked, the
user agent MUST return a Promise
object, which in
case of success resolves to an array, which can be empty, of all
TelephonyCall
objects in the system which have the
value of the state
property different from
'disconnected'
, i.e. all
telephony calls in progress. TelephonyCall
objects
belonging to a conference call are also listed here.
The applications SHOULD check the conferenceId
property
of each TelephonyCall
object in order to determine
whether the call is part of a conference call, and if yes, which is
the controlling TelephonyCall
object for the
conference call.
This method MUST get all calls from all enabled
telephony services, hence the getServices()
method needs to be called first. If the client has not explicitly
called it yet, it is the responsibility of
the implementation to retrieve the available telephony services.
dial()
method
The
dial(remoteParty)
method initiates a new
telephony call on the selected telephony service.
When the dial()
method is invoked, the user agent MUST
run the following dialing steps:
Note that verification of the format of the remoteParty argument is left to the telephony service. Providing an remoteParty in the invalid format will generally result in the call disconnecting because the telephony service or telephony network will deem it an invalid number. However, the user agent SHOULD do a basic validation of the user input.
Promise
object and resolver its associated resolver.
reject(value)
method with
the value argument set to a new DOMError
object whose name is set to
"NoModificationAllowedError"
, and terminate these steps.
remoteParty
property and if it is not valid, resolve promise with an
"InvalidCharacterError"
error, and terminate this
algorithm.
reject(value)
method with the value argument set to a new
DOMError
object whose name is set to
"NoModificationAllowedError"
, and terminate this
algorithm.
state
property to 'dialing'
,
execute the state change
steps, and queue a task to invoke resolver's
accept(value)
method.
transfer()
methodThe telephony service needs to have the call transfer feature enabled in order for this method to succeed. For instance, in GSM, the Call Transfer supplementary service needs to be active.
The transfer() method initiates joining the active and held calls on the selected telephony service, then disconnects, so that the conversation is continuing between the remote parties of the formerly active and held calls, respectively. The method needs the GSM Explicit Call Transfer supplementary service to be active.The method takes one argument, which represents the held call whose remote party is connected with the remote party of this call (which MUST be the active call). When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
reject(value)
method with the value argument
set to a new DOMError
object whose name is set to
"InvalidStateError"
, and terminate this algorithm.
reject(value)
method with
the value argument set to a new DOMError
object whose name is set to NotSupportedError
, and
terminate these steps.
state
of this call to
transferring
state
of the
call to the call state on the modem. Then call resolver's
reject(value)
method with the value argument
set to a new DOMError
object whose name is
set to "NoModificationAllowedError"
or "NotSupportedError"
and terminate these steps.
accept()
method.
createConference()
methodWhen the createConference() method is invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
'held'
state, then optionally resolve
promise with a "NoModificationAllowedError"
error and terminate this algorithm.
serviceId
property of the active call.
TelephonyCall
with a unique callId
property having the same value as
the conferenceId
property, and the value of the
serviceId
property set to service.
state
of confCall to
'connecting'
and execute the
state change steps.
serviceId
property of service make a request
to the telephony system to create a conference call, and wait for
the response. In GSM this will mean joining the active and held
calls into a conference call.
In CDMA, it means joining the waiting
or
held
call with the active call into a 3-way
call.
reject(value)
method with the value
argument set to a new DOMError
object whose name is
set to "NoModificationAllowedError"
, invalidate
confCall and terminate this algorithm.
CallManager
object
(navigator.telephony). In the same step, set the
conferenceId
attribute of all the
participating calls to the callId
of the
conference call confCall, and their state to
conference.
state
of confCall to
'active'
and execute the
state change steps, and
the active call change
steps.
accept(value)
method
with the value argument set to confCall.
getParticipantCalls()
methodWhen the getParticipantCalls() method is invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
DOMString
of this method.
TelephonyCall
object with the callId
property equal to
confId. If there is no such object, then resolve
promise with a "NoModificationAllowedError"
error, and terminate this algorithm.
TelephonyCall
objects
participating in the conference call, i.e. those
whose conferenceId
property is equal to
confId.
accept(value)
method with value parameter
set to the array containing the list of participant calls.
ToneManager
Interface
The ToneManager
interface provides [DTMF] related
functionality, such as sending a series of tones, and starting and
stopping a single tone.
Tone value can be any of the following characters: 0-9, A-D, *, #.
The above needs to be converted to ABNF
interface ToneManager {
Promise sendTones (DOMString tones, optional ToneOptions
options);
Promise startTone (DOMString tone, optional ToneOptions
options);
Promise stopTone (optional DOMString serviceId);
};
sendTones()
methodThe sendTones() method requests a telephony service emit one or more [DTMF] tones.
ToneOptions
Dictionarydictionary ToneOptions {
unsigned long duration;
unsigned long gap;
};
duration
member
The duration
member represents the duration (mark)
in milliseconds of the [DTMF] tones to be sent. The minimum
value SHOULD be 70 ms.
gap
member
The gap
member represents
the duration in milliseconds of the time gap (space) before a
[DTMF] tone. The minimum value SHOULD be 30 ms.
When the sendTones()
method is invoked, the user agent
MUST run the following steps:
Promise
object and resolver its associated
resolver
.
reject(value)
method with the
value argument set to a new DOMError
object
whose name is set to "NoModificationAllowedError"
, and
terminate these steps.
ToneOptions
parameter specifies the tone
duration
, then validate and use that value, otherwise
use a default value.
ToneOptions
parameter specifies the tone
gap
, then validate and use that value, otherwise use a
default value.
accept()
method
with no arguments.
reject()
method, with no
arguments.
startTone()
method
The startTone() method
starts emitting a [DTMF] tone with the platform default or
specified delay, in the platform default or the specified
telephony service. A Promise
object will be
returned in order to notify the result of the request.
When the startTone
method is invoked, the user agent
MUST run the following steps:
Promise
object and resolver its associated
resolver
.
reject(value)
method with the
value argument set to a new DOMError
object
whose name is set to "NoModificationAllowedError"
, and
terminate these steps.
reject(value)
method with the
value argument set to a new DOMError
object
whose name is set to "NotSuppoertedError"
, and
terminate these steps. In
this case applications may then use the sendTones
method for sending [DTMF].
stopTone
method is called.
Promise
object and resolver its associated
resolver
.
accept()
method with no arguments.
reject()
method, with no
arguments.
stopTone()
methodThe stopTone() method stops emitting a [DTMF] tone in the selected telephony service. When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated
resolver
.
reject(value)
method with the
value argument set to a new DOMError
object
whose name is set to "NoModificationAllowedError"
, and
terminate these steps.
reject(value)
method with the
value argument set to a new DOMError
object
whose name is set to "NotSupportedError"
, and
terminate these steps.
accept()
method with no arguments.
reject()
method, with no
arguments.
EmergencyManager
InterfaceThis interface provides access for reading emergency numbers from the available telephony services.
interface EmergencyManager {
// on success returns emergency numbers as sequence of DOMString
Promise getEmergencyNumbers ();
attribute EventHandler
onemergencynumberschanged;
};
The following are the event handlers implemented by the
EmergencyManager
interface.
event handler | event name |
---|---|
onemergencynumberschanged
|
emergencynumberschanged
|
When emergency numbers have changed, the changed
event of
type Event
MUST be fired at the object implementing
this interface. The applications SHOULD read the emergency numbers
by the getEmergencyNumbers()
method.
getEmergencyNumbers()
methodWhen the getEmergencyNumbers() method is invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
"NoModificationAllowedError"
.
reject(value)
method
with error as the value argument.
DOMString
strings, and queue a task to
invoke resolver's accept(value)
method with
the sequence of emergency numbers in the current geographical area,
as the value argument. The list can be empty.
To be improved. See bug 26.
This API provides access to a potentially dangerous and valuable feature of a device. As a result, misuse of the API would have a large cost to users and other system stakeholders. This API should, therefore, not be implemented without careful consideration of security and privacy issues.
This section provides a limited overview of security and privacy considerations relevant for this API. It includes a set of threats to users and other stakeholders, as well as requirements for mitigating them.
However, this section cannot cover all of the potential threats, nor can it reflect the context in which a conformant implementation may be operating. As a result, this security section should be considered only the starting point for implementers.
The following list of threats should be considered by the implementer. Note that these are not given in any order.
The following mechanisms may be employed to help an implementer mitigate the threats outlined in the previous section.
Implementations SHOULD make sure the phone calls are controllable by the user at any point in time while the call is active.
The CallHistoryEntry
interface describes the minimum set of
properties which a user agent would need to support for call history
entries. For conference call there needs to be a separate
CallHistoryEntry
object for each call participant, sharing the
same value for the conferenceId attribute.
It is up the the implementations and applications how to store and access call history. This document only specifies the minimum content of the data to be saved.
CallHistoryEntry
interfaceinterface CallHistoryEntry {
readonly attribute DOMString remoteParty;
readonly attribute Date startTime;
readonly attribute unsigned long long duration;
readonly attribute CallDirection
direction;
readonly attribute DisconnectReason
? disconnectReason;
readonly attribute boolean conference;
readonly attribute boolean emergency;
readonly attribute DOMString serviceName;
};
remoteParty
attribute
When getting the remoteParty
attribute, the
user agent MUST return the remote party id (e.g. telephone
number) of the call participant.
startTime
attributeWhen getting the startTime attribute, the user agent MUST return the starting time of the call, measured from when the call is in active state.
duration
attribute When getting the duration attribute, the user agent MUST return the duration of the call expressed in milliseconds.
direction
attribute
When getting the direction attribute, the user
agent MUST return the CallDirection
.
disconnectReason
attribute
When getting the disconnectReason
attribute, the user agent MUST return the DisconnectReason
if available, or return null
otherwise.
emergency
attribute
When getting the emergency attribute, the user
agent MUST return true
if the call was an emergency
call, or false
otherwise.
conference
attribute
When getting the conference
attribute, the
user agent MUST return the true
if the
call has participated in a conference call. Otherwise, return
false
.
serviceName
attribute
When getting the serviceName
attribute, the user
agent MUST return the name of the telephony service
used for the call.
CallDirection
enumenum CallDirection {
"dialed",
"received",
"misse",
missed-new"
};
The call direction can take the following values:
This section is non-normative.
ServiceManager
Interface
The ServiceManager
interface manages the state of the
TelephonyService
objects.
interface ServiceManager : EventTarget {
readonly attribute selectedService;
Promise selectService (DOMString serviceId);
Promise getServices ();
attribute EventHandler
onserviceadded;
attribute EventHandler
onserviceremoved;
attribute EventHandler
onservicechanged;
attribute EventHandler
onselectedservicechanged;
};
The following are the event handlers implemented by the
ServiceManager
interface.
event handler | event name | event type | short description |
---|---|---|---|
onserviceadded
|
serviceadded |
TelephonyServiceEvent |
handles a new enabled telephony service. |
onserviceremoved
|
serviceremoved |
TelephonyServiceEvent |
handles a disabled telephony service. |
onservicechanged
|
servicechanged |
TelephonyServiceChangeEvent |
handles a changed telephony service. |
onselectedservicechanged
|
selectedservicechanged |
TelephonyServiceEvent |
handles the change of selected telephony service. |
Telephony services can be added or removed from the system at any time (e.g., the user pops out the SIM card or adds a different SIM card; the user tells the system to only allow certain applications to access a particular telephony service, etc.).
The functionality related to managing telephony services is described
in the ServiceManager
interface.
TelephonyManager
implements the
ServiceManager
interface.
When a telephony service is either added or removed in the system, or the selected telephony service is changed, the user agent MUST run the next steps to change the telephony service:
TelephonyServiceEvent
, with
the event name set to serviceremoved
if the telephony
service was removed, or serviceadded
if it was added, or
selectedservicechanged
if the
selected telephony service has changed. Or, if a telephony
service has changed, let event be a new
TelephonyServiceChangeEvent
, with
the event name set to servicechanged
.
This event does not bubble, is not cancelable, has no default action,
and its serviceId
attribute is set to the
telephony service id of the telephony service that
initiated this algorithm.
null
and
queue a task to fire a selectedservicechange
event at the ServiceManager
object(s).
TelephonyManager
.
Note that compliant implementations may not be reporting events exactly when they occur, and the implementations may have to poll for these (e.g. OTA SIM update or hot-swappable SIM cards). See issue 127.
selectedService
property
When getting the selectedService
attribute, the user agent MUST return the
TelephonyService
object that
represents the selected telephony service, or
return null
if it is not available.
selectService()
methodThe selectService() method provides a means to change the selected telephony service used by the user agent. When invoked, the user agent MUST run the the following steps:
Promise
object and resolver its associated resolver.
DOMError
object whose name is
NotFoundError
.
"NoModificationAllowedError"
.
reject(value)
method
with error as the value argument.
accept()
method.
selectedservicechanged
at the ServiceManager
object(s).
getServices()
methodThe getServices() method provides a means to retrieve the list of telephony service ids representing enabled telephony services. When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
"NoModificationAllowedError"
.
reject(value)
method
with error as the value argument.
accept(value)
method with the sequence of
TelephonyService
objects as
value argument, even if the list is empty.
TelephonyServiceEvent
InterfaceDefines a telephony event for notifying about a new or removed telephony service.
interface TelephonyServiceEvent : Event {
readonly attribute TelephonyService
service;
};
service
attribute
When getting the service
, the user
agent MUST return the TelephonyService
object
representing the telephony service that triggered the event.
TelephonyServiceChangeEvent
InterfaceDefines a telephony event for notifying about a changed telephony service.
TelephonyServiceChangeEvent
implements TelephonyService
;
interface TelephonyServiceChangeEvent {
readonly attribute DOMString[] changedProperties;
};
changedProperties
attribute
When getting the changedProperties
, the user
agent MUST return the sequence of property names of the
TelephonyService
object service,
whose value has been changed.
TelephonyProvider
InterfaceThis section is non-normative.
The interface which represents telephony providers present in the system.
[NoInterfaceObject]
interface TelephonyProvider {
attribute DOMString name;
readonly attribute RegistrationMode? registrationMode;
readonly attribute TelephonyTechnology
technology;
readonly attribute TelephonyTechnology
[] technologies;
readonly attribute double signalStrength;
readonly attribute double dataStrength;
readonly attribute DOMString? mobileNetworkCode;
readonly attribute DOMString? mobileCountryCode;
readonly attribute DOMString? locationAreaCode;
};
name
propertyIt MUST return the name of the telephony provider.
registrationMode
propertyIt MUST return the registration mode used by the telephony provider. The following values are supported:
"manual"
: manual registration"auto"
: automatic registrationenum TelephonyTechnology {
"manual",
"auto"
};
technology
property
It MUST return the current TelephonyTechnology
used by the telephony provider, if available, otherwise
null
.
technologies
propertyIt MUST return the list of supported technologies of the telephony provider.
signalStrength
propertyIt MUST return the current radio signal strength with the telephony provider as a number scaled between 0 (no signal) and 1.0 (maximum).
dataStrength
propertyIt MUST return the current radio signal strength of the High Data Rate network if the provider is a CDMA network, as a value between 0 (no signal) and 1 (full strength), or 0 if not available.
mobileNetworkCode
property
It MUST return the Mobile Network Code of the
telephony provider, if available, otherwise null
.
mobileCountryCode
property
It MUST return the Mobile Country Code of the
telephony provider, if available, otherwise null
.
locationAreaCode
property
It MUST return the Location Area Code of the
telephony provider, if available, otherwise null
.
TelephonyService
InterfaceThis section is non-normative.
The interface which manages a given telephony services present in the system. Different services may provide different set of interfaces for managing service specific settings, depending on protocol and the current telephony network to which the device is connected.
[NoInterfaceObject]
interface TelephonyService {
attribute DOMString name;
readonly attribute DOMString serviceId;
readonly attribute TelephonyServiceType
serviceType;
readonly attribute boolean enabled;
readonly attribute boolean emergencyMode;
readonly attribute TelephonyProvider
provider;
Promise setEnabled (boolean enabled);
Promise getProviders ();
Promise selectProvider (TelephonyProvider
provider);
};
serviceId
propertyIt MUST return the telephony service id of the telephony service.
enabled
property
It MUST return or set the enabled state of the service, i.e.
true
if the service is enabled, and false
if the service is disabled.
emergencyMode
property
It MUST return true
if the service is in emergency mode, i.e. an emergency call is in progress,
and false
otherwise.
displayName
propertyIt MUST return the string value as displayed to the user by the application. It MAY be a localization string identifier.
provider
property
It MUST return the TelephonyProvider
object
selected for the telephony service.
serviceType
propertyThe following values are supported as telephony service type:
"unknown"
: service type not known"hw"
: hardware modem"hfp"
: external modem used through Bluetooth
Hands Free Profile (for control and also handles audio)
"sap"
: external modem used through Bluetooth SIM
Access Profile (only for control, audio is local)
"sw"
: software modem.
enum TelephonyServiceType {
"unknown",
"hw",
"hfp",
"sap",
"sw"
};
setEnabled()
methodThe setEnabled() method enables or disabled the telephony service . When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
true
, and disable it otherwise.
"NoModificationAllowedError"
.
reject(value)
method
with error as the value argument.
accept()
method. Parallel to this, implementations
MUST also follow the
steps for handling service change events.
selectProvider()
methodThe selectProvider() method registers with the selected provider (network operator). When invoked, the user agent MUST run the following steps:
Promise
object and resolver its associated resolver.
"NoModificationAllowedError"
.
reject(value)
method
with error as the value argument.
accept()
method. Parallel to this, implementations
MUST also follow the
steps for handling service change events.
In the future, TelephonyService
could be extended e.g. in the following way:
CellularService
implements TelephonyService
;
[NoInterfaceObject]
interface CellularService {
readonly attribute SimInfo? simInfo;
readonly attribute SimSettings? simSettings;
readonly attribute CallForwarding? forwarding;
readonly attribute CallBarring? barring;
readonly attribute CallMeters? meters;
readonly attribute SupplementaryServices? ss;
// ... and other interfaces...
};
Depending on implementation, on operator network support and on
settings, some of these interfaces may not be available, in which case
the value of the corresponding attributes is set to null
.
The following is a list of substantial changes to the document. For a complete list of changes, see the change log on Github. You can also view the recently closed bugs.
navigator.telephony.service
object, in order to keep
navigator.telephony
compatible with earlier versions.
The editors would like to express their gratitude to the Mozilla B2G Team for their technical guidance, implementation work and support, especially to Ben Turner and Jonas Sicking, the authors of the B2G WebTelephony API. Also, thanks to Denis Kenzior (ofono maintainer) and Oleg Zhurakivskyy of Intel Open Source Technology Center, and many others for their advice and support.