The Phonebar API
The XCALLY Phonebar provides CTI capabilities to call external application on one hand and many API to allow your applications to control the phonebar and perform several operations.
API are easy to be called via http requests. The API answers are available via http JSON standard requests (XML is not supported).
Endpoints are documented with the HTTP method for the request and a partial resource identifier.
Example:
GET /api/calls
Prepend your Motion Phonebar URL to the resource identifier to get the full endpoint URL:
http://domain:port/api/calls
Default port is the 9888 (you can change the port inside the Motion GUI section agent/motiobar/advanced)
Curly braces, {}, indicate values you have to supply.
Example:
GET /api/answer/{sessionId}
The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests.
In order to enable APIs, please see the configuration steps Here
Please note we can update APIs from time to time
Calls
List calls
Get information about the active calls.
GET /api/calls
Using curl:
curl http://{domain}:{port}/api/calls -v
Call status Id
NULL = 0,
IDLE = 1,
CONNECTING = 2, OUTBOUND CALL IN PROGRESS
ALERTING = 4, CALLED NUMBER IS RINGING
ACTIVE = 8, ACTIVE CALL
RELEASED = 16, CHANNEL RELEASED (eg. ON TRANSFER COMPLETE)
INCOMING = 32, INCOMING CALL RINGING
HOLDING = 64, ON HOLD
TERMINATED = 128 HANGUP
Answer
Answer an incoming call
GET /api/answer
Using curl:
curl http://{domain}:{port}/api/answer -v
Answer a specific incoming call
GET /api/answer/{sessionId}
Using curl:
curl http://{domain}:{port}/api/answer/{sessionId} -v
Originate
Originate a new call from number
Number is mandatory.
GET /api/originate/{number}
Using curl:
curl http://{domain}:{port}/api/originate/{number} -v
Hangup
Hangup all active calls
GET /api/hangup
Using curl:
curl http://{domain}:{port}/api/hangup -v
Hangup a specific active call
GET /api/hangup/{sessionId}
Using curl:
curl http://{domain}:{port}/api/hangup/{sessionId} -v
Hold
Put on hold an active call
get /api/hold
Using curl:
curl http://{domain}:{port}/api/hold -v
Put on hold a specific active call
get /api/hold/{session}
Using curl:
curl http://{domain}:{port}/api/hold/{sessionId} -v
Transfer
Transfer an active call
GET /api/transfer?number={number}
{number} is mandatory
Using curl:
curl http://{domain}:{port}/api/transfer?number={number} -v
Transfer a specific active call
GET /api/transfer/{sessionId}?number={number}
Using curl:
curl http://{domain}:{port}/api/transfer/{sessionId}?number={number} -v
Attended transfer
GET /api/transfer/attendant/{sessionId}/{partnerSessionId}
Using curl:
curl http://{domain}:{port}/api/transfer/attendant/{sessionId}/{partnerSessionId}
Example to call the extension 12498398500
Conference
Conference 2 active calls
GET /api/conference
Using curl:
curl http://{domain}:{port}/api/conference -v
Example
Here you can download a html/javascript file to use as Motion Phonebar API example.
In particular you will see how to:
- manage the Motion Phonebar status
- manage a call, inserting the phone number as input
- manage a direct call to a specific agent (i.e. john doe)
- manage active calls
You just need to launch the html file, after the Motion Phonebar login, to get the result: