Your first call
This page places the same call to the same phone in two ways. The first way uses Programmable Voice: one HTTP request places the call, and OneML tells Signals what to say. The second way uses a SIP trunk: you create a trunk, then dial from your PBX as usual.
Both examples call +234 803 555 0142 from the Signals number +234 201 330 0117. Replace them with a phone you can answer and a number your project owns.
Automations offers a third way: describe the outcome you want, and Signals runs the call.
Path 1: Programmable Voice
Programmable Voice places calls from your code. You send one request to the Calls API, and when the person answers, Signals follows the OneML you supplied. OneML is an XML format for call instructions. <Say> reads text aloud, <Gather> collects keypad digits, and <Dial> connects another party.
Before you start with Programmable Voice
You need:
- your voice account's
AccountSidand auth token. The voice account is the Programmable Voice identity of your project. TheAccountSidis its public name,ACfollowed by 32 hexadecimal characters. The auth token is its password. - a Signals number owned by your project, to use as the caller ID.
- a phone to ring.
Step 1: get your AccountSid and auth token
In the Signals console, open Developers, then Voice Account. Copy the AccountSid, then choose Show and copy the auth token. Admins and engineers can view it at any time. Store it in a secrets manager.
Keep both values in environment variables:
Code
Step 2: place the call
Create the call with POST /2010-04-01/Accounts/{AccountSid}/Calls.json. Authenticate with HTTP Basic: the username is the AccountSid and the password is the auth token. Pass the OneML inline in the Twiml parameter, so Signals does not need to fetch it from your server.
Code
Signals accepts the call and returns it in the queued status. The response follows Twilio's call resource; this one is abridged:
Code
The phone rings. When you answer, you hear the code read aloud, and the call ends.
Step 3: check the call
Fetch the call by its sid to follow its status:
Code
Code
The subresource_uris.events link lists the HTTP exchanges Signals recorded for the call, which helps when a call does not behave as you expect.
Serve OneML from your own server
Inline OneML suits a fixed message. For anything that reacts to the caller, pass a Url instead of Twiml. When the call is answered, Signals requests that URL and follows the OneML your server returns.
Code
Code
Coming from Twilio? Change api.twilio.com to api.signals.pressone.africa and use your Signals AccountSid and auth token. Your requests and markup stay the same. See Moving from Twilio.
Continue with the Programmable Voice quickstart.
Path 2: SIP trunk
A SIP trunk connects a phone system you already run, such as a PBX, a contact centre platform or an AI voice agent, to Signals over SIP. Your PBX sends each call to Signals. Signals checks that the call came from your trunk, applies the trunk's outbound policy and routes the call to the phone network.
A trunk is live as soon as you create it. There is no draft and nothing to publish: Signals checks the request, saves the trunk and applies it to the network within a minute.
Before you start with a SIP trunk
You need:
- an API key with the
service_configuration:read,service_configuration:write,device_config:readandcall_history:readscopes. See Authentication. - the public IP address your PBX sends calls from, in this example
203.0.113.10. - an outbound policy that allows calls to Nigeria. See Outbound policies.
- a Signals number your organization holds, to present as the caller ID. See Numbers and routing.
Step 1: find your project ID
A trunk is created inside a project. Read your project ID:
Code
Code
Step 2: create the trunk
This trunk accepts calls only from your PBX's IP address, requires TLS for signalling and SRTP for audio, sends inbound calls to pbx.example.com and uses your outbound policy. Every create request carries an Idempotency-Key, so a retry cannot create a second trunk.
Code
The response holds the full trunk under trunk. This excerpt shows the fields this guide uses:
Code
The trunk is saved and takes effect within a minute. If Signals cannot apply it, PressOne staff are alerted; you do not need to poll anything.
The ETag header holds the trunk's revision, a number that goes up with every change. Send it back in If-Match on your next change, so Signals can refuse the change if someone else edited the trunk in between. Requests and errors explains ETags in detail.
Code
Step 3: point your PBX at Signals and dial
Read the current signalling and media addresses. They can change, so read them before you configure a device rather than copying them from this page.
Code
Code
Configure your PBX with these values:
| Setting | Value |
|---|---|
| SIP server | sip.trunk.pressone.co |
| Transport and port | TLS on 5061, because the trunk requires TLS |
| Media encryption | SRTP with SDES, because the trunk requires it |
| Firewall | Allow UDP audio from the ranges in media_cidrs on ports 10000 to 20000 |
| Caller ID | +2342013300117, a number your organization holds |
Then dial +2348035550142 from a PBX extension. The phone rings.
Connect your PBX has device settings for common systems.
Step 4: find the call in call history
Code
Code
Continue with the SIP trunk quickstart, which covers digest authentication, inbound routing and trunk tests.
Next steps
- Authentication: API keys, scopes and the Calls API credentials.
- Requests and errors: idempotency, ETags, background work and error codes.
- Programmable Voice overview: how calls, OneML and webhooks fit together.