configs/basic-pbx - Super Awesome Company example configs Phase 1, Patch 2

Example configuration files for a "basic PBX" deployment for the fictitious
Super Awesome Company. Details at https://reviewboard.asterisk.org/r/4488/
and https://wiki.asterisk.org/wiki/display/AST/Super+Awesome+Company

Patch 4488 includes all functionality needed for SAC's outside connectivity
and some externally accessed features, as well as outbound dialing.

Reported by: Malcolm Davenport
Tested by: Rusty Newton

Review: https://reviewboard.asterisk.org/r/4488/
........

Merged revisions 433624 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Rusty Newton 2015-03-27 21:21:05 +00:00
parent 2659e48d9d
commit c21e2e45a8
6 changed files with 207 additions and 30 deletions

View File

@ -0,0 +1,7 @@
[general]
enable=yes
[custom]
; We log the unique ID as it can be useful for troubleshooting any issues
; that arise.
loguniqueid=yes

View File

@ -0,0 +1,4 @@
[mappings]
; Our CDR log will be written to /var/log/asterisk/cdr-custom/Master.csv
; with the following schema.
Master.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},${CSV_QUOTE(${CDR(dstchannel)})},${CSV_QUOTE(${CDR(lastapp)})},${CSV_QUOTE(${CDR(lastdata)})},${CSV_QUOTE(${CDR(start)})},${CSV_QUOTE(${CDR(answer)})},${CSV_QUOTE(${CDR(end)})},${CSV_QUOTE(${CDR(duration)})},${CSV_QUOTE(${CDR(billsec)})},${CSV_QUOTE(${CDR(disposition)})},${CSV_QUOTE(${CDR(amaflags)})},${CSV_QUOTE(${CDR(accountcode)})},${CSV_QUOTE(${CDR(uniqueid)})},${CSV_QUOTE(${CDR(userfield)})},${CDR(sequence)}

View File

@ -1,58 +1,169 @@
[globals]
; General internal dialing options used in context Internal at
; extension dial_internal_exten. See the Dial app documentation for options.
INTERNAL_DIAL_OPT=,10
; General internal dialing options used in context Dial-Users.
; Only the timeout is defined here. See the Dial app documentation for
; additional options.
INTERNAL_DIAL_OPT=,30
[Hints]
;Allow dynamic hint creation for every extension.
; Allow dynamic hint creation for every extension.
exten = _11XX,hint,PJSIP/${EXTEN}
[Features]
;Extension to check user voicemail.
; Extension to check user voicemail. We don't requre the user to enter
; their pincode.
exten = 8000,1,Verbose(1, "User ${CALLERID(num)} dialed the voicemail feature.")
same = n,VoiceMailMain(${CALLERID(num)}@example,s)
same = n,Hangup()
[DialingErrors]
; Handle any extensions dialed that don't otherwise exist.
; Exten to dial the main IVR internally.
exten = 1100,1,Verbose(1, "User ${CALLERID(num)} dialed the IVR.")
same = n,Goto(Main-IVR,2565551100,1)
[External-Features]
; Extension for users to remotely check voicemail. Here we require the caller to
; enter their mailbox and pincode.
exten = 2565551234,1,Verbose(1, "User ${CALLERID(num)} dialed into remote voicemail.")
same = n,VoiceMailMain(example)
same = n,Hangup()
[Dialing-Errors]
; Handle any extensions dialed internally that don't otherwise exist.
; Comment out or remove this extension if you would rather have the calls
; ignored.
exten = _X.,1,Verbose(1, "User ${CALLERID(num)} dialed an invalid number.")
same = n,Playback(pbx-invalid)
same = n,Hangup()
[Internal]
; Include other contexts providing specific functionality for internal users.
[Internal-Setup]
; Here we capture internal calls to do anything we need to do before sending
; them onto all the possible internal locations. Such as disabling CDR on
; internal to internal calls.
exten = _X.,1,NoOp()
same = n,Set(CDR_PROP(disable)=1)
same = n,Goto(Internal-Main,${EXTEN},1)
; The Internal-Main context provides a way for internal callers to get access to most
; features and functions configured for them. External callers may be sent
; directly to some of the contexts you see included here, so the included
; contexts are not necessarily internal only.
[Internal-Main]
; The order of includes here is important for matching the right extensions.
include = Hints
include = Features
include = DialingErrors
include = Dial-Users
include = Dialing-Errors
; Handle internal calling between user extensions.
exten = _11XX,1,Verbose(1, "User ${CALLERID(num)} dialed internally to ${EXTEN}.")
same = n,Gosub(Internal,dial_internal_exten,1(${EXTEN}))
same = n,Hangup()
; Internal Dialing Subroutine
;
; ARG1 will be the extension number dialed.
exten = dial_internal_exten,1,Verbose(1, "Entering internal dialing gosub.")
same = n,Gotoif($[${DEVICE_STATE(PJSIP/${ARG1})} = BUSY]?dialed-BUSY,1:)
same = n,Dial(PJSIP/${ARG1}${INTERNAL_DIAL_OPT})
; Dial-Users handles calls to internal extensions.
; Calls coming into this context may be *external* or *internal* in origin.
[Dial-Users]
exten = _11XX,1,Verbose(1, "User ${CALLERID(num)} dialed ${EXTEN}.")
same = n,Set(SAC_DIALED_EXTEN=${EXTEN})
same = n,Gotoif($[${DEVICE_STATE(PJSIP/${EXTEN})} = BUSY]?dialed-BUSY,1:)
same = n,Dial(PJSIP/${EXTEN}${INTERNAL_DIAL_OPT})
same = n,Goto(dialed-${DIALSTATUS},1)
exten = dialed-NOANSWER,1,NoOp()
same = n,Voicemail(${ARG1}@example,u)
same = n,Return()
same = n,Voicemail(${SAC_DIALED_EXTEN}@example,u)
same = n,Hangup()
exten = dialed-BUSY,1,NoOp()
same = n,Voicemail(${ARG1}@example,b)
same = n,Return()
same = n,Voicemail(${SAC_DIALED_EXTEN}@example,b)
same = n,Hangup()
exten = dialed-CHANUNAVAIL,1,NoOp()
same = n,Playback(pbx-invalid)
same = n,Return()
same = n,Hangup()
exten = _dialed-.,1,Goto(dialed-NOANSWER,1)
exten = h,1,Hangup()
; Callers in the directory may dial 0 which will jump to the
; 'o' extension.
exten = o,1,Goto(1111)
; Outbound-Dial
;
; Before we dial, see if the extension matches our restricted number patterns.
; Note that this is a basic set of numbers which could incur a fee if dialed.
; The NANP includes many other numbers that you may want to block. If you feel
; it is necessary to block further number patterns you'll have to add them below
; or you may consider implementing a blacklist via methods beyond the scope of
; this example.
[Outbound-Dial]
exten = _011.,1,Hangup()
exten = _900NXXXXXX,1,Hangup()
exten = _1900NXXXXXX,1,Hangup()
exten = _976XXXX,1,Hangup()
exten = _NXX976XXXX,1,Hangup()
exten = _1NXX976XXXX,1,Hangup()
; Dial outbound through our SIP ITSP.
exten = _X.,1,Verbose(1, "Didn't match any restricted numbers, proceeding with outbound dial.")
same = n,Set(CALLERID(num)=256555${CALLERID(num)})
same = n,Dial(PJSIP/${EXTEN}@dcs-endpoint)
same = n,Hangup()
; Calls from internal endpoints will enter into one of the two following
; contexts based on their dialing privilege.
[Local]
include = Internal-Setup
exten = _NXXXXXX,1,Goto(Outbound-Dial,1256${EXTEN},1)
exten = _256NXXXXXX,1,Goto(Outbound-Dial,1${EXTEN},1)
exten = _1256NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
[Long-Distance]
include = Local
exten = _NXXNXXXXXX,1,Goto(Outbound-Dial,1${EXTEN},1)
exten = _1NXXNXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
; The DID-Extensions context captures inbound calls from our ITSP that have a
; DID number where the last four digits matches an internal extension.
[DID-Extensions]
exten = _25655511XX,1,Verbose(1, "External caller dialed inbound to DID ${EXTEN})")
same = n,Goto(Dial-Users,${EXTEN:6},1)
; Our main IVR program for receiving inbound callers.
; The IVR script reads “Thank you for calling Super Awesome Company, Waldos
; premier provider of perfect products. If you know your partys extension,
; you may dial it at any time. To establish a sales partnership, press one. To
; speak with a customer advocate, press two. For accounting and other
; receivables, press three. For a company directory, press four. For an
; operator, press zero.”
; demo-congrats is currently used as a placeholder.
[Main-IVR]
exten = 2565551100,1,Verbose(1, "New caller, ${CALLERID(num)} dialed into the IVR.")
same = n,Answer()
same = n(start),Background(demo-congrats)
same = n,WaitExten(10)
same = n,Background(demo-congrats)
same = n,Hangup()
exten = 0,1,Verbose(1, "Caller ${CALLERID(num)} dialed the operator.")
same = n,Goto(Dial-Users,1111,1)
exten = 1,1,Verbose(1, "Caller ${CALLERID(num)} dialed the Sales queue.")
same = n,Goto(External-Features,2565551200,1)
exten = 2,1,Verbose(1, "Caller ${CALLERID(num)} dialed the Customer Experience queue.")
same = n,Goto(External-Features,2565551250,1)
exten = 3,1,Verbose(1, "Caller ${CALLERID(num)} dialed Accounting and Receivables.")
same = n,Goto(Dial-Users,1106,1)
exten = 4,1,Verbose(1, "Caller ${CALLERID(num)} dialed the directory.")
same = n,Directory(example,Dial-Users)
exten = i,1,Playback(option-is-invalid)
same = n,Goto(2565551100,start)
exten = t,1,Playback(are-you-still-there)
same = n,Goto(2565551100,start)
; Calls from our ITSP SIP account arrive in DCS-Incoming. We should be careful
; to route calls very explicitly so as to avoid any security issues, such as
; accidentally giving outbound dial access to inbound callers.
;
; Each context includes extension pattern matching to match the inbound DID
; dialed appropriately.
[DCS-Incoming]
include = Main-IVR
include = DID-Extensions
include = External-Features

View File

@ -5,5 +5,5 @@
console = verbose,notice,warning,error
;messages = notice,warning,error
;full = verbose,debug,notice,warning,error
;full = verbose,notice,warning,error,debug
;security = security

View File

@ -1,6 +1,9 @@
[modules]
autoload = no
; This is a minimal module load. We are loading only the modules required for
; the Asterisk features used in the Super Awesome Company configuration.
; Applications
load = app_bridgewait.so
@ -9,6 +12,7 @@ load = app_playback.so
load = app_stack.so
load = app_verbose.so
load = app_voicemail.so
load = app_directory.so
; Bridging
@ -19,6 +23,10 @@ load = bridge_native_rtp.so
load = bridge_simple.so
load = bridge_softmix.so
; Call Detail Records
load = cdr_custom.so
; Channel Drivers
load = chan_bridge_media.so
@ -41,9 +49,11 @@ load = format_wav.so
; Functions
load = func_callerid.so
load = func_cdr.so
load = func_pjsip_endpoint.so
load = func_sorcery.so
load = func_devstate.so
load = func_strings.so
; Core/PBX

View File

@ -9,13 +9,58 @@ bind = 0.0.0.0
;external_media_address = 203.0.113.1
;external_signaling_address = 203.0.113.1
;================================ CONFIG FOR SIP ITSP ==
; Registration for Digium Cloud Services Account
[dcs-trunk]
type = registration
transport = transport-udp-nat
outbound_auth = dcs-trunk-auth
server_uri = sip:sip.digiumcloud.net
;client_uri = sip:myaccountID@sip.digiumcloud.net
retry_interval = 60
[dcs-trunk-auth]
type = auth
auth_type = userpass
;username = myaccountID
;password = ASTRONGPASSWORD
; Endpoint for Digium Cloud Services account
[dcs-endpoint]
type=endpoint
transport = transport-udp-nat
context = DCS-Incoming
allow = !all,g722,ulaw
outbound_auth = dcs-auth
aors = dcs-aor
direct_media = no
from_domain = sip.digiumcloud.net
[dcs-auth]
type = auth
auth_type = userpass
;username = myaccountID
;password = ASTRONGPASSWORD
realm = sip.digiumcloud.net
[dcs-aor]
type = aor
contact = sip:sip.digiumcloud.net
[dcs-identify]
type=identify
endpoint = dcs-endpoint
;match = 8.17.32.12
;================================ ENDPOINT TEMPLATES ==
; Our primary endpoint template for internal desk phones.
[endpoint-internal-d70](!)
type = endpoint
transport = transport-udp-nat
context = Internal
context = Long-Distance
allow = !all,g722,ulaw
direct_media = no
trust_id_outbound = yes
@ -110,7 +155,7 @@ mailboxes = 1101@example
[1103](endpoint-internal-d70)
auth = 1103
aors = 1103
callerid = Penelope Bronte <103>
callerid = Penelope Bronte <1103>
[1103](auth-userpass)
password = zutAnacHe8ewuWr