]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
channel: Deprecate `ast_moh_cleanup(...)`.
authorSean Bright <sean@seanbright.com>
Tue, 8 Apr 2025 20:08:42 +0000 (16:08 -0400)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Thu, 10 Apr 2025 12:36:12 +0000 (12:36 +0000)
We don't want anyone calling it but the channel destructor.

include/asterisk/musiconhold.h
main/channel.c

index 46cdc1f04a920e25cd3332d83e9bcdd0699933a5..03cf30555b0e894bd253202d536bccda7d996df4 100644 (file)
@@ -51,7 +51,15 @@ void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, const ch
 
 void ast_uninstall_music_functions(void);
 
-void ast_moh_cleanup(struct ast_channel *chan);
+/*!
+ * \brief Clean up music on hold state on a given channel
+ *
+ * \param chan The channel where music on hold was configured.
+ *
+ * \deprecated This function no longer does anything but is kept for
+ *             backwards compatibility.
+ */
+void ast_moh_cleanup(struct ast_channel *chan) attribute_deprecated;
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }
index c70cc0d4a50ede4fd6244c97c1832daeecf59c5b..645164146c677bfc2aadc34b86cfd86e922970f4 100644 (file)
@@ -2207,6 +2207,8 @@ void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
        ast_party_redirecting_reason_free(&doomed->orig_reason);
 }
 
+static void moh_cleanup(struct ast_channel *chan);
+
 /*! \brief Free a channel structure */
 static void ast_channel_destructor(void *obj)
 {
@@ -2222,7 +2224,7 @@ static void ast_channel_destructor(void *obj)
 
        /* If there is native format music-on-hold state, free it */
        if (ast_channel_music_state(chan)) {
-               ast_moh_cleanup(chan);
+               moh_cleanup(chan);
        }
 
        ast_pbx_hangup_handler_destroy(chan);
@@ -7791,6 +7793,11 @@ void ast_moh_stop(struct ast_channel *chan)
 }
 
 void ast_moh_cleanup(struct ast_channel *chan)
+{
+       /* A nop but needed for API compat */
+}
+
+static void moh_cleanup(struct ast_channel *chan)
 {
        if (ast_moh_cleanup_ptr)
                ast_moh_cleanup_ptr(chan);