Initial configs for asterisk and cgrates in tutorials/asterisk_events

This commit is contained in:
DanB
2016-09-04 13:07:23 +02:00
parent c59a9c510f
commit 74d96488fd
18 changed files with 1699 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
The included Asterisk configuration files are intended to be an example
implementation for a fictitious company, Super Awesome Company.
It can serve as a handy reference for understanding a simple Asterisk
configuration in an approximate real-world environment.
If you intend to use this configuration as a template for your own, then
you will need to change many values in the various configuration files to
match your own devices, network, SIP ITSP accounts and more.
For further documentation on this configuration see the Asterisk wiki:
https://wiki.asterisk.org/wiki/display/AST/Reference+Use+Cases+for+Asterisk.
Please report bugs or errors in configuration on the Asterisk issue tracker:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

View File

@@ -0,0 +1,31 @@
[general]
enabled = yes ; When set to no, ARI support is disabled.
;pretty = no ; When set to yes, responses from ARI are
; ; formatted to be human readable.
;allowed_origins = ; Comma separated list of allowed origins, for
; ; Cross-Origin Resource Sharing. May be set to * to
; ; allow all origins.
;auth_realm = ; Realm to use for authentication. Defaults to Asterisk
; ; REST Interface.
;
; Default write timeout to set on websockets. This value may need to be adjusted
; for connections where Asterisk must write a substantial amount of data and the
; receiving clients are slow to process the received information. Value is in
; milliseconds; default is 100 ms.
;websocket_write_timeout = 100
;[username]
;type = user ; Specifies user configuration
;read_only = no ; When set to yes, user is only authorized for
; ; read-only requests.
;
;password = ; Crypted or plaintext password (see password_format).
;
; password_format may be set to plain (the default) or crypt. When set to crypt,
; crypt(3) is used to validate the password. A crypted password can be generated
; using mkpasswd -m sha-512.
;
; When set to plain, the password is in plaintext.
;
;password_format = plain

View File

@@ -0,0 +1,13 @@
[options]
; If we want to start Asterisk with a default verbosity for the verbose
; or debug logger channel types, then we use these settings (by default
; they are disabled).
;verbose = 5
;debug = 2
; User and group to run asterisk as. NOTE: This will require changes to
; directory and device permissions.
;runuser = asterisk ; The user to run as. The default is root.
;rungroup = asterisk ; The group to run as. The default is root
;defaultlanguage = es

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

@@ -0,0 +1 @@
; All conferences use default settings. This config must be present to load the confbridge application

View File

@@ -0,0 +1,193 @@
[globals]
; 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.
exten = _11XX,hint,PJSIP/${EXTEN}
[Features]
; 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()
; 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)
;Extension to enter a conference intended only for employees
exten = 6000,1,Verbose(1, "User ${CALLERID(num)} dialed the employee conference.")
same = n,Confbridge(employees)
same = n,Hangup()
;Extension to enter a conference intended for employees and customers
exten = 6500,1,Verbose(1, "User ${CALLERID(num)} dialed the employee/customer mixed conference.")
same = n,Confbridge(mixed)
same = n,Hangup()
[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()
; Extension to queue for sales.
; The queue has a 300 second timeout.
exten = 2565551200,1,Verbose(1, "User ${CALLERID(num)} dialed the sales queue.")
same = n,Answer()
same = n,Queue(sales,,,,300)
same = n,Goto(operator,1)
; Extension to queue for a customer advocate.
; The queue has a 1200 second timeout.
exten = 2565551250,1,Verbose(1, "User ${CALLERID(num)} dialed the customer advocate queue.")
same = n,Answer()
same = n,Queue(customer_advocate,,,,1200)
same = n,Goto(operator,1)
[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-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 = Dial-Users
include = Dialing-Errors
; 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(${SAC_DIALED_EXTEN}@example,u)
same = n,Hangup()
exten = dialed-BUSY,1,NoOp()
same = n,Voicemail(${SAC_DIALED_EXTEN}@example,b)
same = n,Hangup()
exten = dialed-CHANUNAVAIL,1,NoOp()
same = n,Playback(pbx-invalid)
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(basic-pbx-ivr-main)
same = n,WaitExten(10)
same = n,Background(basic-pbx-ivr-main)
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

@@ -0,0 +1,19 @@
[general]
country = us ; We are in Waldo, Al, USA so the US is our default.
[us]
description = United States / North America
ringcadence = 2000,4000
dial = 350+440
busy = 480+620/500,0/500
ring = 440+480/2000,0/4000
congestion = 480+620/250,0/250
callwaiting = 440/300,0/10000
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,0
stutter = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
; Additional country configurations can be found in the Asterisk source
; at /configs/samples/indications.conf.sample

View File

@@ -0,0 +1,9 @@
[general]
[logfiles]
console = verbose,notice,warning,error
;messages = notice,warning,error
;full = verbose,notice,warning,error,debug
;security = security

View File

@@ -0,0 +1,155 @@
;
; AMI - The Asterisk Manager Interface
;
; Third party application call management support and PBX event supervision
;
; Use the "manager show commands" at the CLI to list available manager commands
; and their authorization levels.
;
; "manager show command <command>" will show a help text.
;
; ---------------------------- SECURITY NOTE -------------------------------
; Note that you should not enable the AMI on a public IP address. If needed,
; block this TCP port with iptables (or another FW software) and reach it
; with IPsec, SSH, or SSL vpn tunnel. You can also make the manager
; interface available over http/https if Asterisk's http server is enabled in
; http.conf and if both "enabled" and "webenabled" are set to yes in
; this file. Both default to no. httptimeout provides the maximum
; timeout in seconds before a web based session is discarded. The
; default is 60 seconds.
;
[general]
enabled = no
;webenabled = yes
port = 5038
bindaddr = 0.0.0.0
; Parameters that control AMI over TLS. ("enabled" must be set too).
; You can open a connection to this socket with e.g.
;
; openssl s_client -connect my_host:5039
;
;tlsenable=no ; set to YES to enable it
;tlsbindaddr=0.0.0.0:5039 ; address and port to bind to, default to bindaddr and port 5039
;tlscertfile=/tmp/asterisk.pem ; path to the certificate.
;tlsprivatekey=/tmp/private.pem ; path to the private key, if no private given,
; if no tlsprivatekey is given, default is to search
; tlscertfile for private key.
;tlscipher=<cipher string> ; string specifying which SSL ciphers to use or not use
;
;allowmultiplelogin = yes ; IF set to no, rejects manager logins that are already in use.
; ; The default is yes.
;
;displayconnects = yes
;
; Add a Unix epoch timestamp to events (not action responses)
;
;timestampevents = yes
;brokeneventsaction = yes ; Restore previous behavior that caused the events
; action to not return a response in certain
; circumstances. Defaults to 'no'.
;
; Display certain channel variables every time a channel-oriented
; event is emitted:
;
;channelvars = var1,var2,var3
; debug = on ; enable some debugging info in AMI messages (default off).
; Also accessible through the "manager debug" CLI command.
; authtimeout specifies the maximum number of seconds a client has to
; authenticate. If the client does not authenticate beofre this timeout
; expires, the client will be disconnected. (default: 30 seconds)
;authtimeout = 30
; authlimit specifies the maximum number of unauthenticated sessions that will
; be allowed to connect at any given time.
;authlimit = 50
;httptimeout = 60
; a) httptimeout sets the Max-Age of the http cookie
; b) httptimeout is the amount of time the webserver waits
; on a action=waitevent request (actually its httptimeout-10)
; c) httptimeout is also the amount of time the webserver keeps
; a http session alive after completing a successful action
;[mark]
;secret = mysecret
;deny=0.0.0.0/0.0.0.0
;permit=209.16.236.73/255.255.255.0
;acl=named_acl_example ; use a named ACL from acl.conf
;
;
;setvar=PBXACCOUNT=edvina
; The setvar option defines channel variables that will be set when this account
; originates a call. You can define multiple setvar= commands for one manager
; user.
;
;eventfilter=Event: Newchannel
;eventfilter=Channel: (PJ)?SIP/(james|jim|john)-
;eventfilter=!Channel: DAHDI/
; The eventfilter option is used to whitelist or blacklist events per user.
; A filter consists of an (unanchored) regular expression that is run on the
; entire event data. If the first character of the filter is an exclamation
; mark (!), the filter is appended to the blacklist instead of the whitelist.
; After first checking the read access below, the regular expression filters
; are processed as follows:
; - If no filters are configured all events are reported as normal.
; - If there are white filters only: implied black all filter processed first,
; then white filters.
; - If there are black filters only: implied white all filter processed first,
; then black filters.
; - If there are both white and black filters: implied black all filter processed
; first, then white filters, and lastly black filters.
;
; If the device connected via this user accepts input slowly,
; the timeout for writes to it can be increased to keep it
; from being disconnected (value is in milliseconds)
;
; writetimeout = 100
;
;displayconnects = yes ; Display on CLI user login/logoff
;
; Authorization for various classes
;
; Read authorization permits you to receive asynchronous events, in general.
; Write authorization permits you to send commands and get back responses. The
; following classes exist:
;
; all - All event classes below (including any we may have missed).
; system - General information about the system and ability to run system
; management commands, such as Shutdown, Restart, and Reload.
; call - Information about channels and ability to set information in a
; running channel.
; log - Logging information. Read-only. (Defined but not yet used.)
; verbose - Verbose information. Read-only. (Defined but not yet used.)
; agent - Information about queues and agents and ability to add queue
; members to a queue.
; user - Permission to send and receive UserEvent.
; config - Ability to read and write configuration files.
; command - Permission to run CLI commands. Write-only.
; dtmf - Receive DTMF events. Read-only.
; reporting - Ability to get information about the system.
; cdr - Output of cdr_manager, if loaded. Read-only.
; dialplan - Receive NewExten and VarSet events. Read-only.
; originate - Permission to originate new calls. Write-only.
; agi - Output AGI commands executed. Input AGI command to execute.
; cc - Call Completion events. Read-only.
; aoc - Permission to send Advice Of Charge messages and receive Advice
; - Of Charge events.
; test - Ability to read TestEvent notifications sent to the Asterisk Test
; Suite. Note that this is only enabled when the TEST_FRAMEWORK
; compiler flag is defined.
; security - Security Events. Read-only.
; message - Permissions to send out of call messages. Write-only
;
;read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
;write = system,call,agent,user,config,command,reporting,originate,message

View File

@@ -0,0 +1,112 @@
[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
load = app_dial.so
load = app_playback.so
load = app_stack.so
load = app_verbose.so
load = app_voicemail.so
load = app_directory.so
load = app_confbridge.so
load = app_queue.so
; Bridging
load = bridge_builtin_features.so
load = bridge_builtin_interval_features.so
load = bridge_holding.so
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
load = chan_pjsip.so
; Codecs
load = codec_gsm.so
load = codec_resample.so
load = codec_ulaw.so
load = codec_g722.so
; Formats
load = format_gsm.so
load = format_pcm.so
load = format_wav_gsm.so
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
load = pbx_config.so
; Resources
load = res_musiconhold.so
load = res_pjproject.so
load = res_pjsip_acl.so
load = res_pjsip_authenticator_digest.so
load = res_pjsip_caller_id.so
load = res_pjsip_dialog_info_body_generator.so
load = res_pjsip_diversion.so
load = res_pjsip_dtmf_info.so
load = res_pjsip_endpoint_identifier_anonymous.so
load = res_pjsip_endpoint_identifier_ip.so
load = res_pjsip_endpoint_identifier_user.so
load = res_pjsip_exten_state.so
load = res_pjsip_header_funcs.so
load = res_pjsip_logger.so
load = res_pjsip_messaging.so
load = res_pjsip_multihomed.so
load = res_pjsip_mwi_body_generator.so
load = res_pjsip_mwi.so
load = res_pjsip_nat.so
load = res_pjsip_notify.so
load = res_pjsip_one_touch_record_info.so
load = res_pjsip_outbound_authenticator_digest.so
load = res_pjsip_outbound_publish.so
load = res_pjsip_outbound_registration.so
load = res_pjsip_path.so
load = res_pjsip_pidf_body_generator.so
load = res_pjsip_pidf_digium_body_supplement.so
load = res_pjsip_pidf_eyebeam_body_supplement.so
load = res_pjsip_publish_asterisk.so
load = res_pjsip_pubsub.so
load = res_pjsip_refer.so
load = res_pjsip_registrar_expire.so
load = res_pjsip_registrar.so
load = res_pjsip_rfc3326.so
load = res_pjsip_sdp_rtp.so
load = res_pjsip_send_to_voicemail.so
load = res_pjsip_session.so
load = res_pjsip.so
load = res_pjsip_t38.so
load = res_pjsip_transport_websocket.so
load = res_pjsip_xpidf_body_generator.so
load = res_rtp_asterisk.so
load = res_sorcery_astdb.so
load = res_sorcery_config.so
load = res_sorcery_memory.so
load = res_sorcery_realtime.so
load = res_timing_timerfd.so

View File

@@ -0,0 +1,5 @@
[general]
[default]
mode = files
directory = moh

View File

@@ -0,0 +1,332 @@
;================================ TRANSPORTS ==
; Our primary transport definition for UDP communication behind NAT.
[transport-udp-nat]
type = transport
protocol = udp
bind = 0.0.0.0
; NAT settings
;local_net = 10.0.0.0/8
;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 = Long-Distance
allow = !all,g722,ulaw
direct_media = no
trust_id_outbound = yes
device_state_busy_at = 1
dtmf_mode = rfc4733
[auth-userpass](!)
type = auth
auth_type = userpass
[aor-single-reg](!)
type = aor
max_contacts = 1
;================================ ENDPOINT DEFINITIONS ==
; Below are the definitions for all staff devices, listed by department.
;
; Super Awesome Company uses the MAC address of their devices for the auth
; username and the extension number for the name of the endpoint, auth and
; aor objects. If your phones must use the same user ID and auth name then
; you will need to customize the endpoints accordingly.
;================================ MANAGEMENT ==
;Lindsey Freddie
;President for Life
[1107](endpoint-internal-d70)
auth = 1107
aors = 1107
callerid = Lindsey Freddie <1107>
[1107](auth-userpass)
password = 4webrEtHupHewu4
username = 0019159BF771
[1107](aor-single-reg)
mailboxes = 1107@example
;================================
;Temple Morgan
;Life Assistant to the President for Life
[1111](endpoint-internal-d70)
auth = 1111
aors = 1111
callerid = Temple Morgan <1111>
[1111](auth-userpass)
password = be4eberEkUsUMaF
username = 000FD3012445
[1111](aor-single-reg)
mailboxes = 1111@example
;================================
;Terry Jules
;Director of Sales
[1109](endpoint-internal-d70)
auth = 1109
aors = 1109
callerid = Terry Jules <1109>
[1109](auth-userpass)
password = sPeFaChe7ruxarE
username = 00094558B29E
[1109](aor-single-reg)
mailboxes = 1109@example
;================================
;Maria Berny
;Director of Customer Experience
[1101](endpoint-internal-d70)
auth = 1101
aors = 1101
callerid = Maria Berny <1101>
[1101](auth-userpass)
password = SW2fur7facrarac
username = 3605657CFB45
[1101](aor-single-reg)
mailboxes = 1101@example
;================================
;Penelope Bronte
;Director of Engineering
[1103](endpoint-internal-d70)
auth = 1103
aors = 1103
callerid = Penelope Bronte <1103>
[1103](auth-userpass)
password = zutAnacHe8ewuWr
username = D5F646797302
[1103](aor-single-reg)
mailboxes = 103@example
;================================
;Aaron Courtney
;Accounting and Records
[1106](endpoint-internal-d70)
auth = 1106
aors = 1106
callerid = Aaron Courtney <1106>
[1106](auth-userpass)
password = tecrUBUs3u7uTab
username = EAFB2F4319C4
[1106](aor-single-reg)
mailboxes = 1106@example
;================================ SALES STAFF ==
;================================
;Garnet Claude
;Sales Associate
[1105](endpoint-internal-d70)
auth = 1105
aors = 1105
callerid = Garnet Claude <1105>
[1105](auth-userpass)
password = Q7rAphatRusteSW
username = 5187E6D311BE
[1105](aor-single-reg)
mailboxes = 1105@example
;================================
;Franny Ocean
;Sales Associate
[1112](endpoint-internal-d70)
auth = 1112
aors = 1112
callerid = Franny Ocean <1112>
[1112](auth-userpass)
password = nefReSTAq8phaph
username = ACC6BC73A990
[1112](aor-single-reg)
mailboxes = 1112@example
;================================ CUSTOMER SERVICE STAFF =
;================================
;Dusty Williams
;Customer Advocate
[1115](endpoint-internal-d70)
auth = 1115
aors = 1115
callerid = Dusty Williams <1115>
[1115](auth-userpass)
password = cEBraN2trezaqEt
username = 2C61DA1AA74B
[1115](aor-single-reg)
mailboxes = 1115@example
;================================
;Tommie Briar
;Customer Advocate
[1102](endpoint-internal-d70)
auth = 1102
aors = 1102
callerid = Tommie Briar <1102>
[1102](auth-userpass)
password = 6EBu8egespUwuth
username = 558EF2645DC7
[1102](aor-single-reg)
mailboxes = 1102@example
;================================ ENGINEERING STAFF ==
;================================
;Hollis Justy
;Software Engineer
[1110](endpoint-internal-d70)
auth = 1110
aors = 1110
callerid = Hollis Justy <1110>
[1110](auth-userpass)
password = vust6spuFereThA
username = D3D55712AED0
[1110](aor-single-reg)
mailboxes = 1110@example
;================================
;Richard Casey
;Software Engineer
[1104](endpoint-internal-d70)
auth = 1104
aors = 1104
callerid = Richard Casey <1104>
[1104](auth-userpass)
password = fU8puzuzEpRuSTa
username = 13B29A457ED5
[1104](aor-single-reg)
mailboxes = 1104@example
;================================
;Sal Smith
;Software Engineer
[1114](endpoint-internal-d70)
auth = 1114
aors = 1114
callerid = Sal Smith <1114>
[1114](auth-userpass)
password = XapR4munEcadrub
username = C369192006EA
[1114](aor-single-reg)
mailboxes = 1114@example
;================================
;Laverne Roberts
;Software Engineer
[1113](endpoint-internal-d70)
auth = 1113
aors = 1113
callerid = Laverne Roberts <1113>
[1113](auth-userpass)
password = mu8aPr4daJAQaDE
username = B07FF579AAC8
[1113](aor-single-reg)
mailboxes = 1113@example
;================================
;Colby Hildred
;IT Systems
[1108](endpoint-internal-d70)
auth = 1108
aors = 1108
callerid = Colby Hildred <1108>
[1108](auth-userpass)
password = KAthufrudE6uyAs
username = DB589C0875AB
[1108](aor-single-reg)
mailboxes = 1108@example

View File

@@ -0,0 +1,19 @@
[general]
monitor-type = MixMonitor
;========================Sales Queue ==
; Calls all sales persons in a ring-all fashion
[sales]
strategy=ringall
member => PJSIP/1109 ; Terry Jules - Director of Sales
member => PJSIP/1105 ; Garnet Claude - Sales Associate
member => PJSIP/1112 ; Franny Ocean - Sales Associate
;===================== Customer Advocate Queue ==
; Calls all customer advocates in a ring-all fashion
[customer_advocate]
strategy=ringall
member => PJSIP/1101 ; Maria Berny - Director of Customer Experience
member => PJSIP/1115 ; Dusty Williams - Customer Advocate
member => PJSIP/1102 ; Tommy Briar - Customer Advocate

View File

@@ -0,0 +1,23 @@
[general]
format = wav49|gsm|wav
[default]
[example]
; Voicemail context for all internal users in the example.com domain.
1101 = 0717,Maria Berny
1102 = 7085,Tommie Briar
1103 = 1809,Penelope Bronte
1104 = 0039,Richard Casey
1105 = 6618,Garnet Claude
1106 = 9805,Aaron Courtney
1107 = 7484,Lindsey Freddie
1108 = 7788,Colby Hildred
1109 = 5750,Terry Jules
1110 = 3702,Hollis Justy
1111 = 1878,Temple Morgan
1112 = 5497,Franny Ocean
1113 = 1637,Laverne Roberts
1114 = 3717,Sal Smith
1115 = 3088,Dusty Williams

View File

@@ -0,0 +1,143 @@
#! /bin/sh
# $Id$
#
# Mon Jun 04 2007 Iñaki Baz Castillo <ibc@in.ilimit.es>
# - Eliminated SAFE_ASTERISK since it doesn't work as LSB script (it could require a independent "safe_asterisk" init script).
# - Load and use the standar "/lib/lsb/init-functions".
# - Added "--oknodo" to "start-stop-daemon" for compatibility with LSB:
# http://www.linux-foundation.org/spec/refspecs/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
#
# Thu Nov 17 2005 Gregory Boehnlein <damin@nacs.net>
# - Reversed behavior of LD_ASSUME_KERNEL=2.4.1
# - Added detailed failure messages
#
# Sun Jul 18 2004 Gregory Boehnlein <damin@nacs.net>
# - Added test for safe_asterisk
# - Changed "stop gracefully" to "stop now"
# - Added support for -U and -G command line options
# - Modified "reload" to call asterisk -rx 'reload'
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=asterisk
DESC="Asterisk PBX"
# Full path to asterisk binary
DAEMON=__ASTERISK_SBIN_DIR__/asterisk
ASTVARRUNDIR=__ASTERISK_VARRUN_DIR__
ASTETCDIR=__ASTERISK_ETC_DIR__
TRUE=/bin/true
### BEGIN INIT INFO
# Provides: asterisk
# Required-Start: $network $syslog $named $local_fs $remote_fs
# Required-Stop: $network $syslog $named $local_fs $remote_fs
# Should-Start: dahdi misdn lcr wanrouter mysql postgresql
# Should-Stop: dahdi misdn lcr wanrouter mysql postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Asterisk PBX
# Description: the Asterisk Open Source PBX
### END INIT INFO
set -e
if ! [ -x $DAEMON ] ; then
echo "ERROR: $DAEMON not found"
exit 0
fi
if ! [ -d $ASTETCDIR ] ; then
echo "ERROR: $ASTETCDIR directory not found"
exit 0
fi
# Use the LSB standard functions for services management
. /lib/lsb/init-functions
# Allow configuration overrides in /etc/default/asterisk
CONFIG0=`readlink $0 || :` # readlink returns 1 when something isn't a symlink
if [ "$CONFIG0" = "" ]; then
CONFIGFILE=/etc/default/`basename $0`
else
CONFIGFILE=/etc/default/`basename $CONFIG0`
fi
[ -r $CONFIGFILE ] && . $CONFIGFILE
case "$1" in
start)
# Check if Asterisk is already running. If it is, then bug out, because
# starting up Asterisk when Asterisk is already running is very bad.
VERSION=`${DAEMON} -rx 'core show version' 2>/dev/null || ${TRUE}`
if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
echo "Asterisk is already running. $0 will exit now."
exit 0
fi
log_begin_msg "Starting $DESC: $NAME"
if [ ! -d $ASTVARRUNDIR ]; then
mkdir -p $ASTVARRUNDIR
fi
if [ $AST_USER ] ; then
ASTARGS="-U $AST_USER"
chown $AST_USER $ASTVARRUNDIR
fi
if [ $AST_GROUP ] ; then
ASTARGS="$ASTARGS -G $AST_GROUP"
chgrp $AST_GROUP $ASTVARRUNDIR
fi
if [ $ALTCONF ]; then
ASTARGS="$ASTARGS -C \"$ALTCONF\""
fi
if [ "x$COREDUMP" = "xyes" ]; then
ASTARGS="$ASTARGS -g"
fi
if [ "0$MAXLOAD" -gt "0" ]; then
ASTARGS="$ASTARGS -L $MAXLOAD"
fi
if [ "0$MAXCALLS" -gt "0" ]; then
ASTARGS="$ASTARGS -M $MAXCALLS"
fi
if [ "0$VERBOSITY" -gt "0" ]; then
for i in `seq 1 $VERBOSITY`; do
ASTARGS="$ASTARGS -v"
done
# -v implies -f, so we override that implicit specification here
ASTARGS="$ASTARGS -F"
fi
if [ "x$INTERNALTIMING" = "xyes" ]; then
ASTARGS="$ASTARGS -I"
fi
if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
ASTARGS="$ASTARGS -t"
fi
if test "x$COLOR" = "xno" ; then
ASTARGS="$ASTARGS -n"
fi
# "start-stop-daemon --oknodo" returns 0 even if Asterisk was already running (as LSB expects):
start-stop-daemon --start --oknodo --exec $DAEMON -- $ASTARGS
log_end_msg $?
;;
stop)
log_begin_msg "Stopping $DESC: $NAME"
# "start-stop-daemon --oknodo" returns 0 even if Asterisk was already stopped (as LSB expects):
start-stop-daemon --stop --oknodo --exec $DAEMON
log_end_msg $?
;;
reload)
echo "Reloading $DESC configuration files."
$DAEMON -rx 'module reload' > /dev/null 2> /dev/null
;;
restart|force-reload)
$0 stop
sleep 2 # It needs some time to really be stopped.
$0 start
# "restart|force-reload" starts Asterisk and returns 0 even if Asterisk was stopped (as LSB expects).
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
exit 1
;;
esac

View File

@@ -0,0 +1,428 @@
{
// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
// Copyright (C) ITsysCOM GmbH
//
// This file contains the default configuration hardcoded into CGRateS.
// This is what you get when you load CGRateS with an empty configuration file.
// "general": {
// "http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate
// "rounding_decimals": 5, // system level precision for floats
// "dbdata_encoding": "msgpack", // encoding used to store object data in strings: <msgpack|json>
// "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans
// "httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url)
// "http_failed_dir": "/var/spool/cgrates/http_failed", // directory path where we store failed http requests
// "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated>
// "default_category": "call", // default category to consider when missing from requests
// "default_tenant": "cgrates.org", // default tenant to consider when missing from requests
// "default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
// "connect_attempts": 3, // initial server connect attempts
// "reconnects": -1, // number of retries in case of connection lost
// "connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature
// "reply_timeout": "2s", // consider connection down for replies taking longer than this value
// "response_cache_ttl": "0s", // the life span of a cached response
// "internal_ttl": "2m", // maximum duration to wait for internal connections before giving up
// "locking_timeout": "5s", // timeout internal locks to avoid deadlocks
// "cache_dump_dir": "", // cache dump for faster start (leave empty to disable)
// },
// "cache":{
// "destinations": {"limit": 10000, "ttl":"0s", "precache": false},
// "reverse_destinations": {"limit": 10000, "ttl":"0s", "precache": false},
// "rating_plans": {"limit": 10000, "ttl":"0s","precache": true},
// "rating_profiles": {"limit": 10000, "ttl":"0s", "precache": false},
// "lcr": {"limit": 10000, "ttl":"0s", "precache": false},
// "cdr_stats": {"limit": 10000, "ttl":"0s", "precache": false},
// "actions": {"limit": 10000, "ttl":"0s", "precache": false},
// "action_plans": {"limit": 10000, "ttl":"0s", "precache": false},
// "action_triggers": {"limit": 10000, "ttl":"0s", "precache": false},
// "shared_groups": {"limit": 10000, "ttl":"0s", "precache": false},
// "aliases": {"limit": 10000, "ttl":"0s", "precache": false},
// "reverse_aliases": {"limit": 10000, "ttl":"0s", "precache": false},
// },
// "listen": {
// "rpc_json": "127.0.0.1:2012", // RPC JSON listening address
// "rpc_gob": "127.0.0.1:2013", // RPC GOB listening address
// "http": "127.0.0.1:2080", // HTTP listening address
// },
// "tariffplan_db": { // database used to store active tariff plan configuration
// "db_type": "redis", // tariffplan_db type: <redis|mongo>
// "db_host": "127.0.0.1", // tariffplan_db host address
// "db_port": 6379, // port to reach the tariffplan_db
// "db_name": "10", // tariffplan_db name to connect to
// "db_user": "", // sername to use when connecting to tariffplan_db
// "db_password": "", // password to use when connecting to tariffplan_db
// },
// "data_db": { // database used to store runtime data (eg: accounts, cdr stats)
// "db_type": "redis", // data_db type: <redis|mongo>
// "db_host": "127.0.0.1", // data_db host address
// "db_port": 6379, // data_db port to reach the database
// "db_name": "11", // data_db database name to connect to
// "db_user": "", // username to use when connecting to data_db
// "db_password": "", // password to use when connecting to data_db
// "load_history_size": 10, // Number of records in the load history
// },
// "stor_db": { // database used to store offline tariff plans and CDRs
// "db_type": "mysql", // stor database type to use: <mongo|mysql|postgres>
// "db_host": "127.0.0.1", // the host to connect to
// "db_port": 3306, // the port to reach the stordb
// "db_name": "cgrates", // stor database name
// "db_user": "cgrates", // username to use when connecting to stordb
// "db_password": "CGRateS.org", // password to use when connecting to stordb
// "max_open_conns": 100, // maximum database connections opened
// "max_idle_conns": 10, // maximum database connections idle
// "cdrs_indexes": [], // indexes on cdrs table to speed up queries, used only in case of mongo
// },
// "balancer": {
// "enabled": false, // start Balancer service: <true|false>
// },
// "rals": {
// "enabled": false, // enable Rater service: <true|false>
// "balancer": "", // register to balancer as worker: <""|*internal|x.y.z.y:1234>
// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
// "historys_conns": [], // address where to reach the history service, empty to disable history functionality: <""|*internal|x.y.z.y:1234>
// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234>
// "users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234>
// "aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234>
// "rp_subject_prefix_matching": false, // enables prefix matching for the rating profile subject
// "lcr_subject_prefix_matching": false // enables prefix matching for the lcr subject
// },
// "scheduler": {
// "enabled": false, // start Scheduler service: <true|false>
// },
// "cdrs": {
// "enabled": false, // start the CDR Server service: <true|false>
// "extra_fields": [], // extra fields to store in CDRs for non-generic CDRs
// "store_cdrs": true, // store cdrs in storDb
// "cdr_account_summary": false, // add account information from dataDB
// "rals_conns": [
// {"address": "*internal"} // address where to reach the Rater for cost calculation, empty to disable functionality: <""|*internal|x.y.z.y:1234>
// ],
// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234>
// "users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234>
// "aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234>
// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality<""|*internal|x.y.z.y:1234>
// "cdr_replication":[] // replicate the raw CDR to a number of servers
// },
// "cdrstats": {
// "enabled": false, // starts the cdrstats service: <true|false>
// "save_interval": "1m", // interval to save changed stats into dataDb storage
// },
// "cdrc": [
// {
// "id": "*default", // identifier of the CDRC runner
// "enabled": false, // enable CDR client functionality
// "dry_run": false, // do not send the CDRs to CDRS, just parse them
// "cdrs_conns": [
// {"address": "*internal"} // address where to reach CDR server. <*internal|x.y.z.y:1234>
// ],
// "cdr_format": "csv", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore|partial_csv>
// "field_separator": ",", // separator used in case of csv files
// "timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
// "run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify
// "max_open_files": 1024, // maximum simultaneous files to process, 0 for unlimited
// "data_usage_multiply_factor": 1024, // conversion factor for data usage
// "cdr_in_dir": "/var/spool/cgrates/cdrc/in", // absolute path towards the directory where the CDRs are stored
// "cdr_out_dir": "/var/spool/cgrates/cdrc/out", // absolute path towards the directory where processed CDRs will be moved
// "failed_calls_prefix": "missed_calls", // used in case of flatstore CDRs to avoid searching for BYE records
// "cdr_path": "", // path towards one CDR element in case of XML CDRs
// "cdr_source_id": "freeswitch_csv", // free form field, tag identifying the source of the CDRs within CDRS database
// "cdr_filter": "", // filter CDR records to import
// "continue_on_success": false, // continue to the next template if executed
// "partial_record_cache": "10s", // duration to cache partial records when not pairing
// "partial_cache_expiry_action": "*dump_to_file", // action taken when cache when records in cache are timed-out <*dump_to_file|*post_cdr>
// "header_fields": [], // template of the import header fields
// "content_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
// {"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "2", "mandatory": true},
// {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "3", "mandatory": true},
// {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "4", "mandatory": true},
// {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "5", "mandatory": true},
// {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "6", "mandatory": true},
// {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "7", "mandatory": true},
// {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "8", "mandatory": true},
// {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "9", "mandatory": true},
// {"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "10", "mandatory": true},
// {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "11", "mandatory": true},
// {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "12", "mandatory": true},
// {"tag": "Usage", "field_id": "Usage", "type": "*composed", "value": "13", "mandatory": true},
// ],
// "trailer_fields": [], // template of the import trailer fields
// "cache_dump_fields": [
// {"tag": "CGRID", "type": "*composed", "value": "CGRID"},
// {"tag": "RunID", "type": "*composed", "value": "RunID"},
// {"tag": "TOR", "type": "*composed", "value": "ToR"},
// {"tag": "OriginID", "type": "*composed", "value": "OriginID"},
// {"tag": "RequestType", "type": "*composed", "value": "RequestType"},
// {"tag": "Direction", "type": "*composed", "value": "Direction"},
// {"tag": "Tenant", "type": "*composed", "value": "Tenant"},
// {"tag": "Category", "type": "*composed", "value": "Category"},
// {"tag": "Account", "type": "*composed", "value": "Account"},
// {"tag": "Subject", "type": "*composed", "value": "Subject"},
// {"tag": "Destination", "type": "*composed", "value": "Destination"},
// {"tag": "SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
// {"tag": "AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
// {"tag": "Usage", "type": "*composed", "value": "Usage"},
// {"tag": "Cost", "type": "*composed", "value": "Cost"},
// ],
// },
// ],
// "cdre": {
// "*default": {
// "cdr_format": "csv", // exported CDRs format <csv>
// "field_separator": ",",
// "data_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from KBytes to Bytes)
// "sms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from SMS unit to call duration in some billing systems)
// "mms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from MMS unit to call duration in some billing systems)
// "generic_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from GENERIC unit to call duration in some billing systems)
// "cost_multiply_factor": 1, // multiply cost before export, eg: add VAT
// "cost_rounding_decimals": -1, // rounding decimals for Cost values. -1 to disable rounding
// "cost_shift_digits": 0, // shift digits in the cost on export (eg: convert from EUR to cents)
// "mask_destination_id": "MASKED_DESTINATIONS", // destination id containing called addresses to be masked on export
// "mask_length": 0, // length of the destination suffix to be masked
// "export_directory": "/var/spool/cgrates/cdre", // path where the exported CDRs will be placed
// "header_fields": [], // template of the exported header fields
// "content_fields": [ // template of the exported content fields
// {"tag": "CGRID", "type": "*composed", "value": "CGRID"},
// {"tag":"RunID", "type": "*composed", "value": "RunID"},
// {"tag":"TOR", "type": "*composed", "value": "ToR"},
// {"tag":"OriginID", "type": "*composed", "value": "OriginID"},
// {"tag":"RequestType", "type": "*composed", "value": "RequestType"},
// {"tag":"Direction", "type": "*composed", "value": "Direction"},
// {"tag":"Tenant", "type": "*composed", "value": "Tenant"},
// {"tag":"Category", "type": "*composed", "value": "Category"},
// {"tag":"Account", "type": "*composed", "value": "Account"},
// {"tag":"Subject", "type": "*composed", "value": "Subject"},
// {"tag":"Destination", "type": "*composed", "value": "Destination"},
// {"tag":"SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
// {"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
// {"tag":"Usage", "type": "*composed", "value": "Usage"},
// {"tag":"Cost", "type": "*composed", "value": "Cost"},
// ],
// "trailer_fields": [], // template of the exported trailer fields
// },
// },
// "sm_generic": {
// "enabled": false, // starts SessionManager service: <true|false>
// "listen_bijson": "127.0.0.1:2014", // address where to listen for bidirectional JSON-RPC requests
// "rals_conns": [
// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013>
// ],
// "cdrs_conns": [
// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234>
// ],
// "debit_interval": "0s", // interval to perform debits on.
// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this
// "max_call_duration": "3h", // maximum call duration a prepaid call can last
// "session_ttl": "0s", // time after a session with no updates is terminated, not defined by default
// //"session_ttl_last_used": "", // tweak LastUsed for sessions timing-out, not defined by default
// //"session_ttl_usage": "", // tweak Usage for sessions timing-out, not defined by default
// "session_indexes": [], // index sessions based on these fields for GetActiveSessions API
// },
// "sm_freeswitch": {
// "enabled": false, // starts SessionManager service: <true|false>
// "rals_conns": [
// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013>
// ],
// "cdrs_conns": [
// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234>
// ],
// "rls_conns": [], // address where to reach the ResourceLimiter service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
// "create_cdr": false, // create CDR out of events and sends them to CDRS component
// "extra_fields": [], // extra fields to store in auth/CDRs when creating them
// "debit_interval": "10s", // interval to perform debits on.
// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this
// "max_call_duration": "3h", // maximum call duration a prepaid call can last
// "min_dur_low_balance": "5s", // threshold which will trigger low balance warnings for prepaid calls (needs to be lower than debit_interval)
// "low_balance_ann_file": "", // file to be played when low balance is reached for prepaid calls
// "empty_balance_context": "", // if defined, prepaid calls will be transfered to this context on empty balance
// "empty_balance_ann_file": "", // file to be played before disconnecting prepaid calls on empty balance (applies only if no context defined)
// "subscribe_park": true, // subscribe via fsock to receive park events
// "channel_sync_interval": "5m", // sync channels with freeswitch regularly
// "max_wait_connection": "2s", // maximum duration to wait for a connection to be retrieved from the pool
// "event_socket_conns":[ // instantiate connections to multiple FreeSWITCH servers
// {"address": "127.0.0.1:8021", "password": "ClueCon", "reconnects": 5}
// ],
// },
// "sm_kamailio": {
// "enabled": false, // starts SessionManager service: <true|false>
// "rals_conns": [
// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013>
// ],
// "cdrs_conns": [
// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234>
// ],
// "create_cdr": false, // create CDR out of events and sends them to CDRS component
// "debit_interval": "10s", // interval to perform debits on.
// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this
// "max_call_duration": "3h", // maximum call duration a prepaid call can last
// "evapi_conns":[ // instantiate connections to multiple Kamailio servers
// {"address": "127.0.0.1:8448", "reconnects": 5}
// ],
// },
// "sm_opensips": {
// "enabled": false, // starts SessionManager service: <true|false>
// "listen_udp": "127.0.0.1:2020", // address where to listen for datagram events coming from OpenSIPS
// "rals_conns": [
// {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013>
// ],
// "cdrs_conns": [
// {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234>
// ],
// "reconnects": 5, // number of reconnects if connection is lost
// "create_cdr": false, // create CDR out of events and sends it to CDRS component
// "debit_interval": "10s", // interval to perform debits on.
// "min_call_duration": "0s", // only authorize calls with allowed duration higher than this
// "max_call_duration": "3h", // maximum call duration a prepaid call can last
// "events_subscribe_interval": "60s", // automatic events subscription to OpenSIPS, 0 to disable it
// "mi_addr": "127.0.0.1:8020", // address where to reach OpenSIPS MI to send session disconnects
// },
// "diameter_agent": {
// "enabled": false, // enables the diameter agent: <true|false>
// "listen": "127.0.0.1:3868", // address where to listen for diameter requests <x.y.z.y:1234>
// "dictionaries_dir": "/usr/share/cgrates/diameter/dict/", // path towards directory holding additional dictionaries to load
// "sm_generic_conns": [
// {"address": "*internal"} // connection towards SMG component for session management
// ],
// "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234>
// "create_cdr": true, // create CDR out of CCR terminate and send it to SMG component
// "debit_interval": "5m", // interval for CCR updates
// "timezone": "", // timezone for timestamps where not specified, empty for general defaults <""|UTC|Local|$IANA_TZ_DB>
// "origin_host": "CGR-DA", // diameter Origin-Host AVP used in replies
// "origin_realm": "cgrates.org", // diameter Origin-Realm AVP used in replies
// "vendor_id": 0, // diameter Vendor-Id AVP used in replies
// "product_name": "CGRateS", // diameter Product-Name AVP used in replies
// "request_processors": [
// {
// "id": "*default", // formal identifier of this processor
// "dry_run": false, // do not send the events to SMG, just log them
// "publish_event": false, // if enabled, it will publish internal event to pubsub
// "request_filter": "Subscription-Id>Subscription-Id-Type(0)", // filter requests processed by this processor
// "flags": [], // flags to influence processing behavior
// "continue_on_success": false, // continue to the next template if executed
// "append_cca": true, // when continuing will append cca fields to the previous ones
// "ccr_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
// {"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "^*voice", "mandatory": true},
// {"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Session-Id", "mandatory": true},
// {"tag": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "^*users", "mandatory": true},
// {"tag": "Direction", "field_id": "Direction", "type": "*composed", "value": "^*out", "mandatory": true},
// {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "^*users", "mandatory": true},
// {"tag": "Category", "field_id": "Category", "type": "*composed", "value": "^call", "mandatory": true},
// {"tag": "Account", "field_id": "Account", "type": "*composed", "value": "^*users", "mandatory": true},
// {"tag": "Subject", "field_id": "Subject", "type": "*composed", "value": "^*users", "mandatory": true},
// {"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Service-Information>IN-Information>Real-Called-Number", "mandatory": true},
// {"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
// {"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
// {"tag": "Usage", "field_id": "Usage", "type": "*handler", "handler_id": "*ccr_usage", "mandatory": true},
// {"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed", "value": "Subscription-Id>Subscription-Id-Data", "mandatory": true},
// ],
// "cca_fields":[ // fields returned in CCA
// {"tag": "GrantedUnits", "field_id": "Granted-Service-Unit>CC-Time", "type": "*handler", "handler_id": "*cca_usage", "mandatory": true},
// ],
// },
// ],
// },
// "historys": {
// "enabled": false, // starts History service: <true|false>.
// "history_dir": "/var/lib/cgrates/history", // location on disk where to store history files.
// "save_interval": "1s", // interval to save changed cache into .git archive
// },
// "pubsubs": {
// "enabled": false, // starts PubSub service: <true|false>.
// },
// "aliases": {
// "enabled": false, // starts Aliases service: <true|false>.
// },
// "users": {
// "enabled": false, // starts User service: <true|false>.
// "indexes": [], // user profile field indexes
// },
// "rls": {
// "enabled": false, // starts ResourceLimiter service: <true|false>.
// "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
// "cache_dump_interval": "0s", // dump cache regularly to dataDB, 0 - dump at start/shutdown: <""|*never|$dur>
// "usage_ttl": "3h", // expire usage records if older than this duration <""|*never|$dur>
// },
// "mailer": {
// "server": "localhost", // the server to use when sending emails out
// "auth_user": "cgrates", // authenticate to email server using this user
// "auth_password": "CGRateS.org", // authenticate to email server with this password
// "from_address": "cgr-mailer@localhost.localdomain" // from address used when sending emails out
// },
// "suretax": {
// "url": "", // API url
// "client_number": "", // client number, provided by SureTax
// "validation_key": "", // validation key provided by SureTax
// "business_unit": "", // clients Business Unit
// "timezone": "Local", // convert the time of the events to this timezone before sending request out <UTC|Local|$IANA_TZ_DB>
// "include_local_cost": false, // sum local calculated cost with tax one in final cost
// "return_file_code": "0", // default or Quote purposes <0|Q>
// "response_group": "03", // determines how taxes are grouped for the response <03|13>
// "response_type": "D4", // determines the granularity of taxes and (optionally) the decimal precision for the tax calculations and amounts in the response
// "regulatory_code": "03", // provider type
// "client_tracking": "CGRID", // template extracting client information out of StoredCdr; <$RSRFields>
// "customer_number": "Subject", // template extracting customer number out of StoredCdr; <$RSRFields>
// "orig_number": "Subject", // template extracting origination number out of StoredCdr; <$RSRFields>
// "term_number": "Destination", // template extracting termination number out of StoredCdr; <$RSRFields>
// "bill_to_number": "", // template extracting billed to number out of StoredCdr; <$RSRFields>
// "zipcode": "", // template extracting billing zip code out of StoredCdr; <$RSRFields>
// "plus4": "", // template extracting billing zip code extension out of StoredCdr; <$RSRFields>
// "p2pzipcode": "", // template extracting secondary zip code out of StoredCdr; <$RSRFields>
// "p2pplus4": "", // template extracting secondary zip code extension out of StoredCdr; <$RSRFields>
// "units": "^1", // template extracting number of “lines” or unique charges contained within the revenue out of StoredCdr; <$RSRFields>
// "unit_type": "^00", // template extracting number of unique access lines out of StoredCdr; <$RSRFields>
// "tax_included": "^0", // template extracting tax included in revenue out of StoredCdr; <$RSRFields>
// "tax_situs_rule": "^04", // template extracting tax situs rule out of StoredCdr; <$RSRFields>
// "trans_type_code": "^010101", // template extracting transaction type indicator out of StoredCdr; <$RSRFields>
// "sales_type_code": "^R", // template extracting sales type code out of StoredCdr; <$RSRFields>
// "tax_exemption_code_list": "", // template extracting tax exemption code list out of StoredCdr; <$RSRFields>
// },
}

View File

@@ -0,0 +1,190 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: cgrates
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: CGRateS real-time charging system
# Description: Control CGRateS - carrier grade real-time charging system
### END INIT INFO
# Author: DanB <danb@cgrates.org>
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="CGRateS real-time online/offline Charging System"
NAME=cgrates
DAEMON=/usr/bin/cgr-engine
USER=cgrates
GROUP=cgrates
DAEMON_OPTS=""
TUTFOLDER=/usr/share/cgrates/tutorials/asterisk_events/cgrates
TMP_DIR=/tmp/cgr_astevents/cgrates
SCRIPTNAME=$TUTFOLDER/etc/init.d/$NAME
RUNDIR=$TMP_DIR/run
PIDFILE=$RUNDIR/cgr-engine.pid
STACKTRACE=$RUNDIR/$NAME.strace
ENABLE=true
DAEMON_OPTS="-config_dir=$TUTFOLDER/etc/cgrates"
HISTDIR=$TMP_DIR/history
CDREDIR=$TMP_DIR/cdre
CDRCINDIR=$TMP_DIR/cdrc/in
CDRCOUTDIR=$TMP_DIR/cdrc/out
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
if [ "$ENABLE" != "true" ]; then
echo "$DESC not yet configured. Edit $DEFAULTS first."
exit 0
fi
# Install the run folder
if [ ! -d $RUNDIR ]; then
mkdir -p $RUNDIR
touch $STACKTRACE
chown -R $USER:$GROUP $RUNDIR
fi
# Install the cdrc folder
if [ ! -d $CDRCINDIR ]; then
mkdir -p $CDRCINDIR
chown $USER:$GROUP $CDRCINDIR
mkdir -p $CDRCOUTDIR
chown $USER:$GROUP $CDRCOUTDIR
fi
# Install the cdre folder
if [ ! -d $CDREDIR ]; then
mkdir -p $CDREDIR
chown $USER:$GROUP $CDREDIR
fi
# Install the history folder
if [ ! -d $HISTDIR ]; then
mkdir -p $HISTDIR
chown $USER:$GROUP $HISTDIR
fi
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
echo "\n### Started at:" `date`>>$STACKTRACE
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
: