[asterisk-commits] mvanbaak: branch group/multiparking r114699 - in /team/group/multiparking: ./...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Apr 27 10:00:29 CDT 2008


Author: mvanbaak
Date: Sun Apr 27 10:00:26 2008
New Revision: 114699

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114699
Log:
merge, resolve conflicts, reset.
jpeeler, do you still need this branch ?

Removed:
    team/group/multiparking/apps/app_pickupchan.c
Modified:
    team/group/multiparking/   (props changed)
    team/group/multiparking/CHANGES
    team/group/multiparking/apps/app_alarmreceiver.c
    team/group/multiparking/apps/app_chanspy.c
    team/group/multiparking/apps/app_dial.c
    team/group/multiparking/apps/app_directed_pickup.c
    team/group/multiparking/apps/app_disa.c
    team/group/multiparking/apps/app_externalivr.c
    team/group/multiparking/apps/app_followme.c
    team/group/multiparking/apps/app_jack.c
    team/group/multiparking/apps/app_meetme.c
    team/group/multiparking/apps/app_minivm.c
    team/group/multiparking/apps/app_parkandannounce.c
    team/group/multiparking/apps/app_playback.c
    team/group/multiparking/apps/app_queue.c
    team/group/multiparking/apps/app_rpt.c
    team/group/multiparking/apps/app_sms.c
    team/group/multiparking/apps/app_speech_utils.c
    team/group/multiparking/apps/app_voicemail.c
    team/group/multiparking/apps/app_waitforring.c
    team/group/multiparking/apps/app_zapscan.c
    team/group/multiparking/channels/chan_alsa.c
    team/group/multiparking/channels/chan_console.c
    team/group/multiparking/channels/chan_gtalk.c
    team/group/multiparking/channels/chan_h323.c
    team/group/multiparking/channels/chan_iax2.c
    team/group/multiparking/channels/chan_jingle.c
    team/group/multiparking/channels/chan_local.c
    team/group/multiparking/channels/chan_mgcp.c
    team/group/multiparking/channels/chan_misdn.c
    team/group/multiparking/channels/chan_oss.c
    team/group/multiparking/channels/chan_sip.c
    team/group/multiparking/channels/chan_skinny.c
    team/group/multiparking/channels/chan_unistim.c
    team/group/multiparking/channels/chan_zap.c
    team/group/multiparking/configs/sip_notify.conf.sample
    team/group/multiparking/configure
    team/group/multiparking/configure.ac
    team/group/multiparking/contrib/scripts/vmail.cgi
    team/group/multiparking/include/asterisk/astobj.h
    team/group/multiparking/include/asterisk/channel.h
    team/group/multiparking/include/asterisk/logger.h
    team/group/multiparking/include/asterisk/manager.h
    team/group/multiparking/include/asterisk/pbx.h
    team/group/multiparking/main/app.c
    team/group/multiparking/main/channel.c
    team/group/multiparking/main/features.c
    team/group/multiparking/main/http.c
    team/group/multiparking/main/manager.c
    team/group/multiparking/main/pbx.c
    team/group/multiparking/main/utils.c
    team/group/multiparking/pbx/pbx_lua.c
    team/group/multiparking/res/res_musiconhold.c

Propchange: team/group/multiparking/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/multiparking/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/multiparking/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Apr 27 10:00:26 2008
@@ -1,1 +1,1 @@
-/trunk:1-114464
+/trunk:1-114698

Modified: team/group/multiparking/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/CHANGES?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/CHANGES (original)
+++ team/group/multiparking/CHANGES Sun Apr 27 10:00:26 2008
@@ -6,6 +6,7 @@
 ------------------
  * Added a new dialplan function, AST_CONFIG(), which allows you to access
    variables from an Asterisk configuration file.
+ * The JACK_HOOK function now has a c() option to supply a custom client name.
 
 Zaptel channel driver (chan_zap) Changes
 ----------------------------------------
@@ -31,6 +32,10 @@
    continue in the dialplan, at the specified label, if the caller hangs up.
  * ChanSpy and ExtenSpy have a new option, 's' which suppresses speaking the
    technology name (e.g. SIP, IAX, etc) of the channel being spied on.
+ * The Jack application now has a c() option to supply a custom client name.
+ * Chanspy has a new option, 'B', which can be used to "barge" on a call. This is
+   like the pre-existing whisper mode, except that the spy can also talk to the
+   participant on the bridged channel as well.
 
 SIP Changes
 -----------

Modified: team/group/multiparking/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_alarmreceiver.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_alarmreceiver.c (original)
+++ team/group/multiparking/apps/app_alarmreceiver.c Sun Apr 27 10:00:26 2008
@@ -252,6 +252,9 @@
 
 		/* If they hung up, leave */
 		if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+			if (f->seqno) {
+				chan->hangupcause = f->seqno;
+			}
 			ast_frfree(f);
 			res = -1;
 			break;

Modified: team/group/multiparking/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_chanspy.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_chanspy.c (original)
+++ team/group/multiparking/apps/app_chanspy.c Sun Apr 27 10:00:26 2008
@@ -148,6 +148,7 @@
 	OPTION_EXIT      = (1 << 8),    /* Exit to a valid single digit extension */
 	OPTION_ENFORCED  = (1 << 9),    /* Enforced mode */
 	OPTION_NOTECH    = (1 << 10),   /* Skip technology name playback */
+	OPTION_BARGE     = (1 << 11),   /* Barge mode (whisper to both channels) */
 } chanspy_opt_flags;
 
 enum {
@@ -161,6 +162,7 @@
 AST_APP_OPTIONS(spy_opts, {
 	AST_APP_OPTION('q', OPTION_QUIET),
 	AST_APP_OPTION('b', OPTION_BRIDGED),
+	AST_APP_OPTION('B', OPTION_BARGE),
 	AST_APP_OPTION('w', OPTION_WHISPER),
 	AST_APP_OPTION('W', OPTION_PRIVATE),
 	AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
@@ -177,6 +179,7 @@
 	/* spy data */
 	struct ast_audiohook spy_audiohook;
 	struct ast_audiohook whisper_audiohook;
+	struct ast_audiohook bridge_whisper_audiohook;
 	int fd;
 	int volfactor;
 };
@@ -230,7 +233,7 @@
 	.generate = spy_generate,
 };
 
-static int start_spying(struct ast_channel *chan, const char *spychan_name, struct ast_audiohook *audiohook) 
+static int start_spying(struct ast_channel *chan, const char *spychan_name, struct ast_audiohook *audiohook)
 {
 	int res = 0;
 	struct ast_channel *peer = NULL;
@@ -239,12 +242,9 @@
 
 	res = ast_audiohook_attach(chan, audiohook);
 
-	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
-		ast_channel_unlock(chan);
+	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) { 
 		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
-	} else
-		ast_channel_unlock(chan);
-
+	}
 	return res;
 }
 
@@ -293,16 +293,23 @@
 
 	ast_audiohook_init(&csth.spy_audiohook, AST_AUDIOHOOK_TYPE_SPY, "ChanSpy");
 
-	if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) { /* Unlocks spyee */
+	if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) {
 		ast_audiohook_destroy(&csth.spy_audiohook);
+		ast_channel_unlock(spyee);
 		return 0;
 	}
 
-	if (ast_test_flag(flags, OPTION_WHISPER)) {
+	if (ast_test_flag(flags, OPTION_BARGE)) {
+  		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
+		ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy");
+  		start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
+		start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook);
+	} else if (ast_test_flag(flags, OPTION_WHISPER)) {
 		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
 		start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
-	}
-
+  	}
+
+	ast_channel_unlock(spyee);
 	spyee = NULL;
 
 	csth.volfactor = *volfactor;
@@ -339,7 +346,16 @@
 			break;
 		}
 
-		if (ast_test_flag(flags, OPTION_WHISPER) && f->frametype == AST_FRAME_VOICE) {
+		if (ast_test_flag(flags, OPTION_BARGE) && f->frametype == AST_FRAME_VOICE) {
+			ast_audiohook_lock(&csth.whisper_audiohook);
+			ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+			ast_audiohook_write_frame(&csth.whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
+			ast_audiohook_write_frame(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
+			ast_audiohook_unlock(&csth.whisper_audiohook);
+			ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+			ast_frfree(f);
+			continue;
+		} else if (ast_test_flag(flags, OPTION_WHISPER) && f->frametype == AST_FRAME_VOICE) {
 			ast_audiohook_lock(&csth.whisper_audiohook);
 			ast_audiohook_write_frame(&csth.whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
 			ast_audiohook_unlock(&csth.whisper_audiohook);
@@ -401,7 +417,16 @@
 	else
 		ast_deactivate_generator(chan);
 
-	if (ast_test_flag(flags, OPTION_WHISPER)) {
+	if (ast_test_flag(flags, OPTION_BARGE)) {
+		ast_audiohook_lock(&csth.whisper_audiohook);
+		ast_audiohook_detach(&csth.whisper_audiohook);
+		ast_audiohook_unlock(&csth.whisper_audiohook);
+		ast_audiohook_destroy(&csth.whisper_audiohook);
+		ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+		ast_audiohook_detach(&csth.bridge_whisper_audiohook);
+		ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+		ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
+	} else if (ast_test_flag(flags, OPTION_WHISPER)) {
 		ast_audiohook_lock(&csth.whisper_audiohook);
 		ast_audiohook_detach(&csth.whisper_audiohook);
 		ast_audiohook_unlock(&csth.whisper_audiohook);
@@ -705,12 +730,11 @@
 
 			for (s = peer_name; s < ptr; s++)
 				*s = tolower(*s);
-		
 			/* We have to unlock the peer channel here to avoid a deadlock.
-			 * So, when we need it again, we have to lock the datastore and get
-			 * the pointer from there to see if the channel is still valid. */
+			 * So, when we need to dereference it again, we have to lock the 
+			 * datastore and get the pointer from there to see if the channel 
+			 * is still valid. */
 			ast_channel_unlock(peer);
-			peer = NULL;
 
 			if (!ast_test_flag(flags, OPTION_QUIET)) {
 				if (!ast_test_flag(flags, OPTION_NOTECH)) {
@@ -731,7 +755,6 @@
 					ast_say_digits(chan, atoi(ptr), "", chan->language);
 			}
 
-			waitms = 5000;
 			res = channel_spy(chan, peer_chanspy_ds, &volfactor, fd, flags, exitcontext);
 			num_spyed_upon++;	
 

Modified: team/group/multiparking/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_dial.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_dial.c (original)
+++ team/group/multiparking/apps/app_dial.c Sun Apr 27 10:00:26 2008
@@ -26,7 +26,7 @@
  */
 
 /*** MODULEINFO
-        <depend>chan_local</depend>
+	<depend>chan_local</depend>
  ***/
 
 
@@ -788,8 +788,11 @@
 				*to = -1;
 				strcpy(pa->status, "CANCEL");
 				ast_cdr_noanswer(in->cdr);
-				if (f)
+				if (f) {
+					if (f->seqno)
+						in->hangupcause = f->seqno;
 					ast_frfree(f);
+				}
 				return NULL;
 			}
 
@@ -1931,9 +1934,9 @@
 		}
 		if (res != AST_PBX_NO_HANGUP_PEER) {
 			if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {		
-                        	replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
-                        	ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
-	                        ast_pbx_start(peer);
+				replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
+				ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+				ast_pbx_start(peer);
 			} else {
 				if (!ast_check_hangup(chan))
 					chan->hangupcause = peer->hangupcause;

Modified: team/group/multiparking/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_directed_pickup.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_directed_pickup.c (original)
+++ team/group/multiparking/apps/app_directed_pickup.c Sun Apr 27 10:00:26 2008
@@ -4,6 +4,9 @@
  * Copyright (C) 2005, Joshua Colp
  *
  * Joshua Colp <jcolp at digium.com>
+ *
+ * Portions merged from app_pickupchan, which was
+ * Copyright (C) 2008, Gary Cook
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -21,6 +24,7 @@
  * \brief Directed Call Pickup Support
  *
  * \author Joshua Colp <jcolp at digium.com>
+ * \author Gary Cook
  *
  * \ingroup applications
  */
@@ -51,6 +55,13 @@
 "When no parameter is specified, the application will pickup a channel matching\n"
 "the pickup group of the active channel.";
 
+static const char *app2 = "PickupChan";
+static const char *synopsis2 = "Pickup a ringing channel";
+static const char *descrip2 =
+"  PickupChan(channel[&channel...]): This application can pickup any ringing channel\n";
+
+/*! \todo This application should return a result code, like PICKUPRESULT */
+
 /* Perform actual pickup between two channels */
 static int pickup_do(struct ast_channel *chan, struct ast_channel *target)
 {
@@ -83,6 +94,47 @@
 		return 1;
 	else
 		return 0;
+}
+
+/*! \brief Helper Function to walk through ALL channels checking NAME and STATE */
+static struct ast_channel *my_ast_get_channel_by_name_locked(char *channame)
+{
+	struct ast_channel *chan;
+	char *chkchan = alloca(strlen(channame) + 2);
+
+	/* need to append a '-' for the comparison so we check full channel name,
+	 * i.e SIP/hgc- , use a temporary variable so original stays the same for
+	 * debugging.
+	 */
+	strcpy(chkchan, channame);
+	strcat(chkchan, "-");
+
+	for (chan = ast_walk_channel_by_name_prefix_locked(NULL, channame, strlen(channame));
+		 chan;
+		 chan = ast_walk_channel_by_name_prefix_locked(chan, channame, strlen(channame))) {
+		if (!strncasecmp(chan->name, chkchan, strlen(chkchan)) && can_pickup(chan))
+			return chan;
+		ast_channel_unlock(chan);
+	}
+	return NULL;
+}
+
+/*! \brief Attempt to pick up specified channel named , does not use context */
+static int pickup_by_channel(struct ast_channel *chan, char *pickup)
+{
+	int res = 0;
+	struct ast_channel *target;
+
+	if (!(target = my_ast_get_channel_by_name_locked(pickup)))
+		return -1;
+
+	/* Just check that we are not picking up the SAME as target */
+	if (chan->name != target->name && chan != target) {
+		res = pickup_do(chan, target);
+		ast_channel_unlock(target);
+	}
+
+	return res;
 }
 
 /* Attempt to pick up specified extension with context */
@@ -126,7 +178,7 @@
 	return res;
 }
 
-/* Main application entry point */
+/* application entry point for Pickup() */
 static int pickup_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
@@ -155,18 +207,51 @@
 	return res;
 }
 
+/* application entry point for PickupChan() */
+static int pickupchan_exec(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	char *tmp = ast_strdupa(data);
+	char *pickup = NULL;
+
+	if (ast_strlen_zero(data)) {
+		ast_log(LOG_WARNING, "PickupChan requires an argument (channel)!\n");
+		return -1;	
+	}
+
+	/* Parse channel */
+	while (!ast_strlen_zero(tmp) && (pickup = strsep(&tmp, "&"))) {
+		if (!strncasecmp(chan->name, pickup, strlen(pickup))) {
+			ast_log(LOG_NOTICE, "Cannot pickup your own channel %s.\n", pickup);
+		} else {
+			if (!pickup_by_channel(chan, pickup)) {
+				break;
+			}
+			ast_log(LOG_NOTICE, "No target channel found for %s.\n", pickup);
+		}
+	}
+
+	return res;
+}
+
 static int unload_module(void)
 {
 	int res;
 
 	res = ast_unregister_application(app);
+	res |= ast_unregister_application(app2);
 
 	return res;
 }
 
 static int load_module(void)
 {
-	return ast_register_application(app, pickup_exec, synopsis, descrip);
+	int res;
+
+	res = ast_register_application(app, pickup_exec, synopsis, descrip);
+	res |= ast_register_application(app2, pickupchan_exec, synopsis2, descrip2);
+
+	return res;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Directed Call Pickup Application");

Modified: team/group/multiparking/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_disa.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_disa.c (original)
+++ team/group/multiparking/apps/app_disa.c Sun Apr 27 10:00:26 2008
@@ -195,6 +195,8 @@
 		}
 
 		if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+			if (f->seqno)
+				chan->hangupcause = f->seqno;
 			ast_frfree(f);
 			ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
 			return -1;

Modified: team/group/multiparking/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_externalivr.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_externalivr.c (original)
+++ team/group/multiparking/apps/app_externalivr.c Sun Apr 27 10:00:26 2008
@@ -87,8 +87,8 @@
 };
 
 static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, 
-              int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd, 
-              const char *args);
+	int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd, 
+	const char *args);
 
 int eivr_connect_socket(struct ast_channel *chan, const char *host, int port);
 
@@ -560,6 +560,9 @@
  			} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
  				ast_chan_log(LOG_NOTICE, chan, "Got AST_CONTROL_HANGUP\n");
  				send_eivr_event(eivr_events, 'H', NULL, chan);
+				if (f->seqno) {
+					chan->hangupcause = f->seqno;
+				}
  				ast_frfree(f);
  				res = -1;
  				break;

Modified: team/group/multiparking/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_followme.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_followme.c (original)
+++ team/group/multiparking/apps/app_followme.c Sun Apr 27 10:00:26 2008
@@ -29,7 +29,7 @@
  */
 
 /*** MODULEINFO
-        <depend>chan_local</depend>
+	<depend>chan_local</depend>
  ***/
 
 #include "asterisk.h"
@@ -607,6 +607,9 @@
 					switch(f->subclass) {
 					case AST_CONTROL_HANGUP:
 						ast_verb(3, "%s received a hangup frame.\n", winner->name);
+						if (f->seqno) {
+							winner->hangupcause = f->seqno;
+						}
 						if (dg == 0) {
 							ast_verb(3, "The calling channel hungup. Need to drop everyone else.\n");
 							clear_calling_tree(findme_user_list);

Modified: team/group/multiparking/apps/app_jack.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_jack.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_jack.c (original)
+++ team/group/multiparking/apps/app_jack.c Sun Apr 27 10:00:26 2008
@@ -65,7 +65,9 @@
 "    o(<name>) - Connect the input port that gets created to the specified\n" \
 "                jack output port.\n" \
 "    n         - Do not automatically start the JACK server if it is not already\n" \
-"                running.\n"
+"                running.\n" \
+"    c(<name>) - By default, Asterisk will use the channel name for the jack client\n" \
+"                name.  Use this option to specify a custom client name.\n"
 
 static char *jack_app = "JACK";
 static char *jack_synopsis = 
@@ -82,6 +84,7 @@
 struct jack_data {
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(server_name);
+		AST_STRING_FIELD(client_name);
 		AST_STRING_FIELD(connect_input_port);
 		AST_STRING_FIELD(connect_output_port);
 	);
@@ -350,13 +353,17 @@
 
 static int init_jack_data(struct ast_channel *chan, struct jack_data *jack_data)
 {
-	const char *chan_name;
+	const char *client_name;
 	jack_status_t status = 0;
 	jack_options_t jack_options = JackNullOption;
 
-	ast_channel_lock(chan);
-	chan_name = ast_strdupa(chan->name);
-	ast_channel_unlock(chan);
+	if (!ast_strlen_zero(jack_data->client_name)) {
+		client_name = jack_data->client_name;
+	} else {
+		ast_channel_lock(chan);
+		client_name = ast_strdupa(chan->name);
+		ast_channel_unlock(chan);
+	}
 
 	if (!(jack_data->output_rb = jack_ringbuffer_create(RINGBUFFER_SIZE)))
 		return -1;
@@ -369,10 +376,10 @@
 
 	if (!ast_strlen_zero(jack_data->server_name)) {
 		jack_options |= JackServerName;
-		jack_data->client = jack_client_open(chan_name, jack_options, &status,
+		jack_data->client = jack_client_open(client_name, jack_options, &status,
 			jack_data->server_name);
 	} else {
-		jack_data->client = jack_client_open(chan_name, jack_options, &status);
+		jack_data->client = jack_client_open(client_name, jack_options, &status);
 	}
 
 	if (status)
@@ -610,12 +617,15 @@
 	OPT_INPUT_PORT =     (1 << 1),
 	OPT_OUTPUT_PORT =    (1 << 2),
 	OPT_NOSTART_SERVER = (1 << 3),
+	OPT_CLIENT_NAME =    (1 << 4),
 };
 
 enum {
 	OPT_ARG_SERVER_NAME,
 	OPT_ARG_INPUT_PORT,
 	OPT_ARG_OUTPUT_PORT,
+	OPT_ARG_CLIENT_NAME,
+
 	/* Must be the last element */
 	OPT_ARG_ARRAY_SIZE,
 };
@@ -625,6 +635,7 @@
 	AST_APP_OPTION_ARG('i', OPT_INPUT_PORT, OPT_ARG_INPUT_PORT),
 	AST_APP_OPTION_ARG('o', OPT_OUTPUT_PORT, OPT_ARG_OUTPUT_PORT),
 	AST_APP_OPTION('n', OPT_NOSTART_SERVER),
+	AST_APP_OPTION_ARG('c', OPT_CLIENT_NAME, OPT_ARG_CLIENT_NAME),
 END_OPTIONS );
 
 static struct jack_data *jack_data_alloc(void)
@@ -660,6 +671,15 @@
 			ast_string_field_set(jack_data, server_name, option_args[OPT_ARG_SERVER_NAME]);
 		else {
 			ast_log(LOG_ERROR, "A server name must be provided with the s() option\n");
+			return -1;
+		}
+	}
+
+	if (ast_test_flag(&options, OPT_CLIENT_NAME)) {
+		if (!ast_strlen_zero(option_args[OPT_ARG_CLIENT_NAME]))
+			ast_string_field_set(jack_data, client_name, option_args[OPT_ARG_CLIENT_NAME]);
+		else {
+			ast_log(LOG_ERROR, "A client name must be provided with the c() option\n");
 			return -1;
 		}
 	}

Modified: team/group/multiparking/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_meetme.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_meetme.c (original)
+++ team/group/multiparking/apps/app_meetme.c Sun Apr 27 10:00:26 2008
@@ -2706,35 +2706,56 @@
 		char useropts[32] = "";
 		char adminopts[32] = "";
 		struct ast_tm tm, etm;
-		struct timeval starttime = { .tv_sec = 0 }, endtime = { .tv_sec = 0 };
+		struct timeval endtime = { .tv_sec = 0 };
 
 		if (rt_schedule) {
 			now = ast_tvnow();
 
-			if (fuzzystart)
-				now.tv_sec += fuzzystart;
-
 			ast_localtime(&now, &tm, NULL);
 			ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm);
 
-			if (earlyalert) {
+			ast_debug(1, "Looking for conference %s that starts after %s\n", confno, eatime);
+
+			var = ast_load_realtime("meetme", "confno",
+				confno, "starttime <= ", currenttime, "endtime >= ",
+				currenttime, NULL);
+
+			if (!var && fuzzystart) {
+				now = ast_tvnow();
+				now.tv_sec += fuzzystart;
+
+				ast_localtime(&now, &tm, NULL);
+				ast_strftime(currenttime, sizeof(currenttime), DATE_FORMAT, &tm);
+				var = ast_load_realtime("meetme", "confno",
+					confno, "starttime <= ", currenttime, "endtime >= ",
+					currenttime, NULL);
+			}
+
+			if (!var && earlyalert) {
+				now = ast_tvnow();
 				now.tv_sec += earlyalert;
 				ast_localtime(&now, &etm, NULL);
 				ast_strftime(eatime, sizeof(eatime), DATE_FORMAT, &etm);
-			} else {
-				ast_copy_string(eatime, currenttime, sizeof(eatime));
+				var = ast_load_realtime("meetme", "confno",
+					confno, "starttime <= ", eatime, "endtime >= ",
+					currenttime, NULL);
+				if (var)
+					*too_early = 1;
 			}
 
-			ast_debug(1, "Looking for conference %s that starts after %s\n", confno, eatime);
-
-			var = ast_load_realtime("meetme", "confno",
-				confno, "starttime <= ", eatime, "endtime >= ",
-				currenttime, NULL);
 		} else
 			 var = ast_load_realtime("meetme", "confno", confno, NULL);
 
 		if (!var)
 			return NULL;
+
+		if (rt_schedule && *too_early) {
+			/* Announce that the caller is early and exit */
+			if (!ast_streamfile(chan, "conf-has-not-started", chan->language))
+				ast_waitstream(chan, "");
+			ast_variables_destroy(var);
+			return NULL;
+		}
 
 		while (var) {
 			if (!strcasecmp(var->name, "pin")) {
@@ -2753,31 +2774,18 @@
 					struct tm tm;
 				} t = { { 0, }, };
 				strptime(var->value, "%Y-%m-%d %H:%M:%S", &t.tm);
+				/* strptime does not determine if a time is
+				 * in DST or not.  Set tm_isdst to -1 to 
+				 * allow ast_mktime to adjust for DST 
+				 * if needed */
+				t.tm.tm_isdst = -1; 
 				endtime = ast_mktime(&t.atm, NULL);
-			} else if (!strcasecmp(var->name, "starttime")) {
-				union {
-					struct ast_tm atm;
-					struct tm tm;
-				} t = { { 0, }, };
-				strptime(var->value, "%Y-%m-%d %H:%M:%S", &t.tm);
-				starttime = ast_mktime(&t.atm, NULL);
 			}
 
 			var = var->next;
 		}
+
 		ast_variables_destroy(var);
-
-		if (earlyalert) {
-			now = ast_tvnow();
-
-			if (now.tv_sec + fuzzystart < starttime.tv_sec) {
-				/* Announce that the caller is early and exit */
-				if (!ast_streamfile(chan, "conf-has-not-started", chan->language))
-					 ast_waitstream(chan, "");
-				*too_early = 1;
-				return NULL;
-			}
-		}
 
 		cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic, refcount, chan);
 

Modified: team/group/multiparking/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_minivm.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_minivm.c (original)
+++ team/group/multiparking/apps/app_minivm.c Sun Apr 27 10:00:26 2008
@@ -736,8 +736,9 @@
 		return;
 	}
 
-	for (var = vmu->chanvars ; var ; var = var->next)
-                pbx_builtin_setvar_helper(channel, var->name, var->value);
+	for (var = vmu->chanvars ; var ; var = var->next) {
+		pbx_builtin_setvar_helper(channel, var->name, var->value);
+	}
 
 	/* Prepare variables for substition in email body and subject */
 	pbx_builtin_setvar_helper(channel, "MVM_NAME", vmu->fullname);
@@ -2778,12 +2779,12 @@
 */
 static int vm_lock_path(const char *path)
 {
-        switch (ast_lock_path(path)) {
-        case AST_LOCK_TIMEOUT:
-                return -1;
-        default:
-                return 0;
-        }
+	switch (ast_lock_path(path)) {
+	case AST_LOCK_TIMEOUT:
+		return -1;
+	default:
+		return 0;
+	}
 }
 
 /*! \brief Access counter file, lock directory, read and possibly write it again changed 

Modified: team/group/multiparking/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_parkandannounce.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_parkandannounce.c (original)
+++ team/group/multiparking/apps/app_parkandannounce.c Sun Apr 27 10:00:26 2008
@@ -129,7 +129,7 @@
 			ast_verb(4, "Channel %s was answered.\n", dchan->name);
 		} else {
 			ast_verb(4, "Channel %s was never answered.\n", dchan->name);
-        			ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
+			ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
 			ast_hangup(dchan);
 			return -1;
 		}

Modified: team/group/multiparking/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_playback.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_playback.c (original)
+++ team/group/multiparking/apps/app_playback.c Sun Apr 27 10:00:26 2008
@@ -75,16 +75,16 @@
 	int i = 0;
 	say_api_buf[i++] = arg;
 
-        say_api_buf[i++] = ast_say_number_full;
-        say_api_buf[i++] = ast_say_enumeration_full;
-        say_api_buf[i++] = ast_say_digit_str_full;
-        say_api_buf[i++] = ast_say_character_str_full;
-        say_api_buf[i++] = ast_say_phonetic_str_full;
-        say_api_buf[i++] = ast_say_datetime;
-        say_api_buf[i++] = ast_say_time;
-        say_api_buf[i++] = ast_say_date;
-        say_api_buf[i++] = ast_say_datetime_from_now;
-        say_api_buf[i++] = ast_say_date_with_format;
+	say_api_buf[i++] = ast_say_number_full;
+	say_api_buf[i++] = ast_say_enumeration_full;
+	say_api_buf[i++] = ast_say_digit_str_full;
+	say_api_buf[i++] = ast_say_character_str_full;
+	say_api_buf[i++] = ast_say_phonetic_str_full;
+	say_api_buf[i++] = ast_say_datetime;
+	say_api_buf[i++] = ast_say_time;
+	say_api_buf[i++] = ast_say_date;
+	say_api_buf[i++] = ast_say_datetime_from_now;
+	say_api_buf[i++] = ast_say_date_with_format;
 }
 
 static void restore_say_mode(void *arg)
@@ -92,16 +92,16 @@
 	int i = 0;
 	say_api_buf[i++] = arg;
 
-        ast_say_number_full = say_api_buf[i++];
-        ast_say_enumeration_full = say_api_buf[i++];
-        ast_say_digit_str_full = say_api_buf[i++];
-        ast_say_character_str_full = say_api_buf[i++];
-        ast_say_phonetic_str_full = say_api_buf[i++];
-        ast_say_datetime = say_api_buf[i++];
-        ast_say_time = say_api_buf[i++];
-        ast_say_date = say_api_buf[i++];
-        ast_say_datetime_from_now = say_api_buf[i++];
-        ast_say_date_with_format = say_api_buf[i++];
+	ast_say_number_full = say_api_buf[i++];
+	ast_say_enumeration_full = say_api_buf[i++];
+	ast_say_digit_str_full = say_api_buf[i++];
+	ast_say_character_str_full = say_api_buf[i++];
+	ast_say_phonetic_str_full = say_api_buf[i++];
+	ast_say_datetime = say_api_buf[i++];
+	ast_say_time = say_api_buf[i++];
+	ast_say_date = say_api_buf[i++];
+	ast_say_datetime_from_now = say_api_buf[i++];
+	ast_say_date_with_format = say_api_buf[i++];
 }
 
 /* 
@@ -111,25 +111,25 @@
  * parameter.
  */
 typedef struct {
-        struct ast_channel *chan;
-        const char *ints;
-        const char *language;
-        int audiofd;
-        int ctrlfd;
+	struct ast_channel *chan;
+	const char *ints;
+	const char *language;
+	int audiofd;
+	int ctrlfd;
 } say_args_t;
 
 static int s_streamwait3(const say_args_t *a, const char *fn)
 {
-        int res = ast_streamfile(a->chan, fn, a->language);
-        if (res) {
-                ast_log(LOG_WARNING, "Unable to play message %s\n", fn);
-                return res;
-        }
-        res = (a->audiofd  > -1 && a->ctrlfd > -1) ?
-                ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) :
-                ast_waitstream(a->chan, a->ints);
-        ast_stopstream(a->chan);
-        return res;  
+	int res = ast_streamfile(a->chan, fn, a->language);
+	if (res) {
+		ast_log(LOG_WARNING, "Unable to play message %s\n", fn);
+		return res;
+	}
+	res = (a->audiofd  > -1 && a->ctrlfd > -1) ?
+	ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) :
+	ast_waitstream(a->chan, a->ints);
+	ast_stopstream(a->chan);
+	return res;  
 }
 
 /*
@@ -247,11 +247,11 @@
 }
 
 static int say_full(struct ast_channel *chan, const char *string,
-        const char *ints, const char *lang, const char *options,
-        int audiofd, int ctrlfd)
-{
-        say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
-        return do_say(&a, string, options, 0);
+	const char *ints, const char *lang, const char *options,
+	int audiofd, int ctrlfd)
+{
+	say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
+	return do_say(&a, string, options, 0);
 }
 
 static int say_number_full(struct ast_channel *chan, int num,
@@ -259,9 +259,9 @@
 	int audiofd, int ctrlfd)
 {
 	char buf[64];
-        say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
+	say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
 	snprintf(buf, sizeof(buf), "num:%d", num);
-        return do_say(&a, buf, options, 0);
+	return do_say(&a, buf, options, 0);
 }
 
 static int say_enumeration_full(struct ast_channel *chan, int num,
@@ -269,9 +269,9 @@
 	int audiofd, int ctrlfd)
 {
 	char buf[64];
-        say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
+	say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
 	snprintf(buf, sizeof(buf), "enum:%d", num);
-        return do_say(&a, buf, options, 0);
+	return do_say(&a, buf, options, 0);
 }
 
 static int say_date_generic(struct ast_channel *chan, time_t t,
@@ -280,7 +280,7 @@
 	char buf[128];
 	struct ast_tm tm;
 	struct timeval tv = { t, 0 };
-        say_args_t a = { chan, ints, lang, -1, -1 };
+	say_args_t a = { chan, ints, lang, -1, -1 };
 	if (format == NULL)
 		format = "";
 
@@ -296,7 +296,7 @@
 		tm.tm_sec,
 		tm.tm_wday,
 		tm.tm_yday);
-        return do_say(&a, buf, NULL, 0);
+	return do_say(&a, buf, NULL, 0);
 }
 
 static int say_date_with_format(struct ast_channel *chan, time_t t,
@@ -515,7 +515,7 @@
 		}
 	}
 
-        ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
 	return ast_register_application(app, playback_exec, synopsis, descrip);
 }
 

Modified: team/group/multiparking/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_queue.c?view=diff&rev=114699&r1=114698&r2=114699
==============================================================================
--- team/group/multiparking/apps/app_queue.c (original)
+++ team/group/multiparking/apps/app_queue.c Sun Apr 27 10:00:26 2008
@@ -57,7 +57,7 @@
  */
 
 /*** MODULEINFO
-        <depend>res_monitor</depend>
+	<depend>res_monitor</depend>
  ***/
 
 #include "asterisk.h"
@@ -135,7 +135,7 @@
 #define DEFAULT_TIMEOUT		15
 #define RECHECK			1		/*!< Recheck every second to see we we're at the top yet */
 #define MAX_PERIODIC_ANNOUNCEMENTS 10           /*!< The maximum periodic announcements we can have */
-#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15       /*!< The minimum number of seconds between position announcements
+#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15       /*!< The minimum number of seconds between position announcements \
                                                      The default value of 15 provides backwards compatibility */
 #define MAX_QUEUE_BUCKETS 53
 
@@ -581,18 +581,18 @@
 {
 	char interfacevar[256]="";
 	float sl = 0;
-        
+
 	if (qe->parent->setqueuevar) {
 		sl = 0;
 		if (qe->parent->callscompleted > 0) 
 			sl = 100 * ((float) qe->parent->callscompletedinsl / (float) qe->parent->callscompleted);
 
 		snprintf(interfacevar, sizeof(interfacevar),
-			"QUEUENAME=%s|QUEUEMAX=%d|QUEUESTRATEGY=%s|QUEUECALLS=%d|QUEUEHOLDTIME=%d|QUEUECOMPLETED=%d|QUEUEABANDONED=%d|QUEUESRVLEVEL=%d|QUEUESRVLEVELPERF=%2.1f",
+			"QUEUENAME=%s,QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
 			qe->parent->name, qe->parent->maxlen, int2strat(qe->parent->strategy), qe->parent->count, qe->parent->holdtime, qe->parent->callscompleted,
 			qe->parent->callsabandoned,  qe->parent->servicelevel, sl);
 	
-		pbx_builtin_setvar(qe->chan, interfacevar); 
+		pbx_builtin_setvar_multiple(qe->chan, interfacevar); 
 	}
 }
 
@@ -1904,10 +1904,11 @@
 
 	/* Don't restart music on hold if we're about to exit the caller from the queue */
 	if (!res) {
-                if (ringing)
-                        ast_indicate(qe->chan, AST_CONTROL_RINGING);
-                else
-                        ast_moh_start(qe->chan, qe->moh, NULL);
+		if (ringing) {
+			ast_indicate(qe->chan, AST_CONTROL_RINGING);
+		} else {
+			ast_moh_start(qe->chan, qe->moh, NULL);
+		}
 	}
 	return res;
 }
@@ -2077,10 +2078,10 @@
 				j += 9;
 			}
 		}
-		if (j > len - 1)
-			j = len - 1;
-		vars[j - 2] = '\r';
-		vars[j - 1] = '\n';
+		if (j > len - 3)
+			j = len - 3;
+		vars[j++] = '\r';
+		vars[j++] = '\n';
 		vars[j] = '\0';
 	} else {
 		/* there are no channel variables; leave it blank */
@@ -2644,6 +2645,8 @@
 				/* Got hung up */
 				*to = -1;
 				if (f) {
+					if (f->seqno)
+						in->hangupcause = f->seqno;
 					ast_frfree(f);
 				}
 				return NULL;
@@ -3111,12 +3114,12 @@
 		case 'H':
 			ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT);
 			break;
-                case 'k':
-                        ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL);
-                        break;
-                case 'K':
-                        ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
-                        break;
+		case 'k':
+			ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL);
+			break;
+		case 'K':
+			ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
+			break;
 		case 'n':
 			if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR)
 				(*tries)++;
@@ -3395,17 +3398,17 @@
 		/* if setinterfacevar is defined, make member variables available to the channel */
 		/* use  pbx_builtin_setvar to set a load of variables with one call */
 		if (qe->parent->setinterfacevar) {
-			snprintf(interfacevar, sizeof(interfacevar), "MEMBERINTERFACE=%s|MEMBERNAME=%s|MEMBERCALLS=%d|MEMBERLASTCALL=%ld|MEMBERPENALTY=%d|MEMBERDYNAMIC=%d|MEMBERREALTIME=%d",
+			snprintf(interfacevar, sizeof(interfacevar), "MEMBERINTERFACE=%s,MEMBERNAME=%s,MEMBERCALLS=%d,MEMBERLASTCALL=%ld,MEMBERPENALTY=%d,MEMBERDYNAMIC=%d,MEMBERREALTIME=%d",
 				member->interface, member->membername, member->calls, (long)member->lastcall, member->penalty, member->dynamic, member->realtime);
-		 	pbx_builtin_setvar(qe->chan, interfacevar);
+		 	pbx_builtin_setvar_multiple(qe->chan, interfacevar);
 		}
 		
 		/* if setqueueentryvar is defined, make queue entry (i.e. the caller) variables available to the channel */
 		/* use  pbx_builtin_setvar to set a load of variables with one call */
 		if (qe->parent->setqueueentryvar) {
-			snprintf(interfacevar, sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
+			snprintf(interfacevar, sizeof(interfacevar), "QEHOLDTIME=%ld,QEORIGINALPOS=%d",
 				(long) time(NULL) - qe->start, qe->opos);
-			pbx_builtin_setvar(qe->chan, interfacevar);
+			pbx_builtin_setvar_multiple(qe->chan, interfacevar);
 		}
 	
 		/* try to set queue variables if configured to do so*/
@@ -4641,8 +4644,8 @@
 		.name = data,	
 	};
 
-	char interfacevar[256]="";
-        float sl = 0;
+	char interfacevar[256] = "";
+	float sl = 0;
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
@@ -4651,24 +4654,26 @@
 
 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
 		ao2_lock(q);
-        	if (q->setqueuevar) {
-		        sl = 0;
+		if (q->setqueuevar) {
+			sl = 0;
 			res = 0;
 
-		        if (q->callscompleted > 0)
-		                sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
-
-		        snprintf(interfacevar, sizeof(interfacevar),

[... 5818 lines stripped ...]



More information about the asterisk-commits mailing list