int x;
int i;
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. */
struct ast_frame *current;
original->_state = clonechan->_state;
clonechan->_state = origstate;
+ /* And the swap the cachable state too. Otherwise we'd start caching
+ * Local channels and ignoring real ones. */
+ orig_disablestatecache = ast_test_flag(original, AST_FLAG_DISABLE_DEVSTATE_CACHE);
+ clone_disablestatecache = ast_test_flag(clonechan, AST_FLAG_DISABLE_DEVSTATE_CACHE);
+ if (orig_disablestatecache != clone_disablestatecache) {
+ if (orig_disablestatecache) {
+ ast_clear_flag(original, AST_FLAG_DISABLE_DEVSTATE_CACHE);
+ ast_set_flag(clonechan, AST_FLAG_DISABLE_DEVSTATE_CACHE);
+ } else {
+ ast_set_flag(original, AST_FLAG_DISABLE_DEVSTATE_CACHE);
+ ast_clear_flag(clonechan, AST_FLAG_DISABLE_DEVSTATE_CACHE);
+ }
+ }
+
/* Mangle the name of the clone channel */
snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig); /* quick, hide the brains! */
__ast_change_name_nolink(clonechan, zombn);