Merge "install_prereq: Update RHEL/CentOS/Fedora libraries."
authorJenkins2 <jenkins2@gerrit.asterisk.org>
Wed, 31 Jan 2018 12:42:59 +0000 (06:42 -0600)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Wed, 31 Jan 2018 12:42:59 +0000 (06:42 -0600)
118 files changed:
README.md
apps/app_confbridge.c
apps/app_meetme.c
apps/app_stack.c
apps/app_stasis.c
build_tools/list_valid_installed_externals
channels/chan_pjsip.c
configs/samples/modules.conf.sample
configure
configure.ac
contrib/scripts/install_prereq
funcs/func_curl.c
funcs/func_periodic_hook.c
include/asterisk/agi.h
include/asterisk/ari.h
include/asterisk/autoconfig.h.in
include/asterisk/linkedlists.h
include/asterisk/lock.h
include/asterisk/res_mwi_external.h
include/asterisk/res_pjproject.h
include/asterisk/res_pjsip.h
include/asterisk/res_pjsip_pubsub.h
include/asterisk/res_pjsip_session.h
include/asterisk/stasis_app.h
main/asterisk.c
main/editline/el.h
main/loader.c
main/utils.c
res/res_agi.c
res/res_ari.c
res/res_ari_applications.c
res/res_ari_asterisk.c
res/res_ari_bridges.c
res/res_ari_channels.c
res/res_ari_device_states.c
res/res_ari_endpoints.c
res/res_ari_events.c
res/res_ari_mailboxes.c
res/res_ari_playbacks.c
res/res_ari_recordings.c
res/res_ari_sounds.c
res/res_config_curl.c
res/res_crypto.c
res/res_curl.c
res/res_fax.c
res/res_hep_pjsip.c
res/res_hep_rtcp.c
res/res_http_media_cache.c
res/res_http_websocket.c
res/res_monitor.c
res/res_mwi_external.c
res/res_mwi_external_ami.c
res/res_pjproject.c
res/res_pjsip.c
res/res_pjsip/config_auth.c
res/res_pjsip/config_transport.c
res/res_pjsip/include/res_pjsip_private.h
res/res_pjsip/location.c
res/res_pjsip/pjsip_distributor.c
res/res_pjsip/pjsip_global_headers.c
res/res_pjsip/pjsip_message_filter.c
res/res_pjsip/pjsip_options.c
res/res_pjsip/pjsip_session.c
res/res_pjsip_acl.c
res/res_pjsip_authenticator_digest.c
res/res_pjsip_caller_id.c
res/res_pjsip_dialog_info_body_generator.c
res/res_pjsip_diversion.c
res/res_pjsip_dlg_options.c
res/res_pjsip_dtmf_info.c
res/res_pjsip_empty_info.c
res/res_pjsip_endpoint_identifier_anonymous.c
res/res_pjsip_endpoint_identifier_ip.c
res/res_pjsip_endpoint_identifier_user.c
res/res_pjsip_exten_state.c
res/res_pjsip_header_funcs.c
res/res_pjsip_history.c
res/res_pjsip_logger.c
res/res_pjsip_messaging.c
res/res_pjsip_mwi.c
res/res_pjsip_mwi_body_generator.c
res/res_pjsip_nat.c
res/res_pjsip_notify.c
res/res_pjsip_one_touch_record_info.c
res/res_pjsip_outbound_authenticator_digest.c
res/res_pjsip_outbound_publish.c
res/res_pjsip_outbound_registration.c
res/res_pjsip_path.c
res/res_pjsip_phoneprov_provider.c
res/res_pjsip_pidf_body_generator.c
res/res_pjsip_pidf_digium_body_supplement.c
res/res_pjsip_pidf_eyebeam_body_supplement.c
res/res_pjsip_publish_asterisk.c
res/res_pjsip_pubsub.c
res/res_pjsip_refer.c
res/res_pjsip_registrar.c
res/res_pjsip_registrar_expire.c
res/res_pjsip_rfc3326.c
res/res_pjsip_sdp_rtp.c
res/res_pjsip_send_to_voicemail.c
res/res_pjsip_session.c
res/res_pjsip_sips_contact.c
res/res_pjsip_t38.c
res/res_pjsip_transport_management.c
res/res_pjsip_transport_websocket.c
res/res_pjsip_xpidf_body_generator.c
res/res_pktccops.c
res/res_smdi.c
res/res_stasis.c
res/res_stasis_mailbox.c
res/res_statsd.c
res/stasis/app.c
rest-api-templates/res_ari_resource.c.mustache
sounds/Makefile
tests/test_res_pjsip_scheduler.c
tests/test_res_stasis.c
tests/test_utils.c
utils/check_expr.c

index 153c4f3..10158b3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -69,7 +69,7 @@ list of new features in this version of Asterisk, see the [CHANGES] file.
 
   Ensure that your system contains a compatible compiler and development
 libraries.  Asterisk requires either the GNU Compiler Collection (GCC) version
-3.0 or higher, or a compiler that supports the C99 specification and some of
+4.1 or higher, or a compiler that supports the C99 specification and some of
 the gcc language extensions.  In addition, your system needs to have the C
 library headers available, and the headers and libraries for ncurses.
 
index f972e38..7e6f94c 100644 (file)
@@ -2386,11 +2386,11 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
                user.tech_args.drop_silence = 1;
        }
 
-       if (ast_test_flag(&user.u_profile, USER_OPT_JITTERBUFFER) && ast_module_check("func_jitterbuffer.so")) {
+       if (ast_test_flag(&user.u_profile, USER_OPT_JITTERBUFFER)) {
                ast_func_write(chan, "JITTERBUFFER(adaptive)", "default");
        }
 
-       if (ast_test_flag(&user.u_profile, USER_OPT_DENOISE) && ast_module_check("codec_speex.so")) {
+       if (ast_test_flag(&user.u_profile, USER_OPT_DENOISE)) {
                ast_func_write(chan, "DENOISE(rx)", "on");
        }
 
@@ -4088,4 +4088,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Conference Bridge App
        .unload = unload_module,
        .reload = reload,
        .load_pri = AST_MODPRI_DEVSTATE_PROVIDER,
+       .optional_modules = "codec_speex,func_jitterbuffer",
 );
index 634eac8..657aaa7 100644 (file)
@@ -3588,7 +3588,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        }
 
        /* Reduce background noise from each participant */
-       if (!ast_test_flag64(confflags, CONFFLAG_DONT_DENOISE) && ast_module_check("func_speex.so")) {
+       if (!ast_test_flag64(confflags, CONFFLAG_DONT_DENOISE)) {
                ast_func_write(chan, "DENOISE(rx)", "on");
        }
 
@@ -8085,4 +8085,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "MeetMe conference bri
        .unload = unload_module,
        .reload = reload,
        .load_pri = AST_MODPRI_DEVSTATE_PROVIDER,
+       .optional_modules = "func_speex",
 );
index 1f98378..4560865 100644 (file)
@@ -1278,7 +1278,7 @@ static int unload_module(void)
 {
        ast_install_stack_functions(NULL);
 
-       ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
+       ast_agi_unregister(&gosub_agi_command);
 
        ast_unregister_application(app_return);
        ast_unregister_application(app_pop);
index 8d09349..b98c2b4 100644 (file)
@@ -125,19 +125,12 @@ static int app_exec(struct ast_channel *chan, const char *data)
 
 static int load_module(void)
 {
-       int r = 0;
-
-       stasis_app_ref();
-       r |= ast_register_application_xml(stasis, app_exec);
-       return r;
+       return ast_register_application_xml(stasis, app_exec);
 }
 
 static int unload_module(void)
 {
-       int r = 0;
-       r |= ast_unregister_application(stasis);
-       stasis_app_unref();
-       return r;
+       return ast_unregister_application(stasis);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Stasis dialplan application",
index c371022..862447a 100755 (executable)
@@ -19,10 +19,7 @@ EOF
 
 XMLSTARLET=`getvar XMLSTARLET`
 ASTMODDIR=`getvar ASTMODDIR`
-cache_dir=`getvar EXTERNALS_CACHE_DIR`
-DOWNLOAD_TO_STDOUT=`getvar DOWNLOAD_TO_STDOUT`
 HOST_CPU=`getvar HOST_CPU`
-INSTALL=`getvar INSTALL`
 
 tmpdir=$(mktemp -d)
 if [[ -z "${tmpdir}" ]] ; then
index 68da4a1..2c111fe 100644 (file)
@@ -2981,8 +2981,6 @@ static int load_module(void)
 {
        struct ao2_container *endpoints;
 
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        if (!(chan_pjsip_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
                return AST_MODULE_LOAD_DECLINE;
        }
@@ -3016,10 +3014,7 @@ static int load_module(void)
                goto end;
        }
 
-       if (ast_sip_session_register_supplement(&chan_pjsip_supplement)) {
-               ast_log(LOG_ERROR, "Unable to register PJSIP supplement\n");
-               goto end;
-       }
+       ast_sip_session_register_supplement(&chan_pjsip_supplement);
 
        if (!(pjsip_uids_onhold = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK,
                        AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, 37, uid_hold_hash_fn,
@@ -3028,26 +3023,9 @@ static int load_module(void)
                goto end;
        }
 
-       if (ast_sip_session_register_supplement(&call_pickup_supplement)) {
-               ast_log(LOG_ERROR, "Unable to register PJSIP call pickup supplement\n");
-               ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
-               goto end;
-       }
-
-       if (ast_sip_session_register_supplement(&pbx_start_supplement)) {
-               ast_log(LOG_ERROR, "Unable to register PJSIP pbx start supplement\n");
-               ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
-               ast_sip_session_unregister_supplement(&call_pickup_supplement);
-               goto end;
-       }
-
-       if (ast_sip_session_register_supplement(&chan_pjsip_ack_supplement)) {
-               ast_log(LOG_ERROR, "Unable to register PJSIP ACK supplement\n");
-               ast_sip_session_unregister_supplement(&pbx_start_supplement);
-               ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
-               ast_sip_session_unregister_supplement(&call_pickup_supplement);
-               goto end;
-       }
+       ast_sip_session_register_supplement(&call_pickup_supplement);
+       ast_sip_session_register_supplement(&pbx_start_supplement);
+       ast_sip_session_register_supplement(&chan_pjsip_ack_supplement);
 
        if (pjsip_channel_cli_register()) {
                ast_log(LOG_ERROR, "Unable to register PJSIP Channel CLI\n");
index 38e33e1..431a0a8 100644 (file)
@@ -29,12 +29,7 @@ autoload=yes
 ; If you want you can combine with preload
 ; preload-require = res_odbc.so
 ;
-; If you want, load the GTK console right away.
-;
-noload => pbx_gtkconsole.so
-;load => pbx_gtkconsole.so
-;
-load => res_musiconhold.so
+;load => res_musiconhold.so
 ;
 ; Load one of: chan_oss, alsa, or console (portaudio).
 ; By default, load chan_oss only (automatically).
index 867643e..f6e83d9 100755 (executable)
--- a/configure
+++ b/configure
@@ -17893,8 +17893,8 @@ fi
 done
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler atomic operations" >&5
-$as_echo_n "checking for compiler atomic operations... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler sync operations" >&5
+$as_echo_n "checking for compiler sync operations... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -17909,6 +17909,7 @@ _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+ax_cv_have_gcc_atomics=1
 
 $as_echo "#define HAVE_GCC_ATOMICS 1" >>confdefs.h
 
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler atomic operations" >&5
+$as_echo_n "checking for compiler atomic operations... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int foo1; int foo2 = __atomic_fetch_add(&foo1, 1, __ATOMIC_RELAXED);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ax_cv_have_c_atomics=1
+
+$as_echo "#define HAVE_C_ATOMICS 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+if test -z $ax_cv_have_c_atomics$ax_cv_have_gcc_atomics; then
+       as_fn_error $? "*** Atomic operations are not supported by your compiler." "$LINENO" 5
+fi
+
 # glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system printf is NULL-safe." >&5
 $as_echo_n "checking if your system printf is NULL-safe.... " >&6; }
@@ -19330,17 +19363,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
 
-ac_fn_c_check_header_mongrel "$LINENO" "libkern/OSAtomic.h" "ac_cv_header_libkern_OSAtomic_h" "$ac_includes_default"
-if test "x$ac_cv_header_libkern_OSAtomic_h" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OSX_ATOMICS 1
-_ACEOF
-
-fi
-
-
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
index c590c6b..6e54f3c 100644 (file)
@@ -1070,14 +1070,28 @@ AC_LINK_IFELSE(
 # for FreeBSD thr_self
 AC_CHECK_HEADERS([sys/thr.h])
 
-AC_MSG_CHECKING(for compiler atomic operations)
+AC_MSG_CHECKING(for compiler sync operations)
 AC_LINK_IFELSE(
 [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
 AC_MSG_RESULT(yes)
-AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
+ax_cv_have_gcc_atomics=1
+AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides __sync atomic operations.]),
+AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(for compiler atomic operations)
+AC_LINK_IFELSE(
+[AC_LANG_PROGRAM([], [int foo1; int foo2 = __atomic_fetch_add(&foo1, 1, __ATOMIC_RELAXED);])],
+AC_MSG_RESULT(yes)
+ax_cv_have_c_atomics=1
+AC_DEFINE([HAVE_C_ATOMICS], 1, [Define to 1 if your C compiler provides __atomic operations.]),
 AC_MSG_RESULT(no)
 )
 
+if test -z $ax_cv_have_c_atomics$ax_cv_have_gcc_atomics; then
+       AC_MSG_ERROR([*** Atomic operations are not supported by your compiler.])
+fi
+
 # glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
 AC_MSG_CHECKING([if your system printf is NULL-safe.])
 AC_RUN_IFELSE(
@@ -1405,9 +1419,6 @@ AST_C_DEFINE_CHECK([RTLD_NOLOAD], [RTLD_NOLOAD], [dlfcn.h])
 
 AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
 
-AC_CHECK_HEADER([libkern/OSAtomic.h],
-                [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
-
 AC_CHECK_SIZEOF([int])
 AC_CHECK_SIZEOF([long])
 AC_CHECK_SIZEOF([long long])
index da6ba87..19da358 100755 (executable)
@@ -56,7 +56,7 @@ PACKAGES_FBSD="$PACKAGES_FBSD sqlite3 libxslt jansson e2fsprogs-libuuid gsm libs
 
 KVERS=`uname -r`
 
-JANSSON_VER=2.4
+JANSSON_VER=2.10
 
 case "$1" in
 test)
index ebb3dce..682ad5a 100644 (file)
@@ -920,13 +920,6 @@ static int load_module(void)
 {
        int res;
 
-       if (!ast_module_check("res_curl.so")) {
-               if (ast_load_resource("res_curl.so") != AST_MODULE_LOAD_SUCCESS) {
-                       ast_log(LOG_ERROR, "Cannot load res_curl, so func_curl cannot be loaded\n");
-                       return AST_MODULE_LOAD_DECLINE;
-               }
-       }
-
        res = ast_custom_function_register_escalating(&acf_curl, AST_CFE_WRITE);
        res |= ast_custom_function_register(&acf_curlopt);
 
@@ -940,4 +933,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Load external URL",
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_REALTIME_DEPEND2,
+       .requires = "res_curl",
 );
index 958da97..1f66747 100644 (file)
@@ -486,11 +486,6 @@ static int load_module(void)
 
        res = ast_custom_function_register_escalating(&hook_function, AST_CFE_BOTH);
 
-       if (!res) {
-               /* For Optional API. */
-               ast_module_shutdown_ref(AST_MODULE_SELF);
-       }
-
        return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
index cb80f95..568cd5d 100644 (file)
@@ -82,13 +82,12 @@ AST_OPTIONAL_API(int, ast_agi_register,
  *
  * Unregisters an AGI command.
  *
- * \param mod Pointer to the module_info structure for the module that is unregistering the command
  * \param cmd Pointer to the descriptor for the command
  * \return 1 on success, 0 if the command was not already registered
  *
  */
 AST_OPTIONAL_API(int, ast_agi_unregister,
-                (struct ast_module *mod, agi_command *cmd),
+                (agi_command *cmd),
                 { return AST_OPTIONAL_API_UNAVAILABLE; });
 
 /*!
@@ -116,7 +115,6 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple,
  * Unregisters a group of AGI commands, provided as an array of struct agi_command
  * entries.
  *
- * \param mod Pointer to the module_info structure for the module that is unregistering the commands
  * \param cmd Pointer to the first entry in the array of command descriptors
  * \param len Length of the array (use the ARRAY_LEN macro to determine this easily)
  * \return 0 on success, -1 on failure, AST_OPTIONAL_API_UNAVAILABLE if res_agi is not loaded
@@ -125,7 +123,7 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple,
  * remaining commands in the array; it will not reregister the already-unregistered commands.
  */
 AST_OPTIONAL_API(int, ast_agi_unregister_multiple,
-                (struct ast_module *mod, struct agi_command *cmd, unsigned int len),
+                (struct agi_command *cmd, unsigned int len),
                 { return AST_OPTIONAL_API_UNAVAILABLE; });
 
 /*!
index f83d596..865b4b0 100644 (file)
@@ -268,14 +268,4 @@ void ast_ari_response_created(struct ast_ari_response *response,
  */
 void ast_ari_response_alloc_failed(struct ast_ari_response *response);
 
-/*! \brief Determines whether the res_ari module is loaded */
-#define CHECK_ARI_MODULE_LOADED()                              \
-       do {                                                    \
-               if (!ast_module_check("res_ari.so")             \
-                       || !ast_ari_oom_json()) {       \
-                       return AST_MODULE_LOAD_DECLINE;         \
-               }                                               \
-       } while(0)
-
-
 #endif /* _ASTERISK_ARI_H */
index f8bd0e3..b95d526 100644 (file)
 /* Define to 1 if you have the curses library. */
 #undef HAVE_CURSES
 
+/* Define to 1 if your C compiler provides __atomic operations. */
+#undef HAVE_C_ATOMICS
+
 /* Define if your system has the DAHDI headers. */
 #undef HAVE_DAHDI
 
 /* Define to 1 if you have the `ftruncate' function. */
 #undef HAVE_FTRUNCATE
 
-/* Define to 1 if your GCC C compiler provides atomic operations. */
+/* Define to 1 if your GCC C compiler provides __sync atomic operations. */
 #undef HAVE_GCC_ATOMICS
 
 /* Define to 1 if you have the `getcwd' function. */
 /* Define to 1 if you have the Open Sound System library. */
 #undef HAVE_OSS
 
-/* Define to 1 if OSX atomic operations are supported. */
-#undef HAVE_OSX_ATOMICS
-
 /* Define to 1 if your system defines the file flag O_EVTONLY in fcntl.h */
 #undef HAVE_O_EVTONLY
 
index 8715cf1..5f50c75 100644 (file)
@@ -854,7 +854,7 @@ struct {                                                            \
  */
 #define AST_LIST_REMOVE(head, elm, field)                                              \
        ({                                                                                                                      \
-               __typeof(elm) __elm = (elm);                                                    \
+               typeof(elm) __elm = (elm);                                                              \
                if (__elm) {                                                                                    \
                        if ((head)->first == __elm) {                                           \
                                (head)->first = __elm->field.next;                              \
index 58c9a83..c3dd691 100644 (file)
@@ -617,97 +617,39 @@ static void  __attribute__((destructor)) fini_##rwlock(void) \
 #define pthread_create __use_ast_pthread_create_instead__
 #endif
 
-/*
- * Support for atomic instructions.
- * For platforms that have it, use the native cpu instruction to
- * implement them. For other platforms, resort to a 'slow' version
- * (defined in utils.c) that protects the atomic instruction with
- * a single lock.
- * The slow versions is always available, for testing purposes,
- * as ast_atomic_fetchadd_int_slow()
- */
-
-int ast_atomic_fetchadd_int_slow(volatile int *p, int v);
+/* Support for atomic instructions. */
 
 #include "asterisk/inline_api.h"
 
-#if defined(HAVE_OSX_ATOMICS)
-#include "libkern/OSAtomic.h"
+#if defined(HAVE_C_ATOMICS)
+#define ast_atomic_fetch_add(p, v, memorder)  __atomic_fetch_add(p, v, memorder)
+#define ast_atomic_sub_fetch(p, v, memorder)  __atomic_sub_fetch(p, v, memorder)
+#elif defined(HAVE_GCC_ATOMICS)
+#define ast_atomic_fetch_add(p, v, memorder)  __sync_fetch_and_add(p, v)
+#define ast_atomic_sub_fetch(p, v, memorder)  __sync_sub_and_fetch(p, v)
+#else
+#error "Atomics not available."
 #endif
 
-/*! \brief Atomically add v to *p and return * the previous value of *p.
+/*!
+ * \brief Atomically add v to *p and return the previous value of *p.
+ *
  * This can be used to handle reference counts, and the return value
  * can be used to generate unique identifiers.
  */
-
-#if defined(HAVE_GCC_ATOMICS)
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
-       return __sync_fetch_and_add(p, v);
-})
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4)
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
-       return OSAtomicAdd32(v, (int32_t *) p) - v;
-})
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8)
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
-       return OSAtomicAdd64(v, (int64_t *) p) - v;
-})
-#elif defined (__i386__) || defined(__x86_64__)
-#ifdef sun
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
-       __asm __volatile (
-       "       lock;  xaddl   %0, %1 ;        "
-       : "+r" (v),                     /* 0 (result) */
-         "=m" (*p)                     /* 1 */
-       : "m" (*p));                    /* 2 */
-       return (v);
-})
-#else /* ifndef sun */
 AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
 {
-       __asm __volatile (
-       "       lock   xaddl   %0, %1 ;        "
-       : "+r" (v),                     /* 0 (result) */
-         "=m" (*p)                     /* 1 */
-       : "m" (*p));                    /* 2 */
-       return (v);
+       return ast_atomic_fetch_add(p, v, __ATOMIC_RELAXED);
 })
-#endif
-#else   /* low performance version in utils.c */
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
-       return ast_atomic_fetchadd_int_slow(p, v);
-})
-#endif
 
-/*! \brief decrement *p by 1 and return true if the variable has reached 0.
+/*!
+ * \brief decrement *p by 1 and return true if the variable has reached 0.
+ *
  * Useful e.g. to check if a refcount has reached 0.
  */
-#if defined(HAVE_GCC_ATOMICS)
-AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
-{
-       return __sync_sub_and_fetch(p, 1) == 0;
-})
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4)
 AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
 {
-       return OSAtomicAdd32( -1, (int32_t *) p) == 0;
+       return ast_atomic_sub_fetch(p, 1, __ATOMIC_RELAXED) == 0;
 })
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8)
-AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
-{
-       return OSAtomicAdd64( -1, (int64_t *) p) == 0;
-})
-#else
-AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
-{
-       int a = ast_atomic_fetchadd_int(p, -1);
-       return a == 1; /* true if the value is 0 now (so it was 1 previously) */
-})
-#endif
 
 #endif /* _ASTERISK_LOCK_H */
index 7698a1b..25de700 100644 (file)
@@ -36,22 +36,6 @@ extern "C"
 
 /* ------------------------------------------------------------------- */
 
-/*!
- * \brief Increase the external MWI resource module reference count.
- * \since 12.1.0
- *
- * \return Nothing
- */
-void ast_mwi_external_ref(void);
-
-/*!
- * \brief Decrease the external MWI resource module reference count.
- * \since 12.1.0
- *
- * \return Nothing
- */
-void ast_mwi_external_unref(void);
-
 struct ast_mwi_mailbox_object;
 
 /*! \brief Convienience unref function for mailbox object. */
index 8828b34..4993be6 100644 (file)
 #ifndef _RES_PJPROJECT_H
 #define _RES_PJPROJECT_H
 
-/*! \brief Determines whether the res_pjproject module is loaded */
-#define CHECK_PJPROJECT_MODULE_LOADED()                 \
-       do {                                                \
-               if (!ast_module_check("res_pjproject.so")) {    \
-                       return AST_MODULE_LOAD_DECLINE;             \
-               }                                               \
-       } while(0)
-
 /*!
  * \brief Retrieve a pjproject build option
  *
@@ -79,18 +71,4 @@ void ast_pjproject_log_intercept_begin(int fd);
  */
 void ast_pjproject_log_intercept_end(void);
 
-/*!
- * \brief Increment the res_pjproject reference count.
- *
- * This ensures graceful shutdown happens in the proper order.
- */
-void ast_pjproject_ref(void);
-
-/*!
- * \brief Decrement the res_pjproject reference count.
- *
- * This ensures graceful shutdown happens in the proper order.
- */
-void ast_pjproject_unref(void);
-
 #endif /* _RES_PJPROJECT_H */
index 66b99b8..a3bd782 100644 (file)
@@ -933,9 +933,7 @@ enum ast_sip_contact_filter {
  * \retval 0 Success
  * \retval -1 Failure
  */
-#define ast_sip_register_service(module) \
-       __ast_sip_register_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-int __ast_sip_register_service(pjsip_module *module, const char *file, int line, const char *func);
+int ast_sip_register_service(pjsip_module *module);
 
 /*!
  * This is the opposite of ast_sip_register_service().  Unregistering a
@@ -944,9 +942,7 @@ int __ast_sip_register_service(pjsip_module *module, const char *file, int line,
  *
  * \param module The PJSIP module to unregister
  */
-#define ast_sip_unregister_service(module) \
-       __ast_sip_unregister_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-void __ast_sip_unregister_service(pjsip_module *module, const char *file, int line, const char *func);
+void ast_sip_unregister_service(pjsip_module *module);
 
 /*!
  * \brief Register a SIP authenticator
@@ -2448,10 +2444,8 @@ struct ast_sip_endpoint_formatter {
  * \brief Register an endpoint formatter.
  *
  * \param obj the formatter to register
- * \retval 0 Success
- * \retval -1 Failure
  */
-int ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
+void ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
 
 /*!
  * \brief Unregister an endpoint formatter.
@@ -2627,20 +2621,14 @@ struct ast_sip_supplement {
  * \retval 0 Success
  * \retval -1 Failure
  */
-#define ast_sip_register_supplement(supplement) \
-       __ast_sip_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-int __ast_sip_register_supplement(struct ast_sip_supplement *supplement,
-       const char *file, int line, const char *func);
+void ast_sip_register_supplement(struct ast_sip_supplement *supplement);
 
 /*!
  * \brief Unregister a an supplement to SIP out of dialog processing
  *
  * \param supplement The supplement to unregister
  */
-#define ast_sip_unregister_supplement(supplement) \
-       __ast_sip_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-void __ast_sip_unregister_supplement(struct ast_sip_supplement *supplement,
-       const char *file, int line, const char *func);
+void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement);
 
 /*!
  * \brief Retrieve the global MWI taskprocessor high water alert trigger level.
@@ -2764,15 +2752,6 @@ void ast_sip_get_default_realm(char *realm, size_t size);
  */
 void ast_sip_get_default_from_user(char *from_user, size_t size);
 
-/*! \brief Determines whether the res_pjsip module is loaded */
-#define CHECK_PJSIP_MODULE_LOADED()                            \
-       do {                                                    \
-               if (!ast_module_check("res_pjsip.so")           \
-                       || !ast_sip_get_pjsip_endpoint()) {     \
-                       return AST_MODULE_LOAD_DECLINE;         \
-               }                                               \
-       } while(0)
-
 /*!
  * \brief Retrieve the system keep alive interval setting.
  *
index cb51db3..e9d59a0 100644 (file)
@@ -754,13 +754,4 @@ const char *ast_sip_subscription_get_body_subtype(struct ast_sip_subscription *s
  */
 void ast_sip_subscription_destroy(struct ast_sip_subscription *sub);
 
-/*! \brief Determines whether the res_pjsip_pubsub module is loaded */
-#define CHECK_PJSIP_PUBSUB_MODULE_LOADED()                     \
-       do {                                                    \
-               CHECK_PJSIP_MODULE_LOADED();                    \
-               if (!ast_module_check("res_pjsip_pubsub.so")) { \
-                       return AST_MODULE_LOAD_DECLINE;         \
-               }                                               \
-       } while(0)
-
 #endif /* RES_PJSIP_PUBSUB_H */
index 65d4638..f6ee0f0 100644 (file)
@@ -579,23 +579,15 @@ void ast_sip_session_unregister_sdp_handler(struct ast_sip_session_sdp_handler *
  * a module could reject an incoming request if desired.
  *
  * \param supplement The supplement to register
- * \retval 0 Success
- * \retval -1 Failure
  */
-#define ast_sip_session_register_supplement(supplement) \
-       __ast_sip_session_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement,
-       const char *file, int line, const char *func);
+void ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);
 
 /*!
  * \brief Unregister a an supplement to SIP session processing
  *
  * \param supplement The supplement to unregister
  */
-#define ast_sip_session_unregister_supplement(supplement) \
-       __ast_sip_session_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement,
-       const char *file, int line, const char *func);
+void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement);
 
 /*!
  * \brief Add supplements to a SIP session
@@ -894,13 +886,4 @@ int ast_sip_session_media_set_write_callback(struct ast_sip_session *session, st
  */
 struct ast_sip_session_media *ast_sip_session_media_get_transport(struct ast_sip_session *session, struct ast_sip_session_media *session_media);
 
-/*! \brief Determines whether the res_pjsip_session module is loaded */
-#define CHECK_PJSIP_SESSION_MODULE_LOADED()                            \
-       do {                                                            \
-               CHECK_PJSIP_MODULE_LOADED();                            \
-               if (!ast_module_check("res_pjsip_session.so")) {        \
-                       return AST_MODULE_LOAD_DECLINE;                 \
-               }                                                       \
-       } while(0)
-
 #endif /* _RES_PJSIP_SESSION_H */
index 8ef2bda..b0829ab 100644 (file)
@@ -46,8 +46,8 @@
  * functions.
  *
  * Since module unload order is based on reference counting, any module that
- * uses the API defined in this file must call stasis_app_ref() when loaded,
- * and stasis_app_unref() when unloaded.
+ * uses the API defined in this file must list "res_stasis" in the requires
+ * field.
  */
 
 #include "asterisk/channel.h"
@@ -229,18 +229,6 @@ void stasis_app_register_event_source(struct stasis_app_event_source *obj);
 void stasis_app_register_event_sources(void);
 
 /*!
- * \brief Checks to see if the given object is a core event source
- *
- * \note core event sources are currently only endpoint, bridge, and channel.
- *
- * \param obj event source object to check
- *
- * \return non-zero if core event source, otherwise 0 (false)
-
- */
-int stasis_app_is_core_event_source(struct stasis_app_event_source *obj);
-
-/*!
  * \brief Unregister an application event source.
  *
  * \param obj the event source to unregister
@@ -850,20 +838,6 @@ struct ast_bridge *stasis_app_get_bridge(struct stasis_app_control *control);
 void stasis_app_bridge_destroy(const char *bridge_id);
 
 /*!
- * \brief Increment the res_stasis reference count.
- *
- * This ensures graceful shutdown happens in the proper order.
- */
-void stasis_app_ref(void);
-
-/*!
- * \brief Decrement the res_stasis reference count.
- *
- * This ensures graceful shutdown happens in the proper order.
- */
-void stasis_app_unref(void);
-
-/*!
  * \brief Get the Stasis message sanitizer for app_stasis applications
  *
  * \retval The stasis message sanitizer
index 4c7abd6..0214159 100644 (file)
@@ -714,12 +714,6 @@ static int swapmode(int *used, int *total)
        ast_free(swdev);
        return 1;
 }
-#elif defined(HAVE_SYSCTL) && !defined(HAVE_SYSINFO)
-static int swapmode(int *used, int *total)
-{
-       *used = *total = 0;
-       return 1;
-}
 #endif
 
 #if defined(HAVE_SYSINFO) || defined(HAVE_SYSCTL)
@@ -728,11 +722,11 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl
 {
        uint64_t physmem, freeram;
 #if defined(HAVE_SYSINFO) || defined(HAVE_SWAPCTL)
+       int totalswap = 0;
        uint64_t freeswap = 0;
 #endif
        int nprocs = 0;
        long uptime = 0;
-       int totalswap = 0;
 #if defined(HAVE_SYSINFO)
        struct sysinfo sys_info;
 #elif defined(HAVE_SYSCTL)
@@ -740,7 +734,10 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl
        struct vmtotal vmtotal;
        struct timeval  boottime;
        time_t  now;
-       int mib[2], pagesize, usedswap = 0;
+       int mib[2], pagesize;
+#if defined(HAVE_SWAPCTL)
+       int usedswap = 0;
+#endif
        size_t len;
 #endif
 
@@ -800,8 +797,10 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl
        sysctl(mib, 2, &vmtotal, &len, NULL, 0);
        freeram = (vmtotal.t_free << pageshift);
        /* generate swap usage and totals */
+#if defined(HAVE_SWAPCTL)
        swapmode(&usedswap, &totalswap);
        freeswap = (totalswap - usedswap);
+#endif
        /* grab number of processes */
 #if defined(__OpenBSD__)
        mib[0] = CTL_KERN;
@@ -4546,20 +4545,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
        check_init(ast_device_state_engine_init(), "Device State Engine");
        check_init(ast_presence_state_engine_init(), "Presence State Engine");
        check_init(ast_dns_system_resolver_init(), "Default DNS resolver");
-       check_init(load_modules(1), "Module Preload");
-       check_init(ast_features_init(), "Call Features");
-       check_init(dnsmgr_init(), "DNS manager");
        check_init(ast_security_stasis_init(), "Security Stasis Topic and Events");
-       check_init(ast_named_acl_init(), "Named ACL system");
-
-       ast_http_init();                /* Start the HTTP server, if needed */
-
-       check_init(ast_indications_init(), "Indication Tone Handling");
-       check_init(ast_cdr_engine_init(), "CDR Engine");
-
-       ast_dsp_init();
-       ast_udptl_init();
-
        check_init(ast_image_init(), "Image");
        check_init(ast_file_init(), "Generic File Format Support");
        check_init(load_pbx(), "load_pbx");
@@ -4570,10 +4556,27 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
        check_init(load_pbx_app(), "PBX Application Support");
        check_init(load_pbx_hangup_handler(), "PBX Hangup Handler Support");
        check_init(ast_local_init(), "Local Proxy Channel Driver");
+
+       /* We should avoid most config loads before this point as they can't use realtime. */
+       check_init(load_modules(1), "Module Preload");
+
+       /* Initialize core modules that have config files.  These should be converted to
+        * built-in modules with load priority after realtime, that way users will not
+        * need to 'preload' realtime modules. */
+       check_init(ast_features_init(), "Call Features");
+       check_init(dnsmgr_init(), "DNS manager");
+       check_init(ast_named_acl_init(), "Named ACL system");
+       ast_http_init();
+       check_init(ast_indications_init(), "Indication Tone Handling");
+       check_init(ast_cdr_engine_init(), "CDR Engine");
+       ast_dsp_init();
+       ast_udptl_init();
        check_init(ast_cel_engine_init(), "CEL Engine");
        check_init(init_manager(), "Asterisk Manager Interface");
        check_init(ast_enum_init(), "ENUM Support");
        check_init(ast_cc_init(), "Call Completion Supplementary Services");
+
+       /* Load remaining modules */
        check_init(load_modules(0), "Module");
 
        /*
index 641081e..386d84c 100644 (file)
@@ -55,9 +55,9 @@
 
 #define        EL_BUFSIZ       1024            /* Maximum line size            */
 
-#define        HANDLE_SIGNALS  1<<0
-#define        NO_TTY          1<<1
-#define        EDIT_DISABLED   1<<2
+#define        HANDLE_SIGNALS  0x01
+#define        NO_TTY          0x02
+#define        EDIT_DISABLED   0x04
 
 typedef int bool_t;                    /* True or not                  */
 
index da508f3..159014e 100644 (file)
@@ -1394,7 +1394,7 @@ static enum ast_module_load_result start_resource(struct ast_module *mod)
                }
                AST_VECTOR_FREE(&missing);
 
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        if (!ast_fully_booted) {
@@ -1580,6 +1580,7 @@ static int start_resource_list(struct module_vector *resources, int *mod_count)
                struct ast_module *mod = AST_VECTOR_REMOVE(resources, 0, 1);
                enum ast_module_load_result lres;
 
+retry_load:
                lres = start_resource_attempt(mod, mod_count);
                if (lres == AST_MODULE_LOAD_SUCCESS) {
                        /* No missing dependencies, successful. */
@@ -1598,13 +1599,18 @@ static int start_resource_list(struct module_vector *resources, int *mod_count)
 
                res = module_deps_missing_recursive(mod, &missingdeps);
                if (res) {
-                       break;
+                       AST_VECTOR_RESET(&missingdeps, AST_VECTOR_ELEM_CLEANUP_NOOP);
+                       ast_log(LOG_ERROR, "Failed to resolve dependencies for %s\n", ast_module_name(mod));
+                       mod->flags.declined = 1;
+
+                       continue;
                }
 
                if (!AST_VECTOR_SIZE(&missingdeps)) {
-                       ast_log(LOG_WARNING, "%s isn't missing any dependencies but still didn't start\n",
-                               ast_module_name(mod));
-                       /* Dependencies were met but the module failed to start. */
+                       ast_log(LOG_WARNING, "%s load function returned an invalid result. "
+                               "This is a bug in the module.\n", ast_module_name(mod));
+                       /* Dependencies were met but the module failed to start and the result
+                        * code was not AST_MODULE_LOAD_FAILURE or AST_MODULE_LOAD_DECLINE. */
                        res = -1;
                        break;
                }
@@ -1637,17 +1643,17 @@ static int start_resource_list(struct module_vector *resources, int *mod_count)
                }
 
                if (AST_VECTOR_SIZE(&missingdeps)) {
-                       ast_log(LOG_ERROR, "Failed to load %s due to unfilled dependencies.\n",
+                       ast_log(LOG_WARNING, "Failed to load %s due to unfilled dependencies.\n",
                                ast_module_name(mod));
-                       res = -1;
-                       break;
-               }
+                       mod->flags.declined = 1;
+                       AST_VECTOR_RESET(&missingdeps, AST_VECTOR_ELEM_CLEANUP_NOOP);
 
-               res = start_resource_attempt(mod, mod_count);
-               if (res) {
-                       ast_log(LOG_ERROR, "Failed to load %s: %d\n", ast_module_name(mod), res);
-                       break;
+                       continue;
                }
+
+               /* If we're here it means that we started with missingdeps and they're all loaded
+                * now.  It's impossible to reach this point a second time for the same module. */
+               goto retry_load;
        }
 
        AST_VECTOR_FREE(&missingdeps);
index 85228c1..7f74f40 100644 (file)
@@ -1985,18 +1985,6 @@ char *ast_to_camel_case_delim(const char *s, const char *delim)
        return res;
 }
 
-AST_MUTEX_DEFINE_STATIC(fetchadd_m); /* used for all fetc&add ops */
-
-int ast_atomic_fetchadd_int_slow(volatile int *p, int v)
-{
-       int ret;
-       ast_mutex_lock(&fetchadd_m);
-       ret = *p;
-       *p += v;
-       ast_mutex_unlock(&fetchadd_m);
-       return ret;
-}
-
 /*! \brief
  * get values from config variables.
  */
index 2d0dc27..0931c1a 100644 (file)
@@ -3815,8 +3815,6 @@ int AST_OPTIONAL_API_NAME(ast_agi_register)(struct ast_module *mod, agi_command
                AST_RWLIST_WRLOCK(&agi_commands);
                AST_LIST_INSERT_TAIL(&agi_commands, cmd, list);
                AST_RWLIST_UNLOCK(&agi_commands);
-               if (mod != ast_module_info->self)
-                       ast_module_ref(ast_module_info->self);
                ast_verb(2, "AGI Command '%s' registered\n",fullcmd);
                return 1;
        } else {
@@ -3825,7 +3823,7 @@ int AST_OPTIONAL_API_NAME(ast_agi_register)(struct ast_module *mod, agi_command
        }
 }
 
-int AST_OPTIONAL_API_NAME(ast_agi_unregister)(struct ast_module *mod, agi_command *cmd)
+int AST_OPTIONAL_API_NAME(ast_agi_unregister)(agi_command *cmd)
 {
        struct agi_command *e;
        int unregistered = 0;
@@ -3837,8 +3835,6 @@ int AST_OPTIONAL_API_NAME(ast_agi_unregister)(struct ast_module *mod, agi_comman
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&agi_commands, e, list) {
                if (cmd == e) {
                        AST_RWLIST_REMOVE_CURRENT(list);
-                       if (mod != ast_module_info->self)
-                               ast_module_unref(ast_module_info->self);
 #ifdef AST_XML_DOCS
                        if (e->docsrc == AST_XML_DOC) {
                                ast_free((char *) e->summary);
@@ -3885,7 +3881,7 @@ int AST_OPTIONAL_API_NAME(ast_agi_register_multiple)(struct ast_module *mod, str
                           to fail is if the command is not
                           registered
                        */
-                       (void) ast_agi_unregister(mod, cmd + x - 1);
+                       (void) ast_agi_unregister(cmd + x - 1);
                }
                return -1;
        }
@@ -3893,7 +3889,7 @@ int AST_OPTIONAL_API_NAME(ast_agi_register_multiple)(struct ast_module *mod, str
        return 0;
 }
 
-int AST_OPTIONAL_API_NAME(ast_agi_unregister_multiple)(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
+int AST_OPTIONAL_API_NAME(ast_agi_unregister_multiple)(struct agi_command *cmd, unsigned int len)
 {
        unsigned int i;
        int res = 0;
@@ -3903,7 +3899,7 @@ int AST_OPTIONAL_API_NAME(ast_agi_unregister_multiple)(struct ast_module *mod, s
                   attempts failed... there is no recourse if
                   any of them do
                */
-               res |= ast_agi_unregister(mod, cmd + i);
+               res |= ast_agi_unregister(cmd + i);
        }
 
        return res;
@@ -4659,7 +4655,7 @@ AST_TEST_DEFINE(test_agi_null_docs)
        }
 #endif
 
-       ast_agi_unregister(ast_module_info->self, &noop_command);
+       ast_agi_unregister(&noop_command);
        return res;
 }
 #endif
@@ -4673,7 +4669,7 @@ static int unload_module(void)
        STASIS_MESSAGE_TYPE_CLEANUP(agi_async_end_type);
 
        ast_cli_unregister_multiple(cli_agi, ARRAY_LEN(cli_agi));
-       ast_agi_unregister_multiple(ast_module_info->self, commands, ARRAY_LEN(commands));
+       ast_agi_unregister_multiple(commands, ARRAY_LEN(commands));
        ast_unregister_application(eapp);
        ast_unregister_application(deadapp);
        ast_manager_unregister("AGI");
@@ -4706,9 +4702,6 @@ static int load_module(void)
                return AST_MODULE_LOAD_DECLINE;
        }
 
-       /* For Optional API. */
-       ast_module_shutdown_ref(AST_MODULE_SELF);
-
        return AST_MODULE_LOAD_SUCCESS;
 }
 
index 6ce25a5..5ffb583 100644 (file)
@@ -196,7 +196,6 @@ int ast_ari_add_handler(struct stasis_rest_handlers *handler)
        ao2_cleanup(root_handler);
        ao2_ref(new_handler, +1);
        root_handler = new_handler;
-       ast_module_ref(ast_module_info->self);
        return 0;
 }
 
@@ -222,7 +221,6 @@ int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
        memcpy(new_handler, root_handler, sizeof(*new_handler));
        for (i = 0, j = 0; i < root_handler->num_children; ++i) {
                if (root_handler->children[i] == handler) {
-                       ast_module_unref(ast_module_info->self);
                        continue;
                }
                new_handler->children[j++] = root_handler->children[i];
index 323bdb3..fd8a448 100644 (file)
@@ -493,7 +493,6 @@ static struct stasis_rest_handlers applications = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&applications);
-       stasis_app_unref();
        return 0;
 }
 
@@ -501,10 +500,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&applications);
        if (res) {
                unload_module();
index 9f76f93..e143a7f 100644 (file)
@@ -1214,7 +1214,6 @@ static struct stasis_rest_handlers asterisk = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&asterisk);
-       stasis_app_unref();
        return 0;
 }
 
@@ -1222,10 +1221,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&asterisk);
        if (res) {
                unload_module();
index 93cf7c4..7ef0f68 100644 (file)
@@ -1556,7 +1556,6 @@ static struct stasis_rest_handlers bridges = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&bridges);
-       stasis_app_unref();
        return 0;
 }
 
@@ -1564,10 +1563,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&bridges);
        if (res) {
                unload_module();
index 7ca7e2e..dae146c 100644 (file)
@@ -2848,7 +2848,6 @@ static struct stasis_rest_handlers channels = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&channels);
-       stasis_app_unref();
        return 0;
 }
 
@@ -2856,10 +2855,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&channels);
        if (res) {
                unload_module();
index 04479e6..12962b6 100644 (file)
@@ -325,7 +325,6 @@ static struct stasis_rest_handlers deviceStates = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&deviceStates);
-       stasis_app_unref();
        return 0;
 }
 
@@ -333,10 +332,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&deviceStates);
        if (res) {
                unload_module();
index 07197ca..947da71 100644 (file)
@@ -448,7 +448,6 @@ static struct stasis_rest_handlers endpoints = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&endpoints);
-       stasis_app_unref();
        return 0;
 }
 
@@ -456,10 +455,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&endpoints);
        if (res) {
                unload_module();
index 06eb77a..c8f28f9 100644 (file)
@@ -424,7 +424,6 @@ static int unload_module(void)
        ao2_cleanup(events.ws_server);
        events.ws_server = NULL;
        ast_ari_websocket_events_event_websocket_dtor();
-       stasis_app_unref();
        return 0;
 }
 
@@ -432,35 +431,29 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
+       struct ast_websocket_protocol *protocol;
 
-       /* This is scoped to not conflict with CHECK_ARI_MODULE_LOADED */
-       {
-               struct ast_websocket_protocol *protocol;
-
-               if (ast_ari_websocket_events_event_websocket_init() == -1) {
-                       return AST_MODULE_LOAD_DECLINE;
-               }
+       if (ast_ari_websocket_events_event_websocket_init() == -1) {
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-               events.ws_server = ast_websocket_server_create();
-               if (!events.ws_server) {
-                       ast_ari_websocket_events_event_websocket_dtor();
-                       return AST_MODULE_LOAD_DECLINE;
-               }
+       events.ws_server = ast_websocket_server_create();
+       if (!events.ws_server) {
+               ast_ari_websocket_events_event_websocket_dtor();
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-               protocol = ast_websocket_sub_protocol_alloc("ari");
-               if (!protocol) {
-                       ao2_ref(events.ws_server, -1);
-                       events.ws_server = NULL;
-                       ast_ari_websocket_events_event_websocket_dtor();
-                       return AST_MODULE_LOAD_DECLINE;
-               }
-               protocol->session_attempted = ast_ari_events_event_websocket_ws_attempted_cb;
-               protocol->session_established = ast_ari_events_event_websocket_ws_established_cb;
-               res |= ast_websocket_server_add_protocol2(events.ws_server, protocol);
+       protocol = ast_websocket_sub_protocol_alloc("ari");
+       if (!protocol) {
+               ao2_ref(events.ws_server, -1);
+               events.ws_server = NULL;
+               ast_ari_websocket_events_event_websocket_dtor();
+               return AST_MODULE_LOAD_DECLINE;
        }
+       protocol->session_attempted = ast_ari_events_event_websocket_ws_attempted_cb;
+       protocol->session_established = ast_ari_events_event_websocket_ws_established_cb;
+       res |= ast_websocket_server_add_protocol2(events.ws_server, protocol);
 
-       stasis_app_ref();
        res |= ast_ari_add_handler(&events);
        if (res) {
                unload_module();
index 123664e..e25a7bc 100644 (file)
@@ -331,7 +331,6 @@ static struct stasis_rest_handlers mailboxes = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&mailboxes);
-       stasis_app_unref();
        return 0;
 }
 
@@ -339,10 +338,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&mailboxes);
        if (res) {
                unload_module();
index 547b39e..5fbfcf1 100644 (file)
@@ -283,7 +283,6 @@ static struct stasis_rest_handlers playbacks = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&playbacks);
-       stasis_app_unref();
        return 0;
 }
 
@@ -291,10 +290,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&playbacks);
        if (res) {
                unload_module();
index 45c789c..6487f3e 100644 (file)
@@ -867,7 +867,6 @@ static struct stasis_rest_handlers recordings = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&recordings);
-       stasis_app_unref();
        return 0;
 }
 
@@ -875,10 +874,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&recordings);
        if (res) {
                unload_module();
index 5c27ebd..b9c9bdf 100644 (file)
@@ -212,7 +212,6 @@ static struct stasis_rest_handlers sounds = {
 static int unload_module(void)
 {
        ast_ari_remove_handler(&sounds);
-       stasis_app_unref();
        return 0;
 }
 
@@ -220,10 +219,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
 
-
-       stasis_app_ref();
        res |= ast_ari_add_handler(&sounds);
        if (res) {
                unload_module();
index 2132097..03f0338 100644 (file)
@@ -637,20 +637,6 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       if (!ast_module_check("res_curl.so")) {
-               if (ast_load_resource("res_curl.so") != AST_MODULE_LOAD_SUCCESS) {
-                       ast_log(LOG_ERROR, "Cannot load res_curl, so res_config_curl cannot be loaded\n");
-                       return AST_MODULE_LOAD_DECLINE;
-               }
-       }
-
-       if (!ast_module_check("func_curl.so")) {
-               if (ast_load_resource("func_curl.so") != AST_MODULE_LOAD_SUCCESS) {
-                       ast_log(LOG_ERROR, "Cannot load func_curl, so res_config_curl cannot be loaded\n");
-                       return AST_MODULE_LOAD_DECLINE;
-               }
-       }
-
        reload_module();
 
        ast_config_engine_register(&curl_engine);
@@ -664,4 +650,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Realtime Curl configu
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_REALTIME_DRIVER,
+       .requires = "res_curl,func_curl",
 );
index 8f97ce9..4f8f2cb 100644 (file)
@@ -651,8 +651,6 @@ static int load_module(void)
                crypto_load(-1, -1);
        }
 
-       /* This prevents dlclose from ever running, but allows CLI cleanup at shutdown. */
-       ast_module_shutdown_ref(ast_module_info->self);
        return AST_MODULE_LOAD_SUCCESS;
 }
 
@@ -663,7 +661,6 @@ static int unload_module(void)
        return 0;
 }
 
-/* needs usecount semantics defined */
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Cryptographic Digital Signatures",
        .support_level = AST_MODULE_SUPPORT_CORE,
        .load = load_module,
index e0f753c..3dc7c2f 100644 (file)
 
 #include "asterisk/module.h"
 
-static const char *dependents[] = {
-       "func_curl.so",
-       "res_config_curl.so",
-       "res_http_media_cache.so",
-};
-
 static int unload_module(void)
 {
-       int res = 0;
-       size_t i;
-
-       /* If the dependent modules are still in memory, forbid unload */
-       for (i = 0; i < ARRAY_LEN(dependents); i++) {
-               if (ast_module_check(dependents[i])) {
-                       if (!ast_shutting_down()) {
-                               ast_log(LOG_WARNING, "%s (dependent module) is still loaded.  Cannot unload res_curl.so\n", dependents[i]);
-                       }
-                       res = -1;
-               }
-       }
-
-       if (res)
-               return -1;
-
        curl_global_cleanup();
 
-       return res;
+       return 0;
 }
 
 static int load_module(void)
index 4be5aee..315f000 100644 (file)
@@ -978,7 +978,6 @@ int ast_fax_tech_register(struct ast_fax_tech *tech)
        AST_RWLIST_WRLOCK(&faxmodules);
        AST_RWLIST_INSERT_TAIL(&faxmodules, fax, list);
        AST_RWLIST_UNLOCK(&faxmodules);
-       ast_module_ref(ast_module_info->self);
 
        ast_verb(3, "Registered handler for '%s' (%s)\n", fax->tech->type, fax->tech->description);
 
@@ -998,7 +997,6 @@ void ast_fax_tech_unregister(struct ast_fax_tech *tech)
                        continue;
                }
                AST_RWLIST_REMOVE_CURRENT(list);
-               ast_module_unref(ast_module_info->self);
                ast_free(fax);
                ast_verb(4, "Unregistered FAX module type '%s'\n", tech->type);
                break;
index ff02675..be2f6ea 100644 (file)
@@ -232,10 +232,8 @@ static pjsip_module logging_module = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
-       if (!ast_module_check("res_hep.so") || !hepv3_is_loaded()) {
-               ast_log(AST_LOG_WARNING, "res_hep is not loaded or running; declining module load\n");
+       if (!hepv3_is_loaded()) {
+               ast_log(AST_LOG_WARNING, "res_hep is disabled; declining module load\n");
                return AST_MODULE_LOAD_DECLINE;
        }
 
index 199c816..c3abbc1 100644 (file)
@@ -157,8 +157,8 @@ static void rtp_topic_handler(void *data, struct stasis_subscription *sub, struc
 
 static int load_module(void)
 {
-       if (!ast_module_check("res_hep.so") || !hepv3_is_loaded()) {
-               ast_log(AST_LOG_WARNING, "res_hep is not loaded or running; declining module load\n");
+       if (!hepv3_is_loaded()) {
+               ast_log(AST_LOG_WARNING, "res_hep is disabled; declining module load\n");
                return AST_MODULE_LOAD_DECLINE;
        }
 
index 918686e..eba7ecc 100644 (file)
@@ -441,4 +441,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "HTTP Media Cache Backend
                .support_level = AST_MODULE_SUPPORT_CORE,
                .load = load_module,
                .unload = unload_module,
+               .requires = "res_curl",
        );
index 86a1547..bcad1c3 100644 (file)
@@ -131,24 +131,18 @@ struct ast_websocket_server {
        struct ao2_container *protocols; /*!< Container for registered protocols */
 };
 
-static void websocket_server_internal_dtor(void *obj)
+static void websocket_server_dtor(void *obj)
 {
        struct ast_websocket_server *server = obj;
        ao2_cleanup(server->protocols);
        server->protocols = NULL;
 }
 
-static void websocket_server_dtor(void *obj)
-{
-       websocket_server_internal_dtor(obj);
-       ast_module_unref(ast_module_info->self);
-}
-
-static struct ast_websocket_server *websocket_server_create_impl(void (*dtor)(void *))
+static struct ast_websocket_server *websocket_server_create_impl(void)
 {
        RAII_VAR(struct ast_websocket_server *, server, NULL, ao2_cleanup);
 
-       server = ao2_alloc(sizeof(*server), dtor);
+       server = ao2_alloc(sizeof(*server), websocket_server_dtor);
        if (!server) {
                return NULL;
        }
@@ -164,13 +158,12 @@ static struct ast_websocket_server *websocket_server_create_impl(void (*dtor)(vo
 
 static struct ast_websocket_server *websocket_server_internal_create(void)
 {
-       return websocket_server_create_impl(websocket_server_internal_dtor);
+       return websocket_server_create_impl();
 }
 
 struct ast_websocket_server *AST_OPTIONAL_API_NAME(ast_websocket_server_create)(void)
 {
-       ast_module_ref(ast_module_info->self);
-       return websocket_server_create_impl(websocket_server_dtor);
+       return websocket_server_create_impl();
 }
 
 /*! \brief Destructor function for sessions */
@@ -997,11 +990,7 @@ static int websocket_add_protocol_internal(const char *name, ast_websocket_callb
 
 int AST_OPTIONAL_API_NAME(ast_websocket_add_protocol)(const char *name, ast_websocket_callback callback)
 {
-       int res = websocket_add_protocol_internal(name, callback);
-       if (res == 0) {
-               ast_module_ref(ast_module_info->self);
-       }
-       return res;
+       return websocket_add_protocol_internal(name, callback);
 }
 
 int AST_OPTIONAL_API_NAME(ast_websocket_add_protocol2)(struct ast_websocket_protocol *protocol)
@@ -1016,7 +1005,6 @@ int AST_OPTIONAL_API_NAME(ast_websocket_add_protocol2)(struct ast_websocket_prot
                return -1;
        }
 
-       ast_module_ref(ast_module_info->self);
        return 0;
 }
 
@@ -1031,11 +1019,7 @@ static int websocket_remove_protocol_internal(const char *name, ast_websocket_ca
 
 int AST_OPTIONAL_API_NAME(ast_websocket_remove_protocol)(const char *name, ast_websocket_callback callback)
 {
-       int res = websocket_remove_protocol_internal(name, callback);
-       if (res == 0) {
-               ast_module_unref(ast_module_info->self);
-       }
-       return res;
+       return websocket_remove_protocol_internal(name, callback);
 }
 
 /*! \brief Parse the given uri into a path and remote address.
@@ -1457,9 +1441,6 @@ static int load_module(void)
        ast_http_uri_link(&websocketuri);
        websocket_add_protocol_internal("echo", websocket_echo_callback);
 
-       /* For Optional API. */
-       ast_module_shutdown_ref(AST_MODULE_SELF);
-
        return 0;
 }
 
index e2b5fb2..a8631dc 100644 (file)
@@ -985,9 +985,6 @@ static int load_module(void)
        ast_manager_register_xml("PauseMonitor", EVENT_FLAG_CALL, pause_monitor_action);
        ast_manager_register_xml("UnpauseMonitor", EVENT_FLAG_CALL, unpause_monitor_action);
 
-       /* For Optional API. */
-       ast_module_shutdown_ref(AST_MODULE_SELF);
-
        return AST_MODULE_LOAD_SUCCESS;
 }
 
index d797991..82c74b9 100644 (file)
@@ -81,16 +81,6 @@ struct ast_mwi_mailbox_object {
 
 static struct ast_sorcery *mwi_sorcery;
 
-void ast_mwi_external_ref(void)
-{
-       ast_module_ref(ast_module_info->self);
-}
-
-void ast_mwi_external_unref(void)
-{
-       ast_module_unref(ast_module_info->self);
-}
-
 /*!
  * \internal
  * \brief Post an update event to the MWI counts.
index 8639fad..e4d5054 100644 (file)
@@ -342,8 +342,6 @@ static int unload_module(void)
        ast_manager_unregister("MWIDelete");
        ast_manager_unregister("MWIUpdate");
 
-       /* Must be done last */
-       ast_mwi_external_unref();
        return 0;
 }
 
@@ -351,9 +349,6 @@ static int load_module(void)
 {
        int res;
 
-       /* Must be done first */
-       ast_mwi_external_ref();
-
        res = 0;
        res |= ast_manager_register_xml("MWIGet", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, mwi_mailbox_get);
        res |= ast_manager_register_xml("MWIDelete", EVENT_FLAG_CALL, mwi_mailbox_delete);
index 6137898..f506a62 100644 (file)
@@ -280,16 +280,6 @@ void ast_pjproject_log_intercept_end(void)
        ast_mutex_unlock(&pjproject_log_intercept_lock);
 }
 
-void ast_pjproject_ref(void)
-{
-       ast_module_ref(ast_module_info->self);
-}
-
-void ast_pjproject_unref(void)
-{
-       ast_module_unref(ast_module_info->self);
-}
-
 static char *handle_pjproject_show_buildopts(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
        int i;
index 0c7fd51..6a7d918 100644 (file)
@@ -2716,7 +2716,7 @@ static pj_sockaddr host_ip_ipv6;
 /*! Local host address for IPv6 (string form) */
 static char host_ip_ipv6_string[PJ_INET6_ADDRSTRLEN];
 
-static int register_service_noref(void *data)
+static int register_service(void *data)
 {
        pjsip_module **module = data;
        if (!ast_pjsip_endpoint) {
@@ -2731,23 +2731,12 @@ static int register_service_noref(void *data)
        return 0;
 }
 
-int internal_sip_register_service(pjsip_module *module)
+int ast_sip_register_service(pjsip_module *module)
 {
-       return ast_sip_push_task_synchronous(NULL, register_service_noref, &module);
+       return ast_sip_push_task_synchronous(NULL, register_service, &module);
 }
 
-int __ast_sip_register_service(pjsip_module *module, const char *file, int line, const char *func)
-{
-       int res;
-
-       if (!(res = ast_sip_push_task_synchronous(NULL, register_service_noref, &module))) {
-               __ast_module_ref(ast_module_info->self, file, line, func);
-       }
-
-       return res;
-}
-
-static int unregister_service_noref(void *data)
+static int unregister_service(void *data)
 {
        pjsip_module **module = data;
        if (!ast_pjsip_endpoint) {
@@ -2758,16 +2747,9 @@ static int unregister_service_noref(void *data)
        return 0;
 }
 
-int internal_sip_unregister_service(pjsip_module *module)
+void ast_sip_unregister_service(pjsip_module *module)
 {
-       return ast_sip_push_task_synchronous(NULL, unregister_service_noref, &module);
-}
-
-void __ast_sip_unregister_service(pjsip_module *module, const char *file, int line, const char *func)
-{
-       if (!ast_sip_push_task_synchronous(NULL, unregister_service_noref, &module)) {
-               __ast_module_unref(ast_module_info->self, file, line, func);
-       }
+       ast_sip_push_task_synchronous(NULL, unregister_service, &module);
 }
 
 static struct ast_sip_authenticator *registered_authenticator;
@@ -2780,7 +2762,7 @@ int ast_sip_register_authenticator(struct ast_sip_authenticator *auth)
        }
        registered_authenticator = auth;
        ast_debug(1, "Registered SIP authenticator module %p\n", auth);
-       ast_module_ref(ast_module_info->self);
+
        return 0;
 }
 
@@ -2793,7 +2775,6 @@ void ast_sip_unregister_authenticator(struct ast_sip_authenticator *auth)
        }
        registered_authenticator = NULL;
        ast_debug(1, "Unregistered SIP authenticator %p\n", auth);
-       ast_module_unref(ast_module_info->self);
 }
 
 int ast_sip_requires_authentication(struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)
@@ -2826,7 +2807,7 @@ int ast_sip_register_outbound_authenticator(struct ast_sip_outbound_authenticato
        }
        registered_outbound_authenticator = auth;
        ast_debug(1, "Registered SIP outbound authenticator module %p\n", auth);
-       ast_module_ref(ast_module_info->self);
+
        return 0;
 }
 
@@ -2839,7 +2820,6 @@ void ast_sip_unregister_outbound_authenticator(struct ast_sip_outbound_authentic
        }
        registered_outbound_authenticator = NULL;
        ast_debug(1, "Unregistered SIP outbound authenticator %p\n", auth);
-       ast_module_unref(ast_module_info->self);
 }
 
 int ast_sip_create_request_with_auth(const struct ast_sip_auth_vector *auths, pjsip_rx_data *challenge,
@@ -2881,7 +2861,6 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
        if (ast_strlen_zero(name)) {
                /* if an identifier has no name then place in front */
                AST_RWLIST_INSERT_HEAD(&endpoint_identifiers, id_list_item, list);
-               ast_module_ref(ast_module_info->self);
                return 0;
        }
 
@@ -2891,7 +2870,6 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
        if (ast_strlen_zero(identifier_order)) {
                id_list_item->priority = UINT_MAX;
                AST_RWLIST_INSERT_TAIL(&endpoint_identifiers, id_list_item, list);
-               ast_module_ref(ast_module_info->self);
                ast_free(identifier_order);
                return 0;
        }
@@ -2919,7 +2897,6 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
                /* if not in the endpoint_identifier_order list then consider it less in
                   priority and add it to the end */
                AST_RWLIST_INSERT_TAIL(&endpoint_identifiers, id_list_item, list);
-               ast_module_ref(ast_module_info->self);
                ast_free(identifier_order);
                return 0;
        }
@@ -2937,7 +2914,6 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
        }
        AST_RWLIST_TRAVERSE_SAFE_END;
 
-       ast_module_ref(ast_module_info->self);
        ast_free(identifier_order);
        return 0;
 }
@@ -2956,7 +2932,6 @@ void ast_sip_unregister_endpoint_identifier(struct ast_sip_endpoint_identifier *
                        AST_RWLIST_REMOVE_CURRENT(list);
                        ast_free(iter);
                        ast_debug(1, "Unregistered endpoint identifier %p\n", identifier);
-                       ast_module_unref(ast_module_info->self);
                        break;
                }
        }
@@ -3099,23 +3074,17 @@ static struct ast_cli_entry cli_commands[] = {
 
 AST_RWLIST_HEAD_STATIC(endpoint_formatters, ast_sip_endpoint_formatter);
 
-void internal_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
+void ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
 {
        SCOPED_LOCK(lock, &endpoint_formatters, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
        AST_RWLIST_INSERT_TAIL(&endpoint_formatters, obj, next);
 }
 
-int ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
-{
-       internal_sip_register_endpoint_formatter(obj);
-       ast_module_ref(ast_module_info->self);
-       return 0;
-}
-
-int internal_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
+void ast_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
 {
        struct ast_sip_endpoint_formatter *i;
        SCOPED_LOCK(lock, &endpoint_formatters, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
+
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&endpoint_formatters, i, next) {
                if (i == obj) {
                        AST_RWLIST_REMOVE_CURRENT(next);
@@ -3123,14 +3092,6 @@ int internal_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter
                }
        }
        AST_RWLIST_TRAVERSE_SAFE_END;
-       return i == obj ? 0 : -1;
-}
-
-void ast_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
-{
-       if (!internal_sip_unregister_endpoint_formatter(obj)) {
-               ast_module_unref(ast_module_info->self);
-       }
 }
 
 int ast_sip_format_endpoint_ami(struct ast_sip_endpoint *endpoint,
@@ -3817,7 +3778,7 @@ int ast_sip_create_request(const char *method, struct pjsip_dialog *dlg,
 
 AST_RWLIST_HEAD_STATIC(supplements, ast_sip_supplement);
 
-void internal_sip_register_supplement(struct ast_sip_supplement *supplement)
+void ast_sip_register_supplement(struct ast_sip_supplement *supplement)
 {
        struct ast_sip_supplement *iter;
        int inserted = 0;
@@ -3837,39 +3798,18 @@ void internal_sip_register_supplement(struct ast_sip_supplement *supplement)
        }
 }
 
-int __ast_sip_register_supplement(struct ast_sip_supplement *supplement,
-       const char *file, int line, const char *func)
-{
-       internal_sip_register_supplement(supplement);
-       __ast_module_ref(ast_module_info->self, file, line, func);
-
-       return 0;
-}
-
-int internal_sip_unregister_supplement(struct ast_sip_supplement *supplement)
+void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement)
 {
        struct ast_sip_supplement *iter;
        SCOPED_LOCK(lock, &supplements, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
-       int res = -1;
 
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&supplements, iter, next) {
                if (supplement == iter) {
                        AST_RWLIST_REMOVE_CURRENT(next);
-                       res = 0;
                        break;
                }
        }
        AST_RWLIST_TRAVERSE_SAFE_END;
-
-       return res;
-}
-
-void __ast_sip_unregister_supplement(struct ast_sip_supplement *supplement,
-       const char *file, int line, const char *func)
-{
-       if (!internal_sip_unregister_supplement(supplement)) {
-               __ast_module_unref(ast_module_info->self, file, line, func);
-       }
 }
 
 static int send_in_dialog_request(pjsip_tx_data *tdata, struct pjsip_dialog *dlg)
@@ -4999,7 +4939,7 @@ static int unload_pjsip(void *data)
                ast_res_pjsip_destroy_configuration();
                ast_sip_destroy_system();
                ast_sip_destroy_global_headers();
-               internal_sip_unregister_service(&supplement_module);
+               ast_sip_unregister_service(&supplement_module);
                ast_sip_destroy_transport_events();
        }
 
@@ -5099,8 +5039,6 @@ static int load_module(void)
 {
        struct ast_threadpool_options options;
 
-       CHECK_PJPROJECT_MODULE_LOADED();
-
        /* pjproject and config_system need to be initialized before all else */
        if (pj_init() != PJ_SUCCESS) {
                return AST_MODULE_LOAD_DECLINE;
@@ -5166,7 +5104,7 @@ static int load_module(void)
                goto error;
        }
 
-       if (internal_sip_register_service(&supplement_module)) {
+       if (ast_sip_register_service(&supplement_module)) {
                ast_log(LOG_ERROR, "Failed to initialize supplement hooks. Aborting load\n");
                goto error;
        }
@@ -5183,8 +5121,6 @@ static int load_module(void)
        AST_TEST_REGISTER(xml_sanitization_end_null);
        AST_TEST_REGISTER(xml_sanitization_exceeds_buffer);
 
-       ast_pjproject_ref();
-
        return AST_MODULE_LOAD_SUCCESS;
 
 error:
@@ -5226,8 +5162,6 @@ static int unload_module(void)
        serializer_pool_shutdown();
        ast_threadpool_shutdown(sip_threadpool);
 
-       ast_pjproject_unref();
-
        return 0;
 }
 
index 4732681..b1bf9c4 100644 (file)
@@ -374,7 +374,7 @@ int ast_sip_initialize_sorcery_auth(void)
        ast_sorcery_object_field_register_custom(sorcery, SIP_SORCERY_AUTH_TYPE, "auth_type",
                        "userpass", auth_type_handler, auth_type_to_str, NULL, 0, 0);
 
-       internal_sip_register_endpoint_formatter(&endpoint_auth_formatter);
+       ast_sip_register_endpoint_formatter(&endpoint_auth_formatter);
 
        cli_formatter = ao2_alloc(sizeof(struct ast_sip_cli_formatter_entry), NULL);
        if (!cli_formatter) {
@@ -403,7 +403,7 @@ int ast_sip_destroy_sorcery_auth(void)
 {
        ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
        ast_sip_unregister_cli_formatter(cli_formatter);
-       internal_sip_unregister_endpoint_formatter(&endpoint_auth_formatter);
+       ast_sip_unregister_endpoint_formatter(&endpoint_auth_formatter);
 
        ast_manager_unregister("PJSIPShowAuths");
 
index 713ab02..15c0376 100644 (file)
@@ -1436,7 +1436,7 @@ int ast_sip_initialize_sorcery_transport(void)
        ast_sorcery_object_field_register(sorcery, "transport", "allow_reload", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_transport, allow_reload));
        ast_sorcery_object_field_register(sorcery, "transport", "symmetric_transport", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_transport, symmetric_transport));
 
-       internal_sip_register_endpoint_formatter(&endpoint_transport_formatter);
+       ast_sip_register_endpoint_formatter(&endpoint_transport_formatter);
 
        cli_formatter = ao2_alloc(sizeof(struct ast_sip_cli_formatter_entry), NULL);
        if (!cli_formatter) {
@@ -1466,7 +1466,7 @@ int ast_sip_destroy_sorcery_transport(void)
        ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
        ast_sip_unregister_cli_formatter(cli_formatter);
 
-       internal_sip_unregister_endpoint_formatter(&endpoint_transport_formatter);
+       ast_sip_unregister_endpoint_formatter(&endpoint_transport_formatter);
 
        ao2_ref(transport_states, -1);
        transport_states = NULL;
index 5ce3c6f..7fafd80 100644 (file)
@@ -314,58 +314,10 @@ int sip_cli_print_global(struct ast_sip_cli_context *context);
  */
 int sip_cli_print_system(struct ast_sip_cli_context *context);
 
-/*!
- * \internal
- * \brief Used by res_pjsip.so to register a service without adding a self reference
- */
-int internal_sip_register_service(pjsip_module *module);
-
-/*!
- * \internal
- * \brief Used by res_pjsip.so to unregister a service without removing a self reference
- */
-int internal_sip_unregister_service(pjsip_module *module);
-
-/*!
- * \internal
- * \brief Used by res_pjsip.so to register a supplement without adding a self reference
- */
-void internal_sip_register_supplement(struct ast_sip_supplement *supplement);
-
-/*!
- * \internal
- * \brief Used by res_pjsip.so to unregister a supplement without removing a self reference
- */
-int internal_sip_unregister_supplement(struct ast_sip_supplement *supplement);
-
-/*!
- * \internal
- * \brief Used by res_pjsip.so to register an endpoint formatter without adding a self reference
- */
-void internal_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
-
-/*!
- * \internal
- * \brief Used by res_pjsip.so to unregister a endpoint formatter without removing a self reference
- */
-int internal_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
-
 struct ast_sip_session_supplement;
 
 /*!
  * \internal
- * \brief Used by res_pjsip.so to register a session supplement without adding a self reference
- */
-void internal_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);
-
-/*!
- * \internal
- * \brief Used by res_pjsip.so to unregister a session supplement without removing a self reference
- */
-int internal_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement);
-
-/*!
- * \internal
  * \brief Finds or creates contact_status for a contact
  */
 struct ast_sip_contact_status *ast_res_pjsip_find_or_create_contact_status(const struct ast_sip_contact *contact);
index eb9e588..84f73c7 100644 (file)
@@ -1346,7 +1346,7 @@ int ast_sip_initialize_sorcery_location(void)
        ast_sorcery_object_field_register(sorcery, "aor", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_aor, outbound_proxy));
        ast_sorcery_object_field_register(sorcery, "aor", "support_path", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, support_path));
 
-       internal_sip_register_endpoint_formatter(&endpoint_aor_formatter);
+       ast_sip_register_endpoint_formatter(&endpoint_aor_formatter);
 
        contact_formatter = ao2_alloc(sizeof(struct ast_sip_cli_formatter_entry), NULL);
        if (!contact_formatter) {
@@ -1402,7 +1402,7 @@ int ast_sip_destroy_sorcery_location(void)
        ast_sip_unregister_cli_formatter(aor_formatter);
        ast_manager_unregister("PJSIPShowAors");
 
-       internal_sip_unregister_endpoint_formatter(&endpoint_aor_formatter);
+       ast_sip_unregister_endpoint_formatter(&endpoint_aor_formatter);
 
        return 0;
 }
index b4828d8..c239c1a 100644 (file)
@@ -1243,15 +1243,15 @@ int ast_sip_initialize_distributor(void)
                return -1;
        }
 
-       if (internal_sip_register_service(&distributor_mod)) {
+       if (ast_sip_register_service(&distributor_mod)) {
                ast_sip_destroy_distributor();
                return -1;
        }
-       if (internal_sip_register_service(&endpoint_mod)) {
+       if (ast_sip_register_service(&endpoint_mod)) {
                ast_sip_destroy_distributor();
                return -1;
        }
-       if (internal_sip_register_service(&auth_mod)) {
+       if (ast_sip_register_service(&auth_mod)) {
                ast_sip_destroy_distributor();
                return -1;
        }
@@ -1282,9 +1282,9 @@ void ast_sip_destroy_distributor(void)
        ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
        ast_sip_unregister_cli_formatter(unid_formatter);
 
-       internal_sip_unregister_service(&auth_mod);
-       internal_sip_unregister_service(&endpoint_mod);
-       internal_sip_unregister_service(&distributor_mod);
+       ast_sip_unregister_service(&auth_mod);
+       ast_sip_unregister_service(&endpoint_mod);
+       ast_sip_unregister_service(&distributor_mod);
 
        ao2_global_obj_release(artificial_auth);
        ao2_cleanup(artificial_endpoint);
index 4de28b5..52075ae 100644 (file)
@@ -165,7 +165,7 @@ void ast_sip_initialize_global_headers(void)
        AST_RWLIST_HEAD_INIT(&request_headers);
        AST_RWLIST_HEAD_INIT(&response_headers);
 
-       internal_sip_register_service(&global_header_mod);
+       ast_sip_register_service(&global_header_mod);
 }
 
 static void destroy_headers(struct header_list *headers)
@@ -183,5 +183,5 @@ void ast_sip_destroy_global_headers(void)
        destroy_headers(&request_headers);
        destroy_headers(&response_headers);
 
-       internal_sip_unregister_service(&global_header_mod);
+       ast_sip_unregister_service(&global_header_mod);
 }
index 427aec7..f948c44 100644 (file)
@@ -517,24 +517,24 @@ static pj_bool_t filter_on_rx_message(pjsip_rx_data *rdata)
 
 void ast_res_pjsip_cleanup_message_filter(void)
 {
-       internal_sip_unregister_service(&filter_module_tsx);
-       internal_sip_unregister_service(&filter_module_transport);
-       internal_sip_unregister_supplement(&filter_supplement);
-       internal_sip_session_unregister_supplement(&filter_session_supplement);
+       ast_sip_unregister_service(&filter_module_tsx);
+       ast_sip_unregister_service(&filter_module_transport);
+       ast_sip_unregister_supplement(&filter_supplement);
+       ast_sip_session_unregister_supplement(&filter_session_supplement);
 }
 
 int ast_res_pjsip_init_message_filter(void)
 {
-       internal_sip_session_register_supplement(&filter_session_supplement);
-       internal_sip_register_supplement(&filter_supplement);
+       ast_sip_session_register_supplement(&filter_session_supplement);
+       ast_sip_register_supplement(&filter_supplement);
 
-       if (internal_sip_register_service(&filter_module_transport)) {
+       if (ast_sip_register_service(&filter_module_transport)) {
                ast_log(LOG_ERROR, "Could not register message filter module for incoming and outgoing requests\n");
                ast_res_pjsip_cleanup_message_filter();
                return -1;
        }
 
-       if (internal_sip_register_service(&filter_module_tsx)) {
+       if (ast_sip_register_service(&filter_module_tsx)) {
                ast_log(LOG_ERROR, "Could not register message filter module for incoming and outgoing requests\n");
                ast_res_pjsip_cleanup_message_filter();
                return -1;
index 3465eae..4ae1f31 100644 (file)
@@ -1562,7 +1562,7 @@ int ast_res_pjsip_init_options_handling(int reload)
                return -1;
        }
 
-       internal_sip_register_endpoint_formatter(&contact_status_formatter);
+       ast_sip_register_endpoint_formatter(&contact_status_formatter);
        ast_manager_register_xml("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify);
        ast_manager_register_xml("PJSIPShowContacts", EVENT_FLAG_SYSTEM, ami_show_contacts);
        ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options));
@@ -1578,7 +1578,7 @@ void ast_res_pjsip_cleanup_options_handling(void)
        ast_cli_unregister_multiple(cli_options, ARRAY_LEN(cli_options));
        ast_manager_unregister("PJSIPQualify");
        ast_manager_unregister("PJSIPShowContacts");
-       internal_sip_unregister_endpoint_formatter(&contact_status_formatter);
+       ast_sip_unregister_endpoint_formatter(&contact_status_formatter);
 
        ast_sorcery_observer_remove(ast_sip_get_sorcery(), "aor", &observer_callbacks_options);
        pjsip_endpt_unregister_module(ast_sip_get_pjsip_endpoint(), &options_module);
index 153561c..f3f3a4d 100644 (file)
@@ -32,7 +32,7 @@
 
 AST_RWLIST_HEAD_STATIC(session_supplements, ast_sip_session_supplement);
 
-void internal_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)
+void ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)
 {
        struct ast_sip_session_supplement *iter;
        int inserted = 0;
@@ -56,39 +56,18 @@ void internal_sip_session_register_supplement(struct ast_sip_session_supplement
        }
 }
 
-int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement,
-       const char *file, int line, const char *func)
-{
-       internal_sip_session_register_supplement(supplement);
-       __ast_module_ref(AST_MODULE_SELF, file, line, func);
-
-       return 0;
-}
-
-int internal_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
+void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
 {
        struct ast_sip_session_supplement *iter;
-       int res = -1;
        SCOPED_LOCK(lock, &session_supplements, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
 
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&session_supplements, iter, next) {
                if (supplement == iter) {
                        AST_RWLIST_REMOVE_CURRENT(next);
-                       res = 0;
                        break;
                }
        }
        AST_RWLIST_TRAVERSE_SAFE_END;
-
-       return res;
-}
-
-void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement,
-       const char *file, int line, const char *func)
-{
-       if (!internal_sip_session_unregister_supplement(supplement)) {
-               __ast_module_unref(AST_MODULE_SELF, file, line, func);
-       }
 }
 
 static struct ast_sip_session_supplement *supplement_dup(const struct ast_sip_session_supplement *src)
index 9269864..8caf703 100644 (file)
@@ -282,8 +282,6 @@ static void *acl_alloc(const char *name)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        ast_sorcery_apply_config(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE);
        ast_sorcery_apply_default(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE,
                                  "config", "pjsip.conf,criteria=type=acl");
index b6f2b74..518ef73 100644 (file)
@@ -524,8 +524,6 @@ static int reload_module(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (build_entity_id()) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 1673147..f15a66c 100644 (file)
@@ -746,8 +746,6 @@ static struct ast_sip_session_supplement caller_id_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        ast_sip_session_register_supplement(&caller_id_supplement);
        return AST_MODULE_LOAD_SUCCESS;
 }
index 866ea9d..a13995f 100644 (file)
@@ -198,8 +198,6 @@ static struct ast_sip_pubsub_body_generator dialog_info_body_generator = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
        if (ast_sip_pubsub_register_body_generator(&dialog_info_body_generator)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 84c42dc..e82140b 100644 (file)
@@ -411,8 +411,6 @@ static struct ast_sip_session_supplement diversion_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        ast_sip_session_register_supplement(&diversion_supplement);
        return AST_MODULE_LOAD_SUCCESS;
 }
@@ -428,5 +426,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP Add Diversion H
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index 565ad2a..93e3f22 100644 (file)
@@ -83,11 +83,8 @@ static struct ast_sip_session_supplement  dlg_options_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
+       ast_sip_session_register_supplement(&dlg_options_supplement);
 
-       if (ast_sip_session_register_supplement(&dlg_options_supplement)) {
-               return AST_MODULE_LOAD_DECLINE;
-       }
        return AST_MODULE_LOAD_SUCCESS;
 }
 
index 68df617..983498d 100644 (file)
@@ -160,8 +160,6 @@ static struct ast_sip_session_supplement dtmf_info_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        ast_sip_session_register_supplement(&dtmf_info_supplement);
        return AST_MODULE_LOAD_SUCCESS;
 }
@@ -177,5 +175,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP DTMF INFO Suppo
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index c67835c..74e5729 100644 (file)
@@ -66,8 +66,6 @@ static struct ast_sip_session_supplement empty_info_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        ast_sip_session_register_supplement(&empty_info_supplement);
        return AST_MODULE_LOAD_SUCCESS;
 }
@@ -83,5 +81,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP Empty INFO Supp
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index 16662eb..918aec5 100644 (file)
@@ -116,8 +116,6 @@ static struct ast_sip_endpoint_identifier anonymous_identifier = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        ast_sip_register_endpoint_identifier_with_name(&anonymous_identifier, "anonymous");
        return AST_MODULE_LOAD_SUCCESS;
 }
index ee47e4d..555d653 100644 (file)
@@ -717,8 +717,6 @@ static struct ast_sip_cli_formatter_entry *cli_formatter;
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        ast_sorcery_apply_config(ast_sip_get_sorcery(), "res_pjsip_endpoint_identifier_ip");
        ast_sorcery_apply_default(ast_sip_get_sorcery(), "identify", "config", "pjsip.conf,criteria=type=identify");
 
index 1b0c7d9..e18d2fa 100644 (file)
@@ -195,8 +195,6 @@ static struct ast_sip_endpoint_identifier auth_username_identifier = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        ast_sip_register_endpoint_identifier_with_name(&username_identifier, "username");
        ast_sip_register_endpoint_identifier_with_name(&auth_username_identifier, "auth_username");
        return AST_MODULE_LOAD_SUCCESS;
index e70eba7..47ec8b4 100644 (file)
@@ -959,13 +959,6 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
-       if (!ast_module_check("res_pjsip_outbound_publish.so")) {
-               ast_log(LOG_WARNING, "This module requires the 'res_pjsip_outbound_publish.so' module to be loaded\n");
-               return AST_MODULE_LOAD_DECLINE;
-       }
-
        publishers = ao2_container_alloc(PUBLISHER_BUCKETS, exten_state_publisher_hash,
                exten_state_publisher_cmp);
        if (!publishers) {
index 06fba06..7930263 100644 (file)
@@ -609,8 +609,6 @@ static struct ast_sip_session_supplement header_funcs_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        ast_sip_session_register_supplement(&header_funcs_supplement);
        ast_custom_function_register(&pjsip_header_function);
 
index 40d26d5..fa9e27f 100644 (file)
@@ -1364,8 +1364,6 @@ static struct ast_cli_entry cli_pjsip[] = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        log_level = ast_logger_register_level("PJSIP_HISTORY");
        if (log_level < 0) {
                ast_log(LOG_WARNING, "Unable to register history log level\n");
index 460b6a3..49ad6fa 100644 (file)
@@ -231,8 +231,6 @@ static const struct ast_sorcery_observer global_observer = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &global_observer)) {
                ast_log(LOG_WARNING, "Unable to add global observer\n");
                return AST_MODULE_LOAD_DECLINE;
index 3739bcf..cbaed83 100644 (file)
@@ -805,8 +805,6 @@ static pjsip_module messaging_module = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        if (ast_sip_register_service(&messaging_module) != PJ_SUCCESS) {
                return AST_MODULE_LOAD_DECLINE;
        }
@@ -849,5 +847,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP Messaging Suppo
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index 92dc7dc..90fdc09 100644 (file)
@@ -1339,8 +1339,6 @@ static int reload(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (ast_sip_register_subscription_handler(&mwi_handler)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 65ac600..29b2ed0 100644 (file)
@@ -97,8 +97,6 @@ static struct ast_sip_pubsub_body_generator mwi_generator = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
        if (ast_sip_pubsub_register_body_generator(&mwi_generator)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 4231a1e..1d42805 100644 (file)
@@ -357,18 +357,12 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        if (ast_sip_register_service(&nat_module)) {
                ast_log(LOG_ERROR, "Could not register NAT module for incoming and outgoing requests\n");
                return AST_MODULE_LOAD_DECLINE;
        }
 
-       if (ast_sip_session_register_supplement(&nat_supplement)) {
-               ast_log(LOG_ERROR, "Could not register NAT session supplement for incoming and outgoing INVITE requests\n");
-               unload_module();
-               return AST_MODULE_LOAD_DECLINE;
-       }
+       ast_sip_session_register_supplement(&nat_supplement);
 
        return AST_MODULE_LOAD_SUCCESS;
 }
@@ -378,5 +372,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP NAT Support",
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index 9767c56..253cf9a 100644 (file)
@@ -987,8 +987,6 @@ static int manager_notify(struct mansession *s, const struct message *m)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (aco_info_init(&notify_cfg)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index ef59fca..50f2a38 100644 (file)
@@ -107,12 +107,7 @@ static struct ast_sip_session_supplement info_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
-       if (ast_sip_session_register_supplement(&info_supplement)) {
-               ast_log(LOG_ERROR, "Unable to register One Touch Recording supplement\n");
-               return AST_MODULE_LOAD_DECLINE;
-       }
+       ast_sip_session_register_supplement(&info_supplement);
 
        return AST_MODULE_LOAD_SUCCESS;
 }
@@ -128,5 +123,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP INFO One Touch
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index 54bba08..063b4d3 100644 (file)
@@ -205,8 +205,6 @@ static struct ast_sip_outbound_authenticator digest_authenticator = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (ast_sip_register_outbound_authenticator(&digest_authenticator)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index b4e3320..75e74a2 100644 (file)
@@ -345,7 +345,6 @@ AST_RWLIST_HEAD_STATIC(publisher_handlers, ast_sip_event_publisher_handler);
 static void sub_add_handler(struct ast_sip_event_publisher_handler *handler)
 {
        AST_RWLIST_INSERT_TAIL(&publisher_handlers, handler, next);
-       ast_module_ref(ast_module_info->self);
 }
 
 static struct ast_sip_event_publisher_handler *find_publisher_handler_for_event_name(const char *event_name)
@@ -643,7 +642,6 @@ void ast_sip_unregister_event_publisher_handler(struct ast_sip_event_publisher_h
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&publisher_handlers, iter, next) {
                if (handler == iter) {
                        AST_RWLIST_REMOVE_CURRENT(next);
-                       ast_module_unref(ast_module_info->self);
                        break;
                }
        }
@@ -1643,8 +1641,6 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        /* As of pjproject 2.4.5, PJSIP_MAX_URL_SIZE isn't exposed yet but we try anyway. */
        ast_pjproject_get_buildopt("PJSIP_MAX_URL_SIZE", "%d", &pjsip_max_url_size);
 
index 80b885f..4baf23c 100644 (file)
@@ -2177,8 +2177,6 @@ static int load_module(void)
 {
        struct ao2_container *new_states;
 
-       CHECK_PJSIP_MODULE_LOADED();
-
        shutdown_group = ast_serializer_shutdown_group_alloc();
        if (!shutdown_group) {
                return AST_MODULE_LOAD_DECLINE;
index b245f15..3c545f9 100644 (file)
@@ -238,16 +238,8 @@ static struct ast_sip_session_supplement path_session_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
-       if (ast_sip_register_supplement(&path_supplement)) {
-               return AST_MODULE_LOAD_DECLINE;
-       }
-
-       if (ast_sip_session_register_supplement(&path_session_supplement)) {
-               ast_sip_unregister_supplement(&path_supplement);
-               return AST_MODULE_LOAD_DECLINE;
-       }
+       ast_sip_register_supplement(&path_supplement);
+       ast_sip_session_register_supplement(&path_session_supplement);
 
        return AST_MODULE_LOAD_SUCCESS;
 }
@@ -264,5 +256,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP Path Header Sup
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index 11031c3..acb1e68 100644 (file)
@@ -367,8 +367,6 @@ static int load_users(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        sorcery = ast_sip_get_sorcery();
 
        ast_sorcery_apply_config(sorcery, "res_pjsip_phoneprov_provider");
index 6426dfa..8bc062e 100644 (file)
@@ -116,8 +116,6 @@ static struct ast_sip_pubsub_body_generator pidf_body_generator = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
        if (ast_sip_pubsub_register_body_generator(&pidf_body_generator)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index f855e21..832f423 100644 (file)
@@ -95,8 +95,6 @@ static struct ast_sip_pubsub_body_supplement pidf_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
        if (ast_sip_pubsub_register_body_supplement(&pidf_supplement)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 6629aa3..15446bc 100644 (file)
@@ -92,8 +92,6 @@ static struct ast_sip_pubsub_body_supplement pidf_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
        if (ast_sip_pubsub_register_body_supplement(&pidf_supplement)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 13d7fd4..220ba0b 100644 (file)
@@ -855,8 +855,6 @@ static int regex_filter_handler(const struct aco_option *opt, struct ast_variabl
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
        if (ast_eid_is_empty(&ast_eid_default)) {
                ast_log(LOG_ERROR, "Entity ID is not set.\n");
                return AST_MODULE_LOAD_DECLINE;
index af696b8..369e06d 100644 (file)
@@ -2583,8 +2583,6 @@ int ast_sip_register_publish_handler(struct ast_sip_publish_handler *handler)
 
        publish_add_handler(handler);
 
-       ast_module_ref(ast_module_info->self);
-
        return 0;
 }
 
@@ -2597,7 +2595,6 @@ void ast_sip_unregister_publish_handler(struct ast_sip_publish_handler *handler)
                if (handler == iter) {
                        AST_RWLIST_REMOVE_CURRENT(next);
                        ao2_cleanup(handler->publications);
-                       ast_module_unref(ast_module_info->self);
                        break;
                }
        }
@@ -2611,7 +2608,6 @@ static void sub_add_handler(struct ast_sip_subscription_handler *handler)
 {
        AST_RWLIST_WRLOCK(&subscription_handlers);
        AST_RWLIST_INSERT_TAIL(&subscription_handlers, handler, next);
-       ast_module_ref(ast_module_info->self);
        AST_RWLIST_UNLOCK(&subscription_handlers);
 }
 
@@ -2670,7 +2666,6 @@ void ast_sip_unregister_subscription_handler(struct ast_sip_subscription_handler
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&subscription_handlers, iter, next) {
                if (handler == iter) {
                        AST_RWLIST_REMOVE_CURRENT(next);
-                       ast_module_unref(ast_module_info->self);
                        break;
                }
        }
@@ -5378,8 +5373,6 @@ static int load_module(void)
        static const pj_str_t str_PUBLISH = { "PUBLISH", 7 };
        struct ast_sorcery *sorcery;
 
-       CHECK_PJSIP_MODULE_LOADED();
-
        sorcery = ast_sip_get_sorcery();
 
        if (!(sched = ast_sched_context_create())) {
index 3100993..5e0141b 100644 (file)
@@ -1202,8 +1202,6 @@ static int load_module(void)
 {
        const pj_str_t str_norefersub = { "norefersub", 10 };
 
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        pjsip_replaces_init_module(ast_sip_get_pjsip_endpoint());
        pjsip_xfer_init_module(ast_sip_get_pjsip_endpoint());
        pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_SUPPORTED, NULL, 1, &str_norefersub);
index 7277a5f..00981fb 100644 (file)
@@ -1095,14 +1095,10 @@ static int load_module(void)
 {
        const pj_str_t STR_REGISTER = { "REGISTER", 8 };
 
-       CHECK_PJPROJECT_MODULE_LOADED();
-
        ast_pjproject_get_buildopt("PJ_MAX_HOSTNAME", "%d", &pj_max_hostname);
        /* As of pjproject 2.4.5, PJSIP_MAX_URL_SIZE isn't exposed yet but we try anyway. */
        ast_pjproject_get_buildopt("PJSIP_MAX_URL_SIZE", "%d", &pjsip_max_url_size);
 
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (ast_sip_register_service(&registrar_module)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 85e3fb8..e89ea03 100644 (file)
@@ -137,8 +137,6 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &expiration_global_observer);
        ast_sorcery_reload_object(ast_sip_get_sorcery(), "global");
 
index 8b8035e..6c02a17 100644 (file)
@@ -138,8 +138,6 @@ static struct ast_sip_session_supplement rfc3326_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        ast_sip_session_register_supplement(&rfc3326_supplement);
        return AST_MODULE_LOAD_SUCCESS;
 }
@@ -155,5 +153,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP RFC3326 Support
        .load = load_module,
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND,
-       .requires = "res_pjsip",
+       .requires = "res_pjsip,res_pjsip_session",
 );
index 3cc9764..ce8ed82 100644 (file)
@@ -1928,8 +1928,6 @@ static int unload_module(void)
  */
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        if (ast_check_ipv6()) {
                ast_sockaddr_parse(&address_rtp, "::", 0);
        } else {
index 06c3edc..d689602 100644 (file)
@@ -215,12 +215,7 @@ static struct ast_sip_session_supplement refer_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
-       if (ast_sip_session_register_supplement(&refer_supplement)) {
-               ast_log(LOG_ERROR, "Unable to register Send to Voicemail supplement\n");
-               return AST_MODULE_LOAD_DECLINE;
-       }
+       ast_sip_session_register_supplement(&refer_supplement);
 
        return AST_MODULE_LOAD_SUCCESS;
 }
index 8247fba..4d4ed47 100644 (file)
@@ -124,7 +124,7 @@ int ast_sip_session_register_sdp_handler(struct ast_sip_session_sdp_handler *han
                }
                AST_LIST_INSERT_TAIL(&handler_list->list, handler, next);
                ast_debug(1, "Registered SDP stream handler '%s' for stream type '%s'\n", handler->id, stream_type);
-               ast_module_ref(ast_module_info->self);
+
                return 0;
        }
 
@@ -141,7 +141,7 @@ int ast_sip_session_register_sdp_handler(struct ast_sip_session_sdp_handler *han
                return -1;
        }
        ast_debug(1, "Registered SDP stream handler '%s' for stream type '%s'\n", handler->id, stream_type);
-       ast_module_ref(ast_module_info->self);
+
        return 0;
 }
 
@@ -156,7 +156,6 @@ static int remove_handler(void *obj, void *arg, void *data, int flags)
                if (!strcmp(iter->id, handler->id)) {
                        AST_LIST_REMOVE_CURRENT(next);
                        ast_debug(1, "Unregistered SDP stream handler '%s' for stream type '%s'\n", handler->id, stream_type);
-                       ast_module_unref(ast_module_info->self);
                }
        }
        AST_LIST_TRAVERSE_SAFE_END;
@@ -4156,8 +4155,6 @@ static int load_module(void)
 {
        pjsip_endpoint *endpt;
 
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (!ast_sip_get_sorcery() || !ast_sip_get_pjsip_endpoint()) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 41b26df..7c0ff43 100644 (file)
@@ -90,8 +90,6 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        if (ast_sip_register_service(&sips_contact_module)) {
                return AST_MODULE_LOAD_DECLINE;
        }
index 7b7cd99..249472b 100644 (file)
@@ -1023,18 +1023,13 @@ static int unload_module(void)
  */
 static int load_module(void)
 {
-       CHECK_PJSIP_SESSION_MODULE_LOADED();
-
        if (ast_check_ipv6()) {
                ast_sockaddr_parse(&address, "::", 0);
        } else {
                ast_sockaddr_parse(&address, "0.0.0.0", 0);
        }
 
-       if (ast_sip_session_register_supplement(&t38_supplement)) {
-               ast_log(LOG_ERROR, "Unable to register T.38 session supplement\n");
-               goto end;
-       }
+       ast_sip_session_register_supplement(&t38_supplement);
 
        if (ast_sip_session_register_sdp_handler(&image_sdp_handler, "image")) {
                ast_log(LOG_ERROR, "Unable to register SDP handler for image stream type\n");
index acffb86..afaa248 100644 (file)
@@ -323,8 +323,6 @@ static int load_module(void)
 {
        struct ao2_container *transports;
 
-       CHECK_PJSIP_MODULE_LOADED();
-
        transports = ao2_container_alloc(TRANSPORTS_BUCKETS, monitored_transport_hash_fn,
                monitored_transport_cmp_fn);
        if (!transports) {
index af1345f..974b150 100644 (file)
@@ -471,8 +471,6 @@ static struct ast_sip_session_supplement websocket_supplement = {
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        /*
         * We only need one transport type name (ws) defined.  Firefox
         * and Chrome do not support anything other than secure websockets
@@ -490,10 +488,7 @@ static int load_module(void)
                return AST_MODULE_LOAD_DECLINE;
        }
 
-       if (ast_sip_session_register_supplement(&websocket_supplement)) {
-               ast_sip_unregister_service(&websocket_module);
-               return AST_MODULE_LOAD_DECLINE;
-       }
+       ast_sip_session_register_supplement(&websocket_supplement);
 
        if (ast_websocket_add_protocol("sip", websocket_cb)) {
                ast_sip_session_unregister_supplement(&websocket_supplement);
index f7c84db..7395fd9 100644 (file)
@@ -148,8 +148,6 @@ static void unregister_all(void)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_PUBSUB_MODULE_LOADED();
-
        if (ast_sip_pubsub_register_body_generator(&xpidf_body_generator)) {
                goto fail;
        }
index 3a12285..9beabfb 100644 (file)
@@ -1472,9 +1472,6 @@ static int load_module(void)
        ast_cli_register_multiple(cli_pktccops, sizeof(cli_pktccops) / sizeof(struct ast_cli_entry));
        restart_pktc_thread();
 
-       /* For Optional API. */
-       ast_module_shutdown_ref(AST_MODULE_SELF);
-
        return 0;
 }
 
index 76e70c2..1d4826a 100644 (file)
@@ -1405,9 +1405,6 @@ static int load_module(void)
        ast_custom_function_register(&smdi_msg_retrieve_function);
        ast_custom_function_register(&smdi_msg_function);
 
-       /* For Optional API. */
-       ast_module_shutdown_ref(AST_MODULE_SELF);
-
        return AST_MODULE_LOAD_SUCCESS;
 }
 
index a60ec5f..dcd7414 100644 (file)
@@ -1302,8 +1302,6 @@ static void remove_stasis_end_published(struct ast_channel *chan)
 int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
                    char *argv[])
 {
-       SCOPED_MODULE_USE(ast_module_info->self);
-
        RAII_VAR(struct stasis_app *, app, NULL, ao2_cleanup);
        RAII_VAR(struct stasis_app_control *, control, NULL, control_unlink);
        struct ast_bridge *bridge = NULL;
@@ -1654,11 +1652,6 @@ void stasis_app_register_event_source(struct stasis_app_event_source *obj)
 {
        AST_RWLIST_WRLOCK(&event_sources);
        AST_LIST_INSERT_TAIL(&event_sources, obj, next);
-       /* only need to bump the module ref on non-core sources because the
-          core ones are [un]registered by this module. */
-       if (!stasis_app_is_core_event_source(obj)) {
-               ast_module_ref(ast_module_info->self);
-       }
        AST_RWLIST_UNLOCK(&event_sources);
 }
 
@@ -1670,9 +1663,6 @@ void stasis_app_unregister_event_source(struct stasis_app_event_source *obj)
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&event_sources, source, next) {
                if (source == obj) {
                        AST_RWLIST_REMOVE_CURRENT(next);
-                       if (!stasis_app_is_core_event_source(obj)) {
-                               ast_module_unref(ast_module_info->self);
-                       }
                        break;
                }
        }
@@ -2036,16 +2026,6 @@ enum stasis_app_user_event_res stasis_app_user_event(const char *app_name,
        return STASIS_APP_USER_OK;
 }
 
-void stasis_app_ref(void)
-{
-       ast_module_ref(ast_module_info->self);
-}
-
-void stasis_app_unref(void)
-{
-       ast_module_unref(ast_module_info->self);
-}
-
 static int unload_module(void)
 {
        stasis_app_unregister_event_sources();
index 3d0e9db..3f6bede 100644 (file)
@@ -143,17 +143,11 @@ enum stasis_mailbox_result stasis_app_mailbox_delete(
 
 static int load_module(void)
 {
-       /* Must be done first */
-       ast_mwi_external_ref();
-
        return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-       /* Must be done last */
-       ast_mwi_external_unref();
-
        return 0;
 }
 
index 8565e41..3e08152 100644 (file)
@@ -353,9 +353,6 @@ static int load_module(void)
                return AST_MODULE_LOAD_DECLINE;
        }
 
-       /* For Optional API. */
-       ast_module_shutdown_ref(AST_MODULE_SELF);
-
        return AST_MODULE_LOAD_SUCCESS;
 }
 
index 854e799..18ac7d6 100644 (file)
@@ -1600,13 +1600,6 @@ void stasis_app_register_event_sources(void)
        stasis_app_register_event_source(&endpoint_event_source);
 }
 
-int stasis_app_is_core_event_source(struct stasis_app_event_source *obj)
-{
-       return obj == &endpoint_event_source ||
-               obj == &bridge_event_source ||
-               obj == &channel_event_source;
-}
-
 void stasis_app_unregister_event_sources(void)
 {
        stasis_app_unregister_event_source(&endpoint_event_source);
index c697345..67a04d8 100644 (file)
@@ -269,7 +269,6 @@ static int unload_module(void)
        ast_ari_websocket_events_event_websocket_dtor();
 {{/has_websocket}}
 {{/apis}}
-       stasis_app_unref();
        return 0;
 }
 
@@ -277,43 +276,37 @@ static int load_module(void)
 {
        int res = 0;
 
-       CHECK_ARI_MODULE_LOADED();
-
 {{#apis}}
 {{#operations}}
 {{#has_websocket}}
-       /* This is scoped to not conflict with CHECK_ARI_MODULE_LOADED */
-       {
-               struct ast_websocket_protocol *protocol;
+       struct ast_websocket_protocol *protocol;
 
-               if (ast_ari_websocket_{{c_name}}_{{c_nickname}}_init() == -1) {
-                       return AST_MODULE_LOAD_DECLINE;
-               }
+       if (ast_ari_websocket_{{c_name}}_{{c_nickname}}_init() == -1) {
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-               {{full_name}}.ws_server = ast_websocket_server_create();
-               if (!{{full_name}}.ws_server) {
-                       ast_ari_websocket_events_event_websocket_dtor();
-                       return AST_MODULE_LOAD_DECLINE;
-               }
+       {{full_name}}.ws_server = ast_websocket_server_create();
+       if (!{{full_name}}.ws_server) {
+               ast_ari_websocket_events_event_websocket_dtor();
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-               protocol = ast_websocket_sub_protocol_alloc("{{websocket_protocol}}");
-               if (!protocol) {
-                       ao2_ref({{full_name}}.ws_server, -1);
-                       {{full_name}}.ws_server = NULL;
-                       ast_ari_websocket_events_event_websocket_dtor();
-                       return AST_MODULE_LOAD_DECLINE;
-               }
-               protocol->session_attempted = ast_ari_{{c_name}}_{{c_nickname}}_ws_attempted_cb;
-               protocol->session_established = ast_ari_{{c_name}}_{{c_nickname}}_ws_established_cb;
+       protocol = ast_websocket_sub_protocol_alloc("{{websocket_protocol}}");
+       if (!protocol) {
+               ao2_ref({{full_name}}.ws_server, -1);
+               {{full_name}}.ws_server = NULL;
+               ast_ari_websocket_events_event_websocket_dtor();
+               return AST_MODULE_LOAD_DECLINE;
+       }
+       protocol->session_attempted = ast_ari_{{c_name}}_{{c_nickname}}_ws_attempted_cb;
+       protocol->session_established = ast_ari_{{c_name}}_{{c_nickname}}_ws_established_cb;
 {{/has_websocket}}
 {{#is_websocket}}
-               res |= ast_websocket_server_add_protocol2({{full_name}}.ws_server, protocol);
-       }
+       res |= ast_websocket_server_add_protocol2({{full_name}}.ws_server, protocol);
 {{/is_websocket}}
 {{/operations}}
 {{/apis}}
 
-       stasis_app_ref();
        res |= ast_ari_add_handler(&{{root_full_name}});
        if (res) {
                unload_module();
index a081c3c..779d52a 100644 (file)
@@ -19,8 +19,8 @@ CMD_PREFIX?=@
 SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
 SOUNDS_CACHE_DIR?=
 MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
-CORE_SOUNDS_VERSION:=1.6
-EXTRA_SOUNDS_VERSION:=1.5.1
+CORE_SOUNDS_VERSION:=1.6.1
+EXTRA_SOUNDS_VERSION:=1.5.2
 MOH_VERSION:=2.03
 SOUNDS_URL:=http://downloads.asterisk.org/pub/telephony/sounds/releases
 MCS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
index 47a7034..d0c2d90 100644 (file)
@@ -376,8 +376,6 @@ AST_TEST_DEFINE(scheduler_policy)
 
 static int load_module(void)
 {
-       CHECK_PJSIP_MODULE_LOADED();
-
        AST_TEST_REGISTER(serialized_scheduler);
        AST_TEST_REGISTER(unserialized_scheduler);
        AST_TEST_REGISTER(scheduler_cleanup);
index 077cc4c..2c7906a 100644 (file)
@@ -179,13 +179,11 @@ static int unload_module(void)
        AST_TEST_UNREGISTER(app_invoke_dne);
        AST_TEST_UNREGISTER(app_invoke_one);
        AST_TEST_UNREGISTER(app_replaced);
-       stasis_app_unref();
        return 0;
 }
 
 static int load_module(void)
 {
-       stasis_app_ref();
        AST_TEST_REGISTER(app_replaced);
        AST_TEST_REGISTER(app_invoke_one);
        AST_TEST_REGISTER(app_invoke_dne);
index bcb2df3..051fee1 100644 (file)
@@ -391,7 +391,7 @@ AST_TEST_DEFINE(agi_loaded_test)
        }
 #endif
 
-       ast_agi_unregister(ast_module_info->self, &noop_command);
+       ast_agi_unregister(&noop_command);
        return res;
 }
 
index e15705e..1e4b9d1 100644 (file)
@@ -143,13 +143,6 @@ int check_eval(char *buffer, char *error_report);
 void parse_file(const char *fname);
 
 int ast_add_profile(const char *x, uint64_t scale) { return 0;}
-int ast_atomic_fetchadd_int_slow(volatile int *p, int v)
-{
-        int ret;
-        ret = *p;
-        *p += v;
-        return ret;
-}
 
 char *find_var(const char *varname) /* the list should be pretty short, if there's any list at all */
 {