[asterisk-commits] russell: branch russell/chan_console r74213 - in /team/russell/chan_console: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 9 16:34:29 CDT 2007


Author: russell
Date: Mon Jul  9 16:34:28 2007
New Revision: 74213

URL: http://svn.digium.com/view/asterisk?view=rev&rev=74213
Log:
enable automerge

Modified:
    team/russell/chan_console/   (props changed)
    team/russell/chan_console/apps/app_queue.c
    team/russell/chan_console/channels/chan_agent.c
    team/russell/chan_console/channels/chan_skinny.c
    team/russell/chan_console/channels/chan_zap.c
    team/russell/chan_console/configure
    team/russell/chan_console/configure.ac
    team/russell/chan_console/include/asterisk/monitor.h
    team/russell/chan_console/res/res_monitor.c
    team/russell/chan_console/res/res_musiconhold.c

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jul  9 16:34:28 2007
@@ -1,1 +1,1 @@
-/trunk:1-74079
+/trunk:1-74212

Modified: team/russell/chan_console/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/apps/app_queue.c?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/apps/app_queue.c (original)
+++ team/russell/chan_console/apps/app_queue.c Mon Jul  9 16:34:28 2007
@@ -1763,15 +1763,17 @@
 		char vars[2048];
 
 		manager_event(EVENT_FLAG_AGENT, "AgentCalled",
+					"Queue: %s\r\n"
 					"AgentCalled: %s\r\n"
 					"ChannelCalling: %s\r\n"
+					"DestinationChannel: %s\r\n"
 					"CallerIDNum: %s\r\n"
 					"CallerIDName: %s\r\n"
 					"Context: %s\r\n"
 					"Extension: %s\r\n"
 					"Priority: %d\r\n"
 					"%s",
-					tmp->interface, qe->chan->name,
+					qe->parent->name, tmp->interface, qe->chan->name, tmp->chan->name,
 					tmp->chan->cid.cid_num ? tmp->chan->cid.cid_num : "unknown",
 					tmp->chan->cid.cid_name ? tmp->chan->cid.cid_name : "unknown",
 					qe->chan->context, qe->chan->exten, qe->chan->priority,
@@ -2475,8 +2477,7 @@
 			ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT);
 			break;
 		case 'n':
-			if ((now - qe->start >= qe->parent->timeout))
-				*go_on = 1;
+			*go_on = 1;
 			break;
 		case 'i':
 			forwardsallowed = 0;
@@ -3648,6 +3649,17 @@
 
 				stat = get_member_status(qe.parent, qe.max_penalty);
 
+				/* exit after 'timeout' cycle if 'n' option enabled */
+				if (go_on) {
+					if (option_verbose > 2)
+						ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
+					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
+					record_abandoned(&qe);
+					reason = QUEUE_TIMEOUT;
+					res = 0;
+					break;
+				}
+
 				/* leave the queue if no agents, if enabled */
 				if (qe.parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
 					record_abandoned(&qe);
@@ -3697,17 +3709,7 @@
 						qe.digits, qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					break;
 				}
-				/* exit after 'timeout' cycle if 'n' option enabled */
-				if (go_on) {
-					if (option_verbose > 2)
-						ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
-					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d|%d|%ld", 
-						qe.pos, qe.opos, (long) time(NULL) - qe.start);
-					record_abandoned(&qe);
-					reason = QUEUE_TIMEOUT;
-					res = 0;
-					break;
-				}
+
 				/* Since this is a priority queue and
 				 * it is not sure that we are still at the head
 				 * of the queue, go and check for our turn again.

Modified: team/russell/chan_console/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_agent.c?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/channels/chan_agent.c (original)
+++ team/russell/chan_console/channels/chan_agent.c Mon Jul  9 16:34:28 2007
@@ -2139,7 +2139,6 @@
 	char *s;
 	ast_group_t groupmatch;
 	int groupoff;
-	int waitforagent=0;
 	int res = AST_DEVICE_INVALID;
 	
 	s = data;
@@ -2147,7 +2146,6 @@
 		groupmatch = (1 << groupoff);
 	else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
 		groupmatch = (1 << groupoff);
-		waitforagent = 1;
 	} else 
 		groupmatch = 0;
 

Modified: team/russell/chan_console/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_skinny.c?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/channels/chan_skinny.c (original)
+++ team/russell/chan_console/channels/chan_skinny.c Mon Jul  9 16:34:28 2007
@@ -895,7 +895,7 @@
 #endif
 
 /* driver scheduler */
-static struct sched_context *sched;
+static struct sched_context *sched = NULL;
 static struct io_context *io;
 
 /* Protect the monitoring thread, so only one process can kill or start it, and not
@@ -5147,7 +5147,8 @@
 	ast_cli_unregister_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry));
 
 	close(skinnysock);
-	sched_context_destroy(sched);
+	if (sched)
+		sched_context_destroy(sched);
 
 	return 0;
 }

Modified: team/russell/chan_console/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_zap.c?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/channels/chan_zap.c (original)
+++ team/russell/chan_console/channels/chan_zap.c Mon Jul  9 16:34:28 2007
@@ -12131,6 +12131,14 @@
 				ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno);
 			else
 				confp->chan.amaflags = y;
+		} else if (!strcasecmp(v->name, "polarityonanswerdelay")) {
+			confp->chan.polarityonanswerdelay = atoi(v->value);
+		} else if (!strcasecmp(v->name, "answeronpolarityswitch")) {
+			confp->chan.answeronpolarityswitch = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "hanguponpolarityswitch")) {
+			confp->chan.hanguponpolarityswitch = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "sendcalleridafter")) {
+			confp->chan.sendcalleridafter = atoi(v->value);
 		} else if (!reload){ 
 			 if (!strcasecmp(v->name, "signalling")) {
 				confp->chan.outsigmod = -1;
@@ -12627,14 +12635,6 @@
 					}
 				}
 				close(ctlfd);
-			} else if (!strcasecmp(v->name, "polarityonanswerdelay")) {
-				confp->chan.polarityonanswerdelay = atoi(v->value);
-			} else if (!strcasecmp(v->name, "answeronpolarityswitch")) {
-				confp->chan.answeronpolarityswitch = ast_true(v->value);
-			} else if (!strcasecmp(v->name, "hanguponpolarityswitch")) {
-				confp->chan.hanguponpolarityswitch = ast_true(v->value);
-			} else if (!strcasecmp(v->name, "sendcalleridafter")) {
-				confp->chan.sendcalleridafter = atoi(v->value);
 			} else if (!strcasecmp(v->name, "defaultcic")) {
 				ast_copy_string(defaultcic, v->value, sizeof(defaultcic));
 			} else if (!strcasecmp(v->name, "defaultozz")) {

Modified: team/russell/chan_console/configure
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/configure?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/configure (original)
+++ team/russell/chan_console/configure Mon Jul  9 16:34:28 2007
@@ -28979,7 +28979,7 @@
       	 pbxlibdir="-L${PRI_DIR}"
       fi
    fi
-   pbxfuncname="pri_call"
+   pbxfuncname="pri_keypad_facility"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_PRI_FOUND=yes
    else

Modified: team/russell/chan_console/configure.ac
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/configure.ac?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/configure.ac (original)
+++ team/russell/chan_console/configure.ac Mon Jul  9 16:34:28 2007
@@ -774,7 +774,7 @@
 
 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
 
-AST_EXT_LIB_CHECK([PRI], [pri], [pri_call], [libpri.h])
+AST_EXT_LIB_CHECK([PRI], [pri], [pri_keypad_facility], [libpri.h])
 
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 

Modified: team/russell/chan_console/include/asterisk/monitor.h
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/include/asterisk/monitor.h?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/include/asterisk/monitor.h (original)
+++ team/russell/chan_console/include/asterisk/monitor.h Mon Jul  9 16:34:28 2007
@@ -46,7 +46,7 @@
 
 /* Start monitoring a channel */
 int ast_monitor_start(struct ast_channel *chan, const char *format_spec,
-		      const char *fname_base, int need_lock );
+		      const char *fname_base, int need_lock, int stream_action);
 
 /* Stop monitoring a channel */
 int ast_monitor_stop(struct ast_channel *chan, int need_lock);

Modified: team/russell/chan_console/res/res_monitor.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/res/res_monitor.c?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/res/res_monitor.c (original)
+++ team/russell/chan_console/res/res_monitor.c Mon Jul  9 16:34:28 2007
@@ -60,6 +60,11 @@
 	if (needed) \
 		ast_channel_unlock(lock); \
 	} while (0)
+
+/* Streams recording control */
+#define X_REC_IN	1
+#define X_REC_OUT	2
+#define X_JOIN		4
 
 static unsigned long seq = 0;
 
@@ -85,6 +90,10 @@
 "          administrator interface\n"
 "\n"
 "    b   - Don't begin recording unless a call is bridged to another channel\n"
+"\n"
+"    i   - Skip recording of input stream (disables m option)\n"
+"\n"
+"    o   - Skip recording of output stream (disables m option)\n"
 "\nReturns -1 if monitor files can't be opened or if the channel is already\n"
 "monitored, otherwise 0.\n"
 ;
@@ -125,7 +134,7 @@
 
 /* Start monitoring a channel */
 int ast_monitor_start(	struct ast_channel *chan, const char *format_spec,
-		const char *fname_base, int need_lock)
+		const char *fname_base, int need_lock, int stream_action)
 {
 	int res = 0;
 
@@ -184,31 +193,38 @@
 		}
 		
 		/* open files */
-		if (ast_fileexists(monitor->read_filename, NULL, NULL) > 0) {
-			ast_filedelete(monitor->read_filename, NULL);
-		}
-		if (!(monitor->read_stream = ast_writefile(monitor->read_filename,
-						monitor->format, NULL,
-						O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
-			ast_log(LOG_WARNING, "Could not create file %s\n",
-						monitor->read_filename);
-			ast_free(monitor);
-			UNLOCK_IF_NEEDED(chan, need_lock);
-			return -1;
-		}
-		if (ast_fileexists(monitor->write_filename, NULL, NULL) > 0) {
-			ast_filedelete(monitor->write_filename, NULL);
-		}
-		if (!(monitor->write_stream = ast_writefile(monitor->write_filename,
-						monitor->format, NULL,
-						O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
-			ast_log(LOG_WARNING, "Could not create file %s\n",
-						monitor->write_filename);
-			ast_closestream(monitor->read_stream);
-			ast_free(monitor);
-			UNLOCK_IF_NEEDED(chan, need_lock);
-			return -1;
-		}
+		if (stream_action & X_REC_IN) {
+			if (ast_fileexists(monitor->read_filename, NULL, NULL) > 0)
+				ast_filedelete(monitor->read_filename, NULL);
+			if (!(monitor->read_stream = ast_writefile(monitor->read_filename,
+							monitor->format, NULL,
+							O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
+				ast_log(LOG_WARNING, "Could not create file %s\n",
+							monitor->read_filename);
+				ast_free(monitor);
+				UNLOCK_IF_NEEDED(chan, need_lock);
+				return -1;
+			}
+		} else
+			monitor->read_stream = NULL;
+
+		if (stream_action & X_REC_OUT) {
+			if (ast_fileexists(monitor->write_filename, NULL, NULL) > 0) {
+				ast_filedelete(monitor->write_filename, NULL);
+			}
+			if (!(monitor->write_stream = ast_writefile(monitor->write_filename,
+							monitor->format, NULL,
+							O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
+				ast_log(LOG_WARNING, "Could not create file %s\n",
+							monitor->write_filename);
+				ast_closestream(monitor->read_stream);
+				ast_free(monitor);
+				UNLOCK_IF_NEEDED(chan, need_lock);
+				return -1;
+			}
+		} else
+			monitor->write_stream = NULL;
+
 		chan->monitor = monitor;
 		ast_monitor_set_state(chan, AST_MONITOR_RUNNING);
 		/* so we know this call has been monitored in case we need to bill for it or something */
@@ -381,6 +397,7 @@
 	char *delay = NULL;
 	char *urlprefix = NULL;
 	char tmp[256];
+	int stream_action = X_REC_IN | X_REC_OUT;
 	int joinfiles = 0;
 	int waitforbridge = 0;
 	int res = 0;
@@ -397,9 +414,13 @@
 				*options = 0;
 				options++;
 				if (strchr(options, 'm'))
-					joinfiles = 1;
+					stream_action |= X_JOIN;
 				if (strchr(options, 'b'))
 					waitforbridge = 1;
+				if (strchr(options, 'i'))
+					stream_action &= ~X_REC_IN;
+				if (strchr(options, 'o'))
+					stream_action &= ~X_REC_OUT;
 			}
 		}
 		arg = strchr(format,':');
@@ -432,9 +453,16 @@
 		return 0;
 	}
 
-	res = ast_monitor_start(chan, format, fname_base, 1);
+	res = ast_monitor_start(chan, format, fname_base, 1, stream_action);
 	if (res < 0)
 		res = ast_monitor_change_fname(chan, fname_base, 1);
+
+	if (stream_action & X_JOIN) {
+		if ((stream_action & X_REC_IN) && (stream_action & X_REC_OUT))
+			joinfiles = 1;
+		else
+			ast_log(LOG_WARNING, "Won't mix streams unless both input and output streams are recorded\n");
+	}
 	ast_monitor_setjoinfiles(chan, joinfiles);
 
 	return res;
@@ -472,7 +500,7 @@
 	const char *format = astman_get_header(m, "Format");
 	const char *mix = astman_get_header(m, "Mix");
 	char *d;
-	
+
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
 		return 0;
@@ -494,8 +522,8 @@
 		if ((d = strchr(fname, '/'))) 
 			*d = '-';
 	}
-	
-	if (ast_monitor_start(c, format, fname, 1)) {
+
+	if (ast_monitor_start(c, format, fname, 1, X_REC_IN | X_REC_OUT)) {
 		if (ast_monitor_change_fname(c, fname, 1)) {
 			astman_send_error(s, m, "Could not start monitoring channel");
 			ast_channel_unlock(c);

Modified: team/russell/chan_console/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/res/res_musiconhold.c?view=diff&rev=74213&r1=74212&r2=74213
==============================================================================
--- team/russell/chan_console/res/res_musiconhold.c (original)
+++ team/russell/chan_console/res/res_musiconhold.c Mon Jul  9 16:34:28 2007
@@ -603,7 +603,7 @@
 {
 	if (ast_moh_start(chan, data, NULL)) {
 		ast_log(LOG_WARNING, "Unable to start music on hold (class '%s') on channel %s\n", (char *)data, chan->name);
-		return -1;
+		return 0;
 	}
 	while (!ast_safe_sleep(chan, 10000));
 	ast_moh_stop(chan);
@@ -619,7 +619,7 @@
 	}
 	if (ast_moh_start(chan, NULL, NULL)) {
 		ast_log(LOG_WARNING, "Unable to start music on hold for %d seconds on channel %s\n", atoi(data), chan->name);
-		return -1;
+		return 0;
 	}
 	res = ast_safe_sleep(chan, atoi(data) * 1000);
 	ast_moh_stop(chan);
@@ -663,6 +663,9 @@
 		if (!strcasecmp(name, moh->name))
 			break;
 	}
+
+	if (!moh)
+		ast_log(LOG_WARNING, "Music on Hold class '%s' not found\n", name);
 
 	return moh;
 }
@@ -948,7 +951,6 @@
 static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
 {
 	struct mohclass *mohclass;
-	const char *class;
 
 	/* The following is the order of preference for which class to use:
 	 * 1) The channels explicitly set musicclass, which should *only* be
@@ -961,23 +963,19 @@
 	 *    option.
 	 * 4) The default class.
 	 */
+	AST_RWLIST_RDLOCK(&mohclasses);
 	if (!ast_strlen_zero(chan->musicclass))
-		class = chan->musicclass;
-	else if (!ast_strlen_zero(mclass))
-		class = mclass;
-	else if (!ast_strlen_zero(interpclass))
-		class = interpclass;
-	else
-		class = "default";
-
-	AST_RWLIST_RDLOCK(&mohclasses);
-	mohclass = get_mohbyname(class);
+		mohclass = get_mohbyname(chan->musicclass);
+	if (!mohclass && !ast_strlen_zero(mclass))
+		mohclass = get_mohbyname(mclass);
+	if (!mohclass && !ast_strlen_zero(interpclass))
+		mohclass = get_mohbyname(interpclass);
+	if (!mohclass)	
+		mohclass = get_mohbyname("default");
 	AST_RWLIST_UNLOCK(&mohclasses);
 
-	if (!mohclass) {
-		ast_log(LOG_WARNING, "No class: %s\n", class);
+	if (!mohclass)
 		return -1;
-	}
 
 	ast_set_flag(chan, AST_FLAG_MOH);
 	if (mohclass->total_files) {




More information about the asterisk-commits mailing list