diff --git a/main/channel.c b/main/channel.c
index e6025c0628baa4fddba44f7ac45d2e54267f3d70..6846b84af3274cd77ec769d1d13f7f475c1cf314 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -6433,6 +6433,8 @@ void ast_do_masquerade(struct ast_channel *original)
 {
 	int x;
 	int origstate;
+	unsigned int orig_disablestatecache;
+	unsigned int clone_disablestatecache;
 	int visible_indication;
 	int clone_was_zombie = 0;/*!< TRUE if the clonechan was a zombie before the masquerade. */
 	int clone_hold_state;
@@ -6615,6 +6617,20 @@ void ast_do_masquerade(struct ast_channel *original)
 	ast_channel_state_set(original, ast_channel_state(clonechan));
 	ast_channel_state_set(clonechan, origstate);
 
+	/* And the swap the cachable state too. Otherwise we'd start caching
+	 * Local channels and ignoring real ones. */
+	orig_disablestatecache = ast_test_flag(ast_channel_flags(original), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+	clone_disablestatecache = ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+	if (orig_disablestatecache != clone_disablestatecache) {
+		if (orig_disablestatecache) {
+			ast_clear_flag(ast_channel_flags(original), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+			ast_set_flag(ast_channel_flags(clonechan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+		} else {
+			ast_set_flag(ast_channel_flags(original), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+			ast_clear_flag(ast_channel_flags(clonechan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
+		}
+	}
+
 	/* Update the type. */
 	t_pvt = ast_channel_monitor(original);
 	ast_channel_monitor_set(original, ast_channel_monitor(clonechan));