Asterisk SIP trunks: registration, authentication and routing
A SIP trunk connects Asterisk to another calling system, often a provider. Configure the relationship from the provider's published requirements and the Asterisk objects that implement them. A green registration indicator is only one part of that relationship.
Source-reviewed, 18 October 2026. Prepared from the cited documentation. Examples have not been independently tested by Phone Guides. Scope: Asterisk 22/PJSIP trunk design. This guide does not claim a verified setup for a named provider.
Collect the provider facts first
| Fact | Why it matters |
|---|---|
| Registration required or IP-authenticated | Determines whether an outbound registration object is needed |
| Registrar, proxy and signalling destinations | They may be different services with different roles |
| Authentication identity and realm requirements | May differ from account number, public number and caller ID |
| Published inbound source ranges and identification method | Determines how incoming requests map to a trunk endpoint |
| Allowed transport, codecs and DTMF method | Defines the negotiated calling path |
| Dialled-number and caller-ID formats | Determines what routes send and accept |
| Media addresses/ranges and NAT guidance | Determines network permissions and address handling |
| Failover, emergency arrangements and destination restrictions | Determines what the complete service can and cannot do |
Keep the source URL, service/region, date and relevant conditions with those facts. If a required detail is absent, label it unresolved rather than borrowing settings from another provider. Do not publish subscriber secrets in the configuration record.
Understand registration-based trunks
Asterisk's outbound registration tells a remote registrar how it can be reached under that registration identity. Authentication, request identity, contact identity and call handling remain separate choices. The official outbound registration guide explains its configuration objects.
A trunk also needs the appropriate endpoint, reachable destination and routing. Use pjsip show registrations to inspect registration state, then examine endpoint and call behaviour separately. Do not infer inbound number delivery or permitted outbound caller ID from registration success.
Understand IP-authenticated trunks
A provider may authorise service based on a documented source IP arrangement instead of requiring Asterisk to register. That does not justify accepting traffic from arbitrary addresses. Map incoming requests using the provider's published identification scheme and restrict network access appropriately.
The endpoint identification module reference explains IP identification configuration. IP identification associates traffic with an endpoint; it does not itself grant every dialplan destination. Select a restricted inbound context.
Keep object configuration and routing separate
Use this design checklist before writing a full configuration:
- Select the transport and topology-dependent address settings.
- Define an endpoint with an appropriate inbound context and media policy.
- Define the required address/contact and authentication objects.
- Add outbound registration only if the service requires it.
- Define incoming identification and narrow network permissions.
- Add explicit inbound/outbound dialplan routes and documented caller-ID handling.
The upstream PJSIP examples show several relationships. Treat their hostnames and numbers as examples, not a provider specification for your account. The registration module reference supplies branch-specific option details.
Apply with restricted destinations
Before external calling, complete the security baseline. For your own deployment checks, use an authorised ordinary destination, inspect call direction and identity, and record both ringing and two-way audio. Check an inbound call separately. Do not call a real emergency number as a casual configuration test; arrange any emergency-path checks with the provider.
If a change fails, preserve the response sequence and object state before reverting. Do not remove authentication or widen incoming source permissions to make an error disappear. Continue with inbound and outbound routing and NAT/media review. Return to Asterisk documentation.