Connect your community to CEN.
CEN discovers a destination and returns routing information. Your PBXs carry the call directly over IAX2; the optional hub is a separate deployment choice.
1. Register your network
- Create an account, verify your email, and submit a community application from your workspace.
- After approval, open your community. Check its three-digit CEN Area Code, inbound/outbound permissions, and routing status.
- Choose hosted routing or your own Routing API. Create a network key in API access; keep it on your server. A portal password, a network key, a branch key, and an IAX password have different purposes.
- Agree on reachable IAX endpoints, authentication, and destination dialplan rules. Never allow an incoming peer access to an unrestricted internal/PSTN context.
2. Keep your local numbering
An official CEN number is AAA-XXX-YYYY: a three-digit area code plus a seven-digit Local Number. For example, 214-315-1234. Leading zeroes matter; handle numbers as strings. Different networks may use the same Local Number.
The recommended access prefix is 88. It belongs to your PBX dialplan, not to the official number. Dial 88 214 315 1234; your integration strips 88 before sending 2143151234 to CEN. Preserve emergency, local and ordinary PSTN routing.
3. Choose where routing lives
Want a complete system for your own infrastructure? Download Community Router: an installable PHP/MariaDB site with local routing, API keys, FreePBX exports and CEN pairing.
| Option | What you manage | What CEN manages |
|---|---|---|
| Hosted routing | Your PBX, extensions, firewall and IAX authentication. | Your registered branches, their three-digit blocks, and destination routing records. |
| External Routing API | Your existing block directory and an HTTPS endpoint that resolves seven-digit Local Numbers. | Your area code and the handoff to your network. |
For hosted routing, add branches in your workspace and set each branch’s IAX destination and password. For external routing, configure the exact HTTPS API URL and, if needed, its separate bearer token in Routing. Run the built-in connection test. Do not send a CEN network key to another network.
External member API contract
CEN requests GET https://your-api.example/route?number=3151234. Return JSON with HTTP 200. The block and extension are strings; the port is an integer:
{
"success": true,
"status": "route",
"destination": {
"protocol": "iax2", "host": "pbx.example.net", "port": 4569,
"block": "315", "number": "1234"
}
}For an unknown local number, return {"success":true,"status":"intercept"}. CEN plays CEN-08. An unreachable or invalid member API produces CEN-05. The endpoint must use publicly reachable HTTPS with a valid certificate; redirects, private network targets and oversized responses are rejected. Keep it fast: CEN’s member lookup has a four-second total timeout.
Your member API should validate exactly seven ASCII digits, authenticate any configured member token, look up your own directory, and return only the matching destination. CEN does not require moving your existing PHP application or renumbering customers. See the member API reference for the complete contract.
4. Connect FreePBX or Asterisk
- Back up your PBX. Open the PBX config generator or your branch’s FreePBX page.
- Use the generated files and instructions for a dedicated CEN trunk and outbound route. Insert credentials locally on your PBX. Keep generated files containing keys readable only by the administrator and Asterisk.
- Match only your chosen prefix followed by the expected number length. The generator can include seven-digit local calling for a configured branch; the JSON directory API always requires ten digits.
- Configure the incoming CEN IAX peer and FreePBX Inbound Routes for numbers you serve. Do not overwrite existing contexts or generated FreePBX files.
- Choose automatic announcements to download each missing recording on its first use, or upload all twelve recordings in advance. Later calls play the cached file, with a built-in fallback if a sound is missing.
- Apply the configuration and make a controlled test call in each direction. Confirm two-way audio and hangup behavior.
The current simple generator uses Asterisk’s HTTPS lookup directly. If you prefer an AGI bridge or are adapting an existing router, download the PHP or Python adapter. PHP needs CLI PHP 8.1+ with cURL; Python uses its standard library. Both use explicit trusted network/peer mappings.
5. Integrate from PHP or another backend
Directory discovery: JSON, no IAX password
GET https://api.cenpbx.com/v1/route?number=2143151234, with Authorization: Bearer YOUR_NETWORK_KEY, returns a member handoff: area_code, network_name, routing_api, and seven-digit local_number. Your router then resolves that local number at its approved member endpoint. Use the downloadable CenClient.php to validate the response and optionally resolve a trusted member.
<?php
require '/opt/cen/CenClient.php';
$client = new CenClient(getenv('CEN_API_KEY'));
$handoff = $client->lookup('2143151234');
if ($handoff['status'] === 'intercept') {
// Stop the call and play the validated CEN announcement.
return;
}
// Resolve through your operator-approved member API mapping.
// Never trust arbitrary URLs or forward the CEN key to the member.
PBX dialing: a sensitive, plain-text result
POST https://api.cenpbx.com/v1/dial accepts form field num and a bearer credential (or form field auth). Use ten digits globally, or seven digits when the authenticated origin supplies a usable area code. Network keys start cen_net_; branch keys start cen_live_.
// PHP 8.1+, ext-curl. Run on the trusted PBX/backend only.
$handle = curl_init('https://api.cenpbx.com/v1/dial');
curl_setopt_array($handle, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(['num' => '2143151234']),
CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('CEN_API_KEY')],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_CONNECTTIMEOUT => 3,
CURLOPT_TIMEOUT => 8,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
]);
$result = curl_exec($handle);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
// Only a validated HTTP 200 IAX2 result may reach your restricted dialplan.
// All other results stop the call; play a known CEN-01 through CEN-12 code.
// Never print, log, cache publicly, or return $result to a customer browser.A successful dial result contains the destination’s IAX authentication secret. Keep this endpoint and its credentials strictly server-side. Use the complete generated dialplan for result validation and call handling. A customer login is not an API credential, and CEN does not currently issue individual customer API tokens.
Other languages use the same HTTPS contracts. Disable redirects, verify TLS, bound timeouts and response sizes, validate every field, and restrict destinations before using results. Do not build an unauthenticated public proxy. Stop on lookup failure; never fall back to PSTN.
6. Publish a branded customer portal
- In your community, open Portal. Save your name, logo, colors, theme, description and footer, then publish your CEN subdomain.
- Share the portal’s Customer login link. Customers may use an existing CEN account or register and verify their email.
- Open Customers to approve pending requests. Assign an optional seven-digit Local Number, unique within your community. Create the real extension and device credentials in your PBX separately.
- Use Support inbox for customer conversations. Public replies are emailed; internal notes remain visible only to CEN staff and your community operator.
Suspending a portal membership blocks new portal requests; it does not disable an extension on your independent PBX. Manage calling permissions in your PBX and CEN routing settings as appropriate.
7. Validate before rollout
- Test an active destination, unknown area/block, maintenance, inbound disabled, invalid number and a revoked key.
- Test API timeout, missing IAX authentication, unreachable PBX and absent announcement files.
- Verify local extensions, 911, 988 and existing 7-, 10- and 11-digit routes still behave as intended.
- Verify a customer cannot read another customer’s tickets or obtain keys or operator settings.
HTTP 401 means authentication failure; 403 means the origin is restricted; 422 means invalid input; 429 means rate limited—respect Retry-After. The dial endpoint returns CEN codes in its body and X-CEN-Code header, including destination intercepts with HTTP 404. The directory API returns destination intercepts as JSON with success=true and status=intercept.
Use the announcement library to identify all twelve conditions. For help, open a ticket with the timestamp, area code, software versions and redacted status. Never include passwords, keys or the complete dial response.