Latest Legacy

Session status callback

Configure the “callback_url” with your web server URL to receive important session events and status updates. Plivo passes these events to the callback URL.

Attributes

SessionFirstPartyInitiated

Triggered when a phone call is initiated toward the first party. This event is emitted when the call attempt is made toward the first party. If Plivo fails to initiate the call, this event will not be emitted.

SessionFirstPartyRinging

Triggered when the first party’s phone starts ringing.

SessionFirstPartyAnswer

Triggered when the first party answers the call.

SessionFirstPartyComplete

Triggered when the first party disconnects the call.

SessionFirstPartyFailed

Triggered when the first party’s call fails to be completed.

SessionSecondPartyInitiated

Triggered when a call is initiated toward the second party. This event is emitted when the call attempt is made toward the second party. If Plivo fails to initiate the call, this event will not be emitted.

SessionSecondPartyRing

Triggered when the second party’s phone starts ringing.

SessionSecondPartyAnswer

Triggered when the second party answers the call.

SessionSecondPartyComplete

Triggered when the second party disconnects the call.

SessionSecondPartyFailed

Triggered when the second party’s call fails to be completed.

SessionVirtualNumberAnswer

Triggered when either the first party or second party calls the virtual number, and the call lands on the virtual number.Note: Virtual phone numbers are on auto-answer and do not have a ring state.

Callback attributes

For each event, the below attributes will be posted to your web server

EventName (string)

Event that triggered this callback. This parameter will have one of the values from the list of events above.

EventTimestamp (string)

Timestamp in UTC at which the event occurred.

SessionUUID (string)

Unique ID of the masking session for which callback is sent.

FirstParty

The real phone number of the first party used for the interaction.
This will be null for the following events:

  • SessionParamUpdate
  • SessionTimeout
  • When a call is made to the second party via the virtual number.

SecondParty

The real phone number of the second party used for the interaction.
This will be null for the following events:

  • SessionParamUpdate
  • SessionTimeout
  • When a call is made to the first party via the virtual number.

VirtualNumber

The Plivo virtual phone number used for the interaction.

Direction

The direction of the interaction from Plivo’s perspective.
Possible values: inbound, outbound

CallBilledDuration

Duration in seconds for which the call was billed.

CallDuration

Duration in seconds for which the party was actually on the call.

CallRate

Per-minute rate charged for the call

PlivoHangupCause

Reason for the call termination.
Refer to our list of hangup causes and sources.

PlivoHangupCauseCode

A unique integer code for the termination cause. Refer to our list of hangup causes and sources.

SequenceNumber (string)

Indicates the sequence of the callback. Helpful to sort the callback events posted to the recording_callback_url.
null for the following events:

  • SessionParamUpdate
  • SessionTimeout

Example Request

1
2
3
4
5
import plivo

client = plivo.RestClient(auth_id='<auth_id>', auth_token='<auth_token>')
response = client.masking_sessions.delete_masking_session("session_uuid")
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.maskingSession.deleteMaskingSession("SessionUUID"
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Delete Session
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>", "<auth_token>");
try {
    $response = $client->maskingSessions->deleteMaskingSession(
        'SessionUUID'
    );

    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}
1
2
curl -X DELETE "https://api.plivo.com/v1/Account/{Auth ID}/Masking/Session/abcd-1234-ab12-cd34" \
-H "Content-Type: application/json" \
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
       "fmt"
       "github.com/plivo/plivo-go/v7"
)

func main() {
       client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
       if err != nil {
               fmt.Print("Error", err.Error())
               return
       }
       response, err := client.MaskingSession.DeleteMaskingSession("SessionUUID")
       if err != nil {
               fmt.Print("Error", err.Error())
               return
       }
       fmt.Printf("Response: %#v\n", response)
}