<private> new Phone()
Creates a new instance of the private class Phone.
The private class Phone
cannot be accessed directly. To get an instance of the Phone
use the
method ATT.rtc.Phone.getPhone
.
The singleton Phone
object exposes public methods (listed below) that can be used for performing
different call and conference related operations.
The Phone
object fires events that can be subscribed to for taking appropriate action based
on the fired event.
Fires:
Methods
-
acceptModification()
Accept the incoming call modification request.
-
Use this function to accept a call modification request for an ongoing call.
This method fires Phone#call:modification-in-progress initially and Phone#call:state-changed on success.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.acceptModification();
-
addCall(options)
Add a second call when an active call exists.
-
Use this function to dial a second call. You may not use this method if there is not an existing active call.
This method will put the active call on hold (if not already on hold) and then try to dial the second call.
If the second call fails, the user is switched back to the first call.
If the second call connects and is hung-up at a later point, the user is then returned to the first call.
The first call will resume automatically when the second call ends or fails, unless the first call was put on hold explicitly (using the hold function).This method can fire Phone#event:error that can have these error codes:
Error codes
Parameters:
Name Type Description options
Object Properties
Name Type Argument Description destination
String The phone number (Dialing 11 digit phone numbers is required with the exception of special numbers like 911.) or user id of the called party (without 'sip:' or 'tel:').
localMedia
HTMLVideoElement remoteMedia
HTMLVideoElement mediaType
String <optional>
audio
orvideo
. Default is video.Fires:
- Phone#event:dialing
- Phone#call:connecting
- Phone#call:canceled
- Phone#call:rejected
- Phone#call:ringback-provided
- Phone#call:connected
- Phone#media:established
- Phone#event:notification
- Phone#event:error
Examples
// Add a video call with an Mobile Number User var phone = ATT.rtc.Phone.getPhone(); phone.addCall({ destination: '11231231234', //1800CALFEDX, 1 (123) 123-1234 localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo'), mediaType: 'video' });
// Add a video call with an Account ID User var phone = ATT.rtc.Phone.getPhone(); phone.addCall({ destination: 'john@domain.com', localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo') });
-
addParticipant(participant)
Add participant to the conference
-
Use this function to add participant to the current conference.
There should be an established conference beforeaddParticipant
can be invoked.
Only a host side can invoke addParticipant.This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description participant
String id (Dialing 11 digit phone numbers is required with the exception of special numbers like 911.)
Fires:
- Phone#conference:invitation-sending
- Phone#conference:invitation-sent
- Phone#conference:invitation-accepted
- Phone#conference:invitation-rejected
- Phone#event:notification
- Phone#event:error
Examples
var phone = ATT.rtc.Phone.getPhone(); phone.addParticipant('1231231234');
var phone = ATT.rtc.Phone.getPhone(); phone.addParticipant('user@domain.com');
-
answer(options)
Answer an incoming call
-
Once a Phone#call:incoming event is fired, this method can be used this method to answer the incoming call.
If there is an existing call in progress, this method can be used to answer the second incoming call by putting on hold or ending the existing call.This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description options
Object Properties
Name Type Argument Description localVideo
HTMLElement remoteVideo
HTMLElement action
String <optional>
Action to perform on the current call (
end
|hold
).Fires:
- Phone#event:answering
- Phone#call:connecting
- Phone#call:rejected
- Phone#call:connected
- Phone#media:established
- Phone#call:disconnected
- Phone#event:notification
- Phone#event:error
Examples
var phone = ATT.rtc.Phone.getPhone(); phone.answer({ localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo') });
var phone = ATT.rtc.Phone.getPhone(); phone.answer({ localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo'), action: 'hold' // or 'end' });
-
associateE911Id()
Update E911 linked address id for the current user session
-
Use this function to update your E911 linked address id for the current user session.
The user has to be logged in beforeassociateE911Id
can be invoked.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.associateE911Id({ e911Id: e911AddressId });
-
cancel()
Cancel current call.
-
Use this function to cancel the call before other party answers it.
There should be an unestablished outgoing call beforecancel
can be called.This method can fire Phone#event:error that can have these error codes:
Error Code
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.cancel();
-
cleanPhoneNumber(number) → {String}
Cleans a phone number.
-
A utility method used to convert alphanumeric characters to a valid phone number.
Note: Will ignore email formatted inputError Codes
Parameters:
Name Type Description number
String phone number
Fires:
Returns:
-
Converted number
- Type
- String
-
false
otherwise.- Type
- Boolean
Example
var phone = ATT.rtc.Phone.getPhone(); phone.cleanPhoneNumber('1800CALFEDE'); //18002253333
-
-
dial(options)
Dials an outgoing call
-
Use this function to dial a call to another user already logged. The call can be dialled out by providing the destination, call media type information and local and remote media resources.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description options
Object Properties
Name Type Argument Description destination
String The Phone Number (Dialing 11 digit phone numbers is required with the exception of special numbers like 911.) or User Id of the called party (without sip or tel URI)
localMedia
HTMLVideoElement HTML media element for local stream.
remoteMedia
HTMLVideoElement HTML media element for remote stream.
mediaType
String <optional>
audio
orvideo
. Defaults to video.Fires:
- Phone#event:dialing
- Phone#call:connecting
- Phone#call:canceled
- Phone#call:rejected
- Phone#call:ringback-provided
- Phone#call:connected
- Phone#media:established
- Phone#event:notification
- Phone#event:error
Examples
// Start video call with an Mobile Number/Virtual Number User var phone = ATT.rtc.Phone.getPhone(); phone.dial({ destination: '11231231234', //1800CALFEDX, 1 (123) 123-1234 localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo') });
// Start video call with an Account ID User var phone = ATT.rtc.Phone.getPhone(); phone.dial({ destination: 'john@domain.com', localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo'), mediaType: 'video' });
// Start audio call with a special number var phone = ATT.rtc.Phone.getPhone(); phone.dial({ destination: '911', //411,611,*69,#89 localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo'), mediaType: 'audio' });
-
downgrade()
Downgrade the current video call to audio
-
Use this function to downgrade the current video call to an audio call.
This method fires Phone#call:modification-in-progress initially and Phone#call:state-changed when successful.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.downgrade();
-
endConference()
End the current conference conference
-
Use this function to end an ongoing conference.
There should be an established conference beforeendConference
can be invoked.
If a participant side invokesendConference
he is ejected and the host is notified.
If the host side invokes endConference all the participants are disconnected and the conference is closed.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.endConference();
-
formatNumber(number) → {String}
Formats a phone number.
-
Parameters:
Name Type Description number
String phone number
Fires:
Returns:
Formatted phone number
- Type
- String
Example
var phone = ATT.rtc.Phone.getPhone(); phone.formatNumber('9234567890'); // 1 (923) 456-7890
-
getCallerInfo(callerUri) → {Object}
Parses the event.from value to return caller info
-
A utility method used to parse the information in the event.from property and return the information like callerId, protocol, domain, port and other associated information.
Error Codes
Parameters:
Name Type Description callerUri
String caller uri represented by event.from property
Fires:
Returns:
Caller info like protocol, callerId, domain, port etc
- Type
- Object
Example
var phone = ATT.rtc.Phone.getPhone(); phone.getCallerInfo('sip:bob@domain.com'); phone.getCallerInfo('sip:+1111@icmn.api.att.com');
-
getCalls() → {Array}
Gets a list of calls/conferences.
-
Gets a list of calls/conferences currently in progress (foreground or background)
Returns:
Array of objects representing current calls/conferences. e.g.
[{ index: 0, breed: 'call', type: 'Outgoing' state: 'connected' peer: 'john@domain.com' }]
- Type
- Array
Example
var phone = ATT.rtc.Phone.getPhone(); var calls = phone.getCalls();
-
getIceServers() → {String}
Gets the list of ICE servers from the current peer connection configuration.
-
Use this function to get the current ICE servers that the SDK uses for creating peer connections.
Returns:
List of ICE servers. e.g.
[{ 'url': 'STUN:12.45.15.xx' }]
- Type
- String
Example
var phone = ATT.rtc.Phone.getPhone(); phone.getIceServers();
-
getIceTransport() → {String}
Gets the ICE transport value from the current peer connection configuration
-
Use this function to get the current ICE transport value that the SDK uses for creating peer connections.
Returns:
ICE transport. e.g.
all
,none
orrelay
- Type
- String
Example
var phone = ATT.rtc.Phone.getPhone(); phone.getIceTransport();
-
getIpv6() → {Boolean}
Gets the ipv6 value from the current peer connection configuration
-
Use this function to get the ipv6 value that the SDK uses for creating peer connections.
Returns:
IPv6. e.g.
true
orfalse
- Type
- Boolean
Example
var phone = ATT.rtc.Phone.getPhone(); phone.getIpv6();
-
getMediaType() → {String}
Get the media type of the current call or conference.
-
Use this function to get the media type of the ongoing call.
Returns:
audio
orvideo
. Null if no current call.- Type
- String
Example
var phone = ATT.rtc.Phone.getPhone(); phone.getMediaType();
-
getParticipants()
Get a list participants of the current conference
-
Use this function to get a list of participants active in the current conference.
There should be an established conference beforegetParticipants
can be invoked.
Only a host side can invokegetParticipants
.This method can fire Phone#event:error that can have these error codes:
Error Codes
Example
var phone = ATT.rtc.Phone.getPhone(); phone.getParticipants();
-
getVersion() → {string}
Returns the version of the AT&T Enhanced WebRTC SDK
-
Use this method to get the version of the SDK
Returns:
Version e.g.
1.0.0
- Type
- string
Example
var phone = ATT.rtc.Phone.getPhone(); phone.getVersion()
-
hangup()
Hangup an existing call
-
Use this function to hangup the current call. The other party will be disconnected.
There should be an existing established call beforehangup
can be called.This method can fire Phone#event:error that can have these error codes:
Error codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.hangup();
-
hold()
Put the current call or conference on hold
-
Use this function to put the other party(ies) on hold.
The other party(ies) will no longer get the media (audio and video).
There should be an existing established call or conference beforehold
can be called.This method can fire Phone#event:error that can have these error codes:
Error codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.hold();
-
isCallInProgress() → {Boolean}
Checks if there is a call on conference in progress
-
Returns
true
if there is a call or conference in progress.- Deprecated:
-
- Yes
Returns:
true
if there is an active call,false
otherwise.- Type
- Boolean
Example
var phone = ATT.rtc.Phone.getPhone(); phone.isCallInProgress();
-
joinConference(options)
Join a conference by accepting an incoming invite.
-
Use this method on participant side for joining an incoming conference.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description options
Object Properties
Name Type Argument Description localMedia
HTMLElement remoteMedia
HTMLElement action
String <optional>
Action to perform on the current call (
end
|hold
).Fires:
- Phone#conference:joining
- Phone#conference:connecting
- Phone#conference:connected
- Phone#media:established
- Phone#conference:held
- Phone#conference:resumed
- Phone#conference:ended
- Phone#event:notification
- Phone#event:error
Examples
var phone = ATT.rtc.Phone.getPhone(); phone.joinConference({ localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo') });
var phone = ATT.rtc.Phone.getPhone(); phone.joinConference({ localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo'), action: 'hold' // or 'end' });
-
login(options)
Creates a Enhanced WebRTC Session.
-
Use this function to establish Enhanced WebRTC session so that the user can place Enhanced WebRTC calls.
The service parameter indicates the desired service such as audio or video call.This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description options
Object Properties
Name Type Argument Description token
String OAuth Access Token.
userId
String <optional>
User Id. Optional parameter for Mobile users. Required for Account ID users and Virtual Number users
e911Id
String <optional>
E911 Id. Optional parameter for Account ID users. Required for Mobile Number and Virtual Number users
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.login({ token: token, e911Id: e911Id, userId: userId });
-
logout()
Deletes the current Enhanced WebRTC Session
-
Use this function to log out from Enhanced WebRTC session. As a result, enhanced WebRTC session will get deleted and event channel polling will be stopped.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.logout();
-
move()
Move the current call to a different endpoint/device.
-
Use this function to move the current call to another client.
The current user should be logged in to at least two different sessions before a call can be moved.
There should be an established call beforemove
can be invoked.
All endpoints(devices) with sessions for the current user will start to ring.
The user can choose to answer on any of the other endpoints(devices).This method can fire Phone#event:error that can have these error codes:
Error Codes
Example
var phone = ATT.rtc.Phone.getPhone(); phone.move();
-
mute()
Mute the current call or conference.
-
Use this function to mute the local audio for current call or conference.
The other party(ies) will no longer receive any audio. Video (if available) will continue to be received.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.mute();
-
on(event, handler)
Subscribe to event on Phone.
-
Method to subscribe to events fired by
Phone
object.Parameters:
Name Type Description event
String Event name
handler
function Event handler
Throws:
-
Event 'event_name' not defined
- Type
- String
Example
var phone = ATT.rtc.Phone.getPhone(); phone.on('session:ready', function (data) { // ... do something });
-
-
reject()
Reject current incoming call.
-
Use this method to reject an incoming call.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.reject();
-
rejectConference()
Reject an incoming conference invite
-
Use this method to reject an incoming conference invite.
There should be an existing un-accepted conference beforerejectConference
can be called.
Only the participant side can invokerejectConference
.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.rejectConference();
-
rejectModification()
Rejects the incoming media modification (Upgrade/Downgrade) request.
-
You can use this method after you have received the Phone#call:media-modification event which indicates an incoming media modification request.
Rejecting an upgrade request when in an audio call means only the other peer will start sending her video. The peer that rejected will keep sending only his audio.
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.rejectModification();
-
removeParticipant()
Remove a participant from the current conference
-
Use this function to remove a participant from the current conference.
There should be an established conference beforeremoveParticipant
can be invoked.
Only a host side can invokeremoveParticipant
.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.removeParticipant('johnny');
-
resetIceServers()
Resets the ICE servers on the peer connection configuration to the defaults that SDK defines
-
Use this method to reset the list of ICE servers to the default list for peer connection configuration.
Example
var phone = ATT.rtc.Phone.getPhone(); phone.resetIceServers();
-
resetIceTransport()
Resets the ICE transport on the peer connection configuration to the default that SDK defines
-
Use this method to reset the ICE transport value to the value for peer connection configuration.
Example
var phone = ATT.rtc.Phone.getPhone(); phone.resetIceTransport();
-
resetIpv6()
Resets the ipv6 value on the peer connection configuration to the default that SDK defines
-
Use this method to reset the ipv6 to the default value for peer connection configuration.
Example
var phone = ATT.rtc.Phone.getPhone(); phone.resetIpv6();
-
resume()
Resume the current call or conference
-
Use this function to resume the call or conference that was put on hold previously.
The other party(ies) will start receiving the media (audio and video).
There should be an existing established call or conference on hold beforeresume
can be invoked.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.resume();
-
sendDTMFTone(options)
Sends a DTMF signal through the audio steam.
-
You can use this method to send a DTMF signal through the audio stream after you have established a call.
Error Codes
Parameters:
Name Type Description options
object Properties
Name Type Description input
String the character that needs to be sent as a tone.
[gap]
int the intertone gap (in ms greater then 50).
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.sendDTMFTone({input: '2', gap : 5});
-
setIceServers(iceServers)
Sets the ICE servers for the peer connection configuration
-
Use this method to set the list of ICE server that the SDK uses for creating peer connections.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description iceServers
Array The array of url with valid IP
Example
var phone = ATT.rtc.Phone.getPhone(); phone.setIceServers([{ 'url': 'STUN:12.19.19.xx' }]);
-
setIceTransport(iceTransport)
Sets the ICE transport for the peer connection configuration
-
Use this method to set the ICE transport that the SDK uses for creating peer connections.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description iceTransport
String The valid iceTransport value ('none','all' or 'relay')
Example
var phone = ATT.rtc.Phone.getPhone(); phone.setIceTransport('all');
-
setIpv6(ipv6)
Sets the ipv6 value for the peer connection configuration
-
Use this method to set the ipv6 value that the SDK uses for creating peer connections.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description ipv6
Boolean The valid Boolean value (
true
orfalse
)Example
var phone = ATT.rtc.Phone.getPhone(); phone.setIpv6(false);
-
startConference(options)
Starts a conference with host and no participants.
-
Use this method to start a conference. The host can invite other users to the conference by adding the participant(s). Participant(s) can accept or reject an invite.
Only a host can remove a participant from the conference and end the conference.This method can fire Phone#event:error that can have these error codes:
Error Codes
Parameters:
Name Type Description options
Object Properties
Name Type Argument Description localMedia
HTMLVideoElement The host's video element
remoteMedia
HTMLVideoElement The conference participant's video element
mediaType
String <optional>
video
oraudio
. Defaults to video.Fires:
- Phone#conference:connecting
- Phone#conference:connected
- Phone#media:established
- Phone#conference:held
- Phone#conference:resumed
- Phone#conference:ended
- Phone#event:error
Examples
var phone = ATT.rtc.Phone.getPhone(); phone.startConference({ localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo'), mediaType: 'audio' });
var phone = ATT.rtc.Phone.getPhone(); phone.startConference({ localMedia: document.getElementById('localVideo'), remoteMedia: document.getElementById('remoteVideo') });
-
switchCall()
Switches the active call or conference with the one in the background.
-
Use this function to switch between an active call or conference and a background call or conference.
Pre-conditions There should be at least two established calls before
switchCall
can be invoked.Post-conditions If the call that's being brought to the foreground was put on hold by calling Phone#hold then the call will be kept on hold; otherwise the call will be resumed automatically.
This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.switchCall();
-
transfer()
Transfer an established call to a third party
-
Use this function to transfer an established call between a transferee and a transferrer to the transfer-target.
There should be an established call that is on hold.
There should be a second established call with transfer target.
transfer
will transfer the other party of the first call to the other party of the second call and drop the current user from the call.This method can fire Phone#event:error that can have these error codes:
Error Codes
Example
var phone = ATT.rtc.Phone.getPhone(); phone.transfer();
-
unmute()
Unmute the current call or conference
-
Use this function to unmute the local media for current call or conference.
The other party(ies) will start receiving audio.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.unmute();
-
upgrade()
Upgrade the current audio call to video
-
Use this function to upgrade the current audio call to a video call.
This method fires Phone#call:modification-in-progress initially and Phone#call:state-changed when successful.This method can fire Phone#event:error that can have these error codes:
Error Codes
Fires:
Example
var phone = ATT.rtc.Phone.getPhone(); phone.upgrade();
-
<inner> associateAccessToken()
-
- Deprecated:
-
- since version 1.0.6 . Use login method
Events
-
call:canceled
Call canceled event fires when an outgoing call is canceled successfully or when an incoming call is canceled by the calling party
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished incoming or outgoing call in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:connected
Call connected event fires when an outgoing or incoming call is connected to the other party.
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished outgoing or incoming call in order to be able to receive this event.
This event is fired after Phone#call:connecting has been fired.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
downgrade
Boolean <optional>
If the video call was accepted as audio by the other party.
timestamp
Date Event fire time.
-
call:connecting
Call connecting event fires when an outgoing or incoming call is trying to connect to the other party.
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished outgoing or incoming call in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:disconnected
Call disconnected event fires when a call has been disconnected by the other party or by the API
-
The user has to be logged in order to be able to receive this event.
There should be an existing call in progress in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
from
String <optional>
The phone number/id of the calling party for incoming calls.
to
String <optional>
The phone number/id of the called party for outgoing calls.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:disconnecting
Call disconnecting event fires immediately after user tries to hangup a call
-
The user has to be logged in order to be able to receive this event.
There should be an established call in order to be able to receive this event.
This event is fired in response to a successful call tohangup
method.The event is fired with an attached event data of the following format:
Type:
- object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call or conference (audio/video).
codec
Array The CODECs associated with the call or conference.
timestamp
Date Event fire time.
-
call:held
Call held event fires when the user puts an active call on hold
-
The user has to be logged in order to be able to receive this event.
There should be an established outgoing or incoming call in order to be able to receive this event.
This event is fired in response to a successful call tohold
method.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:incoming
Call incoming event fires when a there is an incoming call
-
The user has to be logged in order to be able to receive this event.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the call in the list of existing calls.
from
String The phone number/id of the calling party.
mediaType
String The media type of the incoming call (audio/video).
codec
Array The CODECs associated with the incoming call.
timestamp
Date Event fire time.
-
call:media-modification
Call media-modification event gets triggered when user needs to perform an action for the incoming media modification
-
The user is in a call and gets a media modification request.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The existing media type of the call (audio/video).
newMediaType
String The requested media type for the call modification (audio/video).
codec
Array <optional>
The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:modification-in-progress
Transitional event to indicate that a call modification (Upgrade/Downgrade) is taking place.
-
This event fires in different scenarios:
- After successfully initiating a call modification but before the modification is complete.
- After successfully accepting or rejecting a call modification but before the modification is complete.
The event handler contains the code to execute when the
modification-in-progress
event is received by thisPhone
.Example
// using a named function phone.on('call:modification-in-progress', handler); // using an anonymous function phone.on('call:modification-in-progress', function (data) { ... });
Values
handler
is the name of the user-defined function, or an anonymous declarationdata
contains information about the event, it has the following structure:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:moved
Call moved event fires when a user wants to move the ongoing call to another browser or a mobile device where the user is logged in.
-
The user has to be logged in on atleast two devices or browsers to be able to receive this event.
There should be a established outgoing or incoming call and move method should be invoked in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:muted
Call muted event fires when the media is successfully muted.
-
The user has to be logged in order to be able to receive this event.
There should be an established call or conference in order to be able to receive this event.
This event is fired in response to a successful call tomute
method.The event is fired with an attached event data of the following format:
Type:
- object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party (for an outgoing call).
from
String <optional>
The phone number/id of the calling party or conference initiator.
mediaType
String The media type of the call or conference (audio/video).
codec
Array The CODECs associated with the call or conference.
timestamp
Date Event fire time.
-
call:rejected
Call rejected event fires when an outgoing call is rejected by the called party or when an incoming call is rejected by the user successfully
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished incoming or outgoing call in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:resumed
Call resumed event fires when the user resumes a call which was previously put on hold
-
The user has to be logged in order to be able to receive this event.
There should be an established outgoing or incoming call in order to be able to receive this event.
This event is fired in response to a successful call toresume
method.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:ringback-provided
Call ringback provided event fires when early media starts streaming for an outgoing call.
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished outgoing call in order to be able to receive this event.
The called party should be able to provide early media or ringback.
The early media or ringback starts playing automatically when this event is fired.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description timestamp
Date Event fire time.
-
call:state-changed
State Changed event fires when an media modification request was successfully accepted.
-
The user has to be logged in order to be able to receive this event.
There should be an existing call in progress in order to be able to receive this event.
The user should have initiated and accepted media modification request.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
operation
String <optional>
Operation that generated the event.
generator
String <optional>
The the side(initiator/receiver) that generated the event.
oldState
String The previous state of the call.
newState
String The new state of the call.
timestamp
Date Event fire time.
-
call:transferred
Call transferred event fires when a call has been transferred by the transferrer party
-
The user has to be logged in order to be able to receive this event.
There should be at least two calls in progress in order to be able to receive this event.
The user has to initiate transfer to be able to receive this event.
The call should be transferred successfully to be to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
from
String <optional>
The phone number/id of the calling party for incoming calls.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:transferring
Call transferring event fires when a call is being transferred by the transferrer party
-
The user has to be logged in order to be able to receive this event.
There should be at least two calls in progress in order to be able to receive this event.
The user has to initiate transfer to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
from
String <optional>
The phone number/id of the calling party for incoming calls.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
call:unmuted
Call unmuted event fires when the media is successfully unmuted.
-
The user has to be logged in order to be able to receive this event.
There should be an established call or conference in order to be able to receive this event.
This event is fired in response to a successful call tounmute
method.The event is fired with an attached event data of the following format:
Type:
- object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party (for an outgoing call).
from
String <optional>
The phone number/id of the calling party or conference initiator.
mediaType
String The media type of the call or conference (audio/video).
codec
Array The CODECs associated with the call or conference.
timestamp
Date Event fire time.
-
conference:canceled
Conference canceled fires when a conference is canceled before it starts
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished conference in order to be able to receive this event.
This event is mainly fired participant side in response to a canceled conference.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
from
String <optional>
The phone number/user id of the conference initiator for participant side
participants
Object <optional>
The participants list for host side
invitations
Object <optional>
The invitations list for host side.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:connected
Conference connected fires when a conference started by a host has connected
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished conference started by the user in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the conference in the list of existing conferences.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:connecting
Conference connecting fires when a participant tries to connect to a conference
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished conference in order to be able to receive this event.
This event is fired participant-side in response to a successful call tojoinConference
method.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the conference in the list of existing conferences.
from
Object The conference initiator
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:disconnecting
Conference disconnecting event fires when a conference is in the process of disconnecting.
-
This event fires immediately when the user invokes
endConference
.
There should be an existing conference in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
from
String <optional>
The phone number/user id of the conference initiator for participant side
participants
Object <optional>
The participants list for host side
invitations
Object <optional>
The invitations list for host side.
mediaType
String The media type of the conference (audio or video).
codec
String The codec used by the conference.
timestamp
Date Event fire time.
-
conference:ended
Conference ended fires when a conference has ended
-
The user has to be logged in order to be able to receive this event.
There should be an established in conference in order to be able to receive this event.
This event is mainly fired host-side or participant side in response to a successful call toendConference
method.
This event can also be fired if the conference ends due to some unexpected reason.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
from
String <optional>
The phone number/user id of the conference initiator for participant side
participants
Object <optional>
The participants list for host side
invitations
Object <optional>
The invitations list for host side.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:held
Conference held fires when a conference has been put on hold
-
The user has to be logged in order to be able to receive this event.
There should be an established conference in order to be able to receive this event.
This event is fired in response to a successful call tohold
method.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
invitations
Object <optional>
The invitations list.
participants
Object <optional>
The current participants list.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:invitation-accepted
Conference invitation-accepted fires when an invitation has been accepted
-
The user has to be logged in order to be able to receive this event.
There should be an established conference in order to be able to receive this event.
This event is fired host-side when an invitation has been accepted by the participant.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
invitations
Object <optional>
The invitations list.
participants
Object <optional>
The current participants list.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:invitation-received
Conference invitation received event fires when a there is an incoming conference invite
-
The user has to be logged in order to be able to receive this event.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the conference in the list of existing conferences.
from
String The phone number/id of the calling party.
mediaType
String The media type of the incoming call (audio/video).
codec
Array The CODECs associated with the incoming call.
timestamp
Date Event fire time.
-
conference:invitation-rejected
Conference invitation-rejected fires when an invitation has been rejected
-
The user has to be logged in order to be able to receive this event.
There should be an established conference in order to be able to receive this event.
This event is fired host-side when an invitation has been rejected by the participant.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
invitations
Object <optional>
The invitations list.
participants
Object <optional>
The current participants list.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:invitation-sending
Conference invitation-sending fires when an invitation is being sent
-
This event fires immediately when the host invokes
addParticipant
.
There should be an existing conference in order to be able to receive this event.
This event is fired host-side in response to a successful call to theaddParticipant
method.
This event is followed by Phone#conference:invitation-sentThe event is fired with an attached event data of the following format:
Type:
- object
Properties:
Name Type Description index
Number The ordinal numbering of the conference in the list of existing conferences.
invitee
Object The invitee.
timestamp
Date Event fire time.
-
conference:invitation-sent
Conference invitation-sent fires when an invitation has been successfully sent by the host
-
The user has to be logged in order to be able to receive this event.
There should be an established conference in order to be able to receive this event.
This event is fired host-side in response to a successful call toaddParticipant(s)
method.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
invitations
Object <optional>
The invitations list.
participants
Object <optional>
The current participants list.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:joining
Conference joining fires immediately after a participant joins a conference
-
The user has to be logged in order to be able to receive this event.
There should be an incoming conference invitation in order to be able to receive this event.
This event is fired participant-side in response to a successful call tojoinConference
method.
This event is followed by Phone#conference:connecting.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the conference in the list of existing conferences.
from
Object The conference initiator
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:participant-removed
Conference participant-removed fires when a host successfully removes a participant
-
The user has to be logged in order to be able to receive this event.
There should be an established conference in order to be able to receive this event.
This event is fired host-side in response to a successful call toremoveParticipant
method.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
invitations
Object <optional>
The invitations list.
participants
Object <optional>
The current participants list.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
conference:resumed
Conference resumed fires when a conference has been resumed
-
The user has to be logged in order to be able to receive this event.
There should be an established conference which was previously put on hold by the user in order to be able to receive this event.
This event is fired in response to a successful call toresume
method.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the conference in the list of existing conferences.
invitations
Object <optional>
The invitations list.
participants
Object <optional>
The current participants list.
mediaType
String The media type of the conference (audio/video).
codec
Array The CODECs associated with the conference.
timestamp
Date Event fire time.
-
connectivity:off
connectivity:on event gets fired when the network goes from online to offline
-
The User have to register this event before login.
-
connectivity:on
connectivity:on event gets fired when the network goes from offline to online
-
The User have to register this event before login.
-
dtmf:tone-sending
Tone sending event gets fired when DTMF tone request was successful.
-
The event is fired if the tone is inserted into the audio stream.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String The phone number/id of the called party.
from
String The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
dtmf:tone-sent
Tone sent event gets fired when the tone is sent successfully.
-
The event is fired when the tone is passed into the audio stream successfully.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description tone
String The tone which was inserted successfully.
index
Number The ordinal numbering of the call in the list of existing calls.
to
String The phone number/id of the called party.
from
String The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Timestamp when the tone was inserted into stream.
-
address-updated
Address updated event fires after successfully updating the e911 linked address id
-
The user has to be logged in order to be able to receive this event.
-
answering
Answering event fires immediately after `answer` for an incoming call.
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished incoming call in order to be able to receive this event.
This event is followed by Phone#call:connecting event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the call in the list of existing calls.
from
String The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
dialing
Dialing event fires immediately after `dial` for an outgoing call.
-
The user has to be logged in order to be able to receive this event.
There should be an unestablished outgoing call in order to be able to receive this event.
This event is followed by Phone#call:connecting event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String The phone number/id of the called party.
mediaType
String The media type of the call (audio/video).
timestamp
Date Event fire time.
-
error
Error event fires if there is an invalid behavior reported by the `Phone` object
-
The error event can be fired by the
Phone
for different reasons:API Error - is an error at the platform (RESTful API) level. This may be due to invalid parameters send in an HTTP request or a request being send while in an inconsistent state.
SDK Error - is an error most likely due to an inconsistent state in the client JavaScript library at the browser level.
Sometimes different errors can be caused by the same underlying problem in which case a common error code is used.
A list of API error codes is here ATT.private.errorStore.APIErrors
The user has to be logged in order to be able to receive this event.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description JSObject
String JavaScript object associated with the error
JSMethod
String JavaScript method associated with the error
ErrorCode
String Error code associated with the error
ErrorMessage
String Message associated with the error
Cause
String Possible causes
Resolution
String Possible resolution
APIError
String <optional>
API error associated with the error
ResourceMethod
String <optional>
Resource method associated with the error
HttpStatusCode
String <optional>
HTTP status code associated with the error
MessageId
String <optional>
API message id associated with the error
AdditionalInformation
String <optional>
Additional information associated with the error
timestamp
Date Event fire time.
-
notification
Notification event fires when the SDK is unable to support a behavior that is not an error
-
The user has to be logged in order to be able to receive this event.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description message
String A message for the notification.
from
String <optional>
The phone number/id of the calling party.
to
String <optional>
The phone number/id of the called party.
mediaType
String <optional>
The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
timestamp
Date Event fire time.
-
warning
Warning event fires during certain scenarios, such as muting a call that's already muted.
-
The user has to be logged in order to be able to receive this event.
There should be an established call or conference in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
message
String A message for the warning.
from
String <optional>
The phone number/id of the calling party.
to
String <optional>
The phone number/id of the called party.
mediaType
String <optional>
The media type of the call (audio/video).
codec
Array <optional>
The CODECs associated with the call.
timestamp
Date Event fire time.
-
gateway:unreachable
Gateway Unreachable event fires when the client cannot connect to gateway.
-
The user has to be logged in order to be able to receive this event.
This event is fired when we get '502' or503
with 'Cannot reach the Gateway'.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description sessionId
String <optional>
The session ID associated.
timestamp
Date Event fire time.
-
media:established
Media established event fires when audio/video media has started for a call.
-
The user has to be logged in order to be able to receive this event.
There should be anconnected
incoming or outgoing call in order to be able to receive this event.
This event is fired after Phone#call:connected has been fired.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description index
Number The ordinal numbering of the call in the list of existing calls.
to
String <optional>
The phone number/id of the called party.
from
String <optional>
The phone number/id of the calling party.
mediaType
String The media type of the call (audio/video).
codec
Array The CODECs associated with the call.
timestamp
Date Event fire time.
-
session:call-switched
Call switched event fires when the calls are switched
-
The user has to be logged in order to be able to receive this event.
There needs to be two calls in context in order to be able to receive this event.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description from
String The phone number/id of the peer of the call switched from.
to
String The phone number/id of the peer of the call switched to.
timestamp
Date Event fire time.
-
session:disconnected
Session disconnected event fires when the session was successfully disconnected.
-
The event is fired if the user logs out successfully and the enhanced webrtc session is deleted successfully. User can no longer make or receive calls.
-
session:expired
Session Expired event fires when session expires in the backend.
-
The user has to be logged in order to be able to receive this event.
This event is fired when we get '404' with 'Session id not found' or 'The requested session resource was not found'.The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Argument Description sessionId
String <optional>
The session ID which got expired.
timestamp
Date Event fire time.
-
session:ready
Session ready event fires when the user is successfully logged in and the SDK is initialized and ready to make, receive calls
-
The event is fired if the user logs in successfully and an enhanced webrtc session is created successfully.
The event is fired with an attached event data of the following format:
Type:
- Object
Properties:
Name Type Description sessionId
String The id associated with the enhanced webrtc session.