[asterisk-commits] dlee: branch dlee/record r389964 - in /team/dlee/record: ./ apps/ apps/confbr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 28 16:41:40 CDT 2013


Author: dlee
Date: Tue May 28 16:41:35 2013
New Revision: 389964

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389964
Log:
Merged revisions 389663-389897 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/dlee/record/main/manager_mwi.c
      - copied unchanged from r389897, trunk/main/manager_mwi.c
Modified:
    team/dlee/record/   (props changed)
    team/dlee/record/CHANGES
    team/dlee/record/apps/app_chanspy.c
    team/dlee/record/apps/app_fax.c
    team/dlee/record/apps/app_minivm.c
    team/dlee/record/apps/app_voicemail.c
    team/dlee/record/apps/confbridge/confbridge_manager.c
    team/dlee/record/bridges/bridge_builtin_features.c
    team/dlee/record/channels/chan_dahdi.c
    team/dlee/record/channels/chan_h323.c
    team/dlee/record/channels/chan_iax2.c
    team/dlee/record/channels/chan_mgcp.c
    team/dlee/record/channels/chan_misdn.c
    team/dlee/record/channels/chan_motif.c
    team/dlee/record/channels/chan_sip.c
    team/dlee/record/channels/chan_skinny.c
    team/dlee/record/channels/chan_unistim.c
    team/dlee/record/channels/sig_analog.c
    team/dlee/record/channels/sig_pri.c
    team/dlee/record/channels/sip/include/sip.h
    team/dlee/record/include/asterisk/_private.h
    team/dlee/record/include/asterisk/app.h
    team/dlee/record/include/asterisk/bridging.h
    team/dlee/record/include/asterisk/channel.h
    team/dlee/record/include/asterisk/json.h
    team/dlee/record/include/asterisk/manager.h
    team/dlee/record/include/asterisk/stasis_channels.h
    team/dlee/record/main/app.c
    team/dlee/record/main/asterisk.c
    team/dlee/record/main/bridging.c
    team/dlee/record/main/cdr.c
    team/dlee/record/main/channel.c
    team/dlee/record/main/cli.c
    team/dlee/record/main/devicestate.c
    team/dlee/record/main/dnsmgr.c
    team/dlee/record/main/enum.c
    team/dlee/record/main/features.c
    team/dlee/record/main/json.c
    team/dlee/record/main/loader.c
    team/dlee/record/main/logger.c
    team/dlee/record/main/manager.c
    team/dlee/record/main/manager_channels.c
    team/dlee/record/main/pbx.c
    team/dlee/record/main/slinfactory.c
    team/dlee/record/main/stasis_channels.c
    team/dlee/record/main/stasis_endpoints.c
    team/dlee/record/res/parking/parking_manager.c
    team/dlee/record/res/res_fax.c
    team/dlee/record/res/res_fax_spandsp.c
    team/dlee/record/res/res_jabber.c
    team/dlee/record/res/res_monitor.c
    team/dlee/record/res/res_musiconhold.c
    team/dlee/record/res/res_sip_mwi.c
    team/dlee/record/res/res_sip_sdp_rtp.c
    team/dlee/record/res/res_stasis.c
    team/dlee/record/res/res_xmpp.c

Propchange: team/dlee/record/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/record/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May 28 16:41:35 2013
@@ -1,1 +1,1 @@
-/trunk:1-389659
+/trunk:1-389963

Modified: team/dlee/record/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/CHANGES?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/CHANGES (original)
+++ team/dlee/record/CHANGES Tue May 28 16:41:35 2013
@@ -72,9 +72,39 @@
    event, the various ChanVariable fields will contain a suffix that specifies
    which channel they correspond to.
 
+ * All "Reload" events have been consolidated into a single event type. This
+   event will always contain a Module field specifying the name of the module
+   and a Status field denoting the result of the reload. All modules now issue
+   this event when being reloaded.
+
+ * The "ModuleLoadReport" event has been removed. Most AMI connections would
+   fail to receive this event due to being connected after modules have loaded.
+   AMI connections that want to know when Asterisk is ready should listen for
+   the "FullyBooted" event.
+
+ * app_fax now sends the same send fax/receive fax events as res_fax. The
+   "FaxSent" event is now the "SendFAX" event, and the "FaxReceived" event is
+   now the "ReceiveFAX" event.
+
+ * The MusicOnHold event is now two events: MusicOnHoldStart and
+   MusicOnHoldStop. The sub type field has been removed.
+
+ * The JabberEvent event has been removed. It is not AMI's purpose to be a
+   carrier for another protocol.
+
+ * The Bridge Manager action's Playtone header now accepts more fine-grained
+   options. "Channel1" and "Channel2" may be specified in order to play a tone
+   to the specific channel. "Both" may be specified to play a tone to both
+   channels. The old "yes" option is still accepted as a way of playing the
+   tone to Channel2 only.
+
  * The AMI 'Status' response event to the AMI Status action replaces the
    BridgedChannel and BridgedUniqueid headers with the BridgeID header to
    indicate what bridge the channel is currently in.
+
+ * The AMI 'Hold' event has been moved out of individual channel drivers, into
+   core, and is now two events: Hold and Unhold.  The status field has been
+   removed.
 
 Channel Drivers
 ------------------

Modified: team/dlee/record/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_chanspy.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/apps/app_chanspy.c (original)
+++ team/dlee/record/apps/app_chanspy.c Tue May 28 16:41:35 2013
@@ -55,6 +55,8 @@
 #include "asterisk/lock.h"
 #include "asterisk/options.h"
 #include "asterisk/autochan.h"
+#include "asterisk/stasis_channels.h"
+#include "asterisk/json.h"
 
 #define AST_NAME_STRLEN 256
 #define NUM_SPYGROUPS 128
@@ -188,6 +190,8 @@
 		</description>
 		<see-also>
 			<ref type="application">ExtenSpy</ref>
+			<ref type="managerEvent">ChanSpyStart</ref>
+			<ref type="managerEvent">ChanSpyStop</ref>
 		</see-also>
 	</application>
 	<application name="ExtenSpy" language="en_US">
@@ -322,9 +326,10 @@
 		</description>
 		<see-also>
 			<ref type="application">ChanSpy</ref>
+			<ref type="managerEvent">ChanSpyStart</ref>
+			<ref type="managerEvent">ChanSpyStop</ref>
 		</see-also>
 	</application>
-	
 	<application name="DAHDIScan" language="en_US">
 		<synopsis>
 			Scan DAHDI channels to monitor calls.
@@ -338,6 +343,10 @@
 			<para>Allows a call center manager to monitor DAHDI channels in a
 			convenient way.  Use <literal>#</literal> to select the next channel and use <literal>*</literal> to exit.</para>
 		</description>
+		<see-also>
+			<ref type="managerEvent">ChanSpyStart</ref>
+			<ref type="managerEvent">ChanSpyStop</ref>
+		</see-also>
 	</application>
  ***/
 
@@ -512,6 +521,68 @@
 	}
 }
 
+static int pack_channel_into_message(struct ast_channel *chan, const char *role,
+									 struct ast_multi_channel_blob *payload)
+{
+	RAII_VAR(struct ast_channel_snapshot *, snapshot,
+			ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan)),
+			ao2_cleanup);
+
+	if (!snapshot) {
+		return -1;
+	}
+	ast_multi_channel_blob_add_channel(payload, role, snapshot);
+	return 0;
+}
+
+/*! \internal
+ * \brief Publish the chanspy message over Stasis-Core
+ * \param spyer The channel doing the spying
+ * \param spyee Who is being spied upon
+ * \start start If non-zero, the spying is starting. Otherwise, the spyer is
+ * finishing
+ */
+static void publish_chanspy_message(struct ast_channel *spyer,
+									struct ast_channel *spyee,
+									int start)
+{
+	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+	RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+
+	if (!spyer) {
+		ast_log(AST_LOG_WARNING, "Attempt to publish ChanSpy message for NULL spyer channel\n");
+		return;
+	}
+	blob = ast_json_null();
+	if (!blob) {
+		return;
+	}
+
+	payload = ast_multi_channel_blob_create(blob);
+	if (!payload) {
+		return;
+	}
+
+	if (pack_channel_into_message(spyer, "spyer_channel", payload)) {
+		return;
+	}
+
+	if (spyee) {
+		if (pack_channel_into_message(spyee, "spyee_channel", payload)) {
+			return;
+		}
+	}
+
+	message = stasis_message_create(
+			start ? ast_channel_chanspy_start_type(): ast_channel_chanspy_stop_type(),
+					payload);
+	if (!message) {
+		return;
+	}
+	stasis_publish(ast_channel_topic(spyer), message);
+}
+
 static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_autochan,
 	int *volfactor, int fd, struct spy_dtmf_options *user_options, struct ast_flags *flags,
 	char *exitcontext)
@@ -524,38 +595,22 @@
 	struct ast_silence_generator *silgen = NULL;
 	struct ast_autochan *spyee_bridge_autochan = NULL;
 	const char *spyer_name;
-	struct ast_channel *chans[] = { chan, spyee_autochan->chan };
+
+	if (ast_check_hangup(chan) || ast_check_hangup(spyee_autochan->chan) ||
+			ast_test_flag(ast_channel_flags(spyee_autochan->chan), AST_FLAG_ZOMBIE)) {
+		return 0;
+	}
 
 	ast_channel_lock(chan);
 	spyer_name = ast_strdupa(ast_channel_name(chan));
 	ast_channel_unlock(chan);
 
-	/* We now hold the channel lock on spyee */
-
-	if (ast_check_hangup(chan) || ast_check_hangup(spyee_autochan->chan) ||
-			ast_test_flag(ast_channel_flags(spyee_autochan->chan), AST_FLAG_ZOMBIE)) {
-		return 0;
-	}
-
 	ast_channel_lock(spyee_autochan->chan);
 	name = ast_strdupa(ast_channel_name(spyee_autochan->chan));
 	ast_channel_unlock(spyee_autochan->chan);
 
 	ast_verb(2, "Spying on channel %s\n", name);
-	/*** DOCUMENTATION
-		<managerEventInstance>
-			<synopsis>Raised when a channel has started spying on another channel.</synopsis>
-			<see-also>
-				<ref type="application">ChanSpy</ref>
-				<ref type="application">ExtenSpy</ref>
-				<ref type="managerEvent">ChanSpyStop</ref>
-			</see-also>
-		</managerEventInstance>
-	***/
-	ast_manager_event_multichan(EVENT_FLAG_CALL, "ChanSpyStart", 2, chans,
-			"SpyerChannel: %s\r\n"
-			"SpyeeChannel: %s\r\n",
-			spyer_name, name);
+	publish_chanspy_message(chan, spyee_autochan->chan, 1);
 
 	memset(&csth, 0, sizeof(csth));
 	ast_copy_flags(&csth.flags, flags, AST_FLAGS_ALL);
@@ -740,15 +795,7 @@
 	}
 
 	ast_verb(2, "Done Spying on channel %s\n", name);
-	/*** DOCUMENTATION
-		<managerEventInstance>
-			<synopsis>Raised when a channel has stopped spying on another channel.</synopsis>
-			<see-also>
-				<ref type="managerEvent">ChanSpyStart</ref>
-			</see-also>
-		</managerEventInstance>
-	***/
-	ast_manager_event(chan, EVENT_FLAG_CALL, "ChanSpyStop", "SpyeeChannel: %s\r\n", name);
+	publish_chanspy_message(chan, NULL, 0);
 
 	return running;
 }

Modified: team/dlee/record/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_fax.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/apps/app_fax.c (original)
+++ team/dlee/record/apps/app_fax.c Tue May 28 16:41:35 2013
@@ -43,7 +43,8 @@
 #include "asterisk/app.h"
 #include "asterisk/dsp.h"
 #include "asterisk/module.h"
-#include "asterisk/manager.h"
+#include "asterisk/stasis.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="SendFAX" language="en_US" module="app_fax">
@@ -202,6 +203,9 @@
 
 static void phase_e_handler(t30_state_t *f, void *user_data, int result)
 {
+	RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, json_filenames, NULL, ast_json_unref);
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 	const char *local_ident;
 	const char *far_ident;
 	char buf[20];
@@ -251,32 +255,24 @@
 	ast_debug(1, "  Image resolution:  %d x %d\n", stat.x_resolution, stat.y_resolution);
 	ast_debug(1, "  Transfer Rate:     %d\n", stat.bit_rate);
 
-	ast_manager_event(s->chan, EVENT_FLAG_CALL,
-		s->direction ? "FaxSent" : "FaxReceived",
-		"Channel: %s\r\n"
-		"Exten: %s\r\n"
-		"CallerID: %s\r\n"
-		"CallerIDName: %s\r\n"
-		"ConnectedLineNum: %s\r\n"
-		"ConnectedLineName: %s\r\n"
-		"RemoteStationID: %s\r\n"
-		"LocalStationID: %s\r\n"
-		"PagesTransferred: %d\r\n"
-		"Resolution: %d\r\n"
-		"TransferRate: %d\r\n"
-		"FileName: %s\r\n",
-		ast_channel_name(s->chan),
-		ast_channel_exten(s->chan),
-		S_COR(ast_channel_caller(s->chan)->id.number.valid, ast_channel_caller(s->chan)->id.number.str, ""),
-		S_COR(ast_channel_caller(s->chan)->id.name.valid, ast_channel_caller(s->chan)->id.name.str, ""),
-		S_COR(ast_channel_connected(s->chan)->id.number.valid, ast_channel_connected(s->chan)->id.number.str, ""),
-		S_COR(ast_channel_connected(s->chan)->id.name.valid, ast_channel_connected(s->chan)->id.name.str, ""),
-		far_ident,
-		local_ident,
-		pages_transferred,
-		stat.y_resolution,
-		stat.bit_rate,
-		s->file_name);
+	json_filenames = ast_json_pack("[s]", s->file_name);
+	if (!json_filenames) {
+		return;
+	}
+	ast_json_ref(json_filenames);
+	json_object = ast_json_pack("{s: s, s: s, s: s, s: i, s: i, s: i, s: o}",
+			"type", s->direction ? "send" : "receive",
+			"remote_station_id", far_ident,
+			"local_station_id", local_ident,
+			"fax_pages", pages_transferred,
+			"fax_resolution", stat.y_resolution,
+			"fax_bitrate", stat.bit_rate,
+			"filenames", json_filenames);
+	message = ast_channel_cached_blob_create(s->chan, ast_channel_fax_type(), json_object);
+	if (!message) {
+		return;
+	}
+	stasis_publish(ast_channel_topic(s->chan), message);
 }
 
 /* === Helper functions to configure fax === */

Modified: team/dlee/record/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_minivm.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/apps/app_minivm.c (original)
+++ team/dlee/record/apps/app_minivm.c Tue May 28 16:41:35 2013
@@ -166,14 +166,15 @@
 #include "asterisk/say.h"
 #include "asterisk/module.h"
 #include "asterisk/app.h"
-#include "asterisk/manager.h"
 #include "asterisk/dsp.h"
 #include "asterisk/localtime.h"
 #include "asterisk/cli.h"
 #include "asterisk/utils.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/callerid.h"
-#include "asterisk/event.h"
+#include "asterisk/stasis.h"
+#include "asterisk/stasis_channels.h"
+#include "asterisk/json.h"
 
 /*** DOCUMENTATION
 <application name="MinivmRecord" language="en_US">
@@ -495,7 +496,23 @@
 		<ref type="function">MINIVMCOUNTER</ref>
 	</see-also>
 </function>
-
+	<managerEvent language="en_US" name="MiniVoiceMail">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a notification is sent out by a MiniVoiceMail application</synopsis>
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
+				<parameter name="Action">
+					<para>What action was taken. Currently, this will always be <literal>SentNotification</literal></para>
+				</parameter>
+				<parameter name="Mailbox">
+					<para>The mailbox that the notification was about, specified as <literal>mailbox</literal>@<literal>context</literal></para>
+				</parameter>
+				<parameter name="Counter">
+					<para>A message counter derived from the <literal>MVM_COUNTER</literal> channel variable.</para>
+				</parameter>
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
 ***/
 
 #ifndef TRUE
@@ -1761,6 +1778,9 @@
  * \brief Send message to voicemail account owner */
 static int notify_new_message(struct ast_channel *chan, const char *templatename, struct minivm_account *vmu, const char *filename, long duration, const char *format, char *cidnum, char *cidname)
 {
+	RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_mwi_state *, mwi_state, NULL, ao2_cleanup);
 	char *stringp;
 	struct minivm_template *etemplate;
 	char *messageformat;
@@ -1826,8 +1846,26 @@
 		res = sendmail(etemplate, vmu, cidnum, cidname, filename, messageformat, duration, etemplate->attachment, MVM_MESSAGE_PAGE, counter);
 	}
 
-	ast_manager_event(chan, EVENT_FLAG_CALL, "MiniVoiceMail", "Action: SentNotification\rn\nMailbox: %s@%s\r\nCounter: %s\r\n", vmu->username, vmu->domain, counter);
-
+	mwi_state = ast_mwi_create(vmu->username, vmu->domain);
+	if (!mwi_state) {
+		goto notify_cleanup;
+	}
+	mwi_state->snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan));
+
+	json_object = ast_json_pack("{s: s, s: s}",
+			"Event", "MiniVoiceMail"
+			"Action", "SentNotification",
+			"Counter", counter);
+	if (!json_object) {
+		goto notify_cleanup;
+	}
+	message = ast_mwi_blob_create(mwi_state, ast_mwi_vm_app_type(), json_object);
+	if (!message) {
+		goto notify_cleanup;
+	}
+	stasis_publish(ast_mwi_topic(mwi_state->uniqueid), message);
+
+notify_cleanup:
 	run_externnotify(chan, vmu);		/* Run external notification */
 
 	if (etemplate->locale) {
@@ -2011,7 +2049,7 @@
 
 /*!\internal
  * \brief Queue a message waiting event */
-static void queue_mwi_event(const char *mbx, const char *ctx, int urgent, int new, int old)
+static void queue_mwi_event(const char *channel_id, const char *mbx, const char *ctx, int urgent, int new, int old)
 {
 	char *mailbox, *context;
 
@@ -2021,7 +2059,7 @@
 		context = "default";
 	}
 
-	stasis_publish_mwi_state(mailbox, context, new + urgent, old);
+	ast_publish_mwi_state_channel(mailbox, context, new + urgent, old, channel_id);
 }
 
 /*!\internal
@@ -2056,7 +2094,7 @@
 		ast_log(LOG_ERROR, "Need mailbox at context as argument. Sorry. Argument 0 %s\n", argv[0]);
 		return -1;
 	}
-	queue_mwi_event(mailbox, domain, atoi(argv[1]), atoi(argv[2]), atoi(argv[3]));
+	queue_mwi_event(ast_channel_uniqueid(chan), mailbox, domain, atoi(argv[1]), atoi(argv[2]), atoi(argv[3]));
 
 	return res;
 }
@@ -2078,7 +2116,6 @@
 	const char *filename;
 	const char *format;
 	const char *duration_string;
-
 	if (ast_strlen_zero(data))  {
 		ast_log(LOG_ERROR, "Minivm needs at least an account argument \n");
 		return -1;

Modified: team/dlee/record/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_voicemail.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/apps/app_voicemail.c (original)
+++ team/dlee/record/apps/app_voicemail.c Tue May 28 16:41:35 2013
@@ -7741,7 +7741,7 @@
 	return cmd;
 }
 
-static void queue_mwi_event(const char *box, int urgent, int new, int old)
+static void queue_mwi_event(const char *channel_id, const char *box, int urgent, int new, int old)
 {
 	char *mailbox, *context;
 
@@ -7752,7 +7752,7 @@
 		context = "default";
 	}
 
-	stasis_publish_mwi_state(mailbox, context, new + urgent, old);
+	ast_publish_mwi_state_channel(mailbox, context, new + urgent, old, channel_id);
 }
 
 /*!
@@ -7842,32 +7842,7 @@
 	if (ast_app_has_voicemail(ext_context, NULL)) 
 		ast_app_inboxcount2(ext_context, &urgentmsgs, &newmsgs, &oldmsgs);
 
-	queue_mwi_event(ext_context, urgentmsgs, newmsgs, oldmsgs);
-
-	/*** DOCUMENTATION
-		<managerEventInstance>
-			<synopsis>Raised when a new message has been left in a voicemail mailbox.</synopsis>
-			<syntax>
-				<parameter name="Mailbox">
-					<para>The mailbox with the new message, specified as <emphasis>mailbox</emphasis>@<emphasis>context</emphasis></para>
-				</parameter>
-				<parameter name="Waiting">
-					<para>Whether or not the mailbox has access to a voicemail application.</para>
-				</parameter>
-				<parameter name="New">
-					<para>The number of new messages.</para>
-				</parameter>
-				<parameter name="Old">
-					<para>The number of old messages.</para>
-				</parameter>
-			</syntax>
-		</managerEventInstance>
-	***/
-	ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting",
-			"Mailbox: %s@%s\r\n"
-			"Waiting: %d\r\n"
-			"New: %d\r\n"
-			"Old: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
+	queue_mwi_event(ast_channel_uniqueid(chan), ext_context, urgentmsgs, newmsgs, oldmsgs);
 	run_externnotify(vmu->context, vmu->mailbox, flag);
 
 #ifdef IMAP_STORAGE
@@ -11538,16 +11513,10 @@
 	if (valid) {
 		int new = 0, old = 0, urgent = 0;
 		snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context);
-		/*** DOCUMENTATION
-			<managerEventInstance>
-				<synopsis>Raised when a user has finished listening to their messages.</synopsis>
-			</managerEventInstance>
-		***/
-		ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL));
 		/* Urgent flag not passwd to externnotify here */
 		run_externnotify(vmu->context, vmu->mailbox, NULL);
 		ast_app_inboxcount2(ext_context, &urgent, &new, &old);
-		queue_mwi_event(ext_context, urgent, new, old);
+		queue_mwi_event(ast_channel_uniqueid(chan), ext_context, urgent, new, old);
 	}
 #ifdef IMAP_STORAGE
 	/* expunge message - use UID Expunge if supported on IMAP server*/
@@ -11766,7 +11735,7 @@
 	strcat(mailbox_full, context);
 
 	inboxcount2(mailbox_full, &urgent, &new, &old);
-	queue_mwi_event(mailbox_full, urgent, new, old);
+	queue_mwi_event(NULL, mailbox_full, urgent, new, old);
 
 	return 0;
 }
@@ -12502,7 +12471,7 @@
 		mwi_sub->old_urgent = urgent;
 		mwi_sub->old_new = new;
 		mwi_sub->old_old = old;
-		queue_mwi_event(mwi_sub->mailbox, urgent, new, old);
+		queue_mwi_event(NULL, mwi_sub->mailbox, urgent, new, old);
 		run_externnotify(NULL, mwi_sub->mailbox, NULL);
 	}
 }
@@ -12647,7 +12616,7 @@
 	}
 
 	change = stasis_message_data(msg);
-	if (change->topic == stasis_mwi_topic_all()) {
+	if (change->topic == ast_mwi_topic_all()) {
 		return;
 	}
 
@@ -12668,10 +12637,10 @@
 static void start_poll_thread(void)
 {
 	int errcode;
-	mwi_sub_sub = stasis_subscribe(stasis_mwi_topic_all(), mwi_event_cb, NULL);
+	mwi_sub_sub = stasis_subscribe(ast_mwi_topic_all(), mwi_event_cb, NULL);
 
 	if (mwi_sub_sub) {
-		struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change_type());
+		struct ao2_container *cached = stasis_cache_dump(ast_mwi_topic_cached(), stasis_subscription_change_type());
 		if (cached) {
 			ao2_callback(cached, OBJ_MULTIPLE | OBJ_NODATA, dump_cache, NULL);
 		}
@@ -15263,7 +15232,7 @@
 	snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
 	run_externnotify(vmu->context, vmu->mailbox, NULL);
 	ast_app_inboxcount2(ext_context, &urgent, &new, &old);
-	queue_mwi_event(ext_context, urgent, new, old);
+	queue_mwi_event(NULL, ext_context, urgent, new, old);
 }
 
 static int vm_msg_forward(const char *from_mailbox,

Modified: team/dlee/record/apps/confbridge/confbridge_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/confbridge/confbridge_manager.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/apps/confbridge/confbridge_manager.c (original)
+++ team/dlee/record/apps/confbridge/confbridge_manager.c Tue May 28 16:41:35 2013
@@ -161,6 +161,7 @@
 			</see-also>
 		</managerEventInstance>
 	</managerEvent>
+
 	<managerEvent language="en_US" name="ConfbridgeTalking">
 		<managerEventInstance class="EVENT_FLAG_CALL">
 			<synopsis>Raised when a confbridge participant unmutes.</synopsis>

Modified: team/dlee/record/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/bridges/bridge_builtin_features.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/bridges/bridge_builtin_features.c (original)
+++ team/dlee/record/bridges/bridge_builtin_features.c Tue May 28 16:41:35 2013
@@ -95,6 +95,16 @@
 	return res;
 }
 
+static void copy_caller_data(struct ast_channel *dest, struct ast_channel *caller)
+{
+	ast_channel_lock_both(caller, dest);
+	ast_connected_line_copy_from_caller(ast_channel_connected(dest), ast_channel_caller(caller));
+	ast_channel_inherit_variables(caller, dest);
+	ast_channel_datastore_inherit(caller, dest);
+	ast_channel_unlock(dest);
+	ast_channel_unlock(caller);
+}
+
 /*! \brief Helper function that creates an outgoing channel and returns it immediately */
 static struct ast_channel *dial_transfer(struct ast_channel *caller, const char *exten, const char *context)
 {
@@ -113,12 +123,7 @@
 	}
 
 	/* Before we actually dial out let's inherit appropriate information. */
-	ast_channel_lock_both(caller, chan);
-	ast_connected_line_copy_from_caller(ast_channel_connected(chan), ast_channel_caller(caller));
-	ast_channel_inherit_variables(caller, chan);
-	ast_channel_datastore_inherit(caller, chan);
-	ast_channel_unlock(chan);
-	ast_channel_unlock(caller);
+	copy_caller_data(chan, caller);
 
 	/* Since the above worked fine now we actually call it and return the channel */
 	if (ast_call(chan, destination, 0)) {
@@ -159,19 +164,30 @@
 	return "default";
 }
 
+static void blind_transfer_cb(struct ast_channel *new_channel, void *user_data,
+		enum ast_transfer_type transfer_type)
+{
+	struct ast_channel *transferer_channel = user_data;
+
+	if (transfer_type == AST_BRIDGE_TRANSFER_MULTI_PARTY) {
+		copy_caller_data(new_channel, transferer_channel);
+	}
+}
+
 /*! \brief Internal built in feature for blind transfers */
 static int feature_blind_transfer(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 {
 	char exten[AST_MAX_EXTENSION] = "";
-	struct ast_channel *chan = NULL;
 	struct ast_bridge_features_blind_transfer *blind_transfer = hook_pvt;
 	const char *context;
-	struct ast_exten *park_exten;
+	char *goto_on_blindxfr;
 
 /* BUGBUG the peer needs to be put on hold for the transfer. */
 	ast_channel_lock(bridge_channel->chan);
 	context = ast_strdupa(get_transfer_context(bridge_channel->chan,
 		blind_transfer ? blind_transfer->context : NULL));
+	goto_on_blindxfr = ast_strdupa(S_OR(pbx_builtin_getvar_helper(bridge_channel->chan,
+		"GOTO_ON_BLINDXFR"), ""));
 	ast_channel_unlock(bridge_channel->chan);
 
 	/* Grab the extension to transfer to */
@@ -179,30 +195,16 @@
 		return 0;
 	}
 
-	/* Parking blind transfer override - phase this out for something more general purpose in the future. */
-	park_exten = ast_get_parking_exten(exten, bridge_channel->chan, context);
-	if (park_exten) {
-		/* We are transfering the transferee to a parking lot. */
-		if (ast_park_blind_xfer(bridge, bridge_channel, park_exten)) {
-			ast_log(LOG_ERROR, "%s attempted to transfer to park application and failed.\n", ast_channel_name(bridge_channel->chan));
-		};
-		return 0;
-	}
-
-/* BUGBUG just need to ast_async_goto the peer so this bridge will go away and not accumulate local channels and bridges if the destination is to an application. */
-/* ast_async_goto actually is a blind transfer. */
-/* BUGBUG Use the bridge count to determine if can do DTMF transfer features.  If count is not 2 then don't allow it. */
-
-	/* Get a channel that is the destination we wish to call */
-	chan = dial_transfer(bridge_channel->chan, exten, context);
-	if (!chan) {
-		return 0;
-	}
-
-	/* Impart the new channel onto the bridge, and have it take our place. */
-	if (ast_bridge_impart(bridge_channel->bridge, chan, bridge_channel->chan, NULL, 1)) {
-		ast_hangup(chan);
-		return 0;
+	if (!ast_strlen_zero(goto_on_blindxfr)) {
+		ast_debug(1, "After transfer, transferer %s goes to %s\n",
+				ast_channel_name(bridge_channel->chan), goto_on_blindxfr);
+		ast_after_bridge_set_go_on(bridge_channel->chan, NULL, NULL, 0, goto_on_blindxfr);
+	}
+
+	if (ast_bridge_transfer_blind(bridge_channel->chan, exten, context, blind_transfer_cb,
+			bridge_channel->chan) != AST_BRIDGE_TRANSFER_SUCCESS &&
+			!ast_strlen_zero(goto_on_blindxfr)) {
+		ast_after_bridge_goto_discard(bridge_channel->chan);
 	}
 
 	return 0;

Modified: team/dlee/record/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/channels/chan_dahdi.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/channels/chan_dahdi.c (original)
+++ team/dlee/record/channels/chan_dahdi.c Tue May 28 16:41:35 2013
@@ -3762,7 +3762,7 @@
 	if (ast_strlen_zero(context))
 		context = "default";
 
-	stasis_publish_mwi_state(mailbox, context, thereornot, thereornot);
+	ast_publish_mwi_state(mailbox, context, thereornot, thereornot);
 
 	if (!ast_strlen_zero(mailbox) && !ast_strlen_zero(mwimonitornotify)) {
 		snprintf(s, sizeof(s), "%s %s %d", mwimonitornotify, mailbox, thereornot);
@@ -5427,10 +5427,10 @@
 	}
 
 	ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
-	mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+	mwi_message = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
 
 	if (mwi_message) {
-		struct stasis_mwi_state *mwi_state = stasis_message_data(mwi_message);
+		struct ast_mwi_state *mwi_state = stasis_message_data(mwi_message);
 		new_msgs = mwi_state->new_msgs;
 	} else {
 		new_msgs = ast_app_has_voicemail(p->mailbox, NULL);
@@ -6560,7 +6560,7 @@
 				p->owner = p->subs[SUB_REAL].owner;
 				if (ast_channel_state(p->owner) != AST_STATE_UP)
 					p->subs[SUB_REAL].needanswer = 1;
-				ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+				ast_queue_unhold(p->subs[SUB_REAL].owner);
 			} else if (p->subs[SUB_THREEWAY].dfd > -1) {
 				swap_subs(p, SUB_THREEWAY, SUB_REAL);
 				unalloc_sub(p, SUB_THREEWAY);
@@ -6582,9 +6582,7 @@
 				/* This is actually part of a three way, placed on hold.  Place the third part
 				   on music on hold now */
 				if (p->subs[SUB_THREEWAY].owner) {
-					ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
-						S_OR(p->mohsuggest, NULL),
-						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+					ast_queue_hold(p->subs[SUB_THREEWAY].owner, p->mohsuggest);
 				}
 				p->subs[SUB_THREEWAY].inthreeway = 0;
 				/* Make it the call wait now */
@@ -6597,9 +6595,7 @@
 				/* The other party of the three way call is currently in a call-wait state.
 				   Start music on hold for them, and take the main guy out of the third call */
 				if (p->subs[SUB_CALLWAIT].owner) {
-					ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
-						S_OR(p->mohsuggest, NULL),
-						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+					ast_queue_hold(p->subs[SUB_CALLWAIT].owner, p->mohsuggest);
 				}
 				p->subs[SUB_CALLWAIT].inthreeway = 0;
 			}
@@ -7851,7 +7847,7 @@
 	if (ast_bridged_channel(p->subs[SUB_REAL].owner)) {
 		/* The three-way person we're about to transfer to could still be in MOH, so
 		   stop it now */
-		ast_queue_control(p->subs[SUB_THREEWAY].owner, AST_CONTROL_UNHOLD);
+		ast_queue_unhold(p->subs[SUB_THREEWAY].owner);
 		if (ast_channel_state(p->subs[SUB_REAL].owner) == AST_STATE_RINGING) {
 			ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_RINGING);
 		}
@@ -7867,7 +7863,7 @@
 		ast_channel_unlock(p->subs[SUB_THREEWAY].owner);
 		unalloc_sub(p, SUB_THREEWAY);
 	} else if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
-		ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+		ast_queue_unhold(p->subs[SUB_REAL].owner);
 		if (ast_channel_state(p->subs[SUB_THREEWAY].owner) == AST_STATE_RINGING) {
 			ast_queue_control(p->subs[SUB_THREEWAY].owner, AST_CONTROL_RINGING);
 		}
@@ -8535,7 +8531,7 @@
 				/* Make sure it stops ringing */
 				dahdi_set_hook(p->subs[idx].dfd, DAHDI_OFFHOOK);
 				/* Okay -- probably call waiting*/
-				ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+				ast_queue_unhold(p->owner);
 				p->subs[idx].needunhold = 1;
 				break;
 			case AST_STATE_RESERVED:
@@ -8690,14 +8686,10 @@
 				p->cid_suppress_expire = 0;
 				/* Start music on hold if appropriate */
 				if (!p->subs[SUB_CALLWAIT].inthreeway) {
-					ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
-						S_OR(p->mohsuggest, NULL),
-						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+					ast_queue_hold(p->subs[SUB_CALLWAIT].owner, p->mohsuggest);
 				}
 				p->subs[SUB_CALLWAIT].needhold = 1;
-				ast_queue_control_data(p->subs[SUB_REAL].owner, AST_CONTROL_HOLD,
-					S_OR(p->mohsuggest, NULL),
-					!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+				ast_queue_hold(p->subs[SUB_REAL].owner, p->mohsuggest);
 				p->subs[SUB_REAL].needunhold = 1;
 			} else if (!p->subs[SUB_THREEWAY].owner) {
 				if (!p->threewaycalling) {
@@ -8775,9 +8767,7 @@
 						ast_verb(3, "Started three way call on channel %d\n", p->channel);
 
 						/* Start music on hold */
-						ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
-							S_OR(p->mohsuggest, NULL),
-							!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+						ast_queue_hold(p->subs[SUB_THREEWAY].owner, p->mohsuggest);
 						p->subs[SUB_THREEWAY].needhold = 1;
 					}
 					ast_callid_threadstorage_auto_clean(callid, callid_created);
@@ -8814,8 +8804,9 @@
 							swap_subs(p, SUB_THREEWAY, SUB_REAL);
 							otherindex = SUB_REAL;
 						}
-						if (p->subs[otherindex].owner)
-							ast_queue_control(p->subs[otherindex].owner, AST_CONTROL_UNHOLD);
+						if (p->subs[otherindex].owner) {
+							ast_queue_unhold(p->subs[otherindex].owner);
+						}
 						p->subs[otherindex].needunhold = 1;
 						p->owner = p->subs[SUB_REAL].owner;
 					} else {
@@ -8823,8 +8814,9 @@
 						swap_subs(p, SUB_THREEWAY, SUB_REAL);
 						ast_channel_softhangup_internal_flag_add(p->subs[SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
 						p->owner = p->subs[SUB_REAL].owner;
-						if (p->subs[SUB_REAL].owner)
-							ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+						if (p->subs[SUB_REAL].owner) {
+							ast_queue_unhold(p->subs[SUB_REAL].owner);
+						}
 						p->subs[SUB_REAL].needunhold = 1;
 						dahdi_enable_ec(p);
 					}
@@ -9017,8 +9009,9 @@
 			(res != DAHDI_EVENT_HOOKCOMPLETE)) {
 			ast_debug(1, "Restoring owner of channel %d on event %d\n", p->channel, res);
 			p->owner = p->subs[SUB_REAL].owner;
-			if (p->owner)
-				ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+			if (p->owner) {
+				ast_queue_unhold(p->owner);
+			}
 			p->subs[SUB_REAL].needunhold = 1;
 		}
 		switch (res) {
@@ -9062,7 +9055,7 @@
 				p->callwaitingrepeat = 0;
 				p->cidcwexpire = 0;
 				p->cid_suppress_expire = 0;
-				ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+				ast_queue_unhold(p->owner);
 				p->subs[SUB_REAL].needunhold = 1;
 			} else
 				ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
@@ -10699,7 +10692,7 @@
 					swap_subs(p, SUB_REAL, SUB_THREEWAY);
 					unalloc_sub(p, SUB_THREEWAY);
 					p->owner = p->subs[SUB_REAL].owner;
-					ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+					ast_queue_unhold(p->subs[SUB_REAL].owner);
 					ast_hangup(chan);
 					goto quit;
 				} else {
@@ -13235,7 +13228,7 @@
 
 			ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
 
-			mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+			mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
 			if (mailbox_specific_topic) {
 				tmp->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, NULL);
 			}

Modified: team/dlee/record/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/channels/chan_h323.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/channels/chan_h323.c (original)
+++ team/dlee/record/channels/chan_h323.c Tue May 28 16:41:35 2013
@@ -2096,18 +2096,17 @@
 				ast_queue_control(pvt->owner, AST_CONTROL_PROGRESS);
 			switch (rtp_change) {
 			case NEED_HOLD:
-				ast_queue_control(pvt->owner, AST_CONTROL_HOLD);
+				ast_queue_hold(pvt->owner, NULL);
 				break;
 			case NEED_UNHOLD:
-				ast_queue_control(pvt->owner, AST_CONTROL_UNHOLD);
+				ast_queue_unhold(pvt->owner);
 				break;
 			default:
 				break;
 			}
 			ast_channel_unlock(pvt->owner);
 			pvt_native = ast_format_cap_destroy(pvt_native);
-		}
-		else {
+		} else {
 			if (pvt->options.progress_audio)
 				pvt->newcontrol = AST_CONTROL_PROGRESS;
 			else if (rtp_change == NEED_HOLD)
@@ -2599,10 +2598,11 @@
 	if (!pvt)
 		return;
 	if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
-		if (is_hold)
-			ast_queue_control(pvt->owner, AST_CONTROL_HOLD);
-		else
-			ast_queue_control(pvt->owner, AST_CONTROL_UNHOLD);
+		if (is_hold) {
+			ast_queue_hold(pvt->owner, NULL);
+		} else {
+			ast_queue_unhold(pvt->owner);
+		}
 		ast_channel_unlock(pvt->owner);
 	}
 	else {

Modified: team/dlee/record/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/channels/chan_iax2.c?view=diff&rev=389964&r1=389963&r2=389964
==============================================================================
--- team/dlee/record/channels/chan_iax2.c (original)
+++ team/dlee/record/channels/chan_iax2.c Tue May 28 16:41:35 2013
@@ -3095,6 +3095,52 @@
 }
 
 /*!
+ * \brief Queue a hold frame on the ast_channel owner
+ *
+ * This function queues a hold frame on the owner of the IAX2 pvt struct that
+ * is active for the given call number.
+ *
+ * \pre Assumes lock for callno is already held.
+ *
+ * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
+ * was valid before calling it, it may no longer be valid after calling it.
+ * This function may unlock and lock the mutex associated with this callno,
+ * meaning that another thread may grab it and destroy the call.
+ */
+static int iax2_queue_hold(int callno, const char *musicclass)
+{
+	iax2_lock_owner(callno);
+	if (iaxs[callno] && iaxs[callno]->owner) {
+		ast_queue_hold(iaxs[callno]->owner, musicclass);
+		ast_channel_unlock(iaxs[callno]->owner);
+	}
+	return 0;
+}
+
+/*!
+ * \brief Queue an unhold frame on the ast_channel owner
+ *
+ * This function queues an unhold frame on the owner of the IAX2 pvt struct that
+ * is active for the given call number.
+ *
+ * \pre Assumes lock for callno is already held.
+ *
+ * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
+ * was valid before calling it, it may no longer be valid after calling it.
+ * This function may unlock and lock the mutex associated with this callno,
+ * meaning that another thread may grab it and destroy the call.
+ */
+static int iax2_queue_unhold(int callno)
+{
+	iax2_lock_owner(callno);
+	if (iaxs[callno] && iaxs[callno]->owner) {
+		ast_queue_unhold(iaxs[callno]->owner);
+		ast_channel_unlock(iaxs[callno]->owner);
+	}
+	return 0;
+}
+
+/*!
  * \brief Queue a hangup frame on the ast_channel owner
  *
  * This function queues a hangup frame on the owner of the IAX2 pvt struct that
@@ -3112,30 +3158,6 @@
 	iax2_lock_owner(callno);
 	if (iaxs[callno] && iaxs[callno]->owner) {
 		ast_queue_hangup(iaxs[callno]->owner);
-		ast_channel_unlock(iaxs[callno]->owner);
-	}
-	return 0;
-}
-
-/*!
- * \brief Queue a control frame on the ast_channel owner
- *
- * This function queues a control frame on the owner of the IAX2 pvt struct that
- * is active for the given call number.
- *
- * \pre Assumes lock for callno is already held.
- *
- * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
- * was valid before calling it, it may no longer be valid after calling it.
- * This function may unlock and lock the mutex associated with this callno,
- * meaning that another thread may grab it and destroy the call.
- */
-static int iax2_queue_control_data(int callno, 
-	enum ast_control_frame_type control, const void *data, size_t datalen)
-{
-	iax2_lock_owner(callno);

[... 7747 lines stripped ...]



More information about the asterisk-commits mailing list