[asterisk-commits] rmudgett: branch rmudgett/ss7_27_knk r400283 - in /team/rmudgett/ss7_27_knk: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 2 13:34:26 CDT 2013


Author: rmudgett
Date: Wed Oct  2 13:34:20 2013
New Revision: 400283

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400283
Log:
Resolve conflict and reset automerge.

Added:
    team/rmudgett/ss7_27_knk/doc/astdb2bdb.8
      - copied unchanged from r400282, trunk/doc/astdb2bdb.8
    team/rmudgett/ss7_27_knk/doc/astdb2sqlite3.8
      - copied unchanged from r400282, trunk/doc/astdb2sqlite3.8
Modified:
    team/rmudgett/ss7_27_knk/   (props changed)
    team/rmudgett/ss7_27_knk/Makefile
    team/rmudgett/ss7_27_knk/apps/app_dial.c
    team/rmudgett/ss7_27_knk/apps/app_stack.c
    team/rmudgett/ss7_27_knk/channels/chan_alsa.c
    team/rmudgett/ss7_27_knk/channels/chan_console.c
    team/rmudgett/ss7_27_knk/channels/chan_dahdi.c
    team/rmudgett/ss7_27_knk/channels/chan_gtalk.c
    team/rmudgett/ss7_27_knk/channels/chan_iax2.c
    team/rmudgett/ss7_27_knk/channels/chan_jingle.c
    team/rmudgett/ss7_27_knk/channels/chan_mgcp.c
    team/rmudgett/ss7_27_knk/channels/chan_motif.c
    team/rmudgett/ss7_27_knk/channels/chan_pjsip.c
    team/rmudgett/ss7_27_knk/channels/chan_sip.c
    team/rmudgett/ss7_27_knk/channels/chan_skinny.c
    team/rmudgett/ss7_27_knk/channels/chan_unistim.c
    team/rmudgett/ss7_27_knk/channels/sig_pri.c
    team/rmudgett/ss7_27_knk/channels/sig_ss7.c
    team/rmudgett/ss7_27_knk/include/asterisk/channel.h
    team/rmudgett/ss7_27_knk/include/asterisk/stasis_channels.h
    team/rmudgett/ss7_27_knk/main/bridge.c
    team/rmudgett/ss7_27_knk/main/channel.c
    team/rmudgett/ss7_27_knk/main/dial.c
    team/rmudgett/ss7_27_knk/main/json.c
    team/rmudgett/ss7_27_knk/main/pbx.c
    team/rmudgett/ss7_27_knk/main/stasis_cache.c
    team/rmudgett/ss7_27_knk/main/stasis_channels.c
    team/rmudgett/ss7_27_knk/main/utils.c
    team/rmudgett/ss7_27_knk/res/res_ari.c
    team/rmudgett/ss7_27_knk/res/stasis_recording/stored.c

Propchange: team/rmudgett/ss7_27_knk/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/rmudgett/ss7_27_knk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Wed Oct  2 13:34:20 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-400181,400194,400196,400205,400217,400227,400236,400245,400254,400256
+/branches/12:1-398558,398560-398577,398579-399305,399307-400181,400194,400196,400205,400217,400227,400236,400245,400254,400256,400265,400268,400270,400281

Propchange: team/rmudgett/ss7_27_knk/
------------------------------------------------------------------------------
--- ss7_27_knk-integrated (original)
+++ ss7_27_knk-integrated Wed Oct  2 13:34:20 2013
@@ -1,1 +1,1 @@
-/trunk:1-400263
+/trunk:1-400282

Modified: team/rmudgett/ss7_27_knk/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/Makefile?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/Makefile (original)
+++ team/rmudgett/ss7_27_knk/Makefile Wed Oct  2 13:34:20 2013
@@ -578,6 +578,7 @@
 	$(INSTALL) -m 644 doc/snapshots.xslt "$(DESTDIR)$(ASTDATADIR)/documentation"
 	$(INSTALL) -m 644 doc/appdocsxml.dtd "$(DESTDIR)$(ASTDATADIR)/documentation"
 	$(INSTALL) -m 644 doc/asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
+	$(INSTALL) -m 644 doc/astdb*.8 "$(DESTDIR)$(ASTMANDIR)/man8"
 	$(INSTALL) -m 644 contrib/scripts/astgenkey.8 "$(DESTDIR)$(ASTMANDIR)/man8"
 	$(INSTALL) -m 644 contrib/scripts/autosupport.8 "$(DESTDIR)$(ASTMANDIR)/man8"
 	$(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"

Modified: team/rmudgett/ss7_27_knk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/apps/app_dial.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/apps/app_dial.c (original)
+++ team/rmudgett/ss7_27_knk/apps/app_dial.c Wed Oct  2 13:34:20 2013
@@ -1958,10 +1958,12 @@
 	time(&end);
 
 	ast_channel_lock(chan);
+	ast_channel_stage_snapshot(chan);
 	snprintf(buf, sizeof(buf), "%d", ast_channel_get_up_time(chan));
 	pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
 	snprintf(buf, sizeof(buf), "%d", ast_channel_get_duration(chan));
 	pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
+	ast_channel_stage_snapshot_done(chan);
 	ast_channel_unlock(chan);
 }
 
@@ -2096,11 +2098,13 @@
 	struct ast_party_caller caller;
 
 	/* Reset all DIAL variables back to blank, to prevent confusion (in case we don't reset all of them). */
+	ast_channel_stage_snapshot(chan);
 	pbx_builtin_setvar_helper(chan, "DIALSTATUS", "");
 	pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", "");
 	pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", "");
 	pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", "");
 	pbx_builtin_setvar_helper(chan, "DIALEDTIME", "");
+	ast_channel_stage_snapshot_done(chan);
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Dial requires an argument (technology/resource)\n");
@@ -2431,6 +2435,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);
@@ -2540,6 +2547,8 @@
 		else
 			ast_channel_exten_set(tc, ast_channel_exten(chan));
 
+		ast_channel_stage_snapshot_done(tc);
+
 		ast_channel_unlock(tc);
 		ast_channel_unlock(chan);
 
@@ -2690,6 +2699,7 @@
 			ast_answer(chan);
 
 		strcpy(pa.status, "ANSWER");
+		ast_channel_stage_snapshot(chan);
 		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
 		   we will always return with -1 so that it is hung up properly after the
@@ -2708,6 +2718,7 @@
 		}
 		ast_channel_unlock(peer);
 		pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", number);
+		ast_channel_stage_snapshot_done(chan);
 
 		if (!ast_strlen_zero(args.url) && ast_channel_supports_html(peer) ) {
 			ast_debug(1, "app_dial: sendurl=%s.\n", args.url);
@@ -2793,6 +2804,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 +2813,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/rmudgett/ss7_27_knk/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/apps/app_stack.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/apps/app_stack.c (original)
+++ team/rmudgett/ss7_27_knk/apps/app_stack.c Wed Oct  2 13:34:20 2013
@@ -1215,8 +1215,7 @@
 		ast_agi_send(agi->fd, chan, "200 result=%d Gosub failed\n", res);
 	}
 
-	/* Must use free because the memory was allocated by asprintf(). */
-	free(gosub_args);
+	ast_free(gosub_args);
 
 	ast_channel_lock(chan);
 	ast_debug(4, "%s Ending location: %s,%s,%d\n", ast_channel_name(chan),

Modified: team/rmudgett/ss7_27_knk/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_alsa.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_alsa.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_alsa.c Wed Oct  2 13:34:20 2013
@@ -62,6 +62,7 @@
 #include "asterisk/abstract_jb.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/poll-compat.h"
+#include "asterisk/stasis_channels.h"
 
 /*! Global jitterbuffer configuration - by default, jb is disabled
  *  \note Values shown here match the defaults shown in alsa.conf.sample */
@@ -580,6 +581,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 +599,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/rmudgett/ss7_27_knk/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_console.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_console.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_console.c Wed Oct  2 13:34:20 2013
@@ -76,6 +76,7 @@
 #include "asterisk/musiconhold.h"
 #include "asterisk/callerid.h"
 #include "asterisk/astobj2.h"
+#include "asterisk/stasis_channels.h"
 
 /*! 
  * \brief The sample rate to request from PortAudio 
@@ -427,6 +428,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 +442,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/rmudgett/ss7_27_knk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_dahdi.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_dahdi.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_dahdi.c Wed Oct  2 13:34:20 2013
@@ -8943,6 +8943,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(tmp);
+
 	if (callid) {
 		ast_channel_callid_set(tmp, callid);
 	}
@@ -9119,6 +9121,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/rmudgett/ss7_27_knk/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_gtalk.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_gtalk.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_gtalk.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_iax2.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_iax2.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_iax2.c Wed Oct  2 13:34:20 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"
@@ -5702,6 +5703,8 @@
 		return NULL;
 	}
 
+	ast_channel_stage_snapshot(tmp);
+
 	if ((callid = iaxs[callno]->callid)) {
 		ast_channel_callid_set(tmp, callid);
 	}
@@ -5798,6 +5801,8 @@
 			}
 		}
 	}
+
+	ast_channel_stage_snapshot_done(tmp);
 
 	if (state != AST_STATE_DOWN) {
 		if (ast_pbx_start(tmp)) {

Modified: team/rmudgett/ss7_27_knk/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_jingle.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_jingle.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_jingle.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_mgcp.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_mgcp.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_mgcp.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_motif.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_motif.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_motif.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_pjsip.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_pjsip.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_pjsip.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_sip.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_sip.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_sip.c Wed Oct  2 13:34:20 2013
@@ -7285,6 +7285,10 @@
 					} while (sip_pvt_trylock(p));
 				}
 
+				if (p->rtp || p->vrtp || p->trtp) {
+					ast_channel_stage_snapshot(oldowner);
+				}
+
 				if (p->rtp) {
 					ast_rtp_instance_set_stats_vars(oldowner, p->rtp);
 				}
@@ -7319,6 +7323,9 @@
 						append_history(p, "RTCPtext", "Quality:%s", quality);
 					}
 					pbx_builtin_setvar_helper(oldowner, "RTPTEXTQOS", quality);
+				}
+				if (p->rtp || p->vrtp || p->trtp) {
+					ast_channel_stage_snapshot_done(oldowner);
 				}
 
 				/* Send a hangup */
@@ -8092,6 +8099,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);
@@ -8286,6 +8295,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;
 }
@@ -26531,6 +26542,10 @@
 		}
 	}
 
+	if ((p->rtp || p->vrtp || p->trtp) && p->owner) {
+		ast_channel_stage_snapshot(p->owner);
+	}
+
 	/* Get RTCP quality before end of call */
 	if (p->rtp) {
 		if (p->do_history) {
@@ -26593,6 +26608,10 @@
 		if (p->owner) {
 			pbx_builtin_setvar_helper(p->owner, "RTPTEXTQOS", quality);
 		}
+	}
+
+	if ((p->rtp || p->vrtp || p->trtp) && p->owner) {
+		ast_channel_stage_snapshot_done(p->owner);
 	}
 
 	stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */

Modified: team/rmudgett/ss7_27_knk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_skinny.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_skinny.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_skinny.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_unistim.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_unistim.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_unistim.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/sig_pri.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/sig_pri.c (original)
+++ team/rmudgett/ss7_27_knk/channels/sig_pri.c Wed Oct  2 13:34:20 2013
@@ -6473,6 +6473,7 @@
 						ast_mutex_lock(&pri->lock);
 						sig_pri_lock_private(pri->pvts[chanpos]);
 						if (c) {
+							ast_channel_stage_snapshot(c);
 #if defined(HAVE_PRI_SUBADDR)
 							if (e->ring.calling.subaddress.valid) {
 								/* Set Calling Subaddress */
@@ -6557,6 +6558,7 @@
 									PVT_TO_CHANNEL(pri->pvts[chanpos]), 1);
 #endif
 							}
+							ast_channel_stage_snapshot_done(c);
 						}
 						if (c && !ast_pthread_create_detached(&threadid, NULL, pri_ss_thread, pri->pvts[chanpos])) {
 							ast_verb(3, "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
@@ -6602,6 +6604,7 @@
 							 * will do anything with the channel we have just
 							 * created.
 							 */
+							ast_channel_stage_snapshot(c);
 #if defined(HAVE_PRI_SUBADDR)
 							if (e->ring.calling.subaddress.valid) {
 								/* Set Calling Subaddress */
@@ -6670,6 +6673,8 @@
 
 							sig_pri_handle_subcmds(pri, chanpos, e->e, e->ring.subcmds,
 								e->ring.call);
+
+							ast_channel_stage_snapshot_done(c);
 						}
 						if (c && !ast_pbx_start(c)) {
 							ast_verb(3, "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n",

Modified: team/rmudgett/ss7_27_knk/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/sig_ss7.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/sig_ss7.c (original)
+++ team/rmudgett/ss7_27_knk/channels/sig_ss7.c Wed Oct  2 13:34:20 2013
@@ -43,6 +43,7 @@
 #include "asterisk/cli.h"
 #include "asterisk/callerid.h"
 #include "asterisk/transcap.h"
+#include "asterisk/stasis_channels.h"
 
 #include "sig_ss7.h"
 #if !defined(LIBSS7_ABI_COMPATIBILITY)
@@ -1009,6 +1010,8 @@
 	ast_channel_lock(c);
 	sig_ss7_lock_private(p);
 
+	ast_channel_stage_snapshot(c);
+
 	/*
 	 * It is reasonably safe to set the following
 	 * channel variables while the channel private
@@ -1241,6 +1244,8 @@
 
 		p->cug_indicator = ISUP_CUG_NON;
 	}
+
+	ast_channel_stage_snapshot_done(c);
 
 	sig_ss7_unlock_private(p);
 	ast_channel_unlock(c);

Modified: team/rmudgett/ss7_27_knk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/include/asterisk/channel.h?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/include/asterisk/channel.h (original)
+++ team/rmudgett/ss7_27_knk/include/asterisk/channel.h Wed Oct  2 13:34:20 2013
@@ -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 */

Modified: team/rmudgett/ss7_27_knk/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/include/asterisk/stasis_channels.h?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/include/asterisk/stasis_channels.h (original)
+++ team/rmudgett/ss7_27_knk/include/asterisk/stasis_channels.h Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/bridge.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/bridge.c (original)
+++ team/rmudgett/ss7_27_knk/main/bridge.c Wed Oct  2 13:34:20 2013
@@ -1151,8 +1151,10 @@
 
 static void update_bridge_vars_set(struct ast_channel *chan, const char *name, const char *pvtid)
 {
+	ast_channel_stage_snapshot(chan);
 	pbx_builtin_setvar_helper(chan, "BRIDGEPEER", name);
 	pbx_builtin_setvar_helper(chan, "BRIDGEPVTCALLID", pvtid);
+	ast_channel_stage_snapshot_done(chan);
 }
 
 /*!

Modified: team/rmudgett/ss7_27_knk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/channel.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/channel.c (original)
+++ team/rmudgett/ss7_27_knk/main/channel.c Wed Oct  2 13:34:20 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;
 }
 
@@ -7716,8 +7719,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/rmudgett/ss7_27_knk/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/dial.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/dial.c (original)
+++ team/rmudgett/ss7_27_knk/main/dial.c Wed Oct  2 13:34:20 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/rmudgett/ss7_27_knk/main/json.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/json.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/json.c (original)
+++ team/rmudgett/ss7_27_knk/main/json.c Wed Oct  2 13:34:20 2013
@@ -340,10 +340,10 @@
 	json_t *ret = NULL;
 
 	if (format) {
-		int err = vasprintf(&str, format, args);
+		int err = ast_vasprintf(&str, format, args);
 		if (err > 0) {
 			ret = json_string(str);
-			free(str);
+			ast_free(str);
 		}
 	}
 	return (struct ast_json *)ret;

Modified: team/rmudgett/ss7_27_knk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/pbx.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/pbx.c (original)
+++ team/rmudgett/ss7_27_knk/main/pbx.c Wed Oct  2 13:34:20 2013
@@ -10050,7 +10050,9 @@
 		return -1;
 	}
 
-	ast_set_variables(dialed, vars);
+	if (vars) {
+		ast_set_variables(dialed, vars);
+	}
 
 	if (account) {
 		ast_channel_accountcode_set(dialed, account);

Modified: team/rmudgett/ss7_27_knk/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/stasis_cache.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/stasis_cache.c (original)
+++ team/rmudgett/ss7_27_knk/main/stasis_cache.c Wed Oct  2 13:34:20 2013
@@ -448,10 +448,10 @@
 {
 	RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
 	struct stasis_subscription *sub;
-	RAII_VAR(char *, new_name, NULL, free);
+	RAII_VAR(char *, new_name, NULL, ast_free);
 	int ret;
 
-	ret = asprintf(&new_name, "%s-cached", stasis_topic_name(original_topic));
+	ret = ast_asprintf(&new_name, "%s-cached", stasis_topic_name(original_topic));
 	if (ret < 0) {
 		return NULL;
 	}

Modified: team/rmudgett/ss7_27_knk/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/stasis_channels.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/stasis_channels.c (original)
+++ team/rmudgett/ss7_27_knk/main/stasis_channels.c Wed Oct  2 13:34:20 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) {

Modified: team/rmudgett/ss7_27_knk/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/main/utils.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/main/utils.c (original)
+++ team/rmudgett/ss7_27_knk/main/utils.c Wed Oct  2 13:34:20 2013
@@ -656,9 +656,10 @@
 	}
 
 	pthread_mutex_destroy(&lock_info->lock);
-	if (lock_info->thread_name)
-		free((void *) lock_info->thread_name);
-	free(lock_info);
+	if (lock_info->thread_name) {
+		ast_free((void *) lock_info->thread_name);
+	}
+	ast_free(lock_info);
 }
 
 /*!
@@ -2184,7 +2185,7 @@
 
 static int safe_mkdir(const char *base_path, char *path, int mode)
 {
-	RAII_VAR(char *, absolute_path, NULL, free);
+	RAII_VAR(char *, absolute_path, NULL, ast_std_free);
 
 	absolute_path = realpath(path, NULL);
 
@@ -2206,7 +2207,7 @@
 		int res;
 
 		while (path_term) {
-			RAII_VAR(char *, absolute_subpath, NULL, free);
+			RAII_VAR(char *, absolute_subpath, NULL, ast_std_free);
 
 			/* Truncate the path one past the slash */
 			char c = *(path_term + 1);
@@ -2254,7 +2255,7 @@
 
 int ast_safe_mkdir(const char *base_path, const char *path, int mode)
 {
-	RAII_VAR(char *, absolute_base_path, NULL, free);
+	RAII_VAR(char *, absolute_base_path, NULL, ast_std_free);
 	RAII_VAR(char *, p, NULL, ast_free);
 
 	if (base_path == NULL || path == NULL) {

Modified: team/rmudgett/ss7_27_knk/res/res_ari.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/res/res_ari.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/res/res_ari.c (original)
+++ team/rmudgett/ss7_27_knk/res/res_ari.c Wed Oct  2 13:34:20 2013
@@ -554,8 +554,8 @@
 			  struct ast_ari_response *response)
 {
 	RAII_VAR(struct ast_str *, absolute_path_builder, NULL, ast_free);
-	RAII_VAR(char *, absolute_api_dirname, NULL, free);
-	RAII_VAR(char *, absolute_filename, NULL, free);
+	RAII_VAR(char *, absolute_api_dirname, NULL, ast_std_free);
+	RAII_VAR(char *, absolute_filename, NULL, ast_std_free);
 	struct ast_json *obj = NULL;
 	struct ast_variable *host = NULL;
 	struct ast_json_error error = {};

Modified: team/rmudgett/ss7_27_knk/res/stasis_recording/stored.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/res/stasis_recording/stored.c?view=diff&rev=400283&r1=400282&r2=400283
==============================================================================
--- team/rmudgett/ss7_27_knk/res/stasis_recording/stored.c (original)
+++ team/rmudgett/ss7_27_knk/res/stasis_recording/stored.c Wed Oct  2 13:34:20 2013
@@ -78,7 +78,7 @@
 {
 	RAII_VAR(char *, relative_dir, NULL, ast_free);
 	RAII_VAR(char *, absolute_dir, NULL, ast_free);
-	RAII_VAR(char *, real_dir, NULL, free);
+	RAII_VAR(char *, real_dir, NULL, ast_std_free);
 	char *last_slash;
 	const char *file_portion;
 
@@ -108,7 +108,16 @@
 		return -1;
 	}
 
+#if defined(__AST_DEBUG_MALLOC)
 	*dir = ast_strdup(real_dir); /* Dupe so we can ast_free() */
+#else
+	/*
+	 * ast_std_free() and ast_free() are the same thing at this time
+	 * so we don't need to dupe.
+	 */
+	*dir = real_dir;
+	real_dir = NULL;
+#endif	/* defined(__AST_DEBUG_MALLOC) */
 	*file = ast_strdup(file_portion);
 	return 0;
 }




More information about the asterisk-commits mailing list