API Events
API Events
API Events are used to be able to send a POST event to a designated end point. At this point Incoming Call is the only option available however, others may be added in the future.
Adding the Event Action
The API Event action is added to the Dialplan Condition section in the URL Dashboard. Use the steps below to add the action:
- Login to the Dashboard if not already by using this link – https://dashboard.url.net.au
- Select Services and select the PBX service to manage by clicking the associated wrench icon.
- Select Call Routing then Dialplans
- Edit the Condition you want to add the API Event to
- From the Available Actions add the API Event action
- Complete the form below:
- HTTP Basic Username – If your endpoint uses HTTP basic authentication enter the username here, leave it blank if HTTP authentication is now used
- HTTP Basic Password – Set the password for your endpoint, or leave blank if not using HTTP basic authentication
- HTTP POST URL – The URL we send the POST data to
- Hit Save
Data Post
When using the API Events action the following data will be sent to your URL as a standard HTTP POST.
Parameter Name | Description |
dialed_number | The number that was dialed, this is the external number assigned to the dialplan. Also commonly known as a “DID” |
caller_id_number | Phone number of the person calling |
dialplan_id | Unique ID of the dialplan the API event is assigned to |
condition_id | Unique ID of the condition the API event is assigned to |
dialplan_name | Name of the dialplan the API event is assigned to |
condition_name | Name of the condition the API event is assigned to |
Test using CURL
You can use the following test command to emulate what the server will send to your URL.
curl -X POST –data “dialed_number=61312341234&caller_id_number=61412341234&dialplan_id=1&condition_id=2&dialplan_name=Test&condition_name=
Business Hours” http://example.com/test.php
NB: Replace http://example.com/test.php with the endpoint that is configured to receive events
curl -X POST –data “dialed_number=61312341234&caller_id_number=61412341234&dialplan_id=1&condition_id=2&dialplan_name=Test&condition_name=
Business Hours” http://example.com/test.php
NB: Replace http://example.com/test.php with the endpoint that is configured to receive events
With Authentication
curl -u username:password -X POST –data “dialed_number=61312341234&caller_id_number=61412341234&dialplan_id=1&condition_id=2&dialplan_name=Test&condition_name=
Business Hours” http://example.com/test.php
NB: Replace http://example.com/test.php with the endpoint that is configured to receive events
Business Hours” http://example.com/test.php
NB: Replace http://example.com/test.php with the endpoint that is configured to receive events