API Connector
With the TRiNG API connector you can build a custom interface for your application to request or push data to TRiNG. Consult TRiNG support for a read only / write API Key, tenantcode and server.
For example you can make a request to:
https://api.tring.nu/pbx/proxyapi.php?key=[APIKEY]&tenant=[TENANTCODE]&reqtype=[REQUESTTYPE]
Replace the variables between the brackets.
Parameters:
reqtype - Request type
tenant - Sometime optional if the Admin API key is used, otherwise provide the tenant code
key - Use the Admin API key or the Tenant API key
format - Optional, can be json or plain
callback - Optional, for cross domain script, the function to use as callback (requires format json)
Request type (reqtype):
COUNTPEERS - Return the number of peers on each node and the total
- Additional parameters:
tenant - optional if using the Admin API key,
returns only peers from the selected tenant
COUNTCHANNELS - Return the number of channels (total or on each node)
- Additional parameters:
nodename - optional, if you want only that node counted
tenant - optional if using the Admin API key,
returns only channels from the selected tenant
PEERS - Show the peers registered on all nodes of the network
- Additional parameters:
tenant - optional if using the Admin API key,
returns only peers from the selected tenant
BLFS - Get the BLF status, peers and flows
tenant - the tenant to report
FLOWS - Show the flow status
tenant - the tenant to report
CHANNEL - Show the channel details for the selected tenant
Additional parameters:
channel - the channel to show info
CHANNELS - Show the channels for the selected tenant
Additional parameters:
tenant - optional, show channels for the tenant
PHONEBOOK - Manage phone books:
Additional parameters:
tenant - select the tenant
phonebook - select the phone book by name
subreqtype - select the sub request type:
query - perform a query
field - name of the field
value - value to search for (use % for partial searches)
add - add a record
values - a json encoded associative array with name of the fields and values
delete - delete a record
peid - peid value returned by search
cleanall - delete all the records in the phonebook
INFO - Get info about system
Additional parameters:
info - type of info:
queues (list of queues)
queue (info about the queue based on id)
agents (info about the agents in all or selected queue)
agentsconnected (info about the agents in all or selected queue, but only if currently connected)
agentsdelay (info about the agents delay in answering in all or selected queue)
outdialed (info about the calls dialed out by extensions)
simpledialed (info about the calls dialed out and in by extensions using the simple call history)
call (info about the call originated with the api using the returned id or unique id)
inforecording (get the metadata associated to the recording for the call, you can use the unique id or the originated id)
recording (get the recording for the call, you can use the unique id or the originated id)
playrecording (play the recording for the call, you can use the unique id or the originated id)
voicemail (get the voicemail message for the call, you can use the id of the voicemail_messages table)
voicemailtranscript (get the voicemail message transcript for the call, you can use the id of the voicemail_messages table)
dids (list of dids)
sms (list of sms sent and received)
extensions (list of extensions, including state)
extstate (get the state of the extensions, including the number speaking with)
config (get info about configured tenant)
cdrs (get the list of calls, you can use wildcard % for the tenant code)
Further parameters available: id, uniqueid, linkedid, src, firstdst, direction, phone, format(csv,xml), template
Phone is a special parameter filtering for whoanswered, calleridnum and dialednum
You can filter for multiple parameter values using a comma separator
simplecdrs (get the list of calls using the simple call history source, you can use wildcard % for the tenant code)
Further parameters available: id,uniqueid,calleridnum,calleridname,disposition,direction,whoanswered,phone,format(csv,json)
Phone is a special parameter filtering for whoanswered, calleridnum and dialednum
You can filter for multiple parameter values using a comma separator
queuelogs (get the list of calls processed by queue)
balance (get the credit available)
flow (get the flow status)
variable (get the custom variable value)
id - optional, id of object requested
queue - optional, id of queue requested for agents info or queue logs
start - optional, start date/time of the sms, cdrs or queue logs or balance returned
end - optional, end date/time of the sms, cdrs or queue logs or balance returned
AGENT - Manipulate queue agent status
Additional parameters:
tenant - name of the tenant
extension - agent username or extension number
queue - queue id (alternatively use queuenumber)
queuenumber - queue number (alternatively use queue)
action - action to perform (pause, unpause)
pausereason - optional, pause reason to set
ATXTRANSFER - Attend transfer a channel
Additional parameters:
tenant - optional, tenant for the channel to transfer
channel - channel to transfer
dest - number to transfer the channel to
CAMPAIGN - Manage call campaign
Additional parameters:
campaign - id for campaign, you need to get it on the URL for the editing campaign
tenant - optional, tenant for the campaign
action - action can be start, stop, pause, resume, addnumber, delnumber. Start and stop can affect only on-demand campaign
number - optional, the number to call when using the addnumber action
numberdescription - option, the number description when using the addnumber action
DIAL - Dial a number and connect to another number
Additional parameters:
tenant - tenant where to place the call
source|?exten - first number to dial - use ACCOUNT to use the number associated with the account chosen
dest|phone - number to connect
var - variables to set, will be prefixed tenant code
account - account name to simulate the call from - use SOURCE to use the account associated with the source number choosen
dialtimeout - dial timeout in seconds
timeout - max duration for the call in seconds
sourceclid - use this clid for dialing source number
destclid - use this clid for dialing dest number
recording - set the recording for the call, use: yes, no, yeschange or nochange)
server - you can ask to use a specific server to dial
autoanswer - you can require the source phone to auto answer setting this parameter to 'yes'
nofollow - you can require the source phone to not follow on additional destinations setting this parameter to 'yes'
FAX - Manage Faxes
Additional parameters:
action - Available actions
send - send a fax
source_number - The number to send the fax from
dest_number - The number to send the fax to
quality - Optional fax quality ('204x98', '204x196' or '204x392'
pagesize - Optional page size ('a4', 'letter' or 'legal'
rotate - Optional rotation (empty for automatic, 'E' or 'W' for East/West rotation or 'no' for no rotation)
deleteaftersend - Optional, set to 'on' to delete the fax once sent
schedule - Optional, set the date/time for sending the fax
statusemail - Optional, set the email to send status updates
filename - The PDF for the fax to be sent
HANGUP - Hangup a channel
Additional parameters:
tenant - optional, tenant for the channel to hangup
channel - channel to hangup
extension - optional, extension to hangup, like 103-DEVEL
fast - optional, set to yes to use a new location algorithm for the channel, much faster
MEDIAFILE - Manage media files
Additional parameters:
action - Available actions
getaudio - Download the audio
tenant - tenant to get audio from
objectid - media id
QUEUE - Manage queue agents
tenant - tenant for the queue
number - queue number (alternatively use id). You can use NONE when applicable
id - queue id (alternatively use number)
uniqid - optional, use this as unique id for the log record
extension - optional, number or extension username to add or delete. You can use NONE when applicable
action - Available actions
list - List queue agents
fulllist - Show all agents info
add - add an agent to the queue
del - del an agent from the queue
clean - del all agents from the queue
log - create a custom log entry in the queue_log table
order - optional, numeric order of the agent in the agent list
type - optional, agent type (NF - Not Following, AD - Additional Destinations, NFR - Not Following with Ring, ADR - Additional Destinations with Ring
EA - External Agent, EANM - External no monitoring, EAC - External with confirm, EANMC - External no monitoring with confirm
CU - Custom destination, CUNM - Custom destination no monitoring, CC -Custom destination with confirm
CUFF - Custom destination with full features
event - optional, custom log event to generate
data[1-5] - data1... data5 to populate custom log event (optional)
QUEUERESET - Reset statistics for a queue
Additional parameters:
tenant - optional, tenant for the queue
queueid - queue id to reset
REBOOT - Reboot one or multiple peers
Additional parameters:
peer - peername to reboot or ALL for all peers
tenant - optional, tenant for the peer to reboot
RESPONSEPATH - Get info from response path object
tenant - tenant for the response path to query
id - response path id
rrid - response path response id or response path uniqueid
filter - optional available filters
queue - Apply filter on queue id
answer - Apply filter on answer extension
uniqueid - Apply filter on unique id
filterdata - optional, the value to filter on
action - Available actions
list - List all available responses
getid - Get the details from the specified response path rrid
getlast - Get the details from the latest one
SETFLOW - Set Flow status or variable
Additional parameters:
number - flow number
state - optional state (INUSE, NOT_INUSE, UNAVAILABLE, RINGING)
value - optional value
tenant - optional, tenant for the flow to set
SMS - Send an SMS
Additional parameters:
tenant - tenant where to place the call
dest - number to send the SMS to
destclid - use this clid for sending the SMS to the dest number
server - you can ask to use a specific server to dial
message - the message to be sent
TRANSFER - Transfer a channel
Additional parameters:
tenant - optional, tenant for the channel to transfer
channel - channel to transfer
extrachannel - extra channel to transfer (optional)
dest - number to transfer the channel to
UNREGISTER - Unregister one or multiple peers
Additional parameters:
peer - peername to unregister or ALL for all peers
tenant - optional, tenant for the peer to unregister
VIRTUALEXT - Manage virtual extensions
tenant - tenant for the virtual extension
number - virtual extension number
extension - optional, number or extension username to add or delete
action - Available actions
list - List extensions joined under the virtual extension
add - add an extension to the virtual extension
del - del an extension from the virtual extension
clean - del all extensions from the virtual extension
VOICEMAIL - Get info about voicemails
tenant - optional, tenant for the voicemails
mailbox - optional, show info about a specific mailbox
msgid - optional, message id
action - Available actions
list - List available voicemails
messages - List messages for mailbox specified
message - Get the message binary for msgid specified
delete - Delete the message for msgid specified
COUNTCALLS - Count the number of calls running
MANAGEDB - Manage data in database
Additional parameters:
object - object name to manage ('tenant', 'custom', 'customtype', 'phone', 'mediafile', 'huntlist', 'extension', 'provider', 'did',
'user', 'conference','routingprofile', 'route', 'destination' are currently the only options)
routingprofileid - optional, when getting the list of the routes, returns only the one for the specified routing profile
typesrc - optional, used for selecting the type of object in destination
typeidsrc - optional, used for selecting the object id in destination
action - action to perform ('list' 'get', 'add' or 'update')
for mediafile object type, you can use also 'updatebinary' and 'getbinary'
for huntlist object type, you can use only 'list', 'getextensions' and 'setextensions'
for extension object type, you can use only 'list', 'add', 'update' and 'get'
for user object type, you can use also 'delete', 'listtenants', 'addtenant', 'deltenant'
for conference object type, you can use also 'delete'
for provider object type, you can use also 'delete' and 'listroutes'
for route object type, you can use also 'delete'
for destination object type, you can use only 'list' and 'replace'
objectid - object id to update
tenantid - options, to add/remove tenants from authorized user
jsondata - jsondata for action - check manual for more info
CHECKAUTH - Check authentication, return info about the privileges for the user
- username - username
- password - password
GETWEBRTCAUTH - Authenticate an extension user and return the details for a WebRTC connection
- username - username
- password - password