CEN/Docs
CEN Documentation

Community setup guide · Customer guide

PBX setup (FreePBX)

Connect a FreePBX system to CEN with three small config files, edited in the FreePBX web interface under Admin → Config Edit. No scripts or SSH. Your PBX asks CEN who to call and dials the other PBX directly.

What you need from CEN

Open your network at manage.cenpbx.com → Branches → your branch → PBX setup. It shows:

  • CEN_NUMBER: your area code and block, six digits (for example 916315). Your extensions become 916-315-XXXX.
  • CEN_KEY: this PBX’s lookup key. Shown once when issued.
  • IAX password: what other PBXs use to call you. Shown once when generated.
Easiest: on your branch’s PBX setup page choose Generate my config, or fill in the config generator. Both give you these files with every value filled in and a ZIP download.

1. Paste three files in FreePBX

Go to Admin → Config Edit (install the Config Edit module under Admin → Module Admin if it’s missing) and add these to the end of each file:

extensions_custom.conf

[from-cen]
; Calls from other CEN PBXs. They can only reach the destination below, never outbound routes.
exten => _XXXXXXXXXX,1,NoOp(CEN call for ${EXTEN})
 same => n,GotoIf($["${EXTEN:0:3}" != "${GLOBAL(CEN_NUMBER)}"]?reject)
 same => n,GotoIf(${DIALPLAN_EXISTS(ext-did-0002,${EXTEN},1)}?from-trunk,${EXTEN},1)
 same => n,Goto(from-did-direct,${EXTEN:6},1)
 same => n(reject),Hangup(1)
exten => i,1,Hangup(1)

[from-internal-additional-custom]
; 88 + 10 digits: any CEN number.
exten => _88XXXXXXXXXX,1,Goto(cen-dial,${EXTEN:2},1)

[cen-dial]
exten => _X.,1,NoOp(CEN lookup for ${EXTEN})
 same => n,ExecIf($[${LEN(${CALLERID(num)})} = 7]?Set(CALLERID(num)=${GLOBAL(CEN_NUMBER)}${CALLERID(num)}))
 same => n,Set(lookup=${CURL(https://api.cenpbx.com/v1/dial,ani=${CALLERID(num)}&num=${EXTEN}&auth=${GLOBAL(CEN_KEY)})})
 same => n,GotoIf($[${REGEX("^IAX2/from-cen:[A-Za-z0-9]+@[A-Za-z0-9.-]+:[0-9]+/[0-9]{10}$" ${lookup})}]?dial)
; Not a dial string: CEN answered with an intercept code (CEN-01 … CEN-12). Anything else, such as a timeout, is CEN-12.
 same => n,Set(CEN_CODE=${IF($[${REGEX("^CEN-(0[1-9]|1[0-2])$" ${lookup})}]?${lookup:4:2}:12)})
 same => n,Goto(intercept)
 same => n(dial),Dial(${lookup},60)
 same => n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL" | "${DIALSTATUS}" = "CONGESTION"]?unreachable)
 same => n,Hangup()
 same => n(unreachable),Set(CEN_CODE=06)
 same => n(intercept),Progress()
 same => n,Set(CEN_SOUND=${ASTDATADIR}/sounds/en/custom/cen-${CEN_CODE}.wav)
 same => n,ExecIf($[${STAT(e,${CEN_SOUND})} = 0]?System(curl -fsS --max-time 5 --create-dirs -o ${CEN_SOUND}.part https://cenpbx.com/assets/intercepts/cen-${CEN_CODE}.wav && mv ${CEN_SOUND}.part ${CEN_SOUND}))
 same => n,Playback(custom/cen-${CEN_CODE},noanswer)
 same => n,ExecIf($["${PLAYBACKSTATUS}" = "FAILED"]?Playback(ss-noservice,noanswer))
 same => n,Hangup()

globals_custom.conf

CEN_NUMBER=YOUR-CEN-NUMBER
CEN_KEY=YOUR-CEN-KEY

iax_custom.conf

[from-cen]
type=user
username=from-cen
secret=YOUR-IAX-PASSWORD
auth=md5
encryption=no
context=from-cen
requirecalltoken=yes
disallow=all
allow=ulaw,alaw,g722

2. Open UDP 4569

Other PBXs call yours directly. Forward UDP 4569 on your router to the PBX, and in Connectivity → Firewall → Services allow IAX from the Internet zone. The hostname and port listed for your branch in CEN must reach this PBX.

3. Apply Config and test

Click Apply Config. From an extension dial 88 and another CEN number. Check that your usual PSTN, 911 and 988 calls still work: only numbers starting with 88 go to CEN.

How it works

  1. Dialing 88 214 315 1234 sends the call to [cen-dial] with 2143151234. A four-digit caller ID becomes your full CEN number.
  2. Asterisk’s CURL() posts ani, num and auth (your CEN_KEY) to https://api.cenpbx.com/v1/dial.
  3. CEN answers with a dial string like IAX2/from-cen:[email protected]:4569/2143151234, or with a code like CEN-03 if the call can’t go through.
  4. The dialplan only dials an answer of exactly that shape. For a code, it plays the matching CEN announcement and hangs up; if the other PBX doesn’t answer, it plays CEN-06. CEN never falls back to PSTN.
  5. On the receiving PBX, [from-cen] checks the number is addressed to its own CEN_NUMBER. If an Inbound Route exists for the full number, the call follows it; otherwise it rings the extension matching the last four digits. It can’t reach outbound routes, so the IAX password only lets callers reach destinations you’ve made available.

Send CEN calls to ring groups, IVRs and other destinations

Go to Connectivity → Inbound Routes → Add Inbound Route and set DID Number to the full CEN number, for example 9166721600. Choose any destination: ring group, queue, IVR, time condition, custom destination or extension. To catch every number of your branch in one route, use the pattern _916672XXXX. Numbers without an Inbound Route ring the matching extension. (This needs the default “Use Inbound Routes” option in the config generator.)

Optional: encrypt calls

encryption=yes lets callers encrypt calls to you. To encrypt calls you place, add encryption=yes to iax_general_custom.conf too.

Rollback

Remove the three blocks in Config Edit and Apply Config. Nothing else in FreePBX changes.

Download Integration API Explorer