[general]
static=yes                              ; save dialplan
autofallthrough=yes                     ; hang a call if no more extension to proceed

[globals]

;Unauthorized calls context
[forbidden]
exten => s,1,Goto(41215500331,1)
exten => 41215500331,1,Dial(SIP/phone1&SIP/phone2,30)
exten => 41215500331,n,Hangup(21)
exten => _X.,1,Hangup(21)       ;Whatever is entered, Asterix Hangup with cause code 21: Rejected

;Authorized calls context
[routing]
;Outgoing calls
exten => _X.,1,Dial(SIP/${EXTEN}@switzernet-out,30)
exten => _X.,n,Hangup(${HANGUPCAUSE})

;As the names are alphanumerical alias were also created
exten => _100X,1,Goto(phone${EXTEN:3},1)
exten => _10XX,1,Goto(phone${EXTEN:2},1)

exten => _pho[n]e.,1,Dial(SIP/${EXTEN},30)
exten => _pho[n]e.,n,Hangup(${HANGUPCAUSE})
