support_path. pgw adds a Path header to every REGISTER that it forwards, which asks the registrar to send that device’s calls through pgw. Asterisk honors the header only when support_path is on.
Before you begin
- Asterisk with the PJSIP channel driver. The examples use user
1001. - An upstream in pgw whose host is this Asterisk server. The quickstart creates one.
- The addresses that Asterisk sends calls from, listed in the upstream’s
invite_source_cidrs. See Allow the PBX to send calls to pgw.
Configure a user
1
Set up the AOR
In
/etc/asterisk/pjsip.conf, add these settings to the user’s AOR section:2
Set up the endpoint
In the user’s endpoint section, turn off contact rewriting:With
rewrite_contact=yes, Asterisk replaces the app’s contact with the address that the REGISTER came from, which is pgw. Calls to the app then fail.If the phones are behind NAT, which mobile phones usually are, also set these, so that audio reaches them. pgw doesn’t relay media.3
Reload PJSIP
Check that it works
Register the app through pgw, then list pgw’s bindings:1001 means that Asterisk accepted the registration and kept pgw’s Path. By default (strict_path), pgw refuses a registration when the PBX’s answer drops the Path. Without that check, a device would look registered while its calls bypassed pgw.
Then close the app and call 1001 from another phone. The app rings.
If it doesn’t work
For other symptoms, see Troubleshooting.
Leave room for one more contact
Asterisk refuses a registration that would take an AOR overmax_contacts, and it answers with 403. pgw can’t tell that 403 from a refused password, so a full AOR looks like a credentials problem. Avoid it by counting what registers on the AOR:
- One contact for each device that the user can have. pgw allows
max_bindings_per_aor, 10 by default. - One more, which pgw needs free.
- One for each phone that registers without pgw, such as a desk phone.
max_contacts at the count above anyway, because during an upgrade or a rollback that changes how pgw registers, the AOR briefly holds both kinds of contact.
Don’t solve this with remove_existing=yes. Asterisk then makes room by removing an existing contact, and if that contact belongs to a desk phone, the phone gets no calls until it registers again.
Special cases
Asterisk without Path support
If your Asterisk can’t use Path, create the upstream with themasquerade contact strategy and leave out support_path. pgw then registers its own address as each device’s contact. The other settings on this page still apply.
One Asterisk for several SIP domains
On a managed upstream with several domains, pgw registers each user at the user’s domain, such assip:1001@acme.example.com. Asterisk looks for an AOR named 1001@acme.example.com first, and then for 1001. To keep 1001 at one domain apart from 1001 at another, name each AOR and endpoint with its domain.
The realm in managed mode
Asterisk challenges with the realmasterisk by default, but in managed mode pgw challenges the apps itself. If your apps were set up with the realm asterisk, create the managed upstream with --realm asterisk, so that their saved credentials still match. You can’t change the realm later.
Next steps
Configure apps for pgw
Register your app’s push credentials, so that pgw can wake the app.
Managed mode
Let pgw keep registrations alive when Asterisk grants only short ones.