Add user to a Multi-Party Call

    Dials a phone number or a SIP endpoint and adds the user to the Multi-Party Call

    API Endpoint

    POST https://phlorunner.plivo.com/v1/phlo/{phlo_id}/multi_party_call/{node_id}

    Arguments

    URL Params

    ParamDescription/Allowed Values
    phlo_idRequiredstring

    Unique identifier for the PHLO. PHLO ID is available here.

    node_idRequiredstring

    Unique identifier for the Multi-Party Call. The ID is available in the configuration section of the corresponding Multi-Party Call node in the PHLO.

    Payload

    ParamDescription/Allowed Values
    actionRequired

    call

    toRequired

    Phone number or SIP endpoint address of the user to add to the Multi-party Call

    roleRequired

    Role of the user added to the Multi-Party Call. Allowed values are 'customer' and 'agent'. Defaults to agent.

    trigger_sourceRequired

    Phone number or SIP endpoint address of the user (agent) initiating the trigger

    Returns

    Returns a MultiPartyCall object.

    Response

    HTTP Status Code: 201

    {
        "api_id": "073e36d4-fd1e-4be3-b00b-ab33105011a7",
        "error": ""
    }
    

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    import plivo
    
    auth_id = 'Your AUTH ID'
    auth_token = 'Your AUTH Token'
    phlo_id = 'Your PHLO ID' # https://console.plivo.com/phlo/list/
    node_id = 'Your Node ID'
    phlo_client = plivo.phlo.RestClient(auth_id=auth_id, auth_token=auth_token)
    phlo = phlo_client.phlo.get(phlo_id)
    
    trigger_source = '1111111111'
    to = '1111111112'
    role = 'agent'
    
    response = phlo.multi_party_call(node_id).call(trigger_source, to, role)
    print str(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
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    
    AUTH_ID = 'AUTH_ID'
    AUTH_TOKEN = 'AUTH_TOKEN'
    
    client = Phlo.new(AUTH_ID, AUTH_TOKEN)
    
    # if credentials are stored in the PLIVO_AUTH_ID and the PLIVO_AUTH_TOKEN environment variables
    # then initialize client as:
    # client = Phlo.new
    
    # provide the phlo_id in params
    phlo = client.phlo.get('phlo_id')
    multi_party_call = phlo.multi_party_call('node_id')
    
    # multi_party_call.call(<trigger_source>, <to>, <role>)
    
    begin
        response = multi_party_call.call('9999999999', '0000000000', 'customer')
        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
    17
    18
    19
    
    var plivo = require('plivo');
    var PhloClient = plivo.PhloClient;
    
    var authId = 'auth-id';
    var authToken = 'auth-token';
    var phloId = 'PHLO_ID';
    var mpcId = 'Multiparty_call_NodeID';
    var phloClient = phlo = null;
    var mpcSourceNo = 'member_id'; //Trigger source address
    var mpcTargetNo = 'target_id'; //Trigger target address
    var role = 'agent';
    
    // Add member to multi party call
    phloClient = new PhloClient(authId, authToken);
    phloClient.phlo(phloId).multiPartyCall(mpcId).call(mpcSourceNo, mpcTargetNo, role).then(function (result) {
        console.log('Multiparty call result', result);
    }).catch(function (err) {
        console.log('Multiparty call failed', err);
    });
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    <?php
    /**
     * Example for MultiParty Call
     */
    require 'vendor/autoload.php';
    use Plivo\Resources\PHLO\PhloRestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new PhloRestClient("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
    $phlo = $client->phlo->get("YOUR_PHLO_ID");
    $multiPartyCall = $phlo->multiPartyCall()->get("YOUR_NODE_ID");
    try {
        $response = $multiPartyCall->call($trigger_source, $to, $role);
        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
    24
    25
    26
    27
    28
    29
    30
    
    import com.plivo.api.Plivo;
    import com.plivo.api.PlivoClient;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.node.MultiPartyCall;
    import com.plivo.api.models.node.MultiPartyCallActionType;
    import com.plivo.api.models.node.MultiPartyCallUpdateResponse;
    import com.plivo.api.models.phlo.Phlo;
    import java.io.IOException;
    
    public class Example
    {
        privatestatic final  String authId = "Your AUTH_ID";
        private static final String authToken = "Your AUTH_TOKEN";
        private static PlivoClient client = new PlivoClient(authId, authToken);
        public static void main(String[] args) throws IOException, PlivoRestException
        {
            String phloId = "Your PHLO_ID";
            String nodeId = "Your NODE_ID";
            String triggerSource = "11111111111";
            String to = "11111111112";
            String memberId = to;
            String role = "agent";
            Plivo.init(authId, authToken);
            Phlo phlo = Phlo.getter(phloId).client(client).get();
    
            MultiPartyCall mpc = MultiPartyCall.getter(phloId, nodeId).get();
    
            MultiPartyCallUpdateResponse response = MultiPartyCall.updater(phloId, nodeId).triggerSource(triggerSource).to(to).role(role).call().update();
        }
    }
    
    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;
    
    namespace test_PHLO_dotnet
    {
        class Program
        {
            public static void Main(string[] args)
            {
                var phloClient = new PhloApi("auth_id", "auth_token");
                var phloID = "phlo_id";
                var nodeID = "node_id";
                var phlo = phloClient.Phlo.Get(phloID);
                var multiPartyCallObj = phlo.MultiPartyCall("nodeID");
    
                var triggerSource = "19620074923";
                var to = "19486127623";
                var role = "agent";
    
                Console.WriteLine(multiPartyCallObj.Call(triggerSource, to, role));
            }
        }
    }
    
    1
    2
    3
    4
    5
    
    curl --request POST \
      --user AUTH_ID:AUTH_TOKEN \
      --url 'https://phlorunner.plivo.com/v1/phlo/{phlo_id}/multi_party_call/{node_id}' \
      --header 'Content-Type: application/json' \
      --data '{"trigger_source": "1111111111","to": "1111111112","role": "agent","action":"call"}'
    
    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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    
    package main
    
    import (
    	"fmt"
    	"plivo-go"
    )
    
    // Initialize the following params with corresponding values to trigger resources
    
    const authId  = "auth_id"
    const authToken = "auth_token"
    const phloId = "phlo_id"
    const nodeId = "node_id"
    const actionTo = "to_endpoint"
    const actionSource = "from_endpoint"
    
    //Use the following multiparty call actions as needed; do not edit the following
    
    const actionRole = "agent"
    const actionCall = "call"
    
    func main() {
    	testMultiPartyCallCall()
    }
    
    func testMultiPartyCallCall() {
    	phloClient,err := plivo.NewPhloClient(authId, authToken, &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	phloGet, err := phloClient.Phlos.Get(phloId)
    	if err != nil {
    		panic(err)
    	}
    	MPCGet, err := phloGet.MultiPartyCall(nodeId)
    	if err != nil {
    		panic(err)
    	}
    	callPayload := plivo.PhloMultiPartyCallActionPayload{
    		actionCall,
    		actionTo,
    		actionRole,
    		actionSource,
    	}
    
    	response, _ := MPCGet.Call(callPayload)
    	fmt.Printf("Response: %#v\n", response)
    }