SIP Trunks quickstart
In this quickstart you create an outbound policy, create a trunk for an office PBX that uses it,
allow a second PBX address, run a configuration test and place a test call from your PBX. Every
step uses curl against https://api.signals.pressone.africa/v1.
The example PBX has the public addresses 203.0.113.10 and 203.0.113.11 and accepts SIP over TLS
on port 5061. Replace them with your own.
Before you start
You need:
- An API key with the admin or engineer role. It looks like
sk_live_.... See Authentication. - The ID of the Signals project the trunk belongs to.
GET /v1/projectslists your projects. - The public IP address of your PBX, and the address and port where it accepts SIP.
Set them as shell variables so you can paste the commands below:
Code
Three headers appear throughout:
Idempotency-Keymakes a create or action safe to retry. Send a new unique value for each new request, and the same value when you retry that request.If-Matchcarries the ETag of the trunk or policy you are changing, a quoted integer such as"1". It stops you from overwriting a change someone else made. Every successful edit returns a new ETag.X-Project-IDselects a project. You can leave it out while your organization has one active project.
Every change is live once the API accepts it. There is nothing to publish. Changes take effect within a minute.
Responses below are trimmed to the fields this guide uses.
Step 1: Read the platform endpoints
Fetch the addresses your PBX and firewall need:
Code
Code
You will use these values in Connect your PBX.
Step 2: Create an outbound policy
Outbound calls need an outbound policy. Create one with a daily spend cap of ₦50,000 (5,000,000 kobo) and recording off:
Code
The API returns 201 Created with an ETag of "1". The policy is live. A new policy allows calls
to Nigeria:
Code
Code
Step 3: Create the trunk
Create a trunk that carries calls in both directions, accepts calls from 203.0.113.10, requires
TLS (require_tls), delivers inbound calls to the PBX over TLS on port 5061 and uses the policy
from step 2:
Code
number_block_ids routes whole number blocks to the trunk in the same request. This example leaves
it empty and routes numbers later in Numbers and routing.
The API returns 201 Created with the trunk under trunk and an ETag header of "1":
Code
The trunk is live and takes effect on the network within a minute. Save the ID:
Code
The trunk name must be lowercase letters, digits and hyphens, up to 63 characters, starting and
ending with a letter or digit. Signals uses it in the trunk's signaling_fqdn.
If your PBX cannot use a fixed public IP address, create the trunk with "auth_mode": "digest",
"sources": [] and a digest_realm instead. The response then carries the generated password in
digest_password. It is shown only once, so store it before you do anything else. See
Authentication and security.
If the trunk could not run as configured, the API refuses the create with 422 and a problem
detail that starts with the trunk would not apply:. Nothing is created.
Step 4: Allow a second PBX address
Your office has a second PBX at 203.0.113.11. Add it as an IP credential. Send the ETag from step
3 in If-Match:
Code
Code
The response carries the new ETag "2". The new address is allowed within a minute.
Step 5: Run a configuration test
Ask Signals to check the trunk's configuration:
Code
The API returns 202 Accepted and a Location header that ends with the test ID. Read the test:
Code
Code
While result is running, read the test again. GET /v1/trunks/{trunk_id}/tests lists earlier
runs under data.
Step 6: Place a test call from your PBX
Point your PBX at sip.trunk.pressone.co as described in
Connect your PBX, then dial a Nigerian mobile number from an
extension, for example +2348035550142.
- If the call connects and you hear audio both ways, the trunk works.
- If the call is refused straight away, check that the PBX sends from an allowed address and over TLS, since this trunk requires it.
- If the call connects with no audio, allow the Signals media addresses and RTP ports from step 1 in your firewall.
The call needs a caller ID that is routed to the trunk. Until you route a number block in Numbers and routing, outbound calls have no caller ID they may present.
What you built
- An outbound policy that allows calls to Nigeria and caps daily spend at ₦50,000.
- A trunk,
office-pbx, that uses that policy, accepts calls from two office addresses and delivers inbound calls over TLS.
Next steps
- Route numbers to the trunk so it can receive calls and present caller ID: Numbers and routing.
- Configure your PBX: Connect your PBX.
- Add more destinations or limits: Outbound policies.