diff --git a/main/channel.c b/main/channel.c
index 1c2d6bf57c473354c0e4946802431afe96b935c7..62856d43a873e73b926fe04e7ddf8036516dd9c8 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -7308,13 +7308,13 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
 
 	ast_channel_state_set(chan, state);
 
+	ast_publish_channel_state(chan);
+
 	/* We have to pass AST_DEVICE_UNKNOWN here because it is entirely possible that the channel driver
 	 * for this channel is using the callback method for device state. If we pass in an actual state here
 	 * we override what they are saying the state is and things go amuck. */
 	ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_DEVSTATE_CACHE) ? AST_DEVSTATE_NOT_CACHABLE : AST_DEVSTATE_CACHABLE), name);
 
-	ast_publish_channel_state(chan);
-
 	return 0;
 }