Latest Legacy

Get details of all masking sessions

This method fetches details of all existing masking sessions.

GET https://api.plivo.com/v1/Account/{Auth_ID}/Masking/Session

Attributes

first_party string

The actual phone number of the first party.

second_party string

The actual phone number of the second party.

virtual_number string

Virtual number assigned for the session.

status string

Allowed values: active, expired, all
Defaults to all.

created_time string

Filters sessions based on their created time. The time format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. You can use variants of this attribute:

  • created_time
  • created_time__gt
  • created_time__gte
  • created_time__lt
  • created_time__lte
GO SDK attributes:
  • CreatedTimeEquals
  • CreatedTimeLessThan
  • CreatedTimeGreaterThan
  • CreatedTimeLessOrEqual
  • CreatedTimeGreaterOrEqual
You can combine these filters to retrieve sessions with a precise created time range.
The default search window is seven days, and the maximum search window is 30 days.

expiry_time string

Filters sessions based on their expiry time. The time format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. You can use variants of this attribute:

  • expiry_time
  • expiry_time__gt
  • expiry_time__gte
  • expiry_time__lt
  • expiry_time__lte
Go SDK attributes
  • ExpiryTimeEquals
  • ExpiryTimeLessThan
  • ExpiryTimeGreaterThan
  • ExpiryTimeLessOrEqual
  • ExpiryTimeGreaterOrEqual
You can combine these filters to retrieve sessions with a precise expiry time range.
The default search window is seven days, and the maximum search window is 30 days.

duration string

Filters sessions based on duration in seconds. You can use variants of this attribute:

  • duration
  • duration__gt
  • duration__gte
  • duration__lt
  • Duration__lte
Go SDK attributes
  • DurationEquals
  • DurationLessThan
  • DurationGreaterThan
  • DurationLessOrEqual
  • DurationGreaterOrEqual
You can combine these filters to retrieve sessions with a precise duration range.
The default search window is seven days and the maximum search window is 30 days.

limit integer

Limits the number of results retrieved.
The minimum value is one, the maximum value is 20.
Defaults to 20.

offset integer

Denotes the number of value items by which the results should be offset. For example, if the results contain 100 values and limit is set to 10 and offset is set to five, then values 51 through 60 are displayed in the results. This parameter is also used for the pagination of the results.

Response

{
  "api_id": "7d962130-8eb6-49f1-920b-ae4609bf6dfe",
  "response": {
    "meta": {
      "limit": 20,
      "next": null,
      "offset": 0,
      "previous": null,
      "total_count": 1
    },
    "objects": [
      {
        "amount": 0,
        "call_time_limit": 14400,
        "callback_method": "POST",
        "callback_url": "",
        "created_time": "2024-02-01 06:28:15 +0000 UTC",
        "duration": 1800,
        "expiry_time": "2024-02-01 06:58:15 +0000 UTC",
        "first_party": "919003459051",
        "first_party_play_url": "",
        "initiate_call_to_first_party": false,
        "interaction": null,
        "last_interaction_time": "",
        "modified_time": "2024-02-01 06:28:37 +0000 UTC",
        "record": true,
        "record_file_format": "mp3",
        "recording_callback_method": "POST",
        "recording_callback_url": "",
        "resource_uri": "/v1/Account/MAOTQ3NGFLNZRMZME1MT/Masking/Session/c28b77d4-21e7-43bd-9447-04bfee92e651/",
        "ring_timeout": 45,
        "second_party": "918197241073",
        "second_party_play_url": "",
        "session_uuid": "c28b77d4-21e7-43bd-9447-04bfee92e651",
        "status": "expired",
        "total_call_amount": 0,
        "total_call_billed_duration": 0,
        "total_call_count": 0,
        "total_session_amount": 0,
        "virtual_number": "912269947011"
      }
    ]
  }
}

Example Request

1
2
3
4
5
import plivo

client = plivo.RestClient(auth_id='<auth_id>', auth_token='<auth_token>')
response = client.masking_sessions.list_masking_session(status='active')
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.list()
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.maskingSession.listMaskingSession(
        {
            Limit: 10
        }
    ).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
19
<?php
/**
 * Example for List Session
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>", "<auth_token>");
try {

    $response = $client->maskingSessions->listMaskingSession(
        array('status'=>'active'
        )
    );
    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
22
23
package com.plivo.examples;

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


class ListSession {
  public static void main(String [] args) {
    Plivo.init("<auth_id>","<auth_token>");
    try {
      ListResponse<MaskingSession> response = MaskingSession.lister().
        .list();

      System.out.println(response);
    } catch (PlivoRestException | IOException | PlivoValidationException e) {
      e.printStackTrace();
    }
  }
}
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.List();
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
curl -X GET "https://api.plivo.com/v1/Account/{Auth ID}/Masking/Session/" \
-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
21
22
23
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.ListMaskingSession(
               plivo.ListSessionFilterParams{
                       Limit: 10},
       )
       if err != nil {
               fmt.Print("Error", err.Error())
               return
       }
       fmt.Printf("Response: %#v\n", response)
}