PowerBuilder / Plivo REST API / Warm transfer a caller
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Http.BasicAuth = 1
loo_Http.Login = "{{auth_id}}"
loo_Http.Password = "password"
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "action": "warm_transfer",
// "to": "+14152225555",
// "role": "agent",
// "trigger_source": "+14152223333"
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("action","warm_transfer")
loo_Json.UpdateString("to","+14152225555")
loo_Json.UpdateString("role","agent")
loo_Json.UpdateString("trigger_source","+14152223333")
loo_Resp = loo_Http.PostJson3("https://phlorunner.plivo.com/v1/phlo/{phlo_id}/multi_party_call/{node_id}","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Json
Curl Command
curl -X POST
-u '{{auth_id}}:password'
-d '{
"action": "warm_transfer",
"to": "+14152225555",
"role": "agent",
"trigger_source": "+14152223333"
}'
https://phlorunner.plivo.com/v1/phlo/{phlo_id}/multi_party_call/{node_id}
Postman Collection Item JSON
{
"name": "Warm transfer a caller",
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": \"warm_transfer\",\n \"to\": \"+14152225555\",\n \"role\": \"agent\",\n \"trigger_source\": \"+14152223333\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://phlorunner.plivo.com/v1/phlo/{phlo_id}/multi_party_call/{node_id}",
"protocol": "https",
"host": [
"phlorunner",
"plivo",
"com"
],
"path": [
"v1",
"phlo",
"{phlo_id}",
"multi_party_call",
"{node_id}"
]
},
"description": "A User (U1) can transfer the call with a member (U2) of the Multi-Party Call to another user (U3). On warm transfer, the user who initiates the transfer (U1) and the user to whom the call is transferred to (U3) can speak privately before U2 is added to the call.\n\nBelow is the list of arguments that can be passed in this API request, more information can be found [here](https://www.plivo.com/docs/phlo/api/phlo/multi-party-call/update-a-multi-party-call#add-user-to-call)\n\n| Arguments | Description | Required/Conditional/Optional |\n| :--- | :----: | ---: |\n| action | Set this parameter \"warm_transfer\".| Required |\n| to | Phone number or SIP endpoint address of the user to add to the Multi-party Call| Required |\n| role | Role of the user added to the Multi-Party Call. Allowed values are 'customer' and 'agent'. Defaults to agent. | Required |\n| trigger_source | Phone number or SIP endpoint address of the user (agent) initiating the trigger | Required |"
},
"response": [
{
"name": "Warm transfer a caller",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": \"warm_transfer\",\n \"to\": \"+14152225555\", // Phone number or SIP endpoint address of the user to which the call has to be transferred\n \"role\": \"agent\", // Role of the user added to the Multi-Party Call. Allowed values are 'customer' and 'agent'. Defaults to agent.\n \"trigger_source\": \"+14152223333\" // Phone number or SIP endpoint address of the user initiating the transfer.\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://phlorunner.plivo.com/v1/phlo/{phlo_id}/multi_party_call/{node_id}",
"protocol": "https",
"host": [
"phlorunner",
"plivo",
"com"
],
"path": [
"v1",
"phlo",
"{phlo_id}",
"multi_party_call",
"{node_id}"
]
}
},
"code": 200,
"_postman_previewlanguage": "json",
"header": [
],
"cookie": [
],
"body": "{\n \"api_id\": \"faad0293-f5f0-487e-8ff7-b45ba6c45b25\",\n \"error\": \"\"\n}"
}
]
}