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

SessionFirstPartyAnswer

Triggered when the first party answers the call.

SessionSecondPartyRing

Triggered when the second party’s phone starts ringing.

SessionSecondPartyAnswer

Triggered when the second party answers the call.

SessionSecondPartyHangup

Triggered when the Second party disconnects the call.

SessionFirstPartyHangup

Triggered when the First party disconnects the call.

SessionPinAuthenticationStatus

Triggered when the PIN authentication status is success, failed or if the call is from an authorised caller.

SessionTimeout

Triggered when the session expires.

SessionVirtualNumberReplaced

This attribute is triggered when the health of the number utilized in the session is sub-optimal. Plivo will replace the sub-optimal number with a temporary, fully functional one to sustain the session and prevent call connectivity issues.

The VirtualNumber field transmitted with this event contains the fully operational number. This event is a notification for you to update the older number with the new virtual number in your application.

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)

Timestamp in UTC at which the event occurred.

SessionUUID (string)

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

From (string)

Actual from number used to interact with the virtual number

To (string)

Actual to number dialing out from the virtual number.

PinAuthenticationStatus (string)

Status of the PIN authentication during the interaction.
Possible values: “success”,”failed”,“AuthorizedCaller”
Success: When the PIN authentication is successful for either A-party or B- party
Failed: When the PIN authentication failed. when a incorrect PIN is provided or a PIN Input is not received.
AuthorizedCaller: When the virtual number is dialed using the authorized caller(number part of session)

PinRetryCounter (integer)

Indicates the pin retry counter on account of incorrect Pin input.

VirtualNumber (string)

The virtual number used in the session.

Amount (string)

Total amount incurred for the call.

BilledDuration (string)

Duration in seconds for which the call was billed.

Duration (string)

Actual duration of the call in seconds.

PlivoHangupCause (string)

Reason for the call termination.

PlivoHangupCauseCode (integer)

A unique integer code for the termination cause.

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
  • SessionPinAuthenticationStatus

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
14
require 'rubygems'
require "/root/plivo-ruby/lib/plivo.rb"

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>", "<auth_token>")

begin
  response = api.maskingsession.delete("<session_uuid>")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
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
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.maskingsession.MaskingSession;
import java.io.IOException;

class DeleteSession {
  public static void main(String [] args) {
    Plivo.init("<auth_id>","<auth_token>");
    try {
      MaskingSession.deleter("<session_uuid>").delete();
    } catch (PlivoRestException | IOException e) {
      System.out.println(e);
      e.printStackTrace();
    } catch (PlivoValidationException e) {
      throw new RuntimeException(e);
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.MaskingSession.Delete(sessionUuid: "<session_uuid>");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
curl -X DELETE "https://api.plivo.com/v1/Account/{Auth ID}/Masking/Session/{session_uuid}" \
-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)
}