The Session Object
Attributes
Unique identifier for the session.
The actual phone number of the first participant.
The actual phone number of the second participant.
Plivo phone number to be dialed for connecting with the other participant.
Current session status. Values:
active, in-progress, or expired.Time in seconds after which the session mapping will expire. Calls made after this will not be forwarded.
Time in seconds after which the call should be disconnected. Applies to all call legs.
Time in seconds after which the ring should be disconnected. Defaults to 120.
If
true, Plivo calls the first party immediately and bridges if answered. Defaults to false.Determines the recording status for a phone call. Defaults to
false. If true, call recording starts only when both participants have answered.Audio format for the recording. Values:
mp3, wav. Defaults to mp3.URL to which the call recording is sent.
HTTP verb for invoking
recording_callback_url. Values: GET, POST. Defaults to POST.URL on which to receive important session events and status updates.
HTTP verb for invoking
callback_url. Values: GET, POST. Defaults to POST.URL returning MP3/WAV file to play to first party before connecting.
URL returning MP3/WAV file to play to second party before connecting.
Specifies whether PIN authentication is necessary when the call originates from an unidentified caller.
Indicates if Plivo generates the PIN for the session.
Length of the PIN to be generated. Default: 4, Min: 4, Max: 15.
The PIN for the first party when using a secondary number.
The PIN for the second party when using a secondary number.
UTC time when the session was created (yyyy-mm-dd, hh-mm-ss).
UTC time when the session was last modified (yyyy-mm-dd, hh-mm-ss).
UTC time when the session will expire (yyyy-mm-dd, hh-mm-ss).
UTC time when the latest interaction ended (yyyy-mm-dd, hh-mm-ss).
Duration of the session in seconds.
Total charge incurred for creating the session.
Total number of individual calls (call_uuids) in the session.
Total billed amount for all calls within the session.
Total rounded bill duration (seconds) for all calls.
Total charges for hosting the session, including call and session creation fees.
Interaction object containing session interactions.
Example Object
The Interaction Object
The Interaction object is nested within a session. A masking session can contain multiple interactions. Each interaction within a session has a maximum of two communication legs, regardless of the direction of the call.Attributes
URL of the call-leg resource created for the first party. This field is null if a call is exchanged between the Plivo virtual number and the second party but has not yet been initiated for the first party.
URL of the call-leg resource created for the second party. This field is null if a call is exchanged between the Plivo virtual number and the first party but has not yet been initiated for the second party.
URL of the recording resource for the interaction. This field will be null when one of the participants didn’t pick up the call.
Create a Session
Create a number masking session using the real phone numbers of two parties. Plivo returns a virtual number from your account that either party can call to connect anonymously.Arguments
The actual phone number of the first party.
The actual phone number of the second party.
Specifies if the country of the virtual number must match the first_party number. Default:
true.Specifies the sub-account auth ID for which the session is created.
Time in seconds after which session mapping ends. Default: 3600.
Time in seconds after which the call disconnects. Default: 3600.
Time in seconds after which ringing stops. Default: 120.
If
true, Plivo calls first party immediately and bridges to second party. Default: false.URL to receive session events and status updates.
HTTP method to invoke callback_url. Values:
GET, POST. Default: POST.Call recording status. Default:
false. If true, recording starts after both parties answer.URL where call recordings are sent.
Audio format for recording. Values:
mp3, wav. Default: mp3.HTTP method to invoke recording_callback_url. Values:
GET, POST. Default: POST.URL to .mp3 or .wav file played to first party before connecting.
URL to .mp3 or .wav file played to second party before connecting.
Specifies whether PIN authentication is necessary for unidentified callers. Default:
false.Indicates if Plivo generates the PIN. Only when is_pin_authentication_required is
true. Default: false.Length of the PIN to be generated. Applicable when generate_pin is
true. Default: 4, Min: 4, Max: 15.The PIN for the first party. Must differ from second_party_pin. Length: 4-15 digits.
The PIN for the second party. Must differ from first_party_pin. Length: 4-15 digits.
URL for playback prompting PIN entry. Required when PIN is activated. Must be .mp3 or .wav.
Number of PIN retries allowed. Values: 0-5. Default: 1.
Wait time in seconds before retrying PIN. Default: 5, Min: 5, Max: 10.
URL for playback when incorrect PIN entered. Must be .mp3 or .wav.
URL for playback when unknown caller calls the virtual number. Must be .mp3 or .wav.
Requires PIN even for registered numbers. Only applies if PIN authentication is required. Default:
false.Allows session creation with only one party. Default:
false.Cool-off period in seconds before the virtual number can be reused. Default: 0, Max: 3600.
The following parameters cannot be updated during an active session:
- first_party, second_party
- initiate_call_to_first_party
- is_pin_authentication_required
- pin_prompt_play, pin_retry, pin_retry_wait
- incorrect_pin_play, unknown_caller_play
- geomatch, subaccount
Example
Response
Retrieve a Session
Fetch details of an existing masking session.Example
Response
List All Sessions
Fetch details of all existing masking sessions.Arguments
Filter by first party phone number.
Filter by second party phone number.
Filter by virtual number assigned for the session.
Filter by status. Values:
active, expired, all. Default: all.Filter sessions by creation time. Format:
YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. Supports variants: created_time__gt, created_time__gte, created_time__lt, created_time__lte. Default window: 7 days. Max: 30 days.Filter sessions by expiry time. Format:
YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. Supports variants: expiry_time__gt, expiry_time__gte, expiry_time__lt, expiry_time__lte. Default window: 7 days. Max: 30 days.Filter sessions by duration in seconds. Supports variants:
duration__gt, duration__gte, duration__lt, duration__lte.Number of results per page. Min: 1, Max: 20. Default: 20.
Number of results to skip. Used for pagination.
Example
Response
Update a Session
Update an existing masking session.Arguments
Time in seconds after which the session mapping will end. Default: 3600.
Time in seconds after which the call will be disconnected. Default: 3600.
Time in seconds after which the ring will be disconnected. Default: 120.
URL to receive session events and status updates.
HTTP verb to invoke callback_url. Values:
GET, POST. Default: POST.Recording status for phone calls. Default:
false.URL to which the call recording is sent.
Audio format for the recording. Values:
mp3, wav. Default: mp3.HTTP verb to invoke recording_callback_url. Values:
GET, POST. Default: POST.URL that returns an .mp3 or .wav file to be played to the first party.
URL that returns an .mp3 or .wav file to be played to the second party.
The phone number of the first participant. Only applicable when session was created with
create_session_with_single_party set to true.The phone number of the second participant. Only applicable when session was created with
create_session_with_single_party set to true.Example
Response
Expire a Session
Terminate an ongoing session and mark it as expired.Example
Session Callbacks
Session Status Callback
Configure thecallback_url to receive important session events and status updates.
Events
Triggered when the first party answers the call.
Triggered when the second party’s phone starts ringing.
Triggered when the second party answers the call.
Triggered when the second party disconnects the call.
Triggered when the first party disconnects the call.
Triggered when the PIN authentication status is success, failed, or if the call is from an authorized caller.
Triggered when the session expires.
Triggered when the session call is done.
Callback Attributes
Event that triggered this callback.
Timestamp in UTC at which the event occurred.
Unique ID of the masking session.
Actual from number used to interact with the virtual number.
Actual to number dialing out from the virtual number.
The virtual number used in the session.
Status of the PIN authentication. Values:
success, failed, AuthorizedCaller.Indicates the PIN retry counter due to incorrect PIN input.
Total amount incurred for the call.
Duration in seconds for which the call was billed.
Actual duration of the call in seconds.
Reason for the call termination.
A unique integer code for the termination cause.
Indicates the sequence of the callback. Helpful for sorting events.
Session Recording Callback
Configure therecording_callback_url to receive recording-related callback events.
Events
Triggered when the first party and the second party are connected via the virtual phone number and the recording begins.
Triggered when one of the parties disconnects the call.
Triggered when the record attribute is set to true but the recording could not be started.
Recording Callback Attributes
Event that triggered this callback.
Timestamp at which the event occurred.
Unique ID of the masking session.
Actual from number used to interact with the virtual number.
Actual to number dialing out from the virtual number.
The virtual number used in the session.
Unique identifier of the recording file.
Actual media URL path of the recording.
Complete URL path to the recording resource URL.
Duration of recording in seconds.
UTC Timestamp at which the recording started.
UTC Timestamp at which the recording ended.
Format of the recording. Values:
.mp3, .wav.Indicates the sequence of the callback.