Get Details of a Live Call

To get all current active calls made from an account, make an HTTP GET request to the Call API by passing the ‘status’ as ‘live’.

GET https://api.plivo.com/v1/Account/{auth_id}/Call/?status=live

Prerequisites

  1. Sign up for a trial account at plivo.com.
  2. Check out our Helper Libraries page and install the right helper based on the programming language you want to use.

Implementation

  1. Sign in to your Plivo account.
  2. On the dashboard you can find your Auth ID and Auth Token. Copy those values and paste them into Auth ID and Auth Token variables.

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import plivo, plivoxml

auth_id = "Your AUTH_ID"
auth_token = "Your AUTH_TOKEN"

p = plivo.RestAPI(auth_id, auth_token)

# Get all live calls
response = p.get_live_calls()
print str(response)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require 'rubygems'
require 'plivo'
include Plivo

AUTH_ID = "Your AUTH_ID"
AUTH_TOKEN = "Your AUTH_TOKEN"

p = RestAPI.new(AUTH_ID, AUTH_TOKEN)

# Get all live calls
response = p.get_live_calls()
print response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
var plivo = require('plivo');
var p = plivo.RestAPI({
    authId: 'Your AUTH_ID',
    authToken: 'Your AUTH_TOKEN'
});

var params = {};

p.get_live_calls(params, function (status, response) {
    console.log('Status: ', status);
    console.log('API Response:\n', response);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<?php
	require 'vendor/autoload.php';
    use Plivo\RestAPI;
    
    $auth_id = "Your AUTH_ID";
    $auth_token = "Your AUTH_TOKEN";

    $p = new RestAPI($auth_id, $auth_token);

    // Get all Live Calls
    $response = $p->get_live_calls();
    print_r ($response);

?>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.plivo.test;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.LinkedHashMap;

import com.plivo.helper.api.client.*;
import com.plivo.helper.api.response.call.LiveCallFactory;
import com.plivo.helper.exception.PlivoException;

public class App {
    public static void main(String[] args) throws IllegalAccessException {

        String auth_id = "Your AUTH_ID";
        String auth_token = "Your AUTH_TOKEN";

        RestAPI api = new RestAPI(auth_id, auth_token, "v1");

        try {
            LiveCallFactory lc = api.getLiveCalls();
            System.out.println(lc);
        } catch (PlivoException e) {
            System.out.println(e.getLocalizedMessage());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Collections.Generic;
using RestSharp;
using Plivo.API;

namespace get_details_live
{
    class Program
    {
        static void Main(string[] args)
        {
            RestAPI plivo = new RestAPI("Your AUTH_ID", "Your AUTH_TOKEN");

            IRestResponse<LiveCallList> resp = plivo.get_live_calls();

            Console.Write(resp.Content);

            Console.ReadLine();
        }
    }
}
1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Call/?status=live

Sample Response

(200, 
    {
        u'calls': [
            u'a60f44dc-926f-11e4-82f5-b559cbfe39b9', 
            u'af399206-926f-11e4-8b6f-fd067af138be'
        ], 
        u'api_id': u'23c60a0e-9028-11e4-b423-22000ac8a2f8'
    }
)

Next Step

Learn how to Build an IVR Phone Menu

  1. Make an Outbound Call
  2. Play a Text-to-speech Message
  3. Connect Call to a Second Person
  4. Greet Caller by Name
  5. Play MP3/WAV Audio to Caller
  6. Hangup Using API
  7. Receive Incoming Call
  8. Forward Incoming Call
  9. Record Using API
  10. Screen Incoming Call
  11. Reject incoming call
  12. Get Details of all Calls
  13. Get Details of a single Call
  14. Get Details of Live Calls
  15. Build an IVR Phone Menu
  16. Conference Call
  17. Call Forward
  18. SIP Endpoint (Direct-Dial)
  19. Inbound Trunk
  20. Outbound Trunk