From fb6344e2492c87e90644f63380932b9fa6536fb0 Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Wed, 5 Jun 2013 14:50:46 +0000
Subject: [PATCH] Publish the channel state snapshot *before* calling device
 state so a device state producer can use an up to date snapshot.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390473 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/channel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main/channel.c b/main/channel.c
index 1c2d6bf57c..62856d43a8 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;
 }
 
-- 
GitLab