mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Configuration helper message for errors on parsing files, renamed tutorials/asterisk_events into tutorials/asterisk_ari
This commit is contained in:
15
data/tutorials/asterisk_ari/asterisk/etc/asterisk/README
Executable file
15
data/tutorials/asterisk_ari/asterisk/etc/asterisk/README
Executable 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
|
||||
8
data/tutorials/asterisk_ari/asterisk/etc/asterisk/ari.conf
Executable file
8
data/tutorials/asterisk_ari/asterisk/etc/asterisk/ari.conf
Executable file
@@ -0,0 +1,8 @@
|
||||
[general]
|
||||
enabled = yes
|
||||
allowed_origins = http://cgrates.org
|
||||
|
||||
[cgrates]
|
||||
type = user
|
||||
read_only = no
|
||||
password = CGRateS.org
|
||||
11
data/tutorials/asterisk_ari/asterisk/etc/asterisk/asterisk.conf
Executable file
11
data/tutorials/asterisk_ari/asterisk/etc/asterisk/asterisk.conf
Executable file
@@ -0,0 +1,11 @@
|
||||
[directories]
|
||||
astetcdir => /usr/share/cgrates/tutorials/asterisk_events/asterisk/etc/asterisk
|
||||
astspooldir => /tmp/cgr_astevents/asterisk/spool
|
||||
astlogdir => /tmp/cgr_astevents/asterisk/log
|
||||
astrundir => /tmp/cgr_astevents/asterisk/run
|
||||
|
||||
[options]
|
||||
runuser = asterisk ; The user to run as. The default is root.
|
||||
rungroup = asterisk ; The group to run as. The default is root
|
||||
|
||||
|
||||
7
data/tutorials/asterisk_ari/asterisk/etc/asterisk/cdr.conf
Executable file
7
data/tutorials/asterisk_ari/asterisk/etc/asterisk/cdr.conf
Executable 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
|
||||
4
data/tutorials/asterisk_ari/asterisk/etc/asterisk/cdr_custom.conf
Executable file
4
data/tutorials/asterisk_ari/asterisk/etc/asterisk/cdr_custom.conf
Executable 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)}
|
||||
1
data/tutorials/asterisk_ari/asterisk/etc/asterisk/confbridge.conf
Executable file
1
data/tutorials/asterisk_ari/asterisk/etc/asterisk/confbridge.conf
Executable file
@@ -0,0 +1 @@
|
||||
; All conferences use default settings. This config must be present to load the confbridge application
|
||||
8
data/tutorials/asterisk_ari/asterisk/etc/asterisk/extensions.conf
Executable file
8
data/tutorials/asterisk_ari/asterisk/etc/asterisk/extensions.conf
Executable file
@@ -0,0 +1,8 @@
|
||||
[internal]
|
||||
exten => _1XXX,1,NoOp()
|
||||
same => n,Set(CGRMaxSessionTime=0); use it to disconnect automatically the call if CGRateS is not active
|
||||
same => n,DumpChan()
|
||||
same => n,Stasis(cgrates_auth,cgr_reqtype=*prepaid,cgr_supplier=supplier1)
|
||||
same => n,Dial(PJSIP/${EXTEN},30,L(${CGRMaxSessionTime}))
|
||||
same => n,Hangup()
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[general]
|
||||
enabled = yes
|
||||
bindaddr = 127.0.0.1
|
||||
bindport = 8088
|
||||
19
data/tutorials/asterisk_ari/asterisk/etc/asterisk/indications.conf
Executable file
19
data/tutorials/asterisk_ari/asterisk/etc/asterisk/indications.conf
Executable 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
|
||||
|
||||
9
data/tutorials/asterisk_ari/asterisk/etc/asterisk/logger.conf
Executable file
9
data/tutorials/asterisk_ari/asterisk/etc/asterisk/logger.conf
Executable file
@@ -0,0 +1,9 @@
|
||||
[general]
|
||||
|
||||
[logfiles]
|
||||
|
||||
console = verbose,notice,warning,error
|
||||
|
||||
;messages = notice,warning,error
|
||||
;full = verbose,notice,warning,error,debug
|
||||
;security = security
|
||||
155
data/tutorials/asterisk_ari/asterisk/etc/asterisk/manager.conf
Executable file
155
data/tutorials/asterisk_ari/asterisk/etc/asterisk/manager.conf
Executable 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 = yes
|
||||
;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
|
||||
|
||||
136
data/tutorials/asterisk_ari/asterisk/etc/asterisk/modules.conf
Executable file
136
data/tutorials/asterisk_ari/asterisk/etc/asterisk/modules.conf
Executable file
@@ -0,0 +1,136 @@
|
||||
[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
|
||||
load = app_dumpchan.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
|
||||
|
||||
;ARI
|
||||
load => app_stasis.so
|
||||
load => res_http_websocket.so
|
||||
load => res_stasis.so
|
||||
load => res_stasis_answer.so
|
||||
load => res_stasis_device_state.so
|
||||
load => res_stasis_playback.so
|
||||
load => res_stasis_recording.so
|
||||
load => res_stasis_snoop.so
|
||||
load => res_ari.so
|
||||
load => res_ari_applications.so
|
||||
load => res_ari_asterisk.so
|
||||
load => res_ari_bridges.so
|
||||
load => res_ari_channels.so
|
||||
load => res_ari_device_states.so
|
||||
load => res_ari_endpoints.so
|
||||
load => res_ari_events.so
|
||||
load => res_ari_mailboxes.so
|
||||
load => res_ari_model.so
|
||||
load => res_ari_playbacks.so
|
||||
load => res_ari_recordings.so
|
||||
load => res_ari_sounds.so
|
||||
5
data/tutorials/asterisk_ari/asterisk/etc/asterisk/musiconhold.conf
Executable file
5
data/tutorials/asterisk_ari/asterisk/etc/asterisk/musiconhold.conf
Executable file
@@ -0,0 +1,5 @@
|
||||
[general]
|
||||
|
||||
[default]
|
||||
mode = files
|
||||
directory = moh
|
||||
147
data/tutorials/asterisk_ari/asterisk/etc/asterisk/pjsip.conf
Executable file
147
data/tutorials/asterisk_ari/asterisk/etc/asterisk/pjsip.conf
Executable file
@@ -0,0 +1,147 @@
|
||||
[simpletrans]
|
||||
type=transport
|
||||
protocol=udp
|
||||
bind=0.0.0.0
|
||||
|
||||
[1001]
|
||||
type = endpoint
|
||||
transport = simpletrans
|
||||
context = internal
|
||||
disallow = all
|
||||
allow = ulaw
|
||||
allow = alaw
|
||||
aors = 1001
|
||||
auth = 1001
|
||||
|
||||
[1001]
|
||||
type = aor
|
||||
max_contacts = 5
|
||||
|
||||
[1001]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
username=1001
|
||||
password=CGRateS.org
|
||||
|
||||
[1002]
|
||||
type = endpoint
|
||||
transport = simpletrans
|
||||
context = internal
|
||||
aors = 1002
|
||||
auth = 1002
|
||||
disallow = all
|
||||
allow = ulaw
|
||||
allow = alaw
|
||||
|
||||
[1002]
|
||||
type = aor
|
||||
max_contacts = 5
|
||||
qualify_frequency = 0
|
||||
|
||||
[1002]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
username=1002
|
||||
password=CGRateS.org
|
||||
|
||||
[1003]
|
||||
type = endpoint
|
||||
transport = simpletrans
|
||||
context = internal
|
||||
aors = 1003
|
||||
auth = 1003
|
||||
disallow = all
|
||||
allow = ulaw
|
||||
allow = alaw
|
||||
|
||||
[1003]
|
||||
type = aor
|
||||
max_contacts = 5
|
||||
|
||||
[1003]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
username=1003
|
||||
password=CGRateS.org
|
||||
|
||||
[1004]
|
||||
type = endpoint
|
||||
transport = simpletrans
|
||||
context = internal
|
||||
aors = 1004
|
||||
auth = 1004
|
||||
disallow = all
|
||||
allow = ulaw
|
||||
allow = alaw
|
||||
|
||||
[1004]
|
||||
type = aor
|
||||
max_contacts = 5
|
||||
|
||||
[1004]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
username=1004
|
||||
password=CGRateS.org
|
||||
|
||||
[1005]
|
||||
type = endpoint
|
||||
transport = simpletrans
|
||||
context = internal
|
||||
aors = 1005
|
||||
auth = 1005
|
||||
disallow = all
|
||||
allow = ulaw
|
||||
allow = alaw
|
||||
|
||||
[1005]
|
||||
type = aor
|
||||
max_contacts = 5
|
||||
|
||||
[1005]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
username=1005
|
||||
password=CGRateS.org
|
||||
|
||||
[1006]
|
||||
type = endpoint
|
||||
transport = simpletrans
|
||||
context = internal
|
||||
aors = 1006
|
||||
auth = 1006
|
||||
disallow = all
|
||||
allow = ulaw
|
||||
allow = alaw
|
||||
|
||||
[1006]
|
||||
type = aor
|
||||
max_contacts = 5
|
||||
|
||||
[1006]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
username=1006
|
||||
password=CGRateS.org
|
||||
|
||||
|
||||
[1007]
|
||||
type = endpoint
|
||||
transport = simpletrans
|
||||
context = internal
|
||||
aors = 1007
|
||||
auth = 1007
|
||||
disallow = all
|
||||
allow = ulaw
|
||||
allow = alaw
|
||||
|
||||
[1007]
|
||||
type = aor
|
||||
max_contacts = 5
|
||||
|
||||
[1007]
|
||||
type=auth
|
||||
auth_type=userpass
|
||||
username=1007
|
||||
password=CGRateS.org
|
||||
|
||||
19
data/tutorials/asterisk_ari/asterisk/etc/asterisk/queues.conf
Executable file
19
data/tutorials/asterisk_ari/asterisk/etc/asterisk/queues.conf
Executable 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
|
||||
|
||||
23
data/tutorials/asterisk_ari/asterisk/etc/asterisk/voicemail.conf
Executable file
23
data/tutorials/asterisk_ari/asterisk/etc/asterisk/voicemail.conf
Executable 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
|
||||
168
data/tutorials/asterisk_ari/asterisk/etc/init.d/asterisk
Executable file
168
data/tutorials/asterisk_ari/asterisk/etc/init.d/asterisk
Executable file
@@ -0,0 +1,168 @@
|
||||
#! /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"
|
||||
TUTDIR=/usr/share/cgrates/tutorials/asterisk_events/asterisk
|
||||
TMP_DIR=/tmp/cgr_astevents/asterisk
|
||||
# Full path to asterisk binary
|
||||
DAEMON=/usr/sbin/asterisk
|
||||
ASTVARRUNDIR=$TMP_DIR/run
|
||||
LOGDIR=$TMP_DIR/log
|
||||
CDRDIR=$LOGDIR/cdr-custom
|
||||
SPOOLDIR=$TMP_DIR/spool
|
||||
ALTCONF=$TUTDIR/etc/asterisk/asterisk.conf
|
||||
TRUE=/bin/true
|
||||
AST_USER="asterisk"
|
||||
AST_GROUP="asterisk"
|
||||
VERBOSITY=99
|
||||
|
||||
|
||||
### 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
|
||||
|
||||
if [ ! -d $LOGDIR ]; then
|
||||
mkdir -p $LOGDIR
|
||||
chown -R $AST_USER:$AST_GROUP $LOGDIR
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $CDRDIR ]; then
|
||||
mkdir -p $CDRDIR
|
||||
chown -R $AST_USER:$AST_GROUP $CDRDIR
|
||||
fi
|
||||
|
||||
if [ ! -d $SPOOLDIR ]; then
|
||||
mkdir -p $SPOOLDIR
|
||||
chown -R $AST_USER:$AST_GROUP $SPOOLDIR
|
||||
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="$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
|
||||
141
data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json
Normal file
141
data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json
Normal file
@@ -0,0 +1,141 @@
|
||||
{
|
||||
|
||||
// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
// Copyright (C) ITsysCOM GmbH
|
||||
|
||||
|
||||
|
||||
"rals": {
|
||||
"enabled": true,
|
||||
"cdrstats_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"historys_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"pubsubs_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"users_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"aliases_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
"scheduler": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
|
||||
"cdrs": {
|
||||
"enabled": true, // start the CDR Server service: <true|false>
|
||||
"cdrstats_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
"cdrstats": {
|
||||
"enabled": true, // starts the cdrstats service: <true|false>
|
||||
},
|
||||
|
||||
|
||||
"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)
|
||||
"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_dir": "/tmp/cgr_osipsasync/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":"AccId", "type": "*composed", "value": "OriginID"},
|
||||
{"tag":"ReqType", "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": "*datetime", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
|
||||
{"tag":"AnswerTime", "type": "*datetime", "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
|
||||
},
|
||||
"customer_tpl": {
|
||||
"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)
|
||||
"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": "/tmp/cgr_osipsasync/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":"AccId", "type": "*composed", "value": "OriginID"},
|
||||
{"tag":"ReqType", "type": "*composed", "value": "RequestType"},
|
||||
{"tag":"Tenant", "type": "*composed", "value": "Tenant"},
|
||||
{"tag":"Category", "type": "*composed", "value": "Category"},
|
||||
{"tag":"Subject", "type": "*composed", "value": "Account"},
|
||||
{"tag":"Destination", "type": "*datetime", "value": "~Destination:s/^1(\\d+)/+$1/:s/^\\+(\\d+)/00$1/"},
|
||||
{"tag":"AnswerTime", "type": "*datetime", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
|
||||
{"tag":"Usage", "type": "*composed", "value": "Usage"},
|
||||
{"tag":"Cost", "type": "*composed", "value": "Cost"},
|
||||
],
|
||||
"trailer_fields": [],
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
"sm_generic": {
|
||||
"enabled": true,
|
||||
"debit_interval": "5s", // interval to perform debits on.
|
||||
},
|
||||
|
||||
"sm_asterisk": {
|
||||
"enabled": true, // starts Asterisk SessionManager service: <true|false>
|
||||
"create_cdr": true,
|
||||
},
|
||||
|
||||
|
||||
"historys": {
|
||||
"enabled": true, // starts History service: <true|false>.
|
||||
"history_dir": "/tmp/cgr_osipsasync/cgrates/history", // location on disk where to store history files.
|
||||
},
|
||||
|
||||
|
||||
"pubsubs": {
|
||||
"enabled": true, // starts PubSub service: <true|false>.
|
||||
},
|
||||
|
||||
|
||||
"aliases": {
|
||||
"enabled": true, // starts PubSub service: <true|false>.
|
||||
},
|
||||
|
||||
|
||||
"users": {
|
||||
"enabled": true, // starts User service: <true|false>.
|
||||
"indexes": ["Uuid"], // user profile field indexes
|
||||
},
|
||||
|
||||
}
|
||||
190
data/tutorials/asterisk_ari/cgrates/etc/init.d/cgrates
Executable file
190
data/tutorials/asterisk_ari/cgrates/etc/init.d/cgrates
Executable 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
|
||||
|
||||
:
|
||||
Reference in New Issue
Block a user