diff --git a/.gitignore b/.gitignore index 24c6aa9..e6553a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ +# Ignore other config files in base directory. +./*.conf + +# Ignore asterisk backup directory. +./backup +./asterisk_backup + # ---> Linux *~ diff --git a/README.md b/README.md index e6329e2..ad892ea 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,19 @@ As of Debian 12 Bookworm, Debian no longer has packages for Asterisk :(. ### Using this Configuration -I have remade this repository many times in a vain attempt to keep it -neat and tidy but I've realised that just having the configuration files -as they appear on the filesystem is the most sane option. -Is it the best option? No way, but it does mean you can now just git -clone this repo into your /etc/asterisk directory. +Decide which configuration (directory) you want. -So as a sudo user (or root).. +- start: Just enough to make Asterisk start. +- wip: The current work-in-progress configuration. + +As a sudo user (or root).. ``` # After installing Asterisk (See the above Unit193 link for instructions # on how to add the repo). -apt install git +apt install git asterisk systemctl stop asterisk @@ -37,7 +36,10 @@ mv -v ./* ../asterisk_backup git clone https://markc.net/mpmc/asterisk.git . # ↑↑ -# modify then run `fix_permissions.sh` to fix permissions. +# Copy desired configuration from sub directory. +cp -v ./start/*.conf . + +# Modify then run `fix_permissions.sh` to fix permissions. bash ./fix_permissions.sh` ``` diff --git a/asterisk.conf b/start/asterisk.conf similarity index 100% rename from asterisk.conf rename to start/asterisk.conf diff --git a/logger.conf b/start/logger.conf similarity index 100% rename from logger.conf rename to start/logger.conf diff --git a/modules.conf b/start/modules.conf similarity index 100% rename from modules.conf rename to start/modules.conf diff --git a/wip/asterisk.conf b/wip/asterisk.conf new file mode 100644 index 0000000..1b72ea6 --- /dev/null +++ b/wip/asterisk.conf @@ -0,0 +1,155 @@ +;) /etc/asterisk/asterisk.conf + +[directories](!) +;) These directories aren't always correct. Make sure the section +;) matches with the example asterisk.conf configuration that came with +;) your asterisk package. + +astcachedir => /var/cache/asterisk +astetcdir => /etc/asterisk + +;) Seriously double check the modules directory is correct. +;)astmoddir => /usr/lib/x86_64-linux-gnu/asterisk/modules + +astmoddir => /usr/lib/aarch64-linux-gnu/asterisk/modules + +astvarlibdir => /var/lib/asterisk +astdbdir => /var/lib/asterisk +astkeydir => /var/lib/asterisk +astdatadir => /usr/share/asterisk +astagidir => /usr/share/asterisk/agi-bin +astspooldir => /var/spool/asterisk +astrundir => /var/run/asterisk +astlogdir => /var/log/asterisk +astsbindir => /usr/sbin + +[options] +;verbose = 3 +;debug = 3 +;trace = 0 ; Set the trace level. +;refdebug = yes ; Enable reference count debug logging. +;alwaysfork = yes ; Same as -F at startup. +;nofork = yes ; Same as -f at startup. +;quiet = yes ; Same as -q at startup. +;timestamp = yes ; Same as -T at startup. +;execincludes = yes ; Support #exec in config files. +;console = yes ; Run as console (same as -c at startup). +;highpriority = yes ; Run realtime priority (same as -p at + ; startup). +;initcrypto = yes ; Initialize crypto keys (same as -i at + ; startup). +;nocolor = yes ; Disable console colors. +;dontwarn = yes ; Disable some warnings. +;dumpcore = yes ; Dump core on crash (same as -g at startup). +;languageprefix = yes ; Use the new sound prefix path syntax. +;systemname = my_system_name ; Prefix uniqueid with a system name for + ; Global uniqueness issues. +;autosystemname = yes ; Automatically set systemname to hostname, + ; uses 'localhost' on failure, or systemname if + ; set. +;mindtmfduration = 80 ; Set minimum DTMF duration in ms (default 80 ms) + ; If we get shorter DTMF messages, these will be + ; changed to the minimum duration +;maxcalls = 10 ; Maximum amount of calls allowed. +;maxload = 0.9 ; Asterisk stops accepting new calls if the + ; load average exceed this limit. +;maxfiles = 1000 ; Maximum amount of openfiles. +;minmemfree = 1 ; In MBs, Asterisk stops accepting new calls if + ; the amount of free memory falls below this + ; watermark. +;cache_media_frames = yes ; Cache media frames for performance + ; Disable this option to help track down media frame + ; mismanagement when using valgrind or MALLOC_DEBUG. + ; The cache gets in the way of determining if the + ; frame is used after being freed and who freed it. + ; NOTE: This option has no effect when Asterisk is + ; compiled with the LOW_MEMORY compile time option + ; enabled because the cache code does not exist. + ; Default yes +;cache_record_files = yes ; Cache recorded sound files to another + ; directory during recording. +;record_cache_dir = /tmp ; Specify cache directory (used in conjunction + ; with cache_record_files). +;transmit_silence = yes ; Transmit silence while a channel is in a + ; waiting state, a recording only state, or + ; when DTMF is being generated. Note that the + ; silence internally is generated in raw signed + ; linear format. This means that it must be + ; transcoded into the native format of the + ; channel before it can be sent to the device. + ; It is for this reason that this is optional, + ; as it may result in requiring a temporary + ; codec translation path for a channel that may + ; not otherwise require one. +;transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of + ; directly. +;runuser = asterisk ; The user to run as. +;rungroup = asterisk ; The group to run as. + +;) The user to run as. +runuser = asterisk + +;) The group to run as. +rungroup = asterisk + +;lightbackground = yes ; If your terminal is set for a light-colored + ; background. +;forceblackbackground = yes ; Force the background of the terminal to be + ; black, in order for terminal colors to show + ; up properly. +;defaultlanguage = en ; Default language +;documentation_language = en_US ; Set the language you want documentation + ; displayed in. Value is in the same format as + ; locale names. +;hideconnect = yes ; Hide messages displayed when a remote console + ; connects and disconnects. +;lockconfdir = no ; Protect the directory containing the + ; configuration files (/etc/asterisk) with a + ; lock. +;stdexten = gosub ; How to invoke the extensions.conf stdexten. + ; macro - Invoke the stdexten using a macro as + ; done by legacy Asterisk versions. + ; gosub - Invoke the stdexten using a gosub as + ; documented in extensions.conf.sample. + ; Default gosub. +;live_dangerously = no ; Enable the execution of 'dangerous' dialplan + ; functions and configuration file access from + ; external sources (AMI, etc.) These functions + ; (such as SHELL) are considered dangerous + ; because they can allow privilege escalation. + ; Configuration files are considered dangerous + ; if they exist outside of the Asterisk + ; configuration directory. + ; Default no +;entityid=00:11:22:33:44:55 ; Entity ID. + ; This is in the form of a MAC address. + ; It should be universally unique. + ; It must be unique between servers communicating + ; with a protocol that uses this value. + ; This is currently is used by DUNDi and + ; Exchanging Device and Mailbox State + ; using protocols: XMPP, Corosync and PJSIP. +;rtp_use_dynamic = yes ; When set to "yes" RTP dynamic payload types + ; are assigned dynamically per RTP instance vs. + ; allowing Asterisk to globally initialize them + ; to pre-designated numbers (defaults to "yes"). +;rtp_pt_dynamic = 35 ; Normally the Dynamic RTP Payload Type numbers + ; are 96-127, which allow just 32 formats. The + ; starting point 35 enables the range 35-63 and + ; allows 29 additional formats. When you use + ; more than 32 formats in the dynamic range and + ; calls are not accepted by a remote + ; implementation, please report this and go + ; back to value 96. +;hide_messaging_ami_events = no; This option, if enabled, will + ; suppress all of the Message/ast_msg_queue channel's + ; housekeeping AMI and ARI channel events. This can + ; reduce the load on the manager and ARI applications + ; when the Digium Phone Module for Asterisk is in use. + +; Changing the following lines may compromise your security. +;[files] +;astctlpermissions = 0660 +;astctlowner = root +;astctlgroup = apache +;astctl = asterisk.ctl diff --git a/extensions.conf b/wip/extensions.conf similarity index 100% rename from extensions.conf rename to wip/extensions.conf diff --git a/indications.conf b/wip/indications.conf similarity index 100% rename from indications.conf rename to wip/indications.conf diff --git a/wip/logger.conf b/wip/logger.conf new file mode 100644 index 0000000..05e839f --- /dev/null +++ b/wip/logger.conf @@ -0,0 +1,187 @@ +;) /etc/asterisk/logger.conf +; +; Logging Configuration +; +; In this file, you configure logging to files or to +; the syslog system. +; +; "logger reload" at the CLI will reload configuration +; of the logging system. + +[general] +; +; Customize the display of debug message time stamps +; this example is the ISO 8601 date format (yyyy-mm-dd HH:MM:SS) +; +; see strftime(3) Linux manual for format specifiers. Note that there is also +; a fractional second parameter which may be used in this field. Use %1q +; for tenths, %2q for hundredths, etc. +; +;dateformat=%F %T ; ISO 8601 date format +;dateformat=%F %T.%3q ; with milliseconds +; +; +; This makes Asterisk write callids to log messages +; (defaults to yes) +;use_callids = no +; +; This appends the hostname to the name of the log files. +;appendhostname = yes +; +; This determines whether or not we log queue events to a file +; (defaults to yes). +;queue_log = no +; +; Determines whether the queue_log always goes to a file, even +; when a realtime backend is present (defaults to no). +;queue_log_to_file = yes +; +; Set the queue_log filename +; (defaults to queue_log) +;queue_log_name = queue_log +; +; When using realtime for the queue log, use GMT for the timestamp +; instead of localtime. The default of this option is 'no'. +;queue_log_realtime_use_gmt = yes +; +; Log rotation strategy: +; none: Do not perform any logrotation at all. You should make +; very sure to set up some external logrotate mechanism +; as the asterisk logs can get very large, very quickly. +; sequential: Rename archived logs in order, such that the newest +; has the highest sequence number [default]. When +; exec_after_rotate is set, ${filename} will specify +; the new archived logfile. +; rotate: Rotate all the old files, such that the oldest has the +; highest sequence number [this is the expected behavior +; for Unix administrators]. When exec_after_rotate is +; set, ${filename} will specify the original root filename. +; timestamp: Rename the logfiles using a timestamp instead of a +; sequence number when "logger rotate" is executed. +; When exec_after_rotate is set, ${filename} will +; specify the new archived logfile. +;rotatestrategy = rotate +; +; Run a system command after rotating the files. This is mainly +; useful for rotatestrategy=rotate. The example allows the last +; two archive files to remain uncompressed, but after that point, +; they are compressed on disk. +; +; exec_after_rotate=gzip -9 ${filename}.2 +; +; +; For each file, specify what to log. +; +; For console logging, you set options at start of +; Asterisk with -v for verbose and -d for debug +; See 'asterisk -h' for more information. +; +; Directory for log files is configures in asterisk.conf +; option astlogdir +; +; All log messages go to a queue serviced by a single thread +; which does all the IO. This setting controls how big that +; queue can get (and therefore how much memory is allocated) +; before new messages are discarded. +; The default is 1000 +;logger_queue_limit = 250 +; +; Any custom logging levels you may want to use, which can then +; be sent to logging channels. The maximum number of custom +; levels is 16, but not all of these may be available if modules +; in Asterisk define their own. +;custom_levels = foobar,important,compliance +; +[logfiles] +; +; Format is: +; +; logger_name => [formatter]levels +; +; The name of the logger dictates not only the name of the logging +; channel, but also its type. Valid types are: +; - 'console' - The root console of Asterisk +; - 'syslog' - Linux syslog, with facilities specified afterwards with +; a period delimiter, e.g., 'syslog.local0' +; - 'filename' - The name of the log file to create. This is the default +; for log channels. +; +; Filenames can either be relative to the standard Asterisk log directory +; (see 'astlogdir' in asterisk.conf), or absolute paths that begin with +; '/'. +; +; An optional formatter can be specified prior to the log levels sent +; to the log channel. The formatter is defined immediately preceeding the +; levels, and is enclosed in square brackets. Valid formatters are: +; - [default] - The default formatter, this outputs log messages using a +; human readable format. +; - [plain] - The plain formatter, this outputs log messages using a +; human readable format with the addition of function name +; and line number. No color escape codes are ever printed +; nor are verbose messages treated specially. +; - [json] - Log the output in JSON. Note that JSON formatted log entries, +; if specified for a logger type of 'console', will be formatted +; per the 'default' formatter for log messages of type VERBOSE. +; This is due to the remote consoles interpreting verbosity +; outside of the logging subsystem. +; +; Log levels include the following, and are specified in a comma delineated +; list: +; debug +; trace +; notice +; warning +; error +; verbose() +; dtmf +; fax +; security +; +; +; Verbose takes an optional argument, in the form of an integer level. The +; verbose level can be set per logfile. Verbose messages with higher levels +; will not be logged to the file. If the verbose level is not specified, it +; will log verbose messages following the current level of the root console. +; +; Debug has multiple levels like verbose. However, it is a system wide setting +; and cannot be specified per logfile. You specify the debug level elsewhere +; such as the CLI 'core set debug 3', starting Asterisk with '-ddd', or in +; asterisk.conf 'debug=3'. +; +; Special level name "*" means all levels, even dynamic levels registered +; by modules after the logger has been initialized (this means that loading +; and unloading modules that create/remove dynamic logger levels will result +; in these levels being included on filenames that have a level name of "*", +; without any need to perform a 'logger reload' or similar operation). +; Note that there is no value in specifying both "*" and specific level names +; for a filename; the "*" level means all levels. The only exception is if +; you need to specify a specific verbose level. e.g, "verbose(3),*". +; +; We highly recommend that you DO NOT turn on debug mode if you are simply +; running a production system. Debug mode turns on a LOT of extra messages, +; most of which you are unlikely to understand without an understanding of +; the underlying code. Do NOT report debug messages as code issues, unless +; you have a specific issue that you are attempting to debug. They are +; messages for just that -- debugging -- and do not rise to the level of +; something that merit your attention as an Asterisk administrator. Both +; debug and trace messages are also very verbose and can and do fill up +; logfiles quickly. This is another reason not to have debug or trace +; modes on a production system unless you are in the process of debugging +; a specific issue. +; +;debug.log => error,warning,notice,verbose,debug +;trace.log => trace +;security.log => security +console => notice,warning,error +;console => notice,warning,error,debug +messages.log => notice,warning,error +;full.log => notice,warning,error,debug,verbose,dtmf,fax +; +;full-json.log => [json]debug,verbose,notice,warning,error,dtmf,fax +; +;syslog keyword : This special keyword logs to syslog facility +; +;syslog.local0 => notice,warning,error +; +; A log level defined in 'custom_levels' above +;important.log = important diff --git a/wip/modules.conf b/wip/modules.conf new file mode 100644 index 0000000..404b906 --- /dev/null +++ b/wip/modules.conf @@ -0,0 +1,80 @@ +;) /etc/asterisk/modules.conf + +; +; Asterisk configuration file +; +; Module Loader configuration file +; + +[modules] +autoload=yes +; +; Any modules that need to be loaded before the Asterisk core has been +; initialized (just after the logger has been initialized) can be loaded +; using 'preload'. This will frequently be needed if you wish to map all +; module configuration files into Realtime storage, since the Realtime +; driver will need to be loaded before the modules using those configuration +; files are initialized. +; + +;) We don't need imap or odbc. +noload = app_voicemail_imap.so +noload = app_voicemail_odbc.so + +; An example of loading ODBC support would be: +;preload => res_odbc.so +;preload => res_config_odbc.so +; +; If you want, load the GTK console right away. +; Don't load the KDE console since +; it's not as sophisticated right now. +; +noload => pbx_gtkconsole.so +;load => pbx_gtkconsole.so +noload => pbx_kdeconsole.so +; +; Intercom application is obsoleted by +; chan_oss. Don't load it. +; +noload => app_intercom.so +; +; The 'modem' channel driver and its subdrivers are +; obsolete, don't load them. +; +noload => chan_modem.so +noload => chan_modem_aopen.so +noload => chan_modem_bestdata.so +noload => chan_modem_i4l.so +; +; Comment this out (after installing CAPI middleware and hardware +; drivers) if you have CAPI-able hardware and wish to use it in +; Asterisk. +; +noload => chan_capi.so +; +load => res_musiconhold.so +; +; Do not load load local channel drivers (using the system speaker) by default, +; they are not used in most installations and might block the sound hardware +; +noload => chan_alsa.so +noload => chan_console.so +noload => chan_oss.so +; +; Disable CDR logging to SQLite by default since it writes unconditionally to +; cdr.db without a way to rotate it. +; +noload => cdr_sqlite.so +; +; These conflict with app_directory.so and each other. +noload => app_directory_odbc.so +; +; Enable these if you want to configure Asterisk in a database +; +noload => res_config_odbc.so +noload => res_config_pgsql.so +; +; Module names listed in "global" section will have symbols globally +; exported to modules loaded after them. +; +[global] diff --git a/pjsip.conf b/wip/pjsip.conf similarity index 100% rename from pjsip.conf rename to wip/pjsip.conf diff --git a/pjsip_wizard.conf b/wip/pjsip_wizard.conf similarity index 100% rename from pjsip_wizard.conf rename to wip/pjsip_wizard.conf diff --git a/pjsip_wizard_users.conf b/wip/pjsip_wizard_users.conf similarity index 100% rename from pjsip_wizard_users.conf rename to wip/pjsip_wizard_users.conf diff --git a/quectel.conf b/wip/quectel.conf similarity index 100% rename from quectel.conf rename to wip/quectel.conf diff --git a/res_stun_monitor.conf b/wip/res_stun_monitor.conf similarity index 100% rename from res_stun_monitor.conf rename to wip/res_stun_monitor.conf diff --git a/rtp.conf b/wip/rtp.conf similarity index 100% rename from rtp.conf rename to wip/rtp.conf diff --git a/voicemail.conf b/wip/voicemail.conf similarity index 100% rename from voicemail.conf rename to wip/voicemail.conf