channel_internal_api: Publish a snapshot change when linkedids change
authorMatthew Jordan <mjordan@digium.com>
Sun, 15 Jun 2014 22:12:49 +0000 (22:12 +0000)
committerMatthew Jordan <mjordan@digium.com>
Sun, 15 Jun 2014 22:12:49 +0000 (22:12 +0000)
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

index 0c5117e..c2dc2d7 100644 (file)
@@ -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)