From 072b61bbede22e2cb4424a29c9c60c707671fc54 Mon Sep 17 00:00:00 2001
From: Matthew Jordan <mjordan@digium.com>
Date: Sun, 15 Jun 2014 22:12:49 +0000
Subject: [PATCH] channel_internal_api: Publish a snapshot change when
 linkedids change

Snapshots are now not published *quite* as much as they used to. One instance
where they are not published any longer is during bridge enter and exit - the
state of the channel doesn't change, the bridge does. However, channels are
changed when a linkedid is propagated; previously, the channel's state would
be updated and published during the bridge enter event. Now this must be
explicitly done.
........

Merged revisions 416300 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/channel_internal_api.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 0c5117e6d1..c2dc2d7373 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -57,7 +57,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 struct ast_channel_id {
 	time_t creation_time;				/*!< Creation time */
 	int creation_unique;				/*!< sub-second unique value */
-	char unique_id[AST_MAX_UNIQUEID];	/*< Unique Identifier */
+	char unique_id[AST_MAX_UNIQUEID];	/*!< Unique Identifier */
 };
 
 /*!
@@ -1463,7 +1463,13 @@ struct ast_channel *ast_channel_internal_oldest_linkedid(struct ast_channel *a,
 
 void ast_channel_internal_copy_linkedid(struct ast_channel *dest, struct ast_channel *source)
 {
+	if (dest->linkedid.creation_time == source->linkedid.creation_time
+		&& dest->linkedid.creation_unique == source->linkedid.creation_unique
+		&& !strcmp(dest->linkedid.unique_id, source->linkedid.unique_id)) {
+		return;
+	}
 	dest->linkedid = source->linkedid;
+	ast_channel_publish_snapshot(dest);
 }
 
 void ast_channel_internal_swap_uniqueid_and_linkedid(struct ast_channel *a, struct ast_channel *b)
-- 
GitLab