summaryrefslogtreecommitdiff
path: root/main/loader.c
AgeCommit message (Collapse)Author
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-03-27core: Remove embedded module supportSean Bright
This has not worked for some time and is no longer actively maintained. Change-Id: I5110b0db69c152761b58fa025cb0a53b0e544d99
2016-10-28Fix shutdown crash caused by modules being left open.Corey Farrell
It is only safe to run ast_register_cleanup callbacks when all modules have been unloaded. Previously these callbacks were run during graceful shutdown, making it possible to crash during shutdown. ASTERISK-26513 #close Change-Id: Ibfa635bb688d1227ec54aa211d90d6bd45052e21
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-09-15sd_notify (systemd status notifications) supportTzafrir Cohen
sd_notify() is used to notify systemd of changes to the status of the process. This allows the systemd daemon to know when the process finished loading (and thus only start another program after Asterisk has finished loading). To use this, use a systemd unit with 'Type=notify' for Asterisk. This commit also adds the function ast_sd_notify(), a wrapper around sd_notify that does nothing if not built with systemd support. Also adds support for libsystemd detection in the configure script. Change-Id: Ied6a59dafd5ef331c5c7ae8f3ccd2dfc94be7811
2016-03-03loader: Retry dlopen when loading failsGeorge Joseph
Although we use the RTLD_LAZY flag when calling dlopen the first time on a module, this only defers resolution for function calls. Pointer references to functions are determined at link time so dlopen expects them to be there. Since we don't cross-module link, pointers to functions in other modules won't be available and dlopen will fail. Doing a "hardened" build also causes problems because it typically sets "-z now" on the ld command line which overrides RTLD_LAZY at run time. If the failing module isn't a GLOBAL_SYMBOLS module, then dlopen will be called again after all the GLOBAL_SYMBOLS modules have been loaded and they'll eventually resolve. If the calling module IS a GLOBAL_SYMBOLS module itself and a third module depends on it, then there's an issue because the second time through the dlopen loop, GLOBAL_SYMBOLS modules aren't given any special treatment and since the order in which dlopen is called isn't deterministic, the dependent may again be tried before the module it needs is loaded. Simple solution: Save modules that fail load_resource because of a dlopen error in a list and retry them immediately after the first pass. Keep retrying until the failed list is empty or we reach a #defined max retries. Error messages are suppressed until the final pass which also gets rid of those confusing error messages about module failures that are later corrected. Change-Id: Iddae1d97cd2f00b94e61662447432765755f64bb
2015-12-16json: Audit ast_json_* usage for thread safety.Joshua Colp
The JSON library Asterisk uses, jansson, is not thread safe for us in a few ways. To help with this wrappers for JSON object reference count increasing and decreasing were added which use a global lock to ensure they don't clobber over each other. This does not extend to reference count manipulation within the jansson library itself. This means you can't safely use the object borrowing specifier (O) in ast_json_pack and you can't share JSON instances between objects. This change removes uses of the O specifier and replaces them with the o specifier and an explicit ast_json_ref. Some cases of instance sharing have also been removed. ASTERISK-25601 #close Change-Id: I06550d8b0cc1bfeb56cab580a4e608ae4f1ec7d1
2015-07-13ARI: Added new functionality to get information on a single module.Benjamin Ford
An http request can be sent to retrieve information on a single module, including the resource name, description, use count, status, and support level. The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari /asterisk/modules/{moduleName}'" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Information on a single module can now be retrieved ASTERISK-25173 Change-Id: Ibce5a94e70ecdf4e90329cf0ba66c33a62d37463
2015-07-10ARI: Added new functionality to get all module information.Benjamin Ford
An http request can be sent to retrieve a list of all existing modules, including the resource name, description, use count, status, and support level. The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari/ asterisk/modules" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Information on modules can now be retrieved Change-Id: I63cbbf0ec0c3544cc45ed2a588dceabe91c5e0b0
2015-04-27Astobj2: Allow reference debugging to be enabled/disabled by config.Corey Farrell
* The REF_DEBUG compiler flag no longer has any effect on code that uses Astobj2. It is used to determine if reference debugging is enabled by default. Reference debugging can be enabled or disabled in asterisk.conf. * Caller information is provided in logger errors for ao2 bad magic numbers. * Optimizes AO2 by merging internal functions with the public counterpart. This was possible now that we no longer require a dual ABI. ASTERISK-24974 #close Reported by: Corey Farrell Change-Id: Icf3552721fe999365ba8a8cf00a965aa6b897cc1
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-09loader/main: Don't set ast_fully_booted until deferred reloads are processedGeorge Joseph
Until we have a true module management facility it's sometimes necessary for one module to force a reload on another before its own load is complete. If Asterisk isn't fully booted yet, these reloads are deferred. The problem is that asterisk reports fully booted before processing the deferred reloads which means Asterisk really isn't quite ready when it says it is. This patch moves the report of fully booted after the processing of the deferred reloads is complete. Since the pjsip stack has the most number of related modules, I ran the channels/pjsip testsuite to make sure there aren't any issues. All tests passed. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4604/ ........ Merged revisions 434544 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-22Fix compilation issues for OpenBSDMatthew Jordan
This patch addresses compilation issues for OpenBSD. Specifically, it addresses: * It allows including <sys/vmmeter.h> in asterisk.c * Provides a needed (size_t) cast in xmldoc.c In 13+, it also addresses a conditional inclusion in loader.c. Review: https://reviewboard.asterisk.org/r/4506 ASTERISK-24880 #close Reported by: snuffy Tested by: snuffy patches: misc-openbsd.diff uploaded by snuffy (License 5024) ........ Merged revisions 433245 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433247 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21Allow shutdown to unload modules that register bucket scheme's or codec's.Corey Farrell
* Change __ast_module_shutdown_ref to be NULL safe (11+). * Allow modules that call ast_bucket_scheme_register or ast_codec_register to be unloaded during graceful shutdown only (13+ only). ASTERISK-24796 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4428/ ........ Merged revisions 432058 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432059 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11Enable REF_DEBUG for ast_module_ref / ast_module_unref.Corey Farrell
Add ast_module_shutdown_ref for use by modules that can only be unloaded during graceful shutdown. When REF_DEBUG is enabled: * Add an empty ao2 object to struct ast_module. * Allocate ao2 object when the module is loaded. * Perform an ao2_ref in each place where mod->usecount is manipulated. * ao2_cleanup on module unload. ASTERISK-24479 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4141/ ........ Merged revisions 431662 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 431663 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-17Fix printf problems with high ascii characters after r413586 (1.8).Walter Doekes
In r413586 (1.8) various casts were added to silence gcc 4.10 warnings. Those fixes included things like: -out += sprintf(out, "%%%02X", (unsigned char) *ptr); +out += sprintf(out, "%%%02X", (unsigned) *ptr); That works for low ascii characters, but for the high range that yields e.g. FFFFFFC3 when C3 is expected. This changeset: - fixes those casts to use the 'hh' unsigned char modifier instead - consistently uses %02x instead of %2.2x (or other non-standard usage) - adds a few 'h' modifiers in various places - fixes a 'replcaes' typo - dev/urandon typo (in 13+ patch) Review: https://reviewboard.asterisk.org/r/4263/ ASTERISK-24619 #close Reported by: Stefan27 (on IRC) ........ Merged revisions 429673 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 429674 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 429675 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-26core: Don't allow free to mean ast_free (and malloc, etc..).Walter Doekes
This gets rid of most old libc free/malloc/realloc and replaces them with ast_free and friends. When compiling with MALLOC_DEBUG you'll notice it when you're mistakenly using one of the libc variants. For the legacy cases you can define WRAP_LIBC_MALLOC before including asterisk.h. Even better would be if the errors were also enabled when compiling without MALLOC_DEBUG, but that's a slightly more invasive header file change. Those compiling addons/format_mp3 will need to rerun ./contrib/scripts/get_mp3_source.sh. ASTERISK-24348 #related Review: https://reviewboard.asterisk.org/r/4015/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06Stasis: Allow message types to be blockedKinsey Moore
This introduces stasis.conf and a mechanism to prevent certain message types from being published. Internally, this works by preventing the chosen message types from being created which ensures that those message types can never be published. This patch also adjusts message publishers such that message payloads are not created if the related message type is not available. ASTERISK-23943 #close Review: https://reviewboard.asterisk.org/r/3823/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25loader: Fix an infinite loop when printing modules using "module show".Joshua Colp
When creating the alphabetical sorted list each module is added to a list temporarily. On the second iteration each module already has a pointer to another module, causing stuff to go into a loop. ASTERISK-24123 #close Reported by: Malcolm Davenport git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419612 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25module loader: Unload modules in reverse order of their start orderMatthew Jordan
When Asterisk starts a module (calling its load_module function), it re-orders the module list, sorting it alphabetically. Ostensibly, this was done so that the output of 'module show' listed modules in alphabetic order. This had the unfortunate side effect of making modules with complex usage patterns unloadable. A module that has a large number of modules that depend on it is typically abandoned during the unloading process. This results in its memory not being reclaimed during exit. Generally, this isn't harmful - when the process is destroyed, the operating system will reclaim all memory allocated by the process. Prior to Asterisk 12, we also didn't have many modules with complex dependencies. However, with the advent of ARI and PJSIP, this can make make unloading those modules successfully nearly impossible, and thus tracking memory leaks or ref debug leaks a real pain. While this patch is not a complete overhaul of the module loader - such an effort would be beyond the scope of what could be done for Asterisk 13 - this does make some marginal improvements to the loader such that modules like res_pjsip or res_stasis *may* be made properly un-loadable in the future. 1. The linked list of modules has been replaced with a doubly linked list. This allows traversal of the module list to occur backwards. The module shutdown routine now walks the global list backwards when it attempts to unload modules. 2. The alphabetic reorganization of the module list on startup has been removed. Instead, a started module is placed at the end of the module list. 3. The ast_update_module_list function - which is used by the CLI to display the modules - now does the sorting alphabetically itself. It creates its own linked list and inserts the modules into it in alphabetic order. This allows for the intent of the previous code to be maintained. This patch also contains a fix for res_calendar. Without calendar.conf, the calendar modules were improperly bumping the use count of res_calendar, then failing to load themselves. This patch makes it so that we detect whether or not calendaring is enabled before altering the use count. Review: https://reviewboard.asterisk.org/r/3777/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419563 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messagesMatthew Jordan
This patch addresses some aesthetic issues in Asterisk. These are all just minor tweaks to improve the look of the CLI when used in a variety of settings. Specifically: * A number of chatty verbose messages were removed or demoted to DEBUG messages. Verbose messages with a verbosity level of 5 or higher were - if kept as verbose messages - demoted to level 4. Several messages that were emitted at verbose level 3 were demoted to 4, as announcement of dialplan applications being executed occur at level 3 (and so the effects of those applications should generally be less). * Some verbose messages that only appear when their respective 'debug' options are enabled were bumped up to always be displayed. * Prefix/timestamping of verbose messages were moved to the verboser handlers. This was done to prevent duplication of prefixes when the timestamp option (-T) is used with the CLI. * Verbose magic is removed from messages before being emitted to non-verboser handlers. This prevents the magic in multi-line verbose messages (such as SIP debug traces or the output of DumpChan) from being written to files. * _Slightly_ better support for the "light background" option (-W) was added. This includes using ast_term_quit in the output of XML documentation help, as well as changing the "Asterisk Ready" prompt to bright green on the default background (which stands a better chance of being displayed properly than bright white). Review: https://reviewboard.asterisk.org/r/3547/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-31core/loader: Don't call dlclose in a while loopMatthew Jordan
For awhile now, we've noticed continuous integration builds hanging on CentOS 6 64-bit build agents. After resolving a number of problems with symbols, strange locks, and other shenanigans, the problem has persisted. In all cases, gdb shows the Asterisk process stuck in loader.c on one of the infinite while loops that calls dlclose repeatedly until success. The documentation of dlclose states that it returns 0 on success; any other value on error. It does not state that repeatedly calling it will eventually clear those errors. Most likely, the repeated calls to dlclose was to force a close by exhausting the references on the library; however, that will never succeed if: (a) There is some fundamental error at work in the loaded library that precludes unloading it (b) Some other loaded module is referencing a symbol in the currently loaded module This results in Asterisk sitting forever. Since we have matching pairs of dlopen/dlclose, this patch opts to only call dlclose once, and log out as an ERROR if dlclose fails to return success. If nothing else, this might help to determine why on the CentOS 6 64-bit build agent things are not closing successfully. Review: https://reviewboard.asterisk.org/r/2970 ........ Merged revisions 402287 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 402288 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 402289 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30optional_api: Fix linking problems between modules that export global symbolsDavid M. Lee
With the new work in Asterisk 12, there are some uses of the optional_api that are prone to failure. The details are rather involved, and captured on [the wiki][1]. This patch addresses the issue by removing almost all of the magic from the optional API implementation. Instead of relying on weak symbol resolution, a new optional_api.c module was added to Asterisk core. For modules providing an optional API, the pointer to the implementation function is registered with the core. For modules that use an optional API, a pointer to a stub function, along with a optional_ref function pointer are registered with the core. The optional_ref function pointers is set to the implementation function when it's provided, or the stub function when it's now. Since the implementation no longer relies on magic, it is now supported on all platforms. In the spirit of choice, an OPTIONAL_API flag was added, so we can disable the optional_api if needed (maybe it's buggy on some bizarre platform I haven't tested on) The AST_OPTIONAL_API*() macros themselves remained unchanged, so existing code could remain unchanged. But to help with debugging the optional_api, the patch limits the #include of optional API's to just the modules using the API. This also reduces resource waste maintaining optional_ref pointers that aren't used. Other changes made as a part of this patch: * The stubs for http_websocket that wrap system calls set errno to ENOSYS. * res_http_websocket now properly increments module use count. * In loader.c, the while() wrappers around dlclose() were removed. The while(!dlclose()) is actually an anti-pattern, which can lead to infinite loops if the module you're attempting to unload exports a symbol that was directly linked to. * The special handling of nonoptreq on systems without weak symbol support was removed, since we no longer rely on weak symbols for optional_api. [1]: https://wiki.asterisk.org/wiki/x/wACUAQ (closes issue ASTERISK-22296) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2797/ ........ Merged revisions 397989 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16Improve sounds indexer CLI commandsKinsey Moore
This reworks the CLI commands used to access sounds information from "sounds show[ soundid]" to "core show sounds" and "core show sound <soundid>". This also reworks the "sounds reload" CLI command to fall under normal module reloading ("module reload sounds"). Also, make trunk build when DEBUG_MALLOC is not enabled. Review: https://reviewboard.asterisk.org/r/2745/ (closes issue ASTERISK-22141) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396829 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-29Put the include in thereMatthew Jordan
Mea culpa... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-29When performing a reload, reload the new features_config and not the oldMatthew Jordan
Performing a module reload of core components causes specific functions compiled into the Asterisk binary to be reloaded. The table of said functions was still pointing to the old features reload mechanism, and not the new one. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-12Fix memory leak while loading modules, adding formats, and destroying endpointsMatthew Jordan
This patch fixes three memory leaks * When we load a module with the LOAD_PRIORITY flag, we remove its entry from the load order list. Unfortunately, we don't free the memory associated with entry in the list. This patch corrects that and properly frees the memory for the module in the list. * When adding a custom format (such as SILK or CELT), the routine for adding the format was leaking a reference. RAII_VAR cleans this up properly. * We now de-ref the channel_snapshot appropriately when an endpoint is disposed of ........ Merged revisions 391489 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 391507 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391521 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10Make the reload stasis message bump the ref count of its sub-objectMatthew Jordan
JSON objects are reference stealing. Hence, if you've RAII_VAR'd some subobject and want to pack it into another JSON object, you have to bump the reference count. Using the 'O' option during the pack will bump the reference count for you. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-24Migrate a large number of AMI events over to Stasis-CoreMatthew Jordan
This patch moves a number of AMI events over to the Stasis-Core message bus. This includes: * ChanSpyStart/Stop * MonitorStart/Stop * MusicOnHoldStart/Stop * FullyBooted/Reload * All Voicemail/MWI related events In addition, it adds some Stasis-Core and AMI support for generic AMI messages, refactors the message router in AMI to use a single router with topic forwarding for the topics that AMI cares about, and refactors MWI message types and topics to be more name compliant. Review: https://reviewboard.asterisk.org/r/2532 (closes issue ASTERISK-21462) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-10Address unload order issues for res_stasis* modulesDavid M. Lee
I've noticed when doing a graceful shutdown that the res_stasis_http.so module gets unloaded before the modules that use it, which causes some asserts during their unload. While r386928 was a quick hack to get it to not assert and die, this patch increases the use counts on res_stasis.so and res_stasis_http.so properly. It's a bigger change than I expected, hence the review instead of just committing it. Review: https://reviewboard.asterisk.org/r/2489/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-01Make mod_load_cmp() not as klunky.Richard Mudgett
There is a reason the heap comparison functions like qsort(), and other comparison functions specify <0, >0, and =0 for the return values. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387209 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-26By popular demand, putting the about-to-load-module printf back.David M. Lee
But now it only prints during the initial startup, and prints at verbose 1 level. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-26Removing stray printf from r386540David M. Lee
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386640 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-25Merge the pimp_my_sip branch into trunk.Mark Michelson
The pimp_my_sip branch is being merged at this point because it offers basic functionality, and from an API standpoint, things are complete. SIP work is *not* feature-complete; however, with the completion of the SUBSCRIBE/NOTIFY API, all APIs (except a PUBLISH API) have been created, and thus it is possible for developers to attempt to create new SIP work. API documentation can be found in the doxygen in the code, but usability documentation is still lacking. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-19Add The Status Of A Module To The Output Of "CLI> module show"Michael L. Young
When a module's configuration is not loadable, we still load the module but it is not in a running state. When trying to troubleshoot, let's say, why chan_motif is ignoring inbound XMPP traffic, there is no way to indicate that a loaded module is not currently running. (closes issue ASTERISK-21108) Reported by: Rusty Newton Tested by: Michael L. Young Patches: asterisk-21108_add_status-v2.diff Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2331/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-17Fix potential double free when unloading a module.Richard Mudgett
........ Merged revisions 378092 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 378093 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 378094 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378095 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-05Add safety NULL pointer check in module user references.Richard Mudgett
Made __ast_module_user_remove() check for NULL pointers. ........ Merged revision 375860 from C.3 ........ Merged revisions 375862 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 375863 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 375864 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-27loader: Ensure dependent modules are properly initialized.Joshua Colp
If an Asterisk module specifies a dependency in ast_module_info.nonoptreq, it is possible for Asterisk to skip calling the modules's .load function. Asterisk was loading and linking the module via load_dynamic_module() but was not adding the module to the resource_heap. Therefore the module was not initialized based on it's priority along with the other modules in the heap. Now use load_resource() instead of load_dynamic_module() for non-optional requirement. This will add the module to the resource_heap so the module can be properly initialized in the correct order. This is required if there are any module global data structures initialized in the .load() callback for the module on platforms which do not support weak references. (issue ASTERISK-20439) Reported by: sruffell Patches: 0001-loader-Ensure-dependent-modules-are-properly-initial.patch uploaded by sruffell (license 5417) ........ Merged revisions 373909 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 373910 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 373911 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-17Add instrumentation to subsystem reloadsKinsey Moore
When Asterisk is built with TEST_FRAMEWORK defined, Asterisk will now generate TestEvent AMI events on subsystem reloads such as cdr, dnsmgr, extconfig, etc. (issue PQ-1126) ........ Merged revisions 371436 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 371437 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 371438 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-16Add module reload instrumentation for TEST_FRAMEWORKKinsey Moore
This adds AMI events for module reloads when Asterisk is built with TEST_FRAMEWORK enabled and corrects generation of the module load AMI event. (issue PQ-1126) ........ Merged revisions 371393 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 371394 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 371395 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371396 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-13Add test instrumentationKinsey Moore
This adds test instrumentation for loading and unloading of modules and for certain actions in MeetMe to be used in the testsuite or any other consumer of AMI events. These will only be generated when Asterisk is built with TEST_FRAMEWORK enabled. (issue PQ-1131) (issue PQ-1133) ........ Merged revisions 371201 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 371203 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 371227 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371228 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-11Named ACLs: Introduces a system for creating and sharing ACLsJonathan Rose
This patch adds Named ACL functionality to Asterisk. This allows system administrators to define an ACL and refer to it by a unique name. Configurable items can then refer to that name when specifying access control lists. It also includes updates to all core supported consumers of ACLs. That includes manager, chan_sip, and chan_iax2. This feature is based on the deluxepine-trunk by Olle E. Johansson and provides a subset of the Named ACL functionality implemented in that branch. For more information on this feature, see acl.conf and/or the Asterisk wiki. Review: https://reviewboard.asterisk.org/r/1978/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369959 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-11Fix validation errors when producing documentation using default build scriptMatthew Jordan
The awk script parses out the first instance of the DOCUMENTATION tag that it finds within a file. If a file did not previously have a DOCUMENTATION tag but received one due to it having an AMI event, then the XML fragment associated with the AMI event was erroneously placed in the resulting XML file. Without the python scripts, these XML fragments will not validate. This patch adds DOCUMENTATION tags at the top of those files that did not previously have them to prevent the awk script from pulling AMI event documentation. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-10Add some additional documentation for core AMI eventsMatthew Jordan
This patch adds some basic documentation for a number of modules. This includes core source files in Asterisk (those in main), as well as chan_agent, chan_dahdi, chan_local, sig_analog, and sig_pri. The DTD has also been updated to allow referencing of AMI commands. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15Multiple revisions 369001-369002Kevin P. Fleming
........ r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines Add support-level indications to many more source files. Since we now have tools that scan through the source tree looking for files with specific support levels, we need to ensure that every file that is a component of a 'core' or 'extended' module (or the main Asterisk binary) is explicitly marked with its support level. This patch adds support-level indications to many more source files in tree, but avoids adding them to third-party libraries that are included in the tree and to source files that don't end up involved in Asterisk itself. ........ r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines Add a script to enable finding source files without support-levels defined. ........ Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-11Fix coverity UNUSED_VALUE findings in core support level filesKinsey Moore
Most of these were just saving returned values without using them and in some cases the variable being saved to could be removed as well. (issue ASTERISK-19672) ........ Merged revisions 368738 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 368739 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22Kill off red blobs in most of main/*Kinsey Moore
Everything still compiled after making these changes, so I assume these whitespace-only changes didn't break anything (and shouldn't have). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-22Track module use count for res_calendarTerry Wilson
If the res_calendar module was followed immediately by one of the calendar tech modules and "core stop gracefully" was run, Asterisk would crash. This patch adds use count tracking for res_calendar so that it is unloaded after the tech modules when shutting down gracefully. It is now not possible to unload all the of the calendar modules via "module unload res_calednar.so", but it is still possible to unload them all via "module unload -h res_calendar.so". Review: https://reviewboard.asterisk.org/r/1752/ ........ Merged revisions 356291 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 356297 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356314 65c4cc65-6c06-0410-ace0-fbb531ad65f3