[asterisk-commits] mmichelson: branch mmichelson/more_transfer r389566 - in /team/mmichelson/mor...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 23 13:14:27 CDT 2013


Author: mmichelson
Date: Thu May 23 13:14:22 2013
New Revision: 389566

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


Added:
    team/mmichelson/more_transfer/apps/confbridge/conf_chan_announce.c
      - copied unchanged from r389556, team/mmichelson/transfer/apps/confbridge/conf_chan_announce.c
    team/mmichelson/more_transfer/apps/confbridge/conf_chan_record.c
      - copied unchanged from r389556, team/mmichelson/transfer/apps/confbridge/conf_chan_record.c
Removed:
    team/mmichelson/more_transfer/channels/chan_bridge.c
Modified:
    team/mmichelson/more_transfer/   (props changed)
    team/mmichelson/more_transfer/CHANGES
    team/mmichelson/more_transfer/apps/app_confbridge.c
    team/mmichelson/more_transfer/apps/app_dial.c
    team/mmichelson/more_transfer/apps/app_dumpchan.c
    team/mmichelson/more_transfer/apps/app_followme.c
    team/mmichelson/more_transfer/apps/app_queue.c
    team/mmichelson/more_transfer/apps/confbridge/include/confbridge.h
    team/mmichelson/more_transfer/channels/chan_agent.c
    team/mmichelson/more_transfer/channels/chan_dahdi.c
    team/mmichelson/more_transfer/channels/chan_iax2.c
    team/mmichelson/more_transfer/channels/chan_misdn.c
    team/mmichelson/more_transfer/channels/chan_unistim.c
    team/mmichelson/more_transfer/channels/chan_vpb.cc
    team/mmichelson/more_transfer/include/asterisk/channel.h
    team/mmichelson/more_transfer/include/asterisk/dial.h
    team/mmichelson/more_transfer/include/asterisk/strings.h
    team/mmichelson/more_transfer/main/app.c
    team/mmichelson/more_transfer/main/channel.c
    team/mmichelson/more_transfer/main/cli.c
    team/mmichelson/more_transfer/main/dial.c
    team/mmichelson/more_transfer/main/features.c
    team/mmichelson/more_transfer/main/manager.c
    team/mmichelson/more_transfer/main/stasis_bridging.c
    team/mmichelson/more_transfer/res/res_sip_session.c

Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
--- bridge_construction-integrated (original)
+++ bridge_construction-integrated Thu May 23 13:14:22 2013
@@ -1,1 +1,1 @@
-/trunk:1-389355
+/trunk:1-389552

Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
--- more_transfer-integrated (original)
+++ more_transfer-integrated Thu May 23 13:14:22 2013
@@ -1,1 +1,1 @@
-/team/mmichelson/transfer:1-389367
+/team/mmichelson/transfer:1-389565

Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
--- transfer-integrated (original)
+++ transfer-integrated Thu May 23 13:14:22 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-389363
+/team/group/bridge_construction:1-389555

Modified: team/mmichelson/more_transfer/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/CHANGES?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/CHANGES (original)
+++ team/mmichelson/more_transfer/CHANGES Thu May 23 13:14:22 2013
@@ -77,6 +77,10 @@
    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.
 
 Channel Drivers
 ------------------

Modified: team/mmichelson/more_transfer/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_confbridge.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/apps/app_confbridge.c (original)
+++ team/mmichelson/more_transfer/apps/app_confbridge.c Thu May 23 13:14:22 2013
@@ -306,7 +306,7 @@
 };
 
 /*! \brief Container to hold all conference bridges in progress */
-static struct ao2_container *conference_bridges;
+struct ao2_container *conference_bridges;
 
 static void leave_conference(struct confbridge_user *user);
 static int play_sound_number(struct confbridge_conference *conference, int say_number);
@@ -488,44 +488,6 @@
 	send_conf_stasis(conference, chan, "confbridge_unmute", NULL, 1);
 }
 
-
-static struct ast_frame *rec_read(struct ast_channel *ast)
-{
-	return &ast_null_frame;
-}
-static int rec_write(struct ast_channel *ast, struct ast_frame *f)
-{
-	return 0;
-}
-static struct ast_channel *rec_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause);
-static struct ast_channel_tech record_tech = {
-	.type = "ConfBridgeRec",
-	.description = "Conference Bridge Recording Channel",
-	.requester = rec_request,
-	.read = rec_read,
-	.write = rec_write,
-};
-static struct ast_channel *rec_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
-{
-	struct ast_channel *tmp;
-	struct ast_format fmt;
-	const char *conf_name = data;
-	if (!(tmp = ast_channel_alloc(1, AST_STATE_UP, 0, 0, "", "", "", NULL, 0,
-		"ConfBridgeRecorder/conf-%s-uid-%d",
-		conf_name,
-		(int) ast_random()))) {
-		return NULL;
-	}
-	ast_format_set(&fmt, AST_FORMAT_SLINEAR, 0);
-	ast_channel_tech_set(tmp, &record_tech);
-	ast_format_cap_add_all(ast_channel_nativeformats(tmp));
-	ast_format_copy(ast_channel_writeformat(tmp), &fmt);
-	ast_format_copy(ast_channel_rawwriteformat(tmp), &fmt);
-	ast_format_copy(ast_channel_readformat(tmp), &fmt);
-	ast_format_copy(ast_channel_rawreadformat(tmp), &fmt);
-	return tmp;
-}
-
 static void set_rec_filename(struct confbridge_conference *conference, struct ast_str **filename, int is_new)
 {
 	char *rec_file = conference->b_profile.rec_file;
@@ -596,6 +558,7 @@
 		ao2_ref(conference, -1);
 		return NULL;
 	}
+	ast_set_flag(&features.feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE);
 
 	/* XXX If we get an EXIT right here, START will essentially be a no-op */
 	while (conference->record_state != CONF_RECORD_EXIT) {
@@ -689,8 +652,7 @@
 static int conf_start_record(struct confbridge_conference *conference)
 {
 	struct ast_format_cap *cap;
-	struct ast_format tmpfmt;
-	int cause;
+	struct ast_format format;
 
 	if (conference->record_state != CONF_RECORD_STOP) {
 		return -1;
@@ -701,18 +663,19 @@
 		return -1;
 	}
 
-	if (!(cap = ast_format_cap_alloc_nolock())) {
+	cap = ast_format_cap_alloc_nolock();
+	if (!cap) {
 		return -1;
 	}
 
-	ast_format_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
-
-	if (!(conference->record_chan = ast_request("ConfBridgeRec", cap, NULL, conference->name, &cause))) {
-		cap = ast_format_cap_destroy(cap);
+	ast_format_cap_add(cap, ast_format_set(&format, AST_FORMAT_SLINEAR, 0));
+
+	conference->record_chan = ast_request("CBRec", cap, NULL,
+		conference->name, NULL);
+	cap = ast_format_cap_destroy(cap);
+	if (!conference->record_chan) {
 		return -1;
 	}
-
-	cap = ast_format_cap_destroy(cap);
 
 	conference->record_state = CONF_RECORD_START;
 	ast_mutex_lock(&conference->record_lock);
@@ -923,10 +886,7 @@
 	ast_debug(1, "Destroying conference bridge '%s'\n", conference->name);
 
 	if (conference->playback_chan) {
-		struct ast_channel *underlying_channel = ast_channel_tech(conference->playback_chan)->bridged_channel(conference->playback_chan, NULL);
-		if (underlying_channel) {
-			ast_hangup(underlying_channel);
-		}
+		conf_announce_channel_depart(conference->playback_chan);
 		ast_hangup(conference->playback_chan);
 		conference->playback_chan = NULL;
 	}
@@ -1360,74 +1320,59 @@
 
 /*!
  * \internal
- * \brief allocates playback chan on a channel
+ * \brief Allocate playback channel for a conference.
  * \pre expects conference to be locked before calling this function
  */
 static int alloc_playback_chan(struct confbridge_conference *conference)
 {
-	int cause;
 	struct ast_format_cap *cap;
-	struct ast_format tmpfmt;
-
-	if (conference->playback_chan) {
-		return 0;
-	}
-	if (!(cap = ast_format_cap_alloc_nolock())) {
+	struct ast_format format;
+
+	cap = ast_format_cap_alloc_nolock();
+	if (!cap) {
 		return -1;
 	}
-	ast_format_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
-	if (!(conference->playback_chan = ast_request("Bridge", cap, NULL, "", &cause))) {
-		cap = ast_format_cap_destroy(cap);
+	ast_format_cap_add(cap, ast_format_set(&format, AST_FORMAT_SLINEAR, 0));
+	conference->playback_chan = ast_request("CBAnn", cap, NULL,
+		conference->name, NULL);
+	cap = ast_format_cap_destroy(cap);
+	if (!conference->playback_chan) {
 		return -1;
 	}
-	cap = ast_format_cap_destroy(cap);
-
-	ast_channel_internal_bridge_set(conference->playback_chan, conference->bridge);
-
-	if (ast_call(conference->playback_chan, "", 0)) {
-		ast_hangup(conference->playback_chan);
-		conference->playback_chan = NULL;
-		return -1;
-	}
-
-	ast_debug(1, "Created a playback channel to conference bridge '%s'\n", conference->name);
+
+	ast_debug(1, "Created announcer channel '%s' to conference bridge '%s'\n",
+		ast_channel_name(conference->playback_chan), conference->name);
 	return 0;
 }
 
 static int play_sound_helper(struct confbridge_conference *conference, const char *filename, int say_number)
 {
-	struct ast_channel *underlying_channel;
-
 	/* Do not waste resources trying to play files that do not exist */
 	if (!ast_strlen_zero(filename) && !sound_file_exists(filename)) {
 		return 0;
 	}
 
 	ast_mutex_lock(&conference->playback_lock);
-	if (!(conference->playback_chan)) {
-		if (alloc_playback_chan(conference)) {
-			ast_mutex_unlock(&conference->playback_lock);
-			return -1;
-		}
-		underlying_channel = ast_channel_tech(conference->playback_chan)->bridged_channel(conference->playback_chan, NULL);
-	} else {
-		/* Channel was already available so we just need to add it back into the bridge */
-		underlying_channel = ast_channel_tech(conference->playback_chan)->bridged_channel(conference->playback_chan, NULL);
-		if (ast_bridge_impart(conference->bridge, underlying_channel, NULL, NULL, 0)) {
-			ast_mutex_unlock(&conference->playback_lock);
-			return -1;
-		}
+	if (!conference->playback_chan && alloc_playback_chan(conference)) {
+		ast_mutex_unlock(&conference->playback_lock);
+		return -1;
+	}
+	if (conf_announce_channel_push(conference->playback_chan)) {
+		ast_mutex_unlock(&conference->playback_lock);
+		return -1;
 	}
 
 	/* The channel is all under our control, in goes the prompt */
 	if (!ast_strlen_zero(filename)) {
 		ast_stream_and_wait(conference->playback_chan, filename, "");
 	} else if (say_number >= 0) {
-		ast_say_number(conference->playback_chan, say_number, "", ast_channel_language(conference->playback_chan), NULL);
-	}
-
-	ast_debug(1, "Departing underlying channel '%s' from bridge '%p'\n", ast_channel_name(underlying_channel), conference->bridge);
-	ast_bridge_depart(underlying_channel);
+		ast_say_number(conference->playback_chan, say_number, "",
+			ast_channel_language(conference->playback_chan), NULL);
+	}
+
+	ast_debug(1, "Departing announcer channel '%s' from conference bridge '%s'\n",
+		ast_channel_name(conference->playback_chan), conference->name);
+	conf_announce_channel_depart(conference->playback_chan);
 
 	ast_mutex_unlock(&conference->playback_lock);
 
@@ -2387,7 +2332,13 @@
 	}
 	if (user) {
 		user->features.mute = mute;
-		ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", ast_channel_name(user->chan), user->features.mute ? "muted" : "unmuted", conference->b_profile.name, ast_channel_name(user->chan));
+		ast_channel_lock(user->chan);
+		if (user->features.mute) {
+			send_mute_event(user->chan, conference);
+		} else {
+			send_unmute_event(user->chan, conference);
+		}
+		ast_channel_unlock(user->chan);
 	} else {
 		res = -2;;
 	}
@@ -3102,6 +3053,46 @@
 	conference->waitingusers--;
 }
 
+/*!
+ * \internal
+ * \brief Unregister a ConfBridge channel technology.
+ * \since 12.0.0
+ *
+ * \param tech What to unregister.
+ *
+ * \return Nothing
+ */
+static void unregister_channel_tech(struct ast_channel_tech *tech)
+{
+	ast_channel_unregister(tech);
+	tech->capabilities = ast_format_cap_destroy(tech->capabilities);
+}
+
+/*!
+ * \internal
+ * \brief Register a ConfBridge channel technology.
+ * \since 12.0.0
+ *
+ * \param tech What to register.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+static int register_channel_tech(struct ast_channel_tech *tech)
+{
+	tech->capabilities = ast_format_cap_alloc();
+	if (!tech->capabilities) {
+		return -1;
+	}
+	ast_format_cap_add_all(tech->capabilities);
+	if (ast_channel_register(tech)) {
+		ast_log(LOG_ERROR, "Unable to register channel technology %s(%s).\n",
+			tech->type, tech->description);
+		return -1;
+	}
+	return 0;
+}
+
 /*! \brief Called when module is being unloaded */
 static int unload_module(void)
 {
@@ -3132,8 +3123,8 @@
 
 	conf_destroy_config();
 
-	ast_channel_unregister(&record_tech);
-	record_tech.capabilities = ast_format_cap_destroy(record_tech.capabilities);
+	unregister_channel_tech(conf_announce_get_tech());
+	unregister_channel_tech(conf_record_get_tech());
 
 	return 0;
 }
@@ -3157,13 +3148,8 @@
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
-	if (!(record_tech.capabilities = ast_format_cap_alloc())) {
-		unload_module();
-		return AST_MODULE_LOAD_FAILURE;
-	}
-	ast_format_cap_add_all(record_tech.capabilities);
-	if (ast_channel_register(&record_tech)) {
-		ast_log(LOG_ERROR, "Unable to register ConfBridge recorder.\n");
+	if (register_channel_tech(conf_record_get_tech())
+		|| register_channel_tech(conf_announce_get_tech())) {
 		unload_module();
 		return AST_MODULE_LOAD_FAILURE;
 	}

Modified: team/mmichelson/more_transfer/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_dial.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/apps/app_dial.c (original)
+++ team/mmichelson/more_transfer/apps/app_dial.c Thu May 23 13:14:22 2013
@@ -66,8 +66,9 @@
 #include "asterisk/ccss.h"
 #include "asterisk/indications.h"
 #include "asterisk/framehook.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
 #include "asterisk/bridging.h"
-#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -1014,9 +1015,15 @@
 			num->nochan++;
 		} else {
 			ast_channel_lock_both(c, in);
-			ast_channel_publish_dial(c, in, stuff, NULL);
+			ast_channel_publish_dial(in, c, stuff, NULL);
 			ast_channel_unlock(in);
 			ast_channel_unlock(c);
+
+			ast_channel_lock_both(original, in);
+			ast_channel_publish_dial(in, original, NULL, "CANCEL");
+			ast_channel_unlock(in);
+			ast_channel_unlock(original);
+
 			/* Hangup the original channel now, in case we needed it */
 			ast_hangup(original);
 		}
@@ -1034,22 +1041,6 @@
 	char privintro[1024];
 	char status[256];
 };
-
-static const char *hangup_cause_to_dial_status(int hangup_cause)
-{
-	switch(hangup_cause) {
-	case AST_CAUSE_BUSY:
-		return "BUSY";
-	case AST_CAUSE_CONGESTION:
-		return "CONGESTION";
-	case AST_CAUSE_NO_ROUTE_DESTINATION:
-	case AST_CAUSE_UNREGISTERED:
-		return "CHANUNAVAIL";
-	case AST_CAUSE_NO_ANSWER:
-	default:
-		return "NOANSWER";
-	}
-}
 
 static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
 {
@@ -1266,7 +1257,7 @@
 #ifdef HAVE_EPOLL
 				ast_poll_channel_del(in, c);
 #endif
-				ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+				ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 				ast_hangup(c);
 				c = o->chan = NULL;
 				ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1334,7 +1325,7 @@
 				case AST_CONTROL_BUSY:
 					ast_verb(3, "%s is busy\n", ast_channel_name(c));
 					ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
-					ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+					ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 					ast_hangup(c);
 					c = o->chan = NULL;
 					ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1343,7 +1334,7 @@
 				case AST_CONTROL_CONGESTION:
 					ast_verb(3, "%s is circuit-busy\n", ast_channel_name(c));
 					ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
-					ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+					ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 					ast_hangup(c);
 					c = o->chan = NULL;
 					ast_clear_flag64(o, DIAL_STILLGOING);

Modified: team/mmichelson/more_transfer/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_dumpchan.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/apps/app_dumpchan.c (original)
+++ team/mmichelson/more_transfer/apps/app_dumpchan.c Thu May 23 13:14:22 2013
@@ -41,6 +41,7 @@
 #include "asterisk/channel.h"
 #include "asterisk/app.h"
 #include "asterisk/translate.h"
+#include "asterisk/bridging.h"
 
 /*** DOCUMENTATION
 	<application name="DumpChan" language="en_US">
@@ -77,6 +78,7 @@
 	char pgrp[256];
 	struct ast_str *write_transpath = ast_str_alloca(256);
 	struct ast_str *read_transpath = ast_str_alloca(256);
+	struct ast_bridge *bridge;
 
 	now = ast_tvnow();
 	memset(buf, 0, size);
@@ -90,6 +92,9 @@
 		sec = elapsed_seconds % 60;
 	}
 
+	ast_channel_lock(c);
+	bridge = ast_channel_get_bridge(c);
+	ast_channel_unlock(c);
 	snprintf(buf,size,
 		"Name=               %s\n"
 		"Type=               %s\n"
@@ -117,8 +122,7 @@
 		"Framesout=          %d %s\n"
 		"TimetoHangup=       %ld\n"
 		"ElapsedTime=        %dh%dm%ds\n"
-		"DirectBridge=       %s\n"
-		"IndirectBridge=     %s\n"
+		"BridgeID=           %s\n"
 		"Context=            %s\n"
 		"Extension=          %s\n"
 		"Priority=           %d\n"
@@ -158,8 +162,7 @@
 		hour,
 		min,
 		sec,
-		ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>",
-		ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", 
+		bridge ? bridge->uniqueid : "(Not bridged)",
 		ast_channel_context(c),
 		ast_channel_exten(c),
 		ast_channel_priority(c),
@@ -169,6 +172,7 @@
 		ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)",
 		(ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
 
+	ao2_cleanup(bridge);
 	return 0;
 }
 

Modified: team/mmichelson/more_transfer/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_followme.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/apps/app_followme.c (original)
+++ team/mmichelson/more_transfer/apps/app_followme.c Thu May 23 13:14:22 2013
@@ -63,6 +63,7 @@
 #include "asterisk/astdb.h"
 #include "asterisk/dsp.h"
 #include "asterisk/app.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="FollowMe" language="en_US">
@@ -556,6 +557,17 @@
 	return 1;
 }
 
+static void publish_dial_end_event(struct ast_channel *in, struct findme_user_listptr *findme_user_list, struct ast_channel *exception, const char *status)
+{
+	struct findme_user *tmpuser;
+
+	AST_LIST_TRAVERSE(findme_user_list, tmpuser, entry) {
+		if (tmpuser->ochan && tmpuser->ochan != exception) {
+			ast_channel_publish_dial(in, tmpuser->ochan, NULL, status);
+		}
+	}
+}
+
 static void clear_caller(struct findme_user *tmpuser)
 {
 	struct ast_channel *outbound;
@@ -777,6 +789,7 @@
 						}
 						if (!tmpuser) {
 							ast_verb(3, "The calling channel hungup. Need to drop everyone.\n");
+							publish_dial_end_event(caller, findme_user_list, NULL, "CANCEL");
 							ast_frfree(f);
 							return NULL;
 						}
@@ -788,6 +801,8 @@
 							break;
 						}
 						ast_verb(3, "%s answered %s\n", ast_channel_name(winner), ast_channel_name(caller));
+						ast_channel_publish_dial(caller, winner, NULL, "ANSWER");
+						publish_dial_end_event(caller, findme_user_list, winner, "CANCEL");
 						tmpuser->answered = 1;
 						/* If call has been answered, then the eventual hangup is likely to be normal hangup */ 
 						ast_channel_hangupcause_set(winner, AST_CAUSE_NORMAL_CLEARING);
@@ -815,6 +830,7 @@
 						ast_verb(3, "%s is busy\n", ast_channel_name(winner));
 						if (tmpuser) {
 							/* Outbound call was busy.  Drop it. */
+							ast_channel_publish_dial(caller, winner, NULL, "BUSY");
 							clear_caller(tmpuser);
 						}
 						break;
@@ -822,6 +838,7 @@
 						ast_verb(3, "%s is circuit-busy\n", ast_channel_name(winner));
 						if (tmpuser) {
 							/* Outbound call was congested.  Drop it. */
+							ast_channel_publish_dial(caller, winner, NULL, "CONGESTION");
 							clear_caller(tmpuser);
 						}
 						break;
@@ -970,6 +987,7 @@
 					return NULL;
 				}
 				/* Outgoing channel hung up. */
+				ast_channel_publish_dial(caller, winner, NULL, "NOANSWER");
 				clear_caller(tmpuser);
 			}
 		} else {
@@ -1141,7 +1159,10 @@
 				}
 				ast_channel_unlock(tmpuser->ochan);
 				destroy_calling_node(tmpuser);
-			}
+				continue;
+			}
+
+			ast_channel_publish_dial(caller, tmpuser->ochan, tmpuser->dialarg, NULL);
 		}
 		AST_LIST_TRAVERSE_SAFE_END;
 

Modified: team/mmichelson/more_transfer/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_queue.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/apps/app_queue.c (original)
+++ team/mmichelson/more_transfer/apps/app_queue.c Thu May 23 13:14:22 2013
@@ -106,6 +106,8 @@
 #include "asterisk/cel.h"
 #include "asterisk/data.h"
 #include "asterisk/term.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
 #include "asterisk/bridging.h"
 
 /* Define, to debug reference counts on queues, without debugging reference counts on queue members */
@@ -1317,7 +1319,9 @@
 static struct member *interface_exists(struct call_queue *q, const char *interface);
 static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused);
 
+#if 0	// BUGBUG
 static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
+#endif	// BUGBUG
 
 static struct member *find_member_by_queuename_and_interface(const char *queuename, const char *interface);
 /*! \brief sets the QUEUESTATUS channel variable */
@@ -3328,8 +3332,19 @@
 	ast_free(doomed);
 }
 
+static void publish_dial_end_event(struct ast_channel *in, struct callattempt *outgoing, struct ast_channel *exception, const char *status)
+{
+	struct callattempt *cur;
+
+	for (cur = outgoing; cur; cur = cur->q_next) {
+                if (cur->chan && cur->chan != exception) {
+			ast_channel_publish_dial(in, cur->chan, NULL, status);
+                }
+        }
+}
+
 /*! \brief Hang up a list of outgoing calls */
-static void hangupcalls(struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
+static void hangupcalls(struct queue_ent *qe, struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
 {
 	struct callattempt *oo;
 
@@ -3340,6 +3355,7 @@
 			if (exception || cancel_answered_elsewhere) {
 				ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
 			}
+			ast_channel_publish_dial(qe->chan, outgoing->chan, outgoing->interface, "CANCEL");
 			ast_hangup(outgoing->chan);
 		}
 		oo = outgoing;
@@ -3710,10 +3726,10 @@
 		return 0;
 	}
 
+	ast_channel_lock_both(tmp->chan, qe->chan);
+
 	if (qe->parent->eventwhencalled) {
 		char vars[2048];
-
-		ast_channel_lock_both(tmp->chan, qe->chan);
 
 		/*** DOCUMENTATION
 		<managerEventInstance>
@@ -3759,12 +3775,14 @@
 			S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"),
 			ast_channel_context(qe->chan), ast_channel_exten(qe->chan), ast_channel_priority(qe->chan), ast_channel_uniqueid(qe->chan),
 			qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
-
-		ast_channel_unlock(tmp->chan);
-		ast_channel_unlock(qe->chan);
-
-		ast_verb(3, "Called %s\n", tmp->interface);
-	}
+	}
+
+	ast_channel_publish_dial(qe->chan, tmp->chan, tmp->interface, NULL);
+
+	ast_channel_unlock(tmp->chan);
+	ast_channel_unlock(qe->chan);
+
+	ast_verb(3, "Called %s\n", tmp->interface);
 
 	member_call_pending_clear(tmp->member);
 	return 1;
@@ -4332,6 +4350,15 @@
 							numnochan++;
 						}
 					}
+					ast_channel_lock_both(qe->chan, o->chan);
+					ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL);
+					ast_channel_unlock(o->chan);
+					ast_channel_unlock(qe->chan);
+
+					ast_channel_lock_both(qe->chan, original);
+					ast_channel_publish_dial(qe->chan, original, NULL, "CANCEL");
+					ast_channel_unlock(original);
+					ast_channel_unlock(qe->chan);
 					/* Hangup the original channel now, in case we needed it */
 					ast_hangup(winner);
 					continue;
@@ -4344,6 +4371,8 @@
 							/* This is our guy if someone answered. */
 							if (!peer) {
 								ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
+								ast_channel_publish_dial(qe->chan, o->chan, on, "ANSWER");
+								publish_dial_end_event(qe->chan, outgoing, o->chan, "CANCEL");
 								if (!o->block_connected_update) {
 									if (o->pending_connected_update) {
 										if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
@@ -4378,6 +4407,7 @@
 							if (ast_channel_cdr(in)) {
 								ast_cdr_busy(ast_channel_cdr(in));
 							}
+							ast_channel_publish_dial(qe->chan, o->chan, on, "BUSY");
 							do_hang(o);
 							endtime = (long) time(NULL);
 							endtime -= starttime;
@@ -4399,6 +4429,7 @@
 							if (ast_channel_cdr(in)) {
 								ast_cdr_failed(ast_channel_cdr(in));
 							}
+							ast_channel_publish_dial(qe->chan, o->chan, on, "CONGESTION");
 							endtime = (long) time(NULL);
 							endtime -= starttime;
 							rna(endtime * 1000, qe, on, membername, qe->parent->autopauseunavail);
@@ -4496,6 +4527,7 @@
 					ast_frfree(f);
 				} else { /* ast_read() returned NULL */
 					endtime = (long) time(NULL) - starttime;
+					ast_channel_publish_dial(qe->chan, o->chan, on, "NOANSWER");
 					rna(endtime * 1000, qe, on, membername, 1);
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
@@ -4517,6 +4549,7 @@
 			if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
 				/* Got hung up */
 				*to = -1;
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				if (f) {
 					if (f->data.uint32) {
 						ast_channel_hangupcause_set(in, f->data.uint32);
@@ -4529,6 +4562,7 @@
 			if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
 				ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
 				*to = 0;
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				ast_frfree(f);
 				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
 					ast_cdr_noanswer(ast_channel_cdr(in));
@@ -4538,6 +4572,7 @@
 			if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
 				ast_verb(3, "User pressed digit: %c\n", f->subclass.integer);
 				*to = 0;
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				*digit = f->subclass.integer;
 				ast_frfree(f);
 				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
@@ -4598,6 +4633,7 @@
 			rna(orig, qe, o->interface, o->member->membername, 1);
 		}
 
+		publish_dial_end_event(qe->chan, outgoing, NULL, "NOANSWER");
 		if (ast_channel_cdr(in)
 			&& ast_channel_state(in) != AST_STATE_UP
 			&& (!*to || ast_check_hangup(in))) {
@@ -4781,6 +4817,7 @@
 	return res;
 }
 
+#if 0	// BUGBUG
 /*!
  * \brief update the queue status
  * \retval Always 0
@@ -4825,6 +4862,7 @@
 	ao2_unlock(q);
 	return 0;
 }
+#endif	// BUGBUG
 
 /*! \brief Calculate the metric of each member in the outgoing callattempts
  *
@@ -4979,19 +5017,24 @@
 }
 #endif	// BUGBUG
 
+#if 0	// BUGBUG
 struct queue_transfer_ds {
 	struct queue_ent *qe;
 	struct member *member;
 	time_t starttime;
 	int callcompletedinsl;
 };
-
+#endif	// BUGBUG
+
+#if 0	// BUGBUG
 static void queue_transfer_destroy(void *data)
 {
 	struct queue_transfer_ds *qtds = data;
 	ast_free(qtds);
 }
-
+#endif	// BUGBUG
+
+#if 0	// BUGBUG
 /*! \brief a datastore used to help correctly log attended transfers of queue callers
  */
 static const struct ast_datastore_info queue_transfer_info = {
@@ -4999,7 +5042,9 @@
 	.chan_fixup = queue_transfer_fixup,
 	.destroy = queue_transfer_destroy,
 };
-
+#endif	// BUGBUG
+
+#if 0	// BUGBUG
 /*! \brief Log an attended transfer when a queue caller channel is masqueraded
  *
  * When a caller is masqueraded, we want to log a transfer. Fixup time is the closest we can come to when
@@ -5031,6 +5076,7 @@
 		ast_log(LOG_WARNING, "Can't find the queue_transfer datastore.\n");
 	}
 }
+#endif	// BUGBUG
 
 #if 0	// BUGBUG
 /*! \brief mechanism to tell if a queue caller was atxferred by a queue member.
@@ -5047,6 +5093,7 @@
 }
 #endif	// BUGBUG
 
+#if 0	// BUGBUG
 /*! \brief create a datastore for storing relevant info to log attended transfers in the queue_log
  */
 static struct ast_datastore *setup_transfer_datastore(struct queue_ent *qe, struct member *member, time_t starttime, int callcompletedinsl)
@@ -5077,6 +5124,7 @@
 	ast_channel_unlock(qe->chan);
 	return ds;
 }
+#endif	// BUGBUG
 
 struct queue_end_bridge {
 	struct call_queue *q;
@@ -5181,7 +5229,9 @@
 	int x=0;
 	char *announce = NULL;
 	char digit = 0;
+#if 0	// BUGBUG
 	time_t callstart;
+#endif	// BUGBUG
 	time_t now = time(NULL);
 	struct ast_bridge_config bridge_config;
 	char nondataquality = 1;
@@ -5199,9 +5249,14 @@
 	char vars[2048];
 	int forwardsallowed = 1;
 	int block_connected_line = 0;
+#if 0	// BUGBUG
 	int callcompletedinsl;
+#endif	// BUGBUG
 	struct ao2_iterator memi;
-	struct ast_datastore *datastore, *transfer_ds;
+	struct ast_datastore *datastore;
+#if 0	// BUGBUG
+	struct ast_datastore *transfer_ds;
+#endif	// BUGBUG
 	struct queue_end_bridge *queue_end_bridge = NULL;
 
 	ast_channel_lock(qe->chan);
@@ -5481,12 +5536,14 @@
 		time(&now);
 		recalc_holdtime(qe, (now - qe->start));
 		ao2_lock(qe->parent);
+#if 0	// BUGBUG
 		callcompletedinsl = ((now - qe->start) <= qe->parent->servicelevel);
+#endif	// BUGBUG
 		ao2_unlock(qe->parent);
 		member = lpeer->member;
 		/* Increment the refcount for this member, since we're going to be using it for awhile in here. */
 		ao2_ref(member, 1);
-		hangupcalls(outgoing, peer, qe->cancel_answered_elsewhere);
+		hangupcalls(qe, outgoing, peer, qe->cancel_answered_elsewhere);
 		outgoing = NULL;
 		if (announce || qe->parent->reportholdtime || qe->parent->memberdelay) {
 			int res2;
@@ -5529,7 +5586,7 @@
 				/* Agent must have hung up */
 				ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", ast_channel_name(peer));
 				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "AGENTDUMP", "%s", "");
-				if (qe->parent->eventwhencalled)
+				if (qe->parent->eventwhencalled) {
 					/*** DOCUMENTATION
 					<managerEventInstance>
 						<synopsis>Raised when an agent hangs up on a member in the queue.</synopsis>
@@ -5554,6 +5611,8 @@
 							"%s",
 							queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
 							qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+				}
+				ast_channel_publish_dial(qe->chan, peer, member->interface, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(peer)));
 				ast_autoservice_chan_hangup_peer(qe->chan, peer);
 				ao2_ref(member, -1);
 				goto out;
@@ -5562,6 +5621,7 @@
 				ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", ast_channel_name(peer));
 				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
 				record_abandoned(qe);
+				ast_channel_publish_dial(qe->chan, peer, member->interface, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(peer)));
 				ast_autoservice_chan_hangup_peer(qe->chan, peer);
 				ao2_ref(member, -1);
 				return -1;
@@ -5854,7 +5914,7 @@
 			}
 		}
 
-		if (qe->parent->eventwhencalled)
+		if (qe->parent->eventwhencalled) {
 			/*** DOCUMENTATION
 			<managerEventInstance>
 				<synopsis>Raised when an agent answers and is bridged to a member in the queue.</synopsis>
@@ -5886,6 +5946,8 @@
 					queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
 					(long) time(NULL) - qe->start, ast_channel_uniqueid(peer), (long)(orig - to > 0 ? (orig - to) / 1000 : 0),
 					qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+		}
+
 		ast_copy_string(oldcontext, ast_channel_context(qe->chan), sizeof(oldcontext));
 		ast_copy_string(oldexten, ast_channel_exten(qe->chan), sizeof(oldexten));
 	
@@ -5902,8 +5964,10 @@
 			queue_t_ref(qe->parent, "For bridge_config reference");
 		}
 
+#if 0	// BUGBUG
 		time(&callstart);
 		transfer_ds = setup_transfer_datastore(qe, member, callstart, callcompletedinsl);
+#endif	// BUGBUG
 		bridge = ast_bridge_call(qe->chan, peer, &bridge_config);
 
 /* BUGBUG need to do this queue logging a different way because we cannot reference peer anymore.  Likely needs to be made a subscriber of stasis transfer events. */
@@ -5942,17 +6006,17 @@
 			/* We already logged the TRANSFER on the queue_log, but we still need to send the AgentComplete event */
 			send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
 		}
-#endif	// BUGBUG
 
 		if (transfer_ds) {
 			ast_datastore_free(transfer_ds);
 		}
+#endif	// BUGBUG
 
 		res = bridge ? bridge : 1;
 		ao2_ref(member, -1);
 	}
 out:
-	hangupcalls(outgoing, NULL, qe->cancel_answered_elsewhere);
+	hangupcalls(qe, outgoing, NULL, qe->cancel_answered_elsewhere);
 
 	return res;
 }

Modified: team/mmichelson/more_transfer/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/confbridge/include/confbridge.h?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/apps/confbridge/include/confbridge.h (original)
+++ team/mmichelson/more_transfer/apps/confbridge/include/confbridge.h Thu May 23 13:14:22 2013
@@ -222,6 +222,8 @@
 	AST_LIST_HEAD_NOLOCK(, confbridge_user) waiting_list;             /*!< List of users waiting to join the conference bridge */
 };
 
+extern struct ao2_container *conference_bridges;
+
 struct post_join_action {
 	int (*func)(struct confbridge_user *user);
 	AST_LIST_ENTRY(post_join_action) list;
@@ -484,4 +486,41 @@
  * \brief unregister stasis message routers to handle manager events for confbridge messages
  */
 void manager_confbridge_shutdown(void);
+
+/*!
+ * \brief Get ConfBridge record channel technology struct.
+ * \since 12.0.0
+ *
+ * \return ConfBridge record channel technology.
+ */
+struct ast_channel_tech *conf_record_get_tech(void);
+
+/*!
+ * \brief Get ConfBridge announce channel technology struct.
+ * \since 12.0.0
+ *
+ * \return ConfBridge announce channel technology.
+ */
+struct ast_channel_tech *conf_announce_get_tech(void);
+
+/*!
+ * \brief Remove the announcer channel from the conference.
+ * \since 12.0.0
+ *
+ * \param chan Either channel in the announcer channel pair.
+ *
+ * \return Nothing
+ */
+void conf_announce_channel_depart(struct ast_channel *chan);
+
+/*!
+ * \brief Push the announcer channel into the conference.
+ * \since 12.0.0
+ *
+ * \param ast Either channel in the announcer channel pair.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int conf_announce_channel_push(struct ast_channel *ast);
 #endif

Modified: team/mmichelson/more_transfer/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_agent.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_agent.c (original)
+++ team/mmichelson/more_transfer/channels/chan_agent.c Thu May 23 13:14:22 2013
@@ -345,6 +345,7 @@
 static struct ast_channel* agent_get_base_channel(struct ast_channel *chan);
 static int agent_logoff(const char *agent, int soft);
 
+/* BUGBUG This channel driver is totally hosed until it is rewritten. */
 /*! \brief Channel interface description for PBX integration */
 static struct ast_channel_tech agent_tech = {
 	.type = "Agent",

Modified: team/mmichelson/more_transfer/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_dahdi.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_dahdi.c (original)
+++ team/mmichelson/more_transfer/channels/chan_dahdi.c Thu May 23 13:14:22 2013
@@ -1553,6 +1553,7 @@
 static int dahdi_devicestate(const char *data);
 static int dahdi_cc_callback(struct ast_channel *inbound, const char *dest, ast_cc_callback_fn callback);
 
+/* BUGBUG The DAHDI channel driver needs its own native bridge technology. */
 static struct ast_channel_tech dahdi_tech = {
 	.type = "DAHDI",
 	.description = tdesc,

Modified: team/mmichelson/more_transfer/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_iax2.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_iax2.c (original)
+++ team/mmichelson/more_transfer/channels/chan_iax2.c Thu May 23 13:14:22 2013
@@ -1259,6 +1259,7 @@
 static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
 static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
 
+/* BUGBUG The IAX2 channel driver needs its own native bridge technology. */
 static struct ast_channel_tech iax2_tech = {
 	.type = "IAX2",
 	.description = tdesc,

Modified: team/mmichelson/more_transfer/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_misdn.c?view=diff&rev=389566&r1=389565&r2=389566
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_misdn.c (original)
+++ team/mmichelson/more_transfer/channels/chan_misdn.c Thu May 23 13:14:22 2013
@@ -8091,6 +8091,7 @@
 	return 0;
 }
 

[... 708 lines stripped ...]



More information about the asterisk-commits mailing list