[asterisk-commits] file: branch group/performance r399663 - in /team/group/performance: apps/ ch...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 24 11:24:04 CDT 2013


Author: file
Date: Tue Sep 24 11:24:01 2013
New Revision: 399663

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399663
Log:
Add patch which reduces amount of channel snapshotting and publishing.

Modified:
    team/group/performance/apps/app_dial.c
    team/group/performance/channels/chan_alsa.c
    team/group/performance/channels/chan_console.c
    team/group/performance/channels/chan_dahdi.c
    team/group/performance/channels/chan_gtalk.c
    team/group/performance/channels/chan_iax2.c
    team/group/performance/channels/chan_jingle.c
    team/group/performance/channels/chan_mgcp.c
    team/group/performance/channels/chan_motif.c
    team/group/performance/channels/chan_pjsip.c
    team/group/performance/channels/chan_sip.c
    team/group/performance/channels/chan_skinny.c
    team/group/performance/channels/chan_unistim.c
    team/group/performance/include/asterisk/channel.h
    team/group/performance/include/asterisk/stasis_channels.h
    team/group/performance/main/channel.c
    team/group/performance/main/dial.c
    team/group/performance/main/stasis_channels.c

Modified: team/group/performance/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/apps/app_dial.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/apps/app_dial.c (original)
+++ team/group/performance/apps/app_dial.c Tue Sep 24 11:24:01 2013
@@ -2431,6 +2431,9 @@
 			chanlist_free(tmp);
 			continue;
 		}
+
+		ast_channel_stage_snapshot(tc);
+
 		ast_channel_get_device_name(tc, device_name, sizeof(device_name));
 		if (!ignore_cc) {
 			ast_cc_extension_monitor_add_dialstring(chan, tmp->interface, device_name);
@@ -2539,6 +2542,8 @@
 			ast_channel_exten_set(tc, ast_channel_macroexten(chan));
 		else
 			ast_channel_exten_set(tc, ast_channel_exten(chan));
+
+		ast_channel_stage_snapshot_done(tc);
 
 		ast_channel_unlock(tc);
 		ast_channel_unlock(chan);
@@ -2793,6 +2798,7 @@
 			/* chan and peer are going into the PBX; as such neither are considered
 			 * outgoing channels any longer */
 			ast_clear_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
+			ast_channel_stage_snapshot(peer);
 			ast_clear_flag(ast_channel_flags(peer), AST_FLAG_OUTGOING);
 
 			ast_replace_subargument_delimiter(opt_args[OPT_ARG_GOTO]);
@@ -2801,6 +2807,7 @@
 			ast_channel_context_set(peer, ast_channel_context(chan));
 			ast_channel_exten_set(peer, ast_channel_exten(chan));
 			ast_channel_priority_set(peer, ast_channel_priority(chan) + 2);
+			ast_channel_stage_snapshot_done(peer);
 			if (ast_pbx_start(peer)) {
 				ast_autoservice_chan_hangup_peer(chan, peer);
 			}

Modified: team/group/performance/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_alsa.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_alsa.c (original)
+++ team/group/performance/channels/chan_alsa.c Tue Sep 24 11:24:01 2013
@@ -580,6 +580,8 @@
 	if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, linkedid, 0, "ALSA/%s", indevname)))
 		return NULL;
 
+	ast_channel_stage_snapshot(tmp);
+
 	ast_channel_tech_set(tmp, &alsa_tech);
 	ast_channel_set_fd(tmp, 0, readdev);
 	ast_format_set(ast_channel_readformat(tmp), AST_FORMAT_SLINEAR, 0);
@@ -596,6 +598,9 @@
 	p->owner = tmp;
 	ast_module_ref(ast_module_info->self);
 	ast_jb_configure(tmp, &global_jbconf);
+
+	ast_channel_stage_snapshot_done(tmp);
+
 	if (state != AST_STATE_DOWN) {
 		if (ast_pbx_start(tmp)) {
 			ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));

Modified: team/group/performance/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_console.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_console.c (original)
+++ team/group/performance/channels/chan_console.c Tue Sep 24 11:24:01 2013
@@ -427,6 +427,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(chan);
+
 	ast_channel_tech_set(chan, &console_tech);
 	ast_format_set(ast_channel_readformat(chan), AST_FORMAT_SLINEAR16, 0);
 	ast_format_set(ast_channel_writeformat(chan), AST_FORMAT_SLINEAR16, 0);
@@ -439,6 +441,8 @@
 		ast_channel_language_set(chan, pvt->language);
 
 	ast_jb_configure(chan, &global_jbconf);
+
+	ast_channel_stage_snapshot_done(chan);
 
 	if (state != AST_STATE_DOWN) {
 		if (ast_pbx_start(chan)) {

Modified: team/group/performance/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_dahdi.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_dahdi.c (original)
+++ team/group/performance/channels/chan_dahdi.c Tue Sep 24 11:24:01 2013
@@ -8910,6 +8910,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(tmp);
+
 	if (callid) {
 		ast_channel_callid_set(tmp, callid);
 	}
@@ -9086,6 +9088,8 @@
 
 	for (v = i->vars ; v ; v = v->next)
 		pbx_builtin_setvar_helper(tmp, v->name, v->value);
+
+	ast_channel_stage_snapshot_done(tmp);
 
 	ast_module_ref(ast_module_info->self);
 

Modified: team/group/performance/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_gtalk.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_gtalk.c (original)
+++ team/group/performance/channels/chan_gtalk.c Tue Sep 24 11:24:01 2013
@@ -1149,6 +1149,9 @@
 		ast_log(LOG_WARNING, "Unable to allocate Gtalk channel structure!\n");
 		return NULL;
 	}
+
+	ast_channel_stage_snapshot(tmp);
+
 	ast_channel_tech_set(tmp, &gtalk_tech);
 
 	/* Select our native format based on codec preference until we receive
@@ -1221,6 +1224,9 @@
 	ast_channel_priority_set(tmp, 1);
 	if (i->rtp)
 		ast_jb_configure(tmp, &global_jbconf);
+
+	ast_channel_stage_snapshot_done(tmp);
+
 	if (state != AST_STATE_DOWN && ast_pbx_start(tmp)) {
 		ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));
 		ast_channel_hangupcause_set(tmp, AST_CAUSE_SWITCH_CONGESTION);

Modified: team/group/performance/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_iax2.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_iax2.c (original)
+++ team/group/performance/channels/chan_iax2.c Tue Sep 24 11:24:01 2013
@@ -116,6 +116,7 @@
 #include "asterisk/bridge.h"
 #include "asterisk/stasis.h"
 #include "asterisk/stasis_system.h"
+#include "asterisk/stasis_channels.h"
 
 #include "iax2/include/iax2.h"
 #include "iax2/include/firmware.h"
@@ -5692,6 +5693,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(tmp);
+
 	if ((callid = iaxs[callno]->callid)) {
 		ast_channel_callid_set(tmp, callid);
 	}
@@ -5788,6 +5791,8 @@
 			}
 		}
 	}
+
+	ast_channel_stage_snapshot_done(tmp);
 
 	if (state != AST_STATE_DOWN) {
 		if (ast_pbx_start(tmp)) {

Modified: team/group/performance/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_jingle.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_jingle.c (original)
+++ team/group/performance/channels/chan_jingle.c Tue Sep 24 11:24:01 2013
@@ -79,6 +79,7 @@
 #include "asterisk/abstract_jb.h"
 #include "asterisk/jabber.h"
 #include "asterisk/jingle.h"
+#include "asterisk/stasis_channels.h"
 
 #define JINGLE_CONFIG "jingle.conf"
 
@@ -862,6 +863,9 @@
 		ast_log(LOG_WARNING, "Unable to allocate Jingle channel structure!\n");
 		return NULL;
 	}
+
+	ast_channel_stage_snapshot(tmp);
+
 	ast_channel_tech_set(tmp, &jingle_tech);
 
 	/* Select our native format based on codec preference until we receive
@@ -935,6 +939,9 @@
 	ast_channel_priority_set(tmp, 1);
 	if (i->rtp)
 		ast_jb_configure(tmp, &global_jbconf);
+
+	ast_channel_stage_snapshot_done(tmp);
+
 	if (state != AST_STATE_DOWN && ast_pbx_start(tmp)) {
 		ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));
 		ast_channel_hangupcause_set(tmp, AST_CAUSE_SWITCH_CONGESTION);

Modified: team/group/performance/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_mgcp.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_mgcp.c (original)
+++ team/group/performance/channels/chan_mgcp.c Tue Sep 24 11:24:01 2013
@@ -85,6 +85,7 @@
 #include "asterisk/bridge.h"
 #include "asterisk/features_config.h"
 #include "asterisk/parking.h"
+#include "asterisk/stasis_channels.h"
 
 /*
  * Define to work around buggy dlink MGCP phone firmware which
@@ -1506,6 +1507,7 @@
 
 	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, linkedid, i->accountcode, i->exten, i->context, i->amaflags, "MGCP/%s@%s-%d", i->name, i->parent->name, sub->id);
 	if (tmp) {
+		ast_channel_stage_snapshot(tmp);
 		ast_channel_tech_set(tmp, &mgcp_tech);
 		ast_format_cap_copy(ast_channel_nativeformats(tmp), i->cap);
 		if (ast_format_cap_is_empty(ast_channel_nativeformats(tmp))) {
@@ -1566,6 +1568,9 @@
 		if (sub->rtp) {
 			ast_jb_configure(tmp, &global_jbconf);
 		}
+
+		ast_channel_stage_snapshot_done(tmp);
+
 		if (state != AST_STATE_DOWN) {
 			if (ast_pbx_start(tmp)) {
 				ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));

Modified: team/group/performance/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_motif.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_motif.c (original)
+++ team/group/performance/channels/chan_motif.c Tue Sep 24 11:24:01 2013
@@ -76,6 +76,7 @@
 #include "asterisk/astobj.h"
 #include "asterisk/abstract_jb.h"
 #include "asterisk/xmpp.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<configInfo name="chan_motif" language="en_US">
@@ -785,6 +786,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(chan);
+
 	ast_channel_tech_set(chan, &jingle_tech);
 	ast_channel_tech_pvt_set(chan, session);
 	jingle_set_owner(session, chan);
@@ -847,6 +850,8 @@
 	ast_channel_priority_set(chan, 1);
 
 	ao2_unlock(endpoint);
+
+	ast_channel_stage_snapshot_done(chan);
 
 	return chan;
 }

Modified: team/group/performance/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_pjsip.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_pjsip.c (original)
+++ team/group/performance/channels/chan_pjsip.c Tue Sep 24 11:24:01 2013
@@ -577,6 +577,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(chan);
+
 	/* If res_pjsip_session is ever updated to create/destroy ast_sip_session_media
 	 * during a call such as if multiple same-type stream support is introduced,
 	 * these will need to be recaptured as well */
@@ -631,6 +633,8 @@
 	}
 
 	ast_endpoint_add_channel(session->endpoint->persistent, chan);
+
+	ast_channel_stage_snapshot_done(chan);
 
 	return chan;
 }

Modified: team/group/performance/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_sip.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_sip.c (original)
+++ team/group/performance/channels/chan_sip.c Tue Sep 24 11:24:01 2013
@@ -8091,6 +8091,8 @@
 		}
 	}
 
+	ast_channel_stage_snapshot(tmp);
+
 	/* If we sent in a callid, bind it to the channel. */
 	if (callid) {
 		ast_channel_callid_set(tmp, callid);
@@ -8285,6 +8287,8 @@
 	if (i->do_history) {
 		append_history(i, "NewChan", "Channel %s - from %s", ast_channel_name(tmp), i->callid);
 	}
+
+	ast_channel_stage_snapshot_done(tmp);
 
 	return tmp;
 }

Modified: team/group/performance/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_skinny.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_skinny.c (original)
+++ team/group/performance/channels/chan_skinny.c Tue Sep 24 11:24:01 2013
@@ -82,6 +82,7 @@
 #include "asterisk/stasis_endpoints.h"
 #include "asterisk/bridge.h"
 #include "asterisk/parking.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<manager name="SKINNYdevices" language="en_US">
@@ -5423,6 +5424,7 @@
 			AST_LIST_INSERT_HEAD(&l->sub, sub, list);
 			//l->activesub = sub;
 		}
+		ast_channel_stage_snapshot(tmp);
 		ast_channel_tech_set(tmp, &skinny_tech);
 		ast_channel_tech_pvt_set(tmp, sub);
 		ast_format_cap_copy(ast_channel_nativeformats(tmp), l->cap);
@@ -5495,6 +5497,8 @@
 		/* Set channel variables for this call from configuration */
 		for (v = l->chanvars ; v ; v = v->next)
 			pbx_builtin_setvar_helper(tmp, v->name, v->value);
+
+		ast_channel_stage_snapshot_done(tmp);
 
 		if (state != AST_STATE_DOWN) {
 			if (ast_pbx_start(tmp)) {

Modified: team/group/performance/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_unistim.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/channels/chan_unistim.c (original)
+++ team/group/performance/channels/chan_unistim.c Tue Sep 24 11:24:01 2013
@@ -77,7 +77,7 @@
 #include "asterisk/astdb.h"
 #include "asterisk/features_config.h"
 #include "asterisk/bridge.h"
-
+#include "asterisk/stasis_channels.h"
 
 #define DEFAULTCONTEXT	  "default"
 #define DEFAULTCALLERID	 "Unknown"
@@ -5563,6 +5563,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(tmp);
+
 	ast_format_cap_copy(ast_channel_nativeformats(tmp), l->cap);
 	if (ast_format_cap_is_empty(ast_channel_nativeformats(tmp))) {
 		ast_format_cap_copy(ast_channel_nativeformats(tmp), global_cap);
@@ -5623,6 +5625,9 @@
 		}
 	}
 	ast_channel_priority_set(tmp, 1);
+
+	ast_channel_stage_snapshot_done(tmp);
+
 	if (state != AST_STATE_DOWN) {
 		if (unistimdebug) {
 			ast_verb(0, "Starting pbx in unistim_new\n");

Modified: team/group/performance/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/include/asterisk/channel.h?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/include/asterisk/channel.h (original)
+++ team/group/performance/include/asterisk/channel.h Tue Sep 24 11:24:01 2013
@@ -77,7 +77,7 @@
 
 	\par Reference
 	\arg channel.c - generic functions
- 	\arg channel.h - declarations of functions, flags and structures
+	\arg channel.h - declarations of functions, flags and structures
 	\arg translate.h - Transcoding support functions
 	\arg \ref channel_drivers - Implemented channel drivers
 	\arg \ref Def_Frame Asterisk Multimedia Frames
@@ -887,7 +887,7 @@
 	AST_FLAG_END_DTMF_ONLY = (1 << 14),
 	/* OBSOLETED in favor of AST_CAUSE_ANSWERED_ELSEWHERE
 	Flag to show channels that this call is hangup due to the fact that the call
-	    was indeed answered, but in another channel */
+		was indeed answered, but in another channel */
 	/* AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), */
 	/*! This flag indicates that on a masquerade, an active stream should not
 	 *  be carried over */
@@ -923,6 +923,11 @@
 	 * occur.
 	 */
 	AST_FLAG_DEAD = (1 << 24),
+	/*!
+	 * Channel snapshot should not be published, it is being staged for an explicit
+	 * publish.
+	 */
+	AST_FLAG_SNAPSHOT_STAGE = (1 << 25),
 };
 
 /*! \brief ast_bridge_config flags */
@@ -1120,11 +1125,11 @@
  */
 struct ast_channel * attribute_malloc __attribute__((format(printf, 13, 14)))
 	__ast_channel_alloc(int needqueue, int state, const char *cid_num,
-			    const char *cid_name, const char *acctcode,
-			    const char *exten, const char *context,
-			    const char *linkedid, enum ama_flags amaflag,
-			    const char *file, int line, const char *function,
-			    const char *name_fmt, ...);
+				const char *cid_name, const char *acctcode,
+				const char *exten, const char *context,
+				const char *linkedid, enum ama_flags amaflag,
+				const char *file, int line, const char *function,
+				const char *name_fmt, ...);
 
 /*!
  * \brief Create a channel structure
@@ -1138,7 +1143,7 @@
  */
 #define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, ...) \
 	__ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, \
-			    __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
+				__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
 
 #if defined(REF_DEBUG) || defined(__AST_DEBUG_MALLOC)
 /*!

Modified: team/group/performance/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/include/asterisk/stasis_channels.h?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/include/asterisk/stasis_channels.h (original)
+++ team/group/performance/include/asterisk/stasis_channels.h Tue Sep 24 11:24:01 2013
@@ -316,6 +316,22 @@
 
 /*!
  * \since 12
+ * \brief Set flag to indicate channel snapshot is being staged.
+ *
+ * \param chan Channel being staged.
+ */
+void ast_channel_stage_snapshot(struct ast_channel *chan);
+
+/*!
+ * \since 12
+ * \brief Clear flag to indicate channel snapshot is being staged, and publish snapshot.
+ *
+ * \param chan Channel being staged.
+ */
+void ast_channel_stage_snapshot_done(struct ast_channel *chan);
+
+/*!
+ * \since 12
  * \brief Publish a \ref ast_channel_snapshot for a channel.
  *
  * \param chan Channel to publish.

Modified: team/group/performance/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/main/channel.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/main/channel.c (original)
+++ team/group/performance/main/channel.c Tue Sep 24 11:24:01 2013
@@ -876,6 +876,9 @@
 		/* Channel structure allocation failure. */
 		return NULL;
 	}
+
+	ast_channel_stage_snapshot(tmp);
+
 	if (!(nativeformats = ast_format_cap_alloc())) {
 		ao2_ref(tmp, -1);
 		/* format capabilities structure allocation failure */
@@ -1020,7 +1023,7 @@
 	 * And now, since the channel structure is built, and has its name, let
 	 * the world know of its existance
 	 */
-	ast_channel_publish_snapshot(tmp);
+	ast_channel_stage_snapshot_done(tmp);
 	return tmp;
 }
 
@@ -7711,8 +7714,12 @@
 {
 	struct ast_variable *cur;
 
+	ast_channel_stage_snapshot(chan);
+
 	for (cur = vars; cur; cur = cur->next)
 		pbx_builtin_setvar_helper(chan, cur->name, cur->value);
+
+	ast_channel_stage_snapshot_done(chan);
 }
 
 static void *silence_generator_alloc(struct ast_channel *chan, void *data)

Modified: team/group/performance/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/main/dial.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/main/dial.c (original)
+++ team/group/performance/main/dial.c Tue Sep 24 11:24:01 2013
@@ -286,6 +286,8 @@
 	cap_request = NULL;
 	cap_all_audio = ast_format_cap_destroy(cap_all_audio);
 
+	ast_channel_stage_snapshot(channel->owner);
+
 	ast_channel_appl_set(channel->owner, "AppDial2");
 	ast_channel_data_set(channel->owner, "(Outgoing Line)");
 	ast_publish_channel_state(channel->owner);
@@ -311,6 +313,8 @@
 		ast_channel_adsicpe_set(channel->owner, ast_channel_adsicpe(chan));
 		ast_channel_transfercapability_set(channel->owner, ast_channel_transfercapability(chan));
 	}
+
+	ast_channel_stage_snapshot_done(channel->owner);
 
 	return 0;
 }

Modified: team/group/performance/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/main/stasis_channels.c?view=diff&rev=399663&r1=399662&r2=399663
==============================================================================
--- team/group/performance/main/stasis_channels.c (original)
+++ team/group/performance/main/stasis_channels.c Tue Sep 24 11:24:01 2013
@@ -600,10 +600,25 @@
 	return obj->blob;
 }
 
+void ast_channel_stage_snapshot(struct ast_channel *chan)
+{
+	ast_set_flag(ast_channel_flags(chan), AST_FLAG_SNAPSHOT_STAGE);
+}
+
+void ast_channel_stage_snapshot_done(struct ast_channel *chan)
+{
+	ast_clear_flag(ast_channel_flags(chan), AST_FLAG_SNAPSHOT_STAGE);
+	ast_channel_publish_snapshot(chan);
+}
+
 void ast_channel_publish_snapshot(struct ast_channel *chan)
 {
 	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+
+	if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_SNAPSHOT_STAGE)) {
+		return;
+	}
 
 	snapshot = ast_channel_snapshot_create(chan);
 	if (!snapshot) {




More information about the asterisk-commits mailing list