Register two local SIP phones with Asterisk PJSIP
This example creates separate accounts for 6001 and 6002. It is intended to teach the relationships behind local registration. It does not configure an external trunk or allow calls to public telephone numbers.
Source-reviewed, 18 October 2026. Prepared from the cited documentation. These examples have not been independently tested by Phone Guides. Scope: Asterisk 22/PJSIP, direct file configuration, two single-contact accounts on a controlled local network with no NAT between server and phones.
Prepare the values
Confirm PJSIP modules are loaded and identify the effective configuration directory using files and CLI. Preserve the existing configuration before editing. Do not paste this into files generated by a PBX management product or append duplicate objects to an existing setup.
In the example, 192.0.2.10 is a documentation-only address. Replace it with an address actually assigned to the Asterisk server's intended local interface. Replace both secret placeholders with different generated secrets. The example permits unencrypted UDP signalling, so keep this introduction on a controlled local network; it is not an Internet-facing configuration.
Define the accounts
The following original example belongs in the effective pjsip.conf or a deliberately included file:
[pg-local-udp]
type=transport
protocol=udp
bind=192.0.2.10:5060
[6001]
type=endpoint
transport=pg-local-udp
context=pg-internal
disallow=all
allow=ulaw,alaw
auth=6001-auth
aors=6001
direct_media=no
[6001-auth]
type=auth
auth_type=userpass
username=6001
password=REPLACE_WITH_UNIQUE_SECRET_6001
[6001]
type=aor
max_contacts=1
[6002]
type=endpoint
transport=pg-local-udp
context=pg-internal
disallow=all
allow=ulaw,alaw
auth=6002-auth
aors=6002
direct_media=no
[6002-auth]
type=auth
auth_type=userpass
username=6002
password=REPLACE_WITH_UNIQUE_SECRET_6002
[6002]
type=aor
max_contacts=1
Each endpoint points to its own auth object and AOR. The account names must agree with the phone's identity; the endpoint/AOR names are intentionally aligned for this introductory case. direct_media=no keeps the example's media handling through Asterisk rather than adding direct endpoint media as another variable. The offered codecs must also be available on the actual devices.
The object model and registration examples are documented in the upstream PJSIP configuration examples. Compare the exact options with the Asterisk 22 reference.
Enter the corresponding phone settings
| Phone setting, name varies by manufacturer | Phone 6001 | Phone 6002 |
|---|---|---|
| Registrar/server | Your actual Asterisk interface address | Same server |
| SIP user/account | 6001 | 6002 |
| Authentication user | 6001 | 6002 |
| Password | The generated 6001 secret | The different generated 6002 secret |
| Transport/port | UDP, 5060 for this example | UDP, 5060 for this example |
Use the device's own firmware documentation for field names. A display label is not necessarily the authentication username. Do not enter a provider account's credentials into these local accounts. This example does not establish support for every feature of any particular phone model.
Apply and check registration
Apply endpoint changes with your installation's supported reload procedure. A new or changed transport may require a planned restart; a PJSIP reload is not proof the new bind address was applied. Read the log for load errors before enabling the phone accounts.
At the Asterisk CLI, inspect:
pjsip show endpoint 6001
pjsip show aor 6001
pjsip show endpoint 6002
pjsip show aor 6002
pjsip show contacts
Look for contacts belonging to each intended AOR. max_contacts=1 limits each AOR to one contact; an old contact can therefore explain why an additional registration is refused. Do not add a second client using the same account as an incidental test. A contact's availability display also depends on qualification configuration, so do not require an availability label this example has not configured.
If registration fails, compare account identity, server address, transport, credentials and module logs using the official PJSIP troubleshooting guide. A challenge in the authentication exchange is not by itself a failed registration; inspect the final outcome.
The pg-internal context is configured in first internal call. Registration alone does not create routes. Return to Asterisk documentation.