]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
channel: Preserve CHANNEL(userfield) on masquerade.
authorPeter Jannesen <peter@jannesen.com>
Fri, 20 Sep 2024 20:13:08 +0000 (22:13 +0200)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 14 Nov 2024 20:00:45 +0000 (20:00 +0000)
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 e522eb63572ac8aed07afc09be0a99ab0de65abe)

main/channel.c

index 4eae7fee74102aa13d051473bf7fa8695945c06a..6ae544aa266df1c6955a968452f3235c0a475ca1 100644 (file)
@@ -7306,6 +7306,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));