; ============================================================ ; AstroCom SIP Bridge — Dialplan (extensions.conf) ; /etc/asterisk/extensions.conf ; ; CALL FLOW ; ───────────────────────────────────────────────────────────── ; ; INBOUND from AstroCom (IAX2 → SIP toward downstream PBX): ; ; AstroCom ──IAX2──▶ [bridgeN-from-astrocom] ; │ ; Bridge to SIP peer ; │ ; SIP/bridgeN-pbx/ ; │ ; ▼ ; Downstream PBX / phone ; ; OUTBOUND from downstream PBX (SIP → IAX2 toward AstroCom): ; ; Downstream PBX ──SIP──▶ [bridgeN-from-pbx] ; │ ; Bridge to IAX2 peer ; │ ; IAX2/bridge1-astrocom/ ; │ ; ▼ ; AstroCom ; ; ISOLATION ; ───────────────────────────────────────────────────────────── ; • Each bridge uses its own pair of contexts ; (bridgeN-from-astrocom / bridgeN-from-pbx). ; • No cross-bridge dialplan references exist UNLESS you ; explicitly uncomment the inter-bridge section at the ; bottom. Until then each bridge is a closed island. ; • The [default] context is intentionally empty / drops ; calls to prevent anything landing there from escaping. ; ============================================================ ; ============================================================ ; Safety net — calls that arrive in no recognised context are ; silently dropped. ; ============================================================ [default] exten => _X.,1,Verbose(2,DROP: call to ${EXTEN} landed in [default] — no context matched) same => n,Hangup(21) ; ============================================================ ; ─── BRIDGE 1 ─────────────────────────────────────────────── ; ============================================================ ; ------ Inbound from AstroCom → forward to Bridge-1 PBX ---- ; This context name MUST equal routes.auth for this bridge. [bridge1-from-astrocom] ; Accept any extension that AstroCom sends for this block. exten => _X.,1,Verbose(2,BRIDGE1 inbound from AstroCom: ${CALLERID(all)} → ${EXTEN}) same => n,Set(CALLERID(name)=${CALLERID(name)}) same => n,Dial(SIP/bridge1-pbx/${EXTEN},30,t) same => n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?congestion) same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy) same => n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?noanswer) same => n,Hangup() same => n(congestion),Congestion(5) same => n(busy),Busy(5) same => n(noanswer),Hangup(19) ; ------ Inbound from Bridge-1 PBX → forward to AstroCom ---- [bridge1-from-pbx] exten => _X.,1,Verbose(2,BRIDGE1 outbound from PBX: ${CALLERID(all)} → ${EXTEN}) ; Strip any leading '9' access code the PBX may prepend, e.g. "9XXXXXXX" ; Uncomment/adapt if needed: ;same => n,Set(EXTEN=${EXTEN:1}) same => n,Set(CALLERID(name)=${CALLERID(name)}) same => n,Dial(IAX2/bridge1-astrocom/${EXTEN},30,t) same => n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?congestion) same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy) same => n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?noanswer) same => n,Hangup() same => n(congestion),Congestion(5) same => n(busy),Busy(5) same => n(noanswer),Hangup(19) ; ============================================================ ; ─── BRIDGE 2 ─────────────────────────────────────────────── ; ============================================================ [bridge2-from-astrocom] exten => _X.,1,Verbose(2,BRIDGE2 inbound from AstroCom: ${CALLERID(all)} → ${EXTEN}) same => n,Set(CALLERID(name)=${CALLERID(name)}) same => n,Dial(SIP/bridge2-pbx/${EXTEN},30,t) same => n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?congestion) same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy) same => n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?noanswer) same => n,Hangup() same => n(congestion),Congestion(5) same => n(busy),Busy(5) same => n(noanswer),Hangup(19) [bridge2-from-pbx] exten => _X.,1,Verbose(2,BRIDGE2 outbound from PBX: ${CALLERID(all)} → ${EXTEN}) same => n,Set(CALLERID(name)=${CALLERID(name)}) same => n,Dial(IAX2/bridge2-astrocom/${EXTEN},30,t) same => n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?congestion) same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy) same => n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?noanswer) same => n,Hangup() same => n(congestion),Congestion(5) same => n(busy),Busy(5) same => n(noanswer),Hangup(19) ; ============================================================ ; ─── BRIDGE 3 (template — duplicate & uncomment) ──────────── ; ============================================================ ;[bridge3-from-astrocom] ;exten => _X.,1,Verbose(2,BRIDGE3 inbound from AstroCom: ${CALLERID(all)} → ${EXTEN}) ; same => n,Dial(SIP/bridge3-pbx/${EXTEN},30,t) ; same => n,Hangup() ; ;[bridge3-from-pbx] ;exten => _X.,1,Verbose(2,BRIDGE3 outbound from PBX: ${CALLERID(all)} → ${EXTEN}) ; same => n,Dial(IAX2/bridge3-astrocom/${EXTEN},30,t) ; same => n,Hangup() ; ============================================================ ; ─── OPTIONAL: Inter-bridge dialling ──────────────────────── ; ; If you want Bridge-1's PBX to be able to call Bridge-2's ; numbers *directly* (without round-tripping through AstroCom) ; you can include the other bridge's inbound SIP context here. ; ; Example: in [bridge1-from-pbx], add a pattern for Bridge-2's ; number block *before* the catch-all _X. rule so it is ; preferred. Bridge-2's block in AstroCom is consulted to ; determine the number range. ; ;[bridge1-from-pbx] ;exten => _7XXXX,1,Verbose(2,BRIDGE1→BRIDGE2 direct: ${EXTEN}) ; same => n,Dial(SIP/bridge2-pbx/${EXTEN},30,t) ; same => n,Hangup() ; ; Without uncommenting the above, bridge1 and bridge2 can still ; reach each other — calls just travel via AstroCom as normal. ; ============================================================