SQL Server / Plivo REST API / Add user to a Multi-Party Call
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
EXEC sp_OASetProperty @http, 'BasicAuth', 1
EXEC sp_OASetProperty @http, 'Login', '{{auth_id}}'
EXEC sp_OASetProperty @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": "call",
-- "to": "+14152225555",
-- "role": "agent",
-- "trigger_source": "+14152223333"
-- }
DECLARE @json int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'action', 'call'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'to', '+14152225555'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'role', 'agent'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'trigger_source', '+14152223333'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://phlorunner.plivo.com/v1/phlo/{phlo_id}/multi_party_call/{node_id}', 'application/json', @json
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
END
GO
Curl Command
curl -X POST
-u '{{auth_id}}:password'
-d '{
"action": "call",
"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": "Add user to a Multi-Party Call",
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": \"call\",\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": "Dials a phone number or a SIP endpoint and adds the user to the Multi-Party Call. Below 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 \"call\".| 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": "Add user to a Multi-Party Call",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": \"call\",\n \"to\": \"+14152225555\", // Phone number or SIP endpoint address of the user to add to the Multi-party Call.\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 (agent) initiating the trigger.\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\": \"073e36d4-fd1e-4be3-b00b-ab33105011a7\",\n \"error\": \"\"\n}"
}
]
}