From f3e74d34ce2fdd7eb60fc21d759c7abc19639f21 Mon Sep 17 00:00:00 2001 From: Peter Jannesen Date: Fri, 20 Sep 2024 22:13:08 +0200 Subject: [PATCH] channel: Preserve CHANNEL(userfield) on masquerade. In certain circumstances a channel may undergo an operation referred to as a masquerade. If this occurs the CHANNEL(userfield) value was not preserved causing it to get lost. This change makes it so that this field is now preserved. Fixes: #882 --- main/channel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/channel.c b/main/channel.c index 2b9f192612..95d02e4ae3 100644 --- a/main/channel.c +++ b/main/channel.c @@ -7216,6 +7216,9 @@ static void channel_do_masquerade(struct ast_channel *original, struct ast_chann /* copy over accuntcode and set peeraccount across the bridge */ ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), "")); + /* copy over userfield */ + ast_channel_userfield_set(original, ast_channel_userfield(clonechan)); + ast_debug(1, "Putting channel %s in %s/%s formats\n", ast_channel_name(original), ast_format_get_name(wformat), ast_format_get_name(rformat));