From: Peter Jannesen Date: Fri, 20 Sep 2024 20:13:08 +0000 (+0200) Subject: channel: Preserve CHANNEL(userfield) on masquerade. X-Git-Tag: 22.1.0-rc1~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f44ac22b2693c0158946040d98e567ba85f0db2;p=thirdparty%2Fasterisk.git 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 (cherry picked from commit fd196e9113a2b84bb712b77b91daa0d68759fc19) --- 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));