import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.transfer(
    legs='aleg',
    aleg_url='https://aleg.url',
    call_uuid='1ed7fd89-df77-4ebf-8196-d5cf7222c918', )
print(response)
{
"message": "call transferred",
"api_id": "08c94608-58bd-11e1-86da-adf28403fe48"
}

This API enables an in-progress or ongoing call to fetch and execute XML from a different URL. If the call (the A leg) is in a Dial, you can also transfer the other party (the B leg) at the same time, or only transfer the B leg to a URL. This is useful for applications where you want to asynchronously change the behavior of a live call. For example, you can play music while a call is on hold, queue calls, or transfer calls.

API Endpoint

POST
https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/

Arguments

ParameterTypeDescription
legsValid values are aleg, bleg, or both. aleg transfers call_uuid. bleg transfers the bridged leg of call_uuid. both transfers both legs.
aleg_urlThe URL to fetch XML from for the A leg. This argument needs to be specified if the legs parameter is either aleg or both. Callback-retry configurable
aleg_methodThe HTTP verb to invoke the aleg_url. Defaults to POST.
bleg_urlThe URL to fetch XML from for the B leg. This needs to be specified if the legs parameter is either bleg or both. Callback-retry configurable
bleg_methodThe HTTP verb to invoke the bleg_url. Defaults to POST.

Returns

Returns an acknowledgement that the call is transferred.

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.transfer(
    legs='aleg',
    aleg_url='https://aleg.url',
    call_uuid='1ed7fd89-df77-4ebf-8196-d5cf7222c918', )
print(response)
{
"message": "call transferred",
"api_id": "08c94608-58bd-11e1-86da-adf28403fe48"
}