In order to perhaps improve Asterisk performance (use less memory, etc.) I’d like to “noload” the modules not being used.
If I let asterisk run for a while (and all functionality is tested), is it safe to assume that if the module use count (from CLI command module show) is 0 that I can no-load that module? (Which is easily automated vs. manually going through and checking modules one by one against dial plan, etc.)
So that means the only modules in use are ones with use count > 0?
Generally, yes. You have to be careful with dialplan applications and functions though, they can be executed quickly and appear to have a use count of 0 when you check but in reality your dialplan may require them.
No. He is saying that Asterisk increments the use count, then 50 microseconds later decrements it. Modules only show a use count when a call or something else is executing in them.
Relatedly, what causes a module that has a 0 Use Count and is not loaded explicitly in modules.conf to be loaded? I have 246 modules all with Use Count 0:
app_adsiprog.so Asterisk ADSI Programming Application 0 Running deprecated
app_agent_pool.so Call center agent pool applications 0 Running core
app_alarmreceiver.so Alarm Receiver for Asterisk 0 Running extended
app_amd.so Answering Machine Detection Application 0 Running extended
app_attended_transfer.so Attended transfer to the given extension 0 Running extended
app_audiosocket.so AudioSocket Application 0 Running extended
app_authenticate.so Authentication Application 0 Running core
app_blind_transfer.so Blind transfer channel to the given dest 0 Running extended
app_bridgeaddchan.so Bridge Add Channel Application 0 Running core
app_bridgewait.so Place the channel into a holding bridge 0 Running core
app_cdr.so Tell Asterisk to not maintain a CDR for 0 Running core
app_celgenuserevent.so Generate an User-Defined CEL event 0 Running core
app_chanisavail.so Check channel availability 0 Running extended
app_channelredirect.so Redirects a given channel to a dialplan 0 Running core
app_confbridge.so Conference Bridge Application 0 Running core
app_controlplayback.so Control Playback Application 0 Running core
app_db.so Database Access Functions 0 Running core
app_dial.so Dialing Application 0 Running core
app_dictate.so Virtual Dictation Machine 0 Running extended
app_directed_pickup.so Directed Call Pickup Application 0 Running core
app_directory.so Extension Directory 0 Running core
app_disa.so DISA (Direct Inward System Access) Appli 0 Running core
app_dtmfstore.so Technology independent async DTMF storag 0 Running extended
app_dumpchan.so Dump Info About The Calling Channel 0 Running core
app_echo.so Simple Echo Application 0 Running core
app_exec.so Executes dialplan applications 0 Running core
app_externalivr.so External IVR Interface Application 0 Running extended
app_followme.so Find-Me/Follow-Me Application 0 Running core
app_forkcdr.so Fork The CDR into 2 separate entities 0 Running core
app_getcpeid.so Get ADSI CPE ID 0 Running deprecated
app_image.so Image Transmission Application 0 Running deprecated
app_macro.so Extension Macros 0 Running deprecated
app_mf.so Send MF digits Application 0 Running extended
app_milliwatt.so Digital Milliwatt (mu-law) Test Applicat 0 Running core
app_mixmonitor.so Mixed Audio Monitoring Application 0 Running core
app_morsecode.so Morse code 0 Running extended
app_nbscat.so Silly NBS Stream Application 0 Running deprecated
app_originate.so Originate call 0 Running core
app_playback.so Sound File Playback Application 0 Running core
app_playtones.so Playtones Application 0 Running core
app_privacy.so Require phone number to be entered, if n 0 Running core
app_queue.so True Call Queueing 0 Running core
app_read.so Read Variable Application 0 Running core
app_readexten.so Read and evaluate extension validity 0 Running core
app_record.so Trivial Record Application 0 Running core
app_reload.so Reload module(s) 0 Running extended
app_saycounted.so Decline words according to channel langu 0 Running extended
app_sayunixtime.so Say time 0 Running core
app_senddtmf.so Send DTMF digits Application 0 Running core
app_sendtext.so Send Text Applications 0 Running core
app_sms.so SMS/PSTN handler 0 Running extended
app_softhangup.so Hangs up the requested channel 0 Running core
app_speech_utils.so Dialplan Speech Applications 0 Running core
app_stack.so Dialplan subroutines (Gosub, Return, etc 0 Running core
app_stasis.so Stasis dialplan application 0 Running core
app_statsd.so StatsD Dialplan Application 0 Running extended
app_stream_echo.so Stream Echo Application 0 Running core
app_system.so Generic System() application 0 Running core
app_talkdetect.so Playback with Talk Detection 0 Running core
app_test.so Interface Test Application 0 Running extended
app_transfer.so Transfers a caller to another extension 0 Running core
app_url.so Send URL Applications 0 Running deprecated
app_userevent.so Custom User Event Application 0 Running core
app_verbose.so Send verbose output 0 Running core
app_voicemail_imap.so Comedian Mail (Voicemail System) with IM 0 Running core
app_waitforcond.so Wait until condition is true 0 Running extended
app_waitforring.so Waits until first ring after time 0 Running extended
app_waitforsilence.so Wait For Silence/Noise 0 Running extended
app_waituntil.so Wait until specified time 0 Running core
app_while.so While Loops and Conditional Execution 0 Running core
app_zapateller.so Block Telemarketers with Special Informa 0 Running extended
bridge_builtin_interval_features.so Built in bridging interval features 0 Running core
bridge_holding.so Holding bridge module 0 Running core
bridge_native_rtp.so Native RTP bridging module 0 Running core
bridge_simple.so Simple two channel bridging module 0 Running core
bridge_softmix.so Multi-party software based channel mixin 0 Running core
cdr_csv.so Comma Separated Values CDR Backend 0 Running extended
cdr_custom.so Customizable Comma Separated Values CDR 0 Running core
cdr_manager.so Asterisk Manager Interface CDR Backend 0 Running core
cdr_syslog.so Customizable syslog CDR Backend 0 Not Running core
cel_custom.so Customizable Comma Separated Values CEL 0 Running core
cel_manager.so Asterisk Manager Interface CEL Backend 0 Running core
chan_audiosocket.so AudioSocket Channel 0 Running extended
chan_bridge_media.so Bridge Media Channel Driver 0 Running core
chan_iax2.so Inter Asterisk eXchange (Ver 2) 0 Running core
chan_motif.so Motif Jingle Channel Driver 0 Running core
chan_pjsip.so PJSIP Channel Driver 0 Running core
chan_rtp.so RTP Media Channel 0 Running core
codec_a_mu.so A-law and Mulaw direct Coder/Decoder 0 Running core
codec_adpcm.so Adaptive Differential PCM Coder/Decoder 0 Running core
codec_alaw.so A-law Coder/Decoder 0 Running core
codec_codec2.so Codec 2 Coder/Decoder 0 Running core
codec_g722.so ITU G.722-64kbps G722 Transcoder 0 Running core
codec_g726.so ITU G.726-32kbps G726 Transcoder 0 Running core
codec_gsm.so GSM Coder/Decoder 0 Running core
codec_ilbc.so iLBC Coder/Decoder 0 Running core
codec_lpc10.so LPC10 2.4kbps Coder/Decoder 0 Running core
codec_opus.so OPUS Coder/Decoder 0 Running extended
codec_resample.so SLIN Resampling Codec 0 Running core
codec_silk.so Silk Transcoder 0 Running extended
codec_siren14.so ITU G.722.1 Annex C (Siren14, licensed f 0 Running extended
codec_siren7.so ITU G.722.1 (Siren7, licensed from Polyc 0 Running extended
codec_ulaw.so mu-Law Coder/Decoder 0 Running core
format_g719.so ITU G.719 0 Running core
format_g723.so G.723.1 Simple Timestamp File Format 0 Running core
format_g726.so Raw G.726 (16/24/32/40kbps) data 0 Running core
format_g729.so Raw G.729 data 0 Running core
format_gsm.so Raw GSM data 0 Running core
format_h263.so Raw H.263 data 0 Running core
format_h264.so Raw H.264 data 0 Running core
format_ilbc.so Raw iLBC data 0 Running core
format_ogg_opus.so OGG/Opus audio 0 Running core
format_ogg_speex.so OGG/Speex audio 0 Running extended
format_ogg_vorbis.so OGG/Vorbis audio 0 Running core
format_pcm.so Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. 0 Running core
format_siren14.so ITU G.722.1 Annex C (Siren14, licensed f 0 Running core
format_siren7.so ITU G.722.1 (Siren7, licensed from Polyc 0 Running core
format_sln.so Raw Signed Linear Audio support (SLN) 8k 0 Running core
format_vox.so Dialogic VOX (ADPCM) File Format 0 Running extended
format_wav.so Microsoft WAV/WAV16 format (8kHz/16kHz S 0 Running core
format_wav_gsm.so Microsoft WAV format (Proprietary GSM) 0 Running core
func_aes.so AES dialplan functions 0 Running core
func_base64.so base64 encode/decode dialplan functions 0 Running core
func_blacklist.so Look up Caller*ID name/number from black 0 Running core
func_callcompletion.so Call Control Configuration Function 0 Running core
func_callerid.so Party ID related dialplan functions (Cal 0 Running core
func_channel.so Channel information dialplan functions 0 Running core
func_config.so Asterisk configuration file variable acc 0 Running core
func_db.so Database (astdb) related dialplan functi 0 Running core
func_devstate.so Gets or sets a device state in the dialp 0 Running core
func_dialgroup.so Dialgroup dialplan function 0 Running core
func_dialplan.so Dialplan Context/Extension/Priority Chec 0 Running core
func_enum.so ENUM related dialplan functions 0 Running core
func_env.so Environment/filesystem dialplan function 0 Running core
func_extstate.so Gets an extension's state in the dialpla 0 Running core
func_frame_drop.so Function to drop frames on a channel. 0 Running extended
func_frame_trace.so Frame Trace for internal ast_frame debug 0 Running extended
func_global.so Variable dialplan functions 0 Running core
func_hangupcause.so HANGUPCAUSE related functions and applic 0 Running core
func_holdintercept.so Hold interception dialplan function 0 Running core
func_iconv.so Charset conversions 0 Running core
func_lock.so Dialplan mutexes 0 Running core
func_logic.so Logical dialplan functions 0 Running core
func_math.so Mathematical dialplan function 0 Running core
func_md5.so MD5 digest dialplan functions 0 Running core
func_module.so Checks if Asterisk module is loaded in m 0 Running core
func_pitchshift.so Audio Effects Dialplan Functions 0 Running extended
func_pjsip_aor.so Get information about a PJSIP AOR 0 Running core
func_pjsip_contact.so Get information about a PJSIP contact 0 Running core
func_pjsip_endpoint.so Get information about a PJSIP endpoint 0 Running core
func_presencestate.so Gets or sets a presence state in the dia 0 Running core
func_rand.so Random number dialplan function 0 Running core
func_realtime.so Read/Write/Store/Destroy values from a R 0 Running core
func_sayfiles.so Say application files 0 Running core
func_scramble.so Frequency inverting voice scrambler 0 Running core
func_sha1.so SHA-1 computation dialplan function 0 Running core
func_shell.so Collects the output generated by a comma 0 Running core
func_sorcery.so Get a field from a sorcery object 0 Running core
func_speex.so Noise reduction and Automatic Gain Contr 0 Running core
func_sprintf.so SPRINTF dialplan function 0 Running core
func_srv.so SRV related dialplan functions 0 Running core
func_strings.so String handling dialplan functions 0 Running core
func_sysinfo.so System information related functions 0 Running core
func_talkdetect.so Talk detection dialplan function 0 Running core
func_timeout.so Channel timeout dialplan functions 0 Running core
func_version.so Get Asterisk Version/Build Info 0 Running core
func_vmcount.so Indicator for whether a voice mailbox ha 0 Running core
func_volume.so Technology independent volume control 0 Running core
pbx_ael.so Asterisk Extension Language Compiler 0 Running extended
pbx_config.so Text Extension Configuration 0 Running core
pbx_dundi.so Distributed Universal Number Discovery ( 0 Running extended
pbx_loopback.so Loopback Switch 0 Running core
pbx_realtime.so Realtime Switch 0 Running extended
pbx_spool.so Outgoing Spool Support 0 Running core
res_ari_applications.so RESTful API module - Stasis application 0 Running core
res_ari_asterisk.so RESTful API module - Asterisk resources 0 Running core
res_ari_bridges.so RESTful API module - Bridge resources 0 Running core
res_ari_channels.so RESTful API module - Channel resources 0 Running core
res_ari_device_states.so RESTful API module - Device state resour 0 Running core
res_ari_endpoints.so RESTful API module - Endpoint resources 0 Running core
res_ari_events.so RESTful API module - WebSocket resource 0 Running core
res_ari_playbacks.so RESTful API module - Playback control re 0 Running core
res_ari_recordings.so RESTful API module - Recording resources 0 Running core
res_ari_sounds.so RESTful API module - Sound resources 0 Running core
res_chan_stats.so Example of how to use Stasis 0 Running extended
res_clialiases.so CLI Aliases 0 Running core
res_clioriginate.so Call origination and redirection from th 0 Running core
res_convert.so File format conversion CLI command 0 Running core
res_endpoint_stats.so Endpoint statistics 0 Running extended
res_http_media_cache.so HTTP Media Cache Backend 0 Not Running core
res_http_post.so HTTP POST support 0 Running core
res_limit.so Resource limits 0 Running core
res_manager_devicestate.so Manager Device State Topic Forwarder 0 Running core
res_manager_presencestate.so Manager Presence State Topic Forwarder 0 Running core
res_musiconhold.so Music On Hold Resource 0 Running core
res_mutestream.so Mute audio stream resources 0 Running core
res_mwi_devstate.so MWI Device State Subscriptions 0 Running core
res_parking.so Call Parking Resource 0 Running core
res_phoneprov.so HTTP Phone Provisioning 0 Running extended
res_pjsip_acl.so PJSIP ACL Resource 0 Running core
res_pjsip_authenticator_digest.so PJSIP authentication resource 0 Running core
res_pjsip_dialog_info_body_generator.so PJSIP Extension State Dialog Info+XML Pr 0 Running core
res_pjsip_dlg_options.so SIP OPTIONS in dialog handler 0 Running core
res_pjsip_dtmf_info.so PJSIP DTMF INFO Support 0 Running core
res_pjsip_empty_info.so PJSIP Empty INFO Support 0 Running core
res_pjsip_endpoint_identifier_anonymous.so PJSIP Anonymous endpoint identifier 0 Running core
res_pjsip_endpoint_identifier_ip.so PJSIP IP endpoint identifier 0 Running core
res_pjsip_endpoint_identifier_user.so PJSIP username endpoint identifier 0 Running core
res_pjsip_exten_state.so PJSIP Extension State Notifications 0 Running core
res_pjsip_header_funcs.so PJSIP Header Functions 0 Running core
res_pjsip_history.so PJSIP History 0 Running extended
res_pjsip_logger.so PJSIP Packet Logger 0 Running core
res_pjsip_messaging.so PJSIP Messaging Support 0 Running core
res_pjsip_mwi.so PJSIP MWI resource 0 Running core
res_pjsip_mwi_body_generator.so PJSIP MWI resource 0 Running core
res_pjsip_nat.so PJSIP NAT Support 0 Running core
res_pjsip_notify.so CLI/AMI PJSIP NOTIFY Support 0 Running core
res_pjsip_one_touch_record_info.so PJSIP INFO One Touch Recording Support 0 Running core
res_pjsip_outbound_authenticator_digest.so PJSIP authentication resource 0 Running core
res_pjsip_outbound_registration.so PJSIP Outbound Registration Support 0 Running core
res_pjsip_path.so PJSIP Path Header Support 0 Running core
res_pjsip_pidf_body_generator.so PJSIP Extension State PIDF Provider 0 Running core
res_pjsip_pidf_digium_body_supplement.so PJSIP PIDF Sangoma presence supplement 0 Running core
res_pjsip_pidf_eyebeam_body_supplement.so PJSIP PIDF Eyebeam supplement 0 Running core
res_pjsip_publish_asterisk.so PJSIP Asterisk Event PUBLISH Support 0 Running core
res_pjsip_registrar.so PJSIP Registrar Support 0 Running core
res_pjsip_rfc3326.so PJSIP RFC3326 Support 0 Running core
res_pjsip_sdp_rtp.so PJSIP SDP RTP/AVP stream handler 0 Running core
res_pjsip_send_to_voicemail.so PJSIP REFER Send to Voicemail Support 0 Running core
res_pjsip_sips_contact.so UAC SIPS Contact support 0 Running core
res_pjsip_stir_shaken.so PJSIP STIR/SHAKEN Module for Asterisk 0 Not Running core
res_pjsip_t38.so PJSIP T.38 UDPTL Support 0 Running core
res_pjsip_transport_websocket.so PJSIP WebSocket Transport Support 0 Running core
res_pjsip_xpidf_body_generator.so PJSIP Extension State PIDF Provider 0 Running core
res_prometheus.so Asterisk Prometheus Module 0 Running extended
res_realtime.so Realtime Data Lookup/Rewrite 0 Running core
res_remb_modifier.so REMB Modifier Module 0 Running extended
res_rtp_asterisk.so Asterisk RTP Stack 0 Running core
res_security_log.so Security Event Logging 0 Running core
res_sorcery_memory_cache.so Sorcery Memory Cache Object Wizard 0 Running core
res_sorcery_realtime.so Sorcery Realtime Object Wizard 0 Running core
res_srtp.so Secure RTP (SRTP) 0 Running core
res_stir_shaken.so STIR/SHAKEN Module for Asterisk 0 Not Running core
res_stun_monitor.so STUN Network Monitor 0 Running core
res_timing_pthread.so pthread Timing Interface 0 Running extended
res_tonedetect.so Tone detection module 0 Running extended
To the above, it seems like I shouldn’t have to noload them all and then wait to see what breaks because they are only used intermittently.
The documentation on that seems to be pretty lacking. Not just in the sample file but even Configuring the Asterisk Module Loader - Asterisk Project - Asterisk Project Wiki is pretty scant on details. It doesn’t for example say what kind of [negative] behaviour results from setting that to no and/or why I would want to choose yes rather than no.
It predates me, so it’s from a time where documentation and such wasn’t reviewed or anything. Autoload literally means load everything you find, unless explicitly told not to. If you don’t do that… then it’s up to you to determine your entire dependency requirements for module loading.
That seems a pretty wide gap in functionality. Is there no reasonable middle ground where modules (and dependencies) are loaded on demand or at least first use?
Even having a “Total Use Count” on modules would be immensely useful in determining which ones are used at some point in time.
What you see is what there is, and “first use” wouldn’t really work - because in order to know what a module provides you have to then load it, and you have to run through every usage pattern of the system itself.
I’ve also closed the issue. Feature and functionality requests are not currently accepted on the issue tracker. If it’s a project you’d like to undertake yourself, then it could remain open.
It’s unrealistic within the scope of Asterisk to do such a thing. Is it possible? Yes. Is it a ton of work and would likely take months to achieve what someone would reasonably want? Yes.