Here, we can find all the information relevant to the telephony actions that can be performed through our API.
Calls
With the calls we can find the following available actions
Make call
Relative URL: Integra/resources/Agents/AgentCall Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: callerid (From number that the call will go out with) agent (Name of the Agent that generates the call) phone (Phone of the Agent that generates the call) tech (Usually SIP) context (Context of the Agent configured in uContact) outqueue (Name of the Outbound Campaign to compute the call) destination (Destination number) Result: TEXT (Guid of the generated call) 0 if Error This is a two step call will call the agent and when answer (or auto answer), the final call it is generated.
via Proxy
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/porthole/1.0.0/porthole.js"></script> <script type="text/javascript"> function Call () { var windowProxy; windowProxy.addEventListener(onResponse); windowProxy = new Porthole.WindowProxy(window.location.protocol + window.location.hostname); windowProxy.post({'action': 'call', 'campaign' : '<CAMPAIGN>', 'callerid' : '<CALLERID>', 'destination' : '<NUMBER>'}); } function onResponse(messageEvent) { response = messageEvent.data.guid; //returns uniqueid of the call } </script>
Make call by phone
This function allows you to make a call directly using the portal's phone. The only way to use it is via proxy, because the communication is with the uContact portal.
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/porthole/1.0.0/porthole.js"></script> <script> function call(){ var windowProxy; windowProxy = new Porthole.WindowProxy(window.location.protocol + '//' + window.location.hostname); windowProxy.addEventListener(onResponse); windowProxy.post({ action: 'callWithPhone', destination: '091000000', campaign: 'Sale->' }); } function onResponse(messageEvent) { var response = messageEvent.data.guid; alert(response); } </script>
HungUp Call
Relative URL: Integra/resources/Agents/HungupPhone Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: phone (Phone of the Agent that generates the call) Result: 1 Success on hung up 0 if Error
via Proxy
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/porthole/1.0.0/porthole.js"></script> <script type="text/javascript"> //for example on click when you want to hangup function Hangup () { var windowProxy; windowProxy = new Porthole.WindowProxy(window.location.protocol + window.location.hostname); windowProxy.post({'action': 'hangup'}); } </script>
Disposition Call
Disposition of the call using dialer actions and taging
RESPOOL
RESPOOLALTERNATIVE
BLACKLIST
SCHEDULE
Dispositions must be configured in uContact.
Relative URL: Integra/resources/api/DispositionCall Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: campaign (campaign name) agent (agent name) callerid (customer phone number) guid (call id) l1 (level 1 disposition) l2 (level 2 disposition) l3 (level 3 disposition) d1 (extra data) d2 (extra data) comment (comment) schedule (if action RESCHEDULE will schedule a call in the future for that number) camptoreschedule (optional - dialer to reschedule the call) tag ( text for tag or empty by default l1|l2|l3 ) Result: 1
External Workflow call
Allows to call a web service that injects information into a voice dialplan allowing multiple actions by workflows.
Relative URL: Integra/resources/admin/CallWorkflow Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: context (incoming context of the flow) extension (incoming extension of the flow) jsonparams (JSON Object) Result: OK
Add to DNCR (blacklist)
Add number to Do not call Registry (black list) by campaign or use * on campaign for all
Relative URL: Integra/resources/admin/addblack Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: black (JSON Object) Result: 1
Json object
{"phone": "phone number", "campaign":"Campaign or *", "username": "user", "company": "Customer data", "job_title": "Customer data","name": "Name"}
Recordings
Here you will find how to use recordings with the API.
Get Recordings
Relative URL: Integra/resources/Cdr/getrecords Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: lastrow (Last number of records for pagination, example 0 (will get you 50 recordings from 0-50), 50 (will get from 51-100)) if search limit is 50 searchLimit records count filter (Json of the filter object) Random: 1 (Always 1) Result: JSON
Json Object
{ "calldatei": "2015-12-03 00:00:00", //Initial date "calldatef": "2016-02-24 23:59:59", //Final date "agent": "", //Agent "campaign": "", //Campaign "source": "", //Source "destination": "", //Destination "data": "", //Data of the call Tag "range": "", //Hour range "rating": "", //Qualification "mindur": "", //Min duration "exclude": "", //Exclude number "type": "record" //Type of record alway the same ,"cont": "" //How many times at least we have this number in the range }
The recording could be in 4 different places:
https://TelephonyIP/records/guid.mp3 https://TelephonyIP/records/guid.mp3 https://BackupRecords/records/20160118/guid.mp3 https://BackupRecords/records/guid.mp3 Guid (Unique identifier found in JSON) Example: 7e4e7db9-f080-494e-b04b-7c8e47711558
The folders are the date of the recording that is on the JSON string (calldate) without hypens or time.
This is done because if you are storing many million files the Operating System won't be able to manage them ok, that is why we store the recording per day in folders.
If you don't find the recording on any of these places the recording could be in GSM format, you can do 2 things here:
If your application is capable to reproduce GSM format, then just replace mp3 with GSM and try to find them on the same 4 places.
You can Convert the GSM to MP3 with a WebService.
Convert Recordings
Relative URL: Integra/resources/Supervisor/convert Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: guid (Unique identifier of the recording) folder (Example:20160118) This is the date of the recording in case the recording is found there. Result: 1 for complete.
Then you will try again to find the MP3 file (you can reproduce the URL with HTML5 or any capable audio player).
https://TelephonyIP/records/guid.mp3 https://TelephonyIP/records/guid.mp3 https://BackupRecords/records/20160118/guid.mp3 https://BackupRecords/records/guid.mp3 Guid (Unique identifier found in JSON) Example: 7e4e7db9-f080-494e-b04b-7c8e47711558
Tag Record
Relative URL: Integra/resources/Agents/TagRecord Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: phone (Destination phone) guid (Record unique identifier) data (Text to tag) Result: Empty, is an Async Request
Via Proxy
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/porthole/1.0.0/porthole.js"></script> <script type="text/javascript"> //for example on click when you want to close a tab function CloseTab () { var windowProxy; windowProxy = new Porthole.WindowProxy(window.location.protocol + window.location.hostname); windowProxy.post({'action': 'tag', 'guid' : '<GUID>', 'message' : '<MESSAGE>'}); } </script>
Dialers
Here we see some actions that we use only for voice markers.
CTI
This JSON object is found on LocalStorage and encrypted, this has the information of the Answered Call and if is From a Dialer all the information of the Next alternative phone to Respool.
Dialer: Campaign, Main number, status(always 1), data (params and values for the workflow), alternatives (with :), retries (for this main number), contact (id), dialebase, priority, agentphone
Convert this datas to the Objet Respool shown below.
What can we do with Objet Respool?:
Change main number and alternatives and reorder them
Change retries for the main number (example if we use an alternative number as main then we set retries to 0)
Change priorities
Add data or change them for the workflow
agentphone, if progressive we can assign it to other agent
DON'T CHANGE: campaign, status, contact, dialerbase: Can alter the dialer beheavior.
via Proxy
windowProxy = new Porthole.WindowProxy('<URL PARENT>'); windowProxy.addEventListener(onMessage); windowProxy.post({'action': 'CTI'}); function onMessage(messageEvent) { CTI = messageEvent.data.CTI; }
Respool Call
Relative URL: Integra/resources/Dialers/Respool Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: callspool (JSON Object) Result: 1
Json object
{ "campaign": "Ventas->", //Name of the campaign "destination": "098344484", //Destination number "dialerbase": "basetest", //Name of the dialer List "status": 1, // 1 if enable "data": "Par1=Val1:Par2=Val2", // Params for the workflow and Forms "alternatives": "098124484", //Alternatives numbers separated by : "contact": 222, // Contactid "retries": 0, // 0 as we are starting a new phone "priority": 9999, // Priority to order the records 1 is used for schedule so use > 1 "agentphone": "1001" // For progressive dialers }
Never Respool a destination that is already on the Spool always a alternative number, in CTI the principal number is already the first alternative.
via Proxy
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/porthole/1.0.0/porthole.js"></script> <script type="text/javascript"> function Respool () { var windowProxy; windowProxy = new Porthole.WindowProxy(window.location.protocol + window.location.hostname); windowProxy.post({'action': 'respool', 'objetoRespool' : <Objeto Respool>}); } </script>
Schedule Call
The dialer has to be Enable and On Date To process Schedule Calls if not this will be the first to go out when the Dialer starts again.
Relative URL: Integra/resources/Dialers/ScheduleDialerCall Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: callschedule (JSON Object) Result: 1 OK 0 ERROR
Json Object
{ "calldate" : "2015-10-11 15:00:00", //Calldate to be executed "campaign" : "Ventas->", //Dialer campaign "destination" : "098344484", //Destination for the call "alternatives" : "099124484:099121212", //Alternative phones "agentphone" : "1001", //Agent phone if progressive "data" : "Par1=Val1:Par2=Val2" //Values for Forms and Workflows }
via Proxy
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/porthole/1.0.0/porthole.js"></script> <script type="text/javascript"> function Schedule () { var windowProxy; windowProxy = new Porthole.WindowProxy(window.location.protocol + window.location.hostname); windowProxy.post({'action': 'schedule', 'callDate' : '<2016-10-10 15:00:00>', 'objectDialer' : <Objecto Respool> }); } </script>
Dialer Tasks
If the call date is specified, the task will execute at this exact moment, on the contrary, if the date is specified as null, the task will execute when the schedule is free.
The priority of the scheduled task with an specific date will be higher than the one that date is null.
Dialer Task URL Relativa: Integra/resources/Dialers/DialerTask Método: POST content-type: application/x-www-form-urlencoded Parámetros: call (Objeto JSON) Resultado: 1 OK 0 ERROR
Examples for each mode
Insert Dialer with priority 1
"calldate" is NOW
bulk = false
automatic = true
{"calldate" : null, "campaign" : "campName<-", "destination": "12-345-678", "alternatives": "", "agent" : "", "data": "idcustomer=7", "source": "source", "bulk": false, "automatic": true }
Create a manual call -Click to call-
calldate = null
bulk = false
automatic = false
make a call in the moment
{"calldate" : null, "campaign" : "campName<-", "destination": "12-345-678", "alternatives": "", "agent" : "", "data": "idcustomer=7", "source": "source", "bulk" : false, "automatic" : false }
Insert Scheduled Call for anytime
Calldate is any future date time
Dialer, Any Time {"calldate" : "2020-01-01 00:00:00", "campaign" : "campName<-", "destination": "12-345-678", "alternatives": "", "agent" : "", "data": "idcustomer=7", "source": "source", "bulk" : true, "automatic" : false }
Insert Dialer call to a Dialer
If dialer is progressive, don’t forget to insert the agent
Dialer, Specific Agent //Identify Agent by its username: {"calldate" : null, "campaign" : "campName->", "destination": "12-345-678", "alternatives": "", "agent" : "Agent1", "data": "idcustomer=7", "source": "source", "bulk" : true, "automatic" : false} //Identify Agent by its assigned phone number: {"calldate" : null, "campaign" : "campName->", "destination": "12-345-678", "alternatives": "", "agent" : "1001", "data": "idcustomer=7", "source": "source", "bulk" : true, "automatic" : false}
Delete Contact from Dialer
Relative URL: Integra/resources/Dialers/RemoveContact Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: campaign number Result: 1
Delete Schedule from Dialer
Deletes a schedule call, parameters campaign, number,date from and to format:
(YYYY-MM-DD HH:mm:ss) to be able to delete in a date time range.
Relative URL: Integra/resources/Dialers/RemoveScheduleDialerCall Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: campaign destination from to Result: 1
Upload Bases
The API gives us the possibility to upload the lists of dialers in a simple way, with parameters and with timezone so that it is used the most appropriate to your needs.
Upload Calls Base
Relative URL: Integra/resources/Dialers/uploadbase Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: filename (Name of the file) fileb64 (base64 content of the file) campaign (Name of the campaign) cant (Count of records) username (user uploading) Result: 1 (Async Method)
File Format
prueba1;098344484;var1=val1:var2=val2;099124484:099111111;9999;1001 campaign;principanumber;parameters and values for workflows and forms;alternatives phones separated by :; priority (optional);agentphone (optional)
Upload Calls Base with Timezone
Relative URL: Integra/resources/Dialers/uploadbasewithtimezone Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: filename (Name of the file) fileb64 (base64 content of the file) campaign (Name of the campaign) cant (Count of records) username (user uploading) timezone (Timezone, the list of zones can be found in: uContact Timezones) Result: 1 (Async Method)
File format
prueba1;098344484;var1=val1:var2=val2;099124484:099111111;9999;1001 campaign;principanumber;parameters and values for workflows and forms;alternatives phones separated by :; priority (optional);agentphone (optional)
Campaigns Information
You can also get voice campaign information through the API.
Campaigns Summary
To see the status of system campaigns summarized, the following method exists
Relative URL: Integra/resources/Supervisor/queuesummary Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Result: JSON
Response
[ { "queue": "Power<-", "loggedIn": 10, "available": 5, "callers": 3, "holdTime": 18, "talkTime": 130, "longestHoldTime": 220, "internalActionId": "1982468278_6312", "dateReceived": "Nov 2, 2018 11:31:42 AM" }, { "queue": "test->", "loggedIn": 0, "available": 0, "callers": 0, "holdTime": 0, "talkTime": 0, "longestHoldTime": 0, "internalActionId": "1982468278_6312", "dateReceived": "Nov 2, 2018 11:31:42 AM" }, { "internalActionId": "1982468278_6312", "dateReceived": "Nov 2, 2018 11:31:42 AM" } ]
Campaign Status
On the other hand, if we want to obtain all the information of the campaigns of the system, we can use this other method
Relative URL: Integra/resources/Supervisor/campaignstatus Method: POST content-type:application/x-www-form-urlencoded; charset=UTF-8 Params: queue (Example: CampTest2<-) Result: JSON (Has different type of Objects, Campaigns, Agents and ACD Calls)
Response
{ "Power<-": { "campaign": "Power<-", "availables": 0, "notavailables": 1, "paused": 0, "busy": 0, "busypaused": 0, "totalagents": 1, "logged": 0, "onwrapup": 0, "completed": 0, "abandoned": 0, "talked": "00:00:00-0", "hold": "00:00:00-0", "abandonedlevel": "0", "totalcalls": 0, "acd": 0, "servicelevel": "0.0", "servicelevel2": "0.0", "strategy": "leastrecent", "slevelthreshold": "3", "wrapup": 0 }, "test->": { "campaign": "test->", "availables": 0, "notavailables": 0, "paused": 0, "busy": 0, "busypaused": 0, "totalagents": 0, "logged": 0, "onwrapup": 0, "completed": 0, "abandoned": 0, "talked": "00:00:00-0", "hold": "00:00:00-0", "abandonedlevel": "0", "totalcalls": 0, "acd": 0, "servicelevel": "0.0", "servicelevel2": "0.0", "strategy": "leastrecent", "slevelthreshold": "3", "wrapup": 3 } }