]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
func_frame_drop: Add debug messages for dropped frames.
authorNaveen Albert <asterisk@phreaknet.org>
Thu, 14 Aug 2025 23:40:27 +0000 (19:40 -0400)
committerGeorge Joseph <gjoseph@sangoma.com>
Wed, 17 Sep 2025 17:40:38 +0000 (11:40 -0600)
Add debug messages in scenarios where frames that are usually processed
are dropped or skipped.

Resolves: #1371
(cherry picked from commit 95becab1862bfbe29ebebcb887f232f7ed48d51f)

funcs/func_frame_drop.c
main/channel.c

index 0d679ad9fca606945e1ea2adb08b5700522f578f..38c0d990d4a54f5abe7e3aee4fffa3597c777c73 100644 (file)
@@ -173,6 +173,7 @@ static struct ast_frame *hook_event_cb(struct ast_channel *chan, struct ast_fram
 {
        int i;
        int drop_frame = 0;
+       char buf[64];
        struct frame_drop_data *framedata = data;
        if (!frame) {
                return frame;
@@ -188,6 +189,7 @@ static struct ast_frame *hook_event_cb(struct ast_channel *chan, struct ast_fram
                        if (frame->subclass.integer == controlframetype2str[i].type) {
                                if (framedata->controlvalues[i]) {
                                        drop_frame = 1;
+                                       ast_frame_subclass2str(frame, buf, sizeof(buf), NULL, 0);
                                }
                                break;
                        }
@@ -197,6 +199,7 @@ static struct ast_frame *hook_event_cb(struct ast_channel *chan, struct ast_fram
                        if (frame->frametype == frametype2str[i].type) {
                                if (framedata->values[i]) {
                                        drop_frame = 1;
+                                       ast_frame_type2str(frame->frametype, buf, sizeof(buf));
                                }
                                break;
                        }
@@ -206,6 +209,7 @@ static struct ast_frame *hook_event_cb(struct ast_channel *chan, struct ast_fram
        if (drop_frame) {
                ast_frfree(frame);
                frame = &ast_null_frame;
+               ast_debug(2, "Dropping %s frame\n", buf);
        }
        return frame;
 }
index 60eec48cfaaa81c8646246954db4d726ad10349e..aa52b9954c60055774ce289258931f619838b52c 100644 (file)
@@ -2645,8 +2645,9 @@ int ast_raw_answer_with_stream_topology(struct ast_channel *chan, struct ast_str
                ast_channel_unlock(chan);
                break;
        case AST_STATE_UP:
-               break;
+               /* Fall through */
        default:
+               ast_debug(2, "Skipping answer, since channel state on %s is %s\n", ast_channel_name(chan), ast_state2str(ast_channel_state(chan)));
                break;
        }