Legs API
...
Leg Actions
Request, cURL & Response Payloads
73 min
endpoint (all actions) post /v2/accounts/{account sid}/legs/{leg sid}/actions full url https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions authentication authorization basic \<base64 apikey apitoken> content type application/json \<answer> request payload { "action custom param" "answer call", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<answer>\</answer>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "answer call", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<answer>\</answer>\</flow>" }' \<dial> request parameters attribute required description contacturi yes destination number or sip uri exophone yes caller id networktype no pstn or voip absorbdtmf no absorb dtmf during dial request payload { "action custom param" "test dial", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<dial contacturi=\\"9791111865\\" exophone=\\"02048566335\\" networktype=\\"pstn\\" absorbdtmf=\\"true\\">\</dial>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "test dial", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<dial contacturi=\\"9791111865\\" exophone=\\"02048566335\\" networktype=\\"pstn\\" absorbdtmf=\\"true\\">\</dial>\</flow>" }' \<gather> request parameters attribute required description numdigits no number of digits to collect timeoutinsec no timeout duration finishonkey no key to terminate input request payload { "action custom param" "collect digits", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<gather numdigits=\\"4\\" timeoutinsec=\\"10\\" finishonkey=\\"#\\">\</gather>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "collect digits", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<gather numdigits=\\"4\\" timeoutinsec=\\"10\\" finishonkey=\\"#\\">\</gather>\</flow>" }' \<hangup> request payload { "action custom param" "hangup call", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<hangup>\</hangup>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "hangup call", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<hangup>\</hangup>\</flow>" }' \<hold> request payload { "action custom param" "hold leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<hold>\</hold>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "hold leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<hold>\</hold>\</flow>" }' \<joinbridge> request parameters attribute required description bridgesid yes bridge identifier absorbdtmf no absorb dtmf request payload { "action custom param" "join bridge", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<joinbridge bridgesid=\\"bridge sid\\" absorbdtmf=\\"true\\">\</joinbridge>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "join bridge", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<joinbridge bridgesid=\\"bridge sid\\" absorbdtmf=\\"true\\">\</joinbridge>\</flow>" }' \<leavebridge> request payload { "action custom param" "leave bridge", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<leavebridge>\</leavebridge>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "leave bridge", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<leavebridge>\</leavebridge>\</flow>" }' \<mute> / \<unmute> request parameters attribute required description direction no in, out, both request payload { "action custom param" "mute leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<mute direction=\\"out\\">\</mute>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "mute leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<mute direction=\\"out\\">\</mute>\</flow>" }' \<playsequence> request parameters nested media actions only request payload { "action custom param" "play sequence", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<playsequence>\<startplay>https //example com/audio wav\</startplay>\<say>hello\</say>\</playsequence>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "play sequence", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<playsequence>\<startplay>https //example com/audio wav\</startplay>\<say>hello\</say>\</playsequence>\</flow>" }' \<refer> request parameters attribute required description legeventendpoint yes grpc endpoint request payload { "action custom param" "refer leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<refer legeventendpoint=\\"grpc //host\ port\\">\</refer>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "refer leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<refer legeventendpoint=\\"grpc //host\ port\\">\</refer>\</flow>" }' \<say> request payload { "action custom param" "say text", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<say>hello\</say>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "say text", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<say>hello\</say>\</flow>" }' \<senddigits> request parameters attribute required description duration no tone duration (ms) between no gap between digits request payload { "action custom param" "send digits", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<senddigits duration=\\"100\\" between=\\"500\\">1234#\</senddigits>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "send digits", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<senddigits duration=\\"100\\" between=\\"500\\">1234#\</senddigits>\</flow>" }' \<startmonitoring> request parameters attribute required description monitoringlegsid yes target leg sid rxaudio no muted / enabled request payload { "action custom param" "start monitoring", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startmonitoring monitoringlegsid=\\"leg sid\\" rxaudio=\\"muted\\">\</startmonitoring>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "start monitoring", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startmonitoring monitoringlegsid=\\"leg sid\\" rxaudio=\\"muted\\">\</startmonitoring>\</flow>" }' \<startplay> request parameters attribute required description body (url) yes public or authenticated audio file url request payload { "action custom param" "start play", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startplay>https //example com/audio wav\</startplay>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "start play", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startplay>https //example com/audio wav\</startplay>\</flow>" }' \<startrecording> request parameters attribute required description direction no in, out, both format no wav, mp3 storagetype no https, s3 storageurl no upload endpoint request payload { "action custom param" "start recording", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startrecording direction=\\"both\\" format=\\"wav\\" storagetype=\\"https\" storageurl=\\"https //example com/upload\\">\</startrecording>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "start recording", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startrecording direction=\\"both\\" format=\\"wav\\" storagetype=\\"https\" storageurl=\\"https //example com/upload\\">\</startrecording>\</flow>" }' \<startstream> request parameters attribute required description streamtype yes unidirectional / bidirectional streamurl yes websocket endpoint request payload { "action custom param" "start stream", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startstream streamtype=\\"bidirectional\\" streamurl=\\"wss\ //example com/stream\\">\</startstream>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "start stream", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<startstream streamtype=\\"bidirectional\\" streamurl=\\"wss\ //example com/stream\\">\</startstream>\</flow>" }' \<stopmonitoring> request payload { "action custom param" "stop monitoring", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopmonitoring>\</stopmonitoring>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "stop monitoring", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopmonitoring>\</stopmonitoring>\</flow>" }' \<stopplay> request payload { "action custom param" "stop play", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopplay>\</stopplay>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "stop play", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopplay>\</stopplay>\</flow>" }' \<stoprecording> request payload { "action custom param" "stop recording", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stoprecording>\</stoprecording>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "stop recording", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stoprecording>\</stoprecording>\</flow>" }' \<stopsay> request payload { "action custom param" "stop say", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopsay>\</stopsay>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "stop say", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopsay>\</stopsay>\</flow>" }' \<stopstream> request parameters attribute required description streamsid yes stream identifier request payload { "action custom param" "stop stream", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopstream streamsid=\\"stream sid\\">\</stopstream>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "stop stream", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<stopstream streamsid=\\"stream sid\\">\</stopstream>\</flow>" }' \<unhold> request payload { "action custom param" "unhold leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<unhold>\</unhold>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "unhold leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<unhold>\</unhold>\</flow>" }' \<unmute> request parameters attribute required description direction no in, out, both request payload { "action custom param" "unmute leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<unmute direction=\\"out\\">\</unmute>\</flow>" } curl curl location 'https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid}/actions' \\ \ header 'authorization basic \<base64 apikey apitoken>' \\ \ header 'content type application/json' \\ \ data '{ "action custom param" "unmute leg", "exoml" "\<?xml version=\\"1 0\\" encoding=\\"utf 8\\"?>\<flow>\<unmute direction=\\"out\\">\</unmute>\</flow>" }'
Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.
