[asterisk-commits] branch group/new_loader_completion r25569 - in /team/group/new_loader_complet...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon May 8 07:58:44 MST 2006


Author: kpfleming
Date: Mon May  8 09:58:44 2006
New Revision: 25569

URL: http://svn.digium.com/view/asterisk?rev=25569&view=rev
Log:
update to current trunk (still does not build)

Added:
    team/group/new_loader_completion/sounds/vm-tempgreetactive.gsm
      - copied unchanged from r25568, trunk/sounds/vm-tempgreetactive.gsm
Modified:
    team/group/new_loader_completion/   (props changed)
    team/group/new_loader_completion/Makefile
    team/group/new_loader_completion/UPGRADE.txt
    team/group/new_loader_completion/apps/app_exec.c
    team/group/new_loader_completion/apps/app_meetme.c
    team/group/new_loader_completion/apps/app_mixmonitor.c
    team/group/new_loader_completion/apps/app_queue.c
    team/group/new_loader_completion/apps/app_voicemail.c
    team/group/new_loader_completion/apps/app_while.c
    team/group/new_loader_completion/asterisk.c
    team/group/new_loader_completion/build_tools/make_version
    team/group/new_loader_completion/build_tools/menuselect.c
    team/group/new_loader_completion/build_tools/menuselect.h
    team/group/new_loader_completion/channel.c
    team/group/new_loader_completion/channels/chan_agent.c
    team/group/new_loader_completion/channels/chan_sip.c
    team/group/new_loader_completion/channels/chan_zap.c
    team/group/new_loader_completion/channels/misdn/isdn_lib.c
    team/group/new_loader_completion/cli.c
    team/group/new_loader_completion/codecs/codec_a_mu.c
    team/group/new_loader_completion/codecs/codec_alaw.c
    team/group/new_loader_completion/codecs/codec_ulaw.c
    team/group/new_loader_completion/configs/func_odbc.conf.sample
    team/group/new_loader_completion/configs/queues.conf.sample
    team/group/new_loader_completion/configs/voicemail.conf.sample
    team/group/new_loader_completion/file.c
    team/group/new_loader_completion/frame.c
    team/group/new_loader_completion/funcs/func_odbc.c
    team/group/new_loader_completion/include/asterisk/manager.h
    team/group/new_loader_completion/include/asterisk/options.h
    team/group/new_loader_completion/include/asterisk/pbx.h
    team/group/new_loader_completion/include/asterisk/utils.h
    team/group/new_loader_completion/logger.c
    team/group/new_loader_completion/manager.c
    team/group/new_loader_completion/pbx.c
    team/group/new_loader_completion/pbx/pbx_dundi.c
    team/group/new_loader_completion/pbx/pbx_spool.c
    team/group/new_loader_completion/res/res_agi.c
    team/group/new_loader_completion/res/res_features.c
    team/group/new_loader_completion/say.c
    team/group/new_loader_completion/sounds.txt
    team/group/new_loader_completion/static-http/ajamdemo.html
    team/group/new_loader_completion/strcompat.c
    team/group/new_loader_completion/utils.c
    team/group/new_loader_completion/utils/Makefile

Propchange: team/group/new_loader_completion/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/group/new_loader_completion/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/group/new_loader_completion/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May  8 09:58:44 2006
@@ -1,1 +1,1 @@
-/trunk:1-24982
+/trunk:1-25568

Modified: team/group/new_loader_completion/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/Makefile?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/Makefile (original)
+++ team/group/new_loader_completion/Makefile Mon May  8 09:58:44 2006
@@ -482,10 +482,10 @@
 endif
 
 ast_expr2.c:
-	bison -d --name-prefix=ast_yy ast_expr2.y -o ast_expr2.c
+	bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
 
 ast_expr2f.c:
-	flex --full ast_expr2.fl
+	flex -o $@ --full ast_expr2.fl
 
 testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
 	gcc -g -c -DSTANDALONE ast_expr2f.c
@@ -884,12 +884,30 @@
 	$(MAKE) -C mpg123-0.59r $(MPG123TARG)
 
 config:
-	if [ -d /etc/rc.d/init.d ]; then \
-		$(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
-		/sbin/chkconfig --add asterisk; \
-	elif [ -d /etc/init.d ]; then \
-		$(INSTALL) -m 755 init.asterisk /etc/init.d/asterisk; \
-	fi 
+	@if [ "${OSARCH}" = "Linux" ]; then \
+		if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
+			$(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
+			/sbin/chkconfig --add asterisk; \
+		elif [ -f /etc/debian_version ]; then \
+			$(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \
+			/usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \
+		elif [ -f /etc/gentoo-release ]; then \
+			$(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \
+			/sbin/rc-update add asterisk default; \
+		elif [ -f /etc/mandrake-release ]; then \
+			$(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \
+			/sbin/chkconfig --add asterisk; \
+		elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
+			$(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \
+			/sbin/chkconfig --add asterisk; \
+		elif [ -f /etc/slackware-version ]; then \
+			echo "Slackware is not currently supported, although an init script does exist for it." \
+		else \
+			echo "We could not install init scripts for your distribution."; \
+		fi \
+	else \
+		echo "We could not install init scripts for your operating system."; \
+	fi
 
 dont-optimize: _all
 

Modified: team/group/new_loader_completion/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/UPGRADE.txt?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/UPGRADE.txt (original)
+++ team/group/new_loader_completion/UPGRADE.txt Mon May  8 09:58:44 2006
@@ -93,6 +93,20 @@
   option, it will default to "no" to keep backward compatability with the old 
   behavior.
 
+* The app_queue application now has the ability to use MixMonitor to 
+  record conversations queue members are having with queue callers. Please
+  see configs/queues.conf.sample for more information on this option.
+
+* ast_play_and_record would attempt to cancel the recording if a DTMF
+  '0' was received.  This behavior was not documented in most of the
+  applications that used ast_play_and_record and the return codes from
+  ast_play_and_record weren't checked for properly.
+  ast_play_and_record has been changed so that '0' no longer cancels a
+  recording.  If you want to allow DTMF digits to cancel an
+  in-progress recording use ast_play_and_record_full which allows you
+  to specify which DTMF digits can be used to accept a recording and
+  which digits can be used to cancel a recording.
+
 Manager:
 
 * After executing the 'status' manager action, the "Status" manager events

Modified: team/group/new_loader_completion/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_exec.c?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_exec.c (original)
+++ team/group/new_loader_completion/apps/app_exec.c Mon May  8 09:58:44 2006
@@ -83,6 +83,13 @@
 "    NOAPP     if the application was not found or was not specified\n"
 "    NOMEMORY  if there was not enough memory to execute.\n";
 
+static char *app_execif = "ExecIf";
+static char *execif_synopsis = "Executes dialplan application, conditionally";
+static char *execif_descrip = 
+"Usage:  ExecIF (<expr>|<app>|<data>)\n"
+"If <expr> is true, execute and return the result of <app>(<data>).\n"
+"If <expr> is true, but <app> is not found, then the application\n"
+"will return a non-zero value.\n";
 
 static int exec_exec(struct ast_channel *chan, void *data)
 {
@@ -159,12 +166,54 @@
 	return 0;
 }
 
+static int execif_exec(struct ast_channel *chan, void *data) {
+	int res=0;
+	struct localuser *u;
+	char *myapp = NULL;
+	char *mydata = NULL;
+	char *expr = NULL;
+	struct ast_app *app = NULL;
+
+	LOCAL_USER_ADD(u);
+
+	if (!(expr = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
+
+	if ((myapp = strchr(expr,'|'))) {
+		*myapp = '\0';
+		myapp++;
+		if ((mydata = strchr(myapp,'|'))) {
+			*mydata = '\0';
+			mydata++;
+		} else
+			mydata = "";
+
+		if (pbx_checkcondition(expr)) { 
+			if ((app = pbx_findapp(myapp))) {
+				res = pbx_exec(chan, app, mydata);
+			} else {
+				ast_log(LOG_WARNING, "Count not find application! (%s)\n", myapp);
+				res = -1;
+			}
+		}
+	} else {
+		ast_log(LOG_ERROR,"Invalid Syntax.\n");
+		res = -1;
+	}
+		
+	LOCAL_USER_REMOVE(u);
+	return res;
+}
+
 static int unload_module(void)
 {
 	int res;
 
 	res = ast_unregister_application(app_exec);
 	res |= ast_unregister_application(app_tryexec);
+	res |= ast_unregister_application(app_execif);
 
 	ast_module_user_hangup_all();
 
@@ -175,6 +224,7 @@
 {
 	int res = ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
 	res |= ast_register_application(app_tryexec, tryexec_exec, tryexec_synopsis, tryexec_descrip);
+	res |= ast_register_application(app_execif, execif_exec, execif_synopsis, execif_descrip);
 	return res;
 }
 

Modified: team/group/new_loader_completion/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_meetme.c?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_meetme.c (original)
+++ team/group/new_loader_completion/apps/app_meetme.c Mon May  8 09:58:44 2006
@@ -1,4 +1,3 @@
-
 /*
  * Asterisk -- An open source telephony toolkit.
  *
@@ -2150,9 +2149,12 @@
 								break;
 							} else {
 								/* Pin invalid */
-								res = ast_streamfile(chan, "conf-invalidpin", chan->language);
-								if (!res)
-									ast_waitstream(chan, AST_DIGIT_ANY);
+								if (!ast_streamfile(chan, "conf-invalidpin", chan->language))
+									res = ast_waitstream(chan, AST_DIGIT_ANY);
+								else {
+									ast_log(LOG_WARNING, "Couldn't play invalid pin msg!\n");
+									break;
+								}
 								if (res < 0) {
 									AST_LIST_LOCK(&confs);
 									cnf->refcount--;
@@ -2286,6 +2288,11 @@
 			case 77: /* M: Mute */ 
 				if (user) {
 					user->adminflags |= ADMINFLAG_MUTED;
+					manager_event(EVENT_FLAG_CALL, "MeetmeMute",
+						"Status: on"
+						"Meetme: %s\r\n"
+						"Usernum: %d\r\n",
+						cnf->confno, user->user_no);
 				} else {
 					ast_log(LOG_NOTICE, "Specified User not found!\n");
 				}
@@ -2305,6 +2312,11 @@
 			case 109: /* m: Unmute */ 
 				if (user && (user->adminflags & ADMINFLAG_MUTED)) {
 					user->adminflags ^= ADMINFLAG_MUTED;
+					manager_event(EVENT_FLAG_CALL, "MeetmeMute",
+						"Status: off"
+						"Meetme: %s\r\n"
+						"Usernum: %d\r\n",
+						cnf->confno, user->user_no);
 				} else {
 					ast_log(LOG_NOTICE, "Specified User not found or he muted himself!\n");
 				}

Modified: team/group/new_loader_completion/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_mixmonitor.c?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_mixmonitor.c (original)
+++ team/group/new_loader_completion/apps/app_mixmonitor.c Mon May  8 09:58:44 2006
@@ -133,9 +133,9 @@
 	if (!chan)
 		return;
 
-	ast_mutex_lock(&chan->lock);
+	ast_channel_lock(chan);
 	ast_channel_spy_remove(chan, spy);
-	ast_mutex_unlock(&chan->lock);
+	ast_channel_unlock(chan);
 }
 
 static int startmon(struct ast_channel *chan, struct ast_channel_spy *spy) 
@@ -146,9 +146,9 @@
 	if (!chan)
 		return -1;
 
-	ast_mutex_lock(&chan->lock);
+	ast_channel_lock(chan);
 	res = ast_channel_spy_add(chan, spy);
-	ast_mutex_unlock(&chan->lock);
+	ast_channel_unlock(chan);
 		
 	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
 		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);	
@@ -408,13 +408,9 @@
 
 	u = ast_module_user_add(chan);
 
-	if (!ast_mutex_lock(&chan->lock)) {
-		ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
-		ast_mutex_unlock(&chan->lock);
-	} else {
-		ast_log(LOG_WARNING, "Could not lock %s to stop MixMonitor on it\n", 
-				chan->name);
-	}
+	ast_channel_lock(chan);
+	ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
+	ast_channel_unlock(chan);
 
 	ast_module_user_remove(u);
 
@@ -438,7 +434,7 @@
 	else if (!strcasecmp(argv[1], "stop"))
 		ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
 
-	ast_mutex_unlock(&chan->lock);
+	ast_channel_unlock(chan);
 
 	return RESULT_SUCCESS;
 }

Modified: team/group/new_loader_completion/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_queue.c?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_queue.c (original)
+++ team/group/new_loader_completion/apps/app_queue.c Mon May  8 09:58:44 2006
@@ -129,7 +129,7 @@
 static char *synopsis = "Queue a call for a call queue";
 
 static char *descrip =
-"  Queue(queuename[|options[|URL][|announceoverride][|timeout]]):\n"
+"  Queue(queuename[|options[|URL][|announceoverride][|timeout][|AGI]):\n"
 "Queues an incoming call in a particular call queue as defined in queues.conf.\n"
 "This application will return to the dialplan if the queue does not exist, or\n"
 "any of the join options cause the caller to not enter the queue.\n"
@@ -148,6 +148,8 @@
 "up by another user.\n"
 "  The optional URL will be sent to the called party if the channel supports\n"
 "it.\n"
+"  The optional AGI parameter will setup an AGI script to be executed on the \n"
+"calling party's channel once they are connected to a queue member.\n"
 "  The timeout will cause the queue to fail out after a specified number of\n"
 "seconds, checked between each queues.conf 'timeout' and 'retry' cycle.\n"
 "  This application sets the following channel variable upon completion:\n"
@@ -237,6 +239,9 @@
 /*! \brief queues.conf [general] option */
 static int autofill_default = 0;
 
+/*! \brief queues.conf [general] option */
+static int montype_default = 0;
+
 enum queue_result {
 	QUEUE_UNKNOWN = 0,
 	QUEUE_TIMEOUT = 1,
@@ -328,6 +333,7 @@
 	unsigned int eventwhencalled:1;
 	unsigned int leavewhenempty:2;
 	unsigned int ringinuse:1;
+	unsigned int setinterfacevar:1;
 	unsigned int reportholdtime:1;
 	unsigned int wrapped:1;
 	unsigned int timeoutrestart:1;
@@ -344,6 +350,7 @@
 	int servicelevel;               /*!< seconds setting for servicelevel*/
 	int callscompletedinsl;         /*!< Number of calls answered with servicelevel*/
 	char monfmt[8];                 /*!< Format to use when recording calls */
+	int montype;			/*!< Monitor type  Monitor vs. MixMonitor */
 	char sound_next[80];            /*!< Sound file: "Your call is now first in line" (def. queue-youarenext) */
 	char sound_thereare[80];        /*!< Sound file: "There are currently" (def. queue-thereare) */
 	char sound_calls[80];           /*!< Sound file: "calls waiting to speak to a representative." (def. queue-callswaiting)*/
@@ -578,7 +585,9 @@
 	q->roundingseconds = 0; /* Default - don't announce seconds */
 	q->servicelevel = 0;
 	q->ringinuse = 1;
+	q->setinterfacevar = 0;
 	q->autofill = autofill_default;
+	q->montype = montype_default;
 	q->moh[0] = '\0';
 	q->announce[0] = '\0';
 	q->context[0] = '\0';
@@ -632,6 +641,8 @@
 			q->timeout = DEFAULT_TIMEOUT;
 	} else if (!strcasecmp(param, "ringinuse")) {
 		q->ringinuse = ast_true(val);
+	} else if (!strcasecmp(param, "setinterfacevar")) {
+		q->setinterfacevar = ast_true(val);
 	} else if (!strcasecmp(param, "monitor-join")) {
 		q->monjoin = ast_true(val);
 	} else if (!strcasecmp(param, "monitor-format")) {
@@ -704,6 +715,9 @@
 		q->wrapuptime = atoi(val);
 	} else if (!strcasecmp(param, "autofill")) {
 		q->autofill = ast_true(val);
+	} else if (!strcasecmp(param, "monitor-type")) {
+		if (!strcasecmp(val, "mixmonitor"))
+			q->montype = 1;
 	} else if (!strcasecmp(param, "autopause")) {
 		q->autopause = ast_true(val);
 	} else if (!strcasecmp(param, "maxlen")) {
@@ -1199,7 +1213,9 @@
 	/* Set our last_pos indicators */
  	qe->last_pos = now;
 	qe->last_pos_said = qe->pos;
-	ast_moh_start(qe->chan, qe->moh);
+	/* Don't restart music on hold if we're about to exit the caller from the queue */
+	if (res)
+		ast_moh_start(qe->chan, qe->moh);
 
 	return res;
 }
@@ -1244,9 +1260,8 @@
 			manager_event(EVENT_FLAG_CALL, "Leave",
 				"Channel: %s\r\nQueue: %s\r\nCount: %d\r\n",
 				qe->chan->name, q->name,  q->count);
-#if 0
-ast_log(LOG_NOTICE, "Queue '%s' Leave, Channel '%s'\n", q->name, qe->chan->name );
-#endif
+			if (option_debug)
+				ast_log(LOG_DEBUG, "Queue '%s' Leave, Channel '%s'\n", q->name, qe->chan->name );
 			/* Take us out of the queue */
 			if (prev)
 				prev->next = cur->next;
@@ -2067,7 +2082,7 @@
 	return 0;
 }
 
-static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *go_on)
+static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *go_on, const char *agi)
 {
 	struct member *cur;
 	struct callattempt *outgoing=NULL; /* the queue we are building */
@@ -2079,6 +2094,7 @@
 	struct ast_channel *which;
 	struct callattempt *lpeer;
 	struct member *member;
+	struct ast_app *app;
 	int res = 0, bridge = 0;
 	int numbusies = 0;
 	int x=0;
@@ -2088,6 +2104,17 @@
 	time_t now = time(NULL);
 	struct ast_bridge_config bridge_config;
 	char nondataquality = 1;
+	char *agiexec = NULL;
+	int ret = 0;
+	const char *monitorfilename;
+	const char *monitor_exec;
+	const char *monitor_options;
+	char tmpid[256], tmpid2[256];
+	char meid[1024], meid2[1024];
+	char mixmonargs[1512];
+	struct ast_app *mixmonapp = NULL;
+	char *p;
+
 
 	memset(&bridge_config, 0, sizeof(bridge_config));
 	time(&now);
@@ -2273,23 +2300,90 @@
 		}
 		/* Begin Monitoring */
 		if (qe->parent->monfmt && *qe->parent->monfmt) {
-			const char *monitorfilename = pbx_builtin_getvar_helper(qe->chan, "MONITOR_FILENAME");
-			if (pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC") || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))
-				which = qe->chan;
-			else
-				which = peer;
-			if (monitorfilename)
-				ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1 );
-			else if (qe->chan->cdr) 
-				ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1 );
-			else {
-				/* Last ditch effort -- no CDR, make up something */
-				char tmpid[256];
-				snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
-				ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
-			}
-			if (qe->parent->monjoin)
-				ast_monitor_setjoinfiles(which, 1);
+			if (!qe->parent->montype) {
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Starting Monitor as requested.\n");
+				monitorfilename = pbx_builtin_getvar_helper(qe->chan, "MONITOR_FILENAME");
+				if (pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC") || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))
+					which = qe->chan;
+				else
+					which = peer;
+				if (monitorfilename)
+					ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1 );
+				else if (qe->chan->cdr) 
+					ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1 );
+				else {
+					/* Last ditch effort -- no CDR, make up something */
+					snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
+					ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
+				}
+				if (qe->parent->monjoin)
+					ast_monitor_setjoinfiles(which, 1);
+			} else {
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Starting MixMonitor as requested.\n");
+				monitorfilename = pbx_builtin_getvar_helper(qe->chan, "MONITOR_FILENAME");
+				if (!monitorfilename) {
+					if (qe->chan->cdr)
+						ast_copy_string(tmpid, qe->chan->cdr->uniqueid, sizeof(tmpid)-1);
+					else 
+						snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
+				} else {
+					ast_copy_string(tmpid2, monitorfilename, sizeof(tmpid2)-1);
+					for (p = tmpid2; *p ; p++) {
+						if (*p == '^' && *(p+1) == '{') {
+							*p = '$';
+						}
+					}
+
+					pbx_substitute_variables_helper(qe->chan, tmpid2, tmpid, sizeof(tmpid) - 1);
+				}
+
+				monitor_exec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC");
+				monitor_options = pbx_builtin_getvar_helper(qe->chan, "MONITOR_OPTIONS");
+
+				if (monitor_exec) {
+					ast_copy_string(meid2, monitor_exec, sizeof(meid2)-1);
+					for (p = meid2; *p ; p++) {
+						if (*p == '^' && *(p+1) == '{') {
+							*p = '$';
+						}
+					}
+					pbx_substitute_variables_helper(qe->chan, meid2, meid, sizeof(meid) - 1);
+				} 
+	
+				snprintf(tmpid2, sizeof(tmpid2)-1, "%s.%s", tmpid, qe->parent->monfmt);
+
+				mixmonapp = pbx_findapp("MixMonitor");
+
+				if (strchr(tmpid2, '|')) {
+					ast_log(LOG_WARNING, "monitor-format (in queues.conf) and MONITOR_FILENAME cannot contain a '|'! Not recording.\n");
+					mixmonapp = NULL;
+				}
+				
+				if (strchr(monitor_options, '|')) {
+					ast_log(LOG_WARNING, "MONITOR_OPTIONS cannot contain a '|'! Not recording.\n");
+					mixmonapp = NULL;
+				}
+
+				if (!monitor_options)
+					monitor_options = ast_strdupa("");
+
+				if (mixmonapp) {
+					if (!ast_strlen_zero(monitor_exec) && !ast_strlen_zero(monitor_options)) 
+						snprintf(mixmonargs, sizeof(mixmonargs)-1, "%s|b%s|%s", tmpid2, monitor_options, monitor_exec);
+					else 
+						snprintf(mixmonargs, sizeof(mixmonargs)-1, "%s|b%s", tmpid2, monitor_options);
+						
+					if (option_debug)
+						ast_log(LOG_DEBUG, "Arguments being passed to MixMonitor: %s\n", mixmonargs);
+
+					ret = pbx_exec(qe->chan, mixmonapp, mixmonargs);
+
+				} else
+					ast_log(LOG_WARNING, "Asked to run MixMonitor on this call, but cannot find the MixMonitor app!\n");
+
+			}
 		}
 		/* Drop out of the queue at this point, to prepare for next caller */
 		leave_queue(qe);			
@@ -2298,6 +2392,18 @@
 	 			ast_log(LOG_DEBUG, "app_queue: sendurl=%s.\n", url);
  			ast_channel_sendurl(peer, url);
  		}
+		if (qe->parent->setinterfacevar)
+				pbx_builtin_setvar_helper(qe->chan, "MEMBERINTERFACE", member->interface);
+		if (!ast_strlen_zero(agi)) {
+			if (option_debug)
+				ast_log(LOG_DEBUG, "app_queue: agi=%s.\n", agi);
+			app = pbx_findapp("agi");
+			if (app) {
+				agiexec = ast_strdupa(agi);
+				ret = pbx_exec(qe->chan, app, agiexec);
+			} else 
+				ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
+		}
 		ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "CONNECT", "%ld|%s", (long)time(NULL) - qe->start, peer->uniqueid);
 		if (qe->parent->eventwhencalled)
 			manager_event(EVENT_FLAG_AGENT, "AgentConnect",
@@ -2908,6 +3014,7 @@
 		 AST_APP_ARG(url);
 		 AST_APP_ARG(announceoverride);
 		 AST_APP_ARG(queuetimeoutstr);
+		 AST_APP_ARG(agi);
 	);
 	
 	/* Our queue entry */
@@ -3038,7 +3145,7 @@
 					/* Make a position announcement, if enabled */
 					if (qe.parent->announcefrequency && !ringing)
 						res = say_position(&qe);
-					if (res && valid_exit(&qe, res)) {
+					if (res) {
 						 ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
 						break;
 					}
@@ -3056,7 +3163,7 @@
 				}
 
 				/* Try calling all queue members for 'timeout' seconds */
-				res = try_calling(&qe, args.options, args.announceoverride, args.url, &go_on);
+				res = try_calling(&qe, args.options, args.announceoverride, args.url, &go_on, args.agi);
 
 				if (res) {
 					if (res < 0) {
@@ -3363,6 +3470,10 @@
 			autofill_default = 0;
 			if ((general_val = ast_variable_retrieve(cfg, "general", "autofill")))
 				autofill_default = ast_true(general_val);
+			montype_default = 0;
+			if ((general_val = ast_variable_retrieve(cfg, "general", "monitor-type")))
+				if (!strcasecmp(general_val, "mixmonitor"))
+					montype_default = 1;
 		} else {	/* Define queue */
 			/* Look for an existing one */
 			AST_LIST_TRAVERSE(&queues, q, list) {
@@ -3716,12 +3827,13 @@
 		}
 		ast_mutex_unlock(&q->lock);
 	}
-	AST_LIST_UNLOCK(&queues);
 
 	astman_append(s,
 		"Event: QueueStatusComplete\r\n"
 		"%s"
 		"\r\n",idText);
+
+	AST_LIST_UNLOCK(&queues);
 
 
 	return RESULT_SUCCESS;

Modified: team/group/new_loader_completion/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_voicemail.c?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_voicemail.c (original)
+++ team/group/new_loader_completion/apps/app_voicemail.c Mon May  8 09:58:44 2006
@@ -37,6 +37,8 @@
  * 07-11-2005 : An issue with voicemail synchronization has been fixed by GDS Partners (www.gdspartners.com)
  *				 Stojan Sljivic <stojan.sljivic at gdspartners.com>
  *
+ * 12-04-2006 : Support for Polish added by DIR (www.dir.pl)
+ *				 Bartosz Supczinski <Bartosz.Supczinski at dir.pl>
  */
 
 #include <stdlib.h>
@@ -120,7 +122,7 @@
 #define VM_DELETE		(1 << 12)
 #define VM_ALLOCED		(1 << 13)
 #define VM_SEARCH		(1 << 14)
-
+#define VM_TEMPGREETWARN	(1 << 15)	/*!< Remind user tempgreeting is set */
 #define ERROR_LOCK_PATH		-100
 
 enum {
@@ -161,6 +163,7 @@
 	\arg \b fr - French
 	\arg \b it = Italian
 	\arg \b nl - Dutch
+	\arg \b pt - Polish
 	\arg \b pt - Portuguese
 	\arg \b gr - Greek
 	\arg \b no - Norwegian
@@ -179,6 +182,16 @@
 NB these are plural:
 \arg \b vm-INBOX	nieuwe (nl)
 \arg \b vm-Old		oude (nl)
+
+Polish uses:
+\arg \b vm-new-a	'new', feminine singular accusative
+\arg \b vm-new-e	'new', feminine plural accusative
+\arg \b vm-new-ych	'new', feminine plural genitive
+\arg \b vm-old-a	'old', feminine singular accusative
+\arg \b vm-old-e	'old', feminine plural accusative
+\arg \b vm-old-ych	'old', feminine plural genitive
+\arg \b digits/1-a	'one', not always same as 'digits/1'
+\arg \b digits/2-ie	'two', not always same as 'digits/2'
 
 Swedish uses:
 \arg \b vm-nytt		singular of 'new'
@@ -466,7 +479,9 @@
 	} else if (!strcasecmp(var,"sendvoicemail")){
 		ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);	
 	} else if (!strcasecmp(var, "review")){
-		ast_set2_flag(vmu, ast_true(value), VM_REVIEW);	
+		ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
+	} else if (!strcasecmp(var, "tempgreetwarn")){
+		ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);	
 	} else if (!strcasecmp(var, "operator")){
 		ast_set2_flag(vmu, ast_true(value), VM_OPERATOR);	
 	} else if (!strcasecmp(var, "envelope")){
@@ -3685,10 +3700,12 @@
 #endif
 	if (the_zone)
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
-       else if(!strcasecmp(chan->language,"se"))       /* SWEDISH syntax */
-               res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL);
-       else if(!strcasecmp(chan->language,"no"))       /* NORWEGIAN syntax */
-               res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
+	else if(!strcasecmp(chan->language,"pl"))	/* POLISH syntax */
+		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL);
+	else if(!strcasecmp(chan->language,"se"))       /* SWEDISH syntax */
+		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL);
+	else if(!strcasecmp(chan->language,"no"))       /* NORWEGIAN syntax */
+		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
 	else if(!strcasecmp(chan->language,"de"))	/* GERMAN syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
 	else if (!strcasecmp(chan->language,"nl"))	/* DUTCH syntax */
@@ -3785,9 +3802,37 @@
 
 	ast_log(LOG_DEBUG, "VM-Duration: duration is: %d seconds converted to: %d minutes\n", durations, durationm);
 
-	if((!res)&&(durationm>=minduration)) {
-		res = ast_say_number(chan, durationm, AST_DIGIT_ANY, chan->language, (char *) NULL);
-		res = wait_file2(chan, vms, "vm-minutes");
+	if ((!res) && (durationm >= minduration)) {
+		res = wait_file2(chan, vms, "vm-duration");
+
+		/* POLISH syntax */
+		if (!strcasecmp(chan->language, "pl")) {
+			div_t num = div(durationm, 10);
+
+			if (durationm == 1) {
+				res = ast_play_and_wait(chan, "digits/1z");
+				res = res ? res : ast_play_and_wait(chan, "vm-minute-ta");
+			} else if (num.rem > 1 && num.rem < 5 && num.quot != 1) {
+				if (num.rem == 2) {
+					if (!num.quot) {
+						res = ast_play_and_wait(chan, "digits/2-ie");
+					} else {
+						res = say_and_wait(chan, durationm - 2 , chan->language);
+						res = res ? res : ast_play_and_wait(chan, "digits/2-ie");
+					}
+				} else {
+					res = say_and_wait(chan, durationm, chan->language);
+				}
+				res = res ? res : ast_play_and_wait(chan, "vm-minute-ty");
+			} else {
+				res = say_and_wait(chan, durationm, chan->language);
+				res = res ? res : ast_play_and_wait(chan, "vm-minute-t");
+			}
+		/* DEFAULT syntax */
+		} else {
+			res = ast_say_number(chan, durationm, AST_DIGIT_ANY, chan->language, NULL);
+			res = wait_file2(chan, vms, "vm-minutes");
+		}
 	}
 	return res;
 }
@@ -3807,21 +3852,45 @@
 	else if (vms->curmsg == vms->lastmsg)
 		res = wait_file2(chan, vms, "vm-last");		/* "last" */
 	if (!res) {
-               if (!strcasecmp(chan->language, "se")) {             /* SWEDISH syntax */
-                       res = wait_file2(chan, vms, "vm-meddelandet");  /* "message" */
-               }
-               else {
-                       res = wait_file2(chan, vms, "vm-message");      /* "message" */
-               }
-		if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+		/* POLISH syntax */
+		if (!strcasecmp(chan->language, "pl")) { 
+			if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+				int ten, one;
+				char nextmsg[256];
+				ten = (vms->curmsg + 1) / 10;
+				one = (vms->curmsg + 1) % 10;
+				
+				if (vms->curmsg < 20) {
+					snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", vms->curmsg + 1);
+					res = wait_file2(chan, vms, nextmsg);
+				} else {
+					snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", ten * 10);
+					res = wait_file2(chan, vms, nextmsg);
+					if (one > 0) {
+						if (!res) {
+							snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", one);
+							res = wait_file2(chan, vms, nextmsg);
+						}
+					}
+				}
+			}
 			if (!res)
-				res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, (char *) NULL);
+				res = wait_file2(chan, vms, "vm-message");
+		} else {
+			if (!strcasecmp(chan->language, "se")) /* SWEDISH syntax */
+				res = wait_file2(chan, vms, "vm-meddelandet");  /* "message" */
+			else /* DEFAULT syntax */
+				res = wait_file2(chan, vms, "vm-message");
+			if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+				if (!res)
+					res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, NULL);
+			}
 		}
 	}
 
 	/* Retrieve info from VM attribute file */
 	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg);
-	snprintf(filename,sizeof(filename), "%s.txt", vms->fn2);
+	snprintf(filename, sizeof(filename), "%s.txt", vms->fn2);
 	RETRIEVE(vms->curdir, vms->curmsg);
 	msg_cfg = ast_config_load(filename);
 	if (!msg_cfg) {
@@ -3977,14 +4046,26 @@
 
 	if (!strcasecmp(mbox, "vm-INBOX") || !strcasecmp(mbox, "vm-Old")){
 		cmd = ast_play_and_wait(chan, buf); /* "NEA / PALIA" */
-		if (cmd)
-		return cmd;
-		return ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
+		return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
 	} else {
 		cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
-	  	if (cmd)
-			return cmd;
-	  	return ast_play_and_wait(chan, mbox); /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
+	  	return cmd ? cmd : ast_play_and_wait(chan, mbox); /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
+	}
+}
+
+static int vm_play_folder_name_pl(struct ast_channel *chan, char *mbox)
+{
+	int cmd;
+
+	if (!strcasecmp(mbox, "vm-INBOX") || !strcasecmp(mbox, "vm-Old")) {
+		if (!strcasecmp(mbox, "vm-INBOX"))
+			cmd = ast_play_and_wait(chan, "vm-new-e");
+		else
+			cmd = ast_play_and_wait(chan, "vm-old-e");
+		return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");
+	} else {
+		cmd = ast_play_and_wait(chan, "vm-messages");
+	  	return cmd ? cmd : ast_play_and_wait(chan, mbox);
 	}
 }
 
@@ -3994,16 +4075,14 @@
 
 	if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "fr") || !strcasecmp(chan->language, "pt")) { /* Italian, Spanish, French or Portuguese syntax */
 		cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages */
-		if (cmd)
-			return cmd;
-		return ast_play_and_wait(chan, mbox);
+		return cmd ? cmd : ast_play_and_wait(chan, mbox);
 	} else if (!strcasecmp(chan->language, "gr")){
 		return vm_play_folder_name_gr(chan, mbox);
+	} else if (!strcasecmp(chan->language, "pl")){
+		return vm_play_folder_name_pl(chan, mbox);
 	} else {  /* Default English */
 		cmd = ast_play_and_wait(chan, mbox);
-		if (cmd)
-			return cmd;
-		return ast_play_and_wait(chan, "vm-messages"); /* "messages */
+		return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages */
 	}
 }
 
@@ -4057,10 +4136,11 @@
 }
 	
 /* Default English syntax */
-static int vm_intro_en(struct ast_channel *chan,struct vm_state *vms)
-{
+static int vm_intro_en(struct ast_channel *chan, struct vm_state *vms)
+{
+	int res;
+
 	/* Introduce messages they have */
-	int res;
 	res = ast_play_and_wait(chan, "vm-youhave");
 	if (!res) {
 		if (vms->newmessages) {
@@ -4134,6 +4214,77 @@
 	return res ? -1 : 0;
 }
 
+/* POLISH syntax */
+static int vm_intro_pl(struct ast_channel *chan, struct vm_state *vms)
+{
+	/* Introduce messages they have */
+	int res;
+	div_t num;
+
+	if (!vms->oldmessages && !vms->newmessages) {
+		res = ast_play_and_wait(chan, "vm-no");
+		res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		return res;
+	} else {
+		res = ast_play_and_wait(chan, "vm-youhave");
+	}
+
+	if (vms->newmessages) {
+		num = div(vms->newmessages, 10);
+		if (vms->newmessages == 1) {
+			res = ast_play_and_wait(chan, "digits/1-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-new-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-message");
+		} else if (num.rem > 1 && num.rem < 5 && num.quot != 1) {
+			if (num.rem == 2) {
+				if (!num.quot) {
+					res = ast_play_and_wait(chan, "digits/2-ie");
+				} else {
+					res = say_and_wait(chan, vms->newmessages - 2 , chan->language);
+					res = res ? res : ast_play_and_wait(chan, "digits/2-ie");
+				}
+			} else {
+				res = say_and_wait(chan, vms->newmessages, chan->language);
+			}
+			res = res ? res : ast_play_and_wait(chan, "vm-new-e");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		} else {
+			res = say_and_wait(chan, vms->newmessages, chan->language);
+			res = res ? res : ast_play_and_wait(chan, "vm-new-ych");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		}
+		if (!res && vms->oldmessages)
+			res = ast_play_and_wait(chan, "vm-and");
+	}
+	if (!res && vms->oldmessages) {
+		num = div(vms->oldmessages, 10);
+		if (vms->oldmessages == 1) {
+			res = ast_play_and_wait(chan, "digits/1-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-old-a");
+			res = res ? res : ast_play_and_wait(chan, "vm-message");
+		} else if (num.rem > 1 && num.rem < 5 && num.quot != 1) {
+			if (num.rem == 2) {
+				if (!num.quot) {
+					res = ast_play_and_wait(chan, "digits/2-ie");
+				} else {
+					res = say_and_wait(chan, vms->oldmessages - 2 , chan->language);
+					res = res ? res : ast_play_and_wait(chan, "digits/2-ie");
+				}
+			} else {
+				res = say_and_wait(chan, vms->oldmessages, chan->language);
+			}
+			res = res ? res : ast_play_and_wait(chan, "vm-old-e");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		} else {
+			res = say_and_wait(chan, vms->oldmessages, chan->language);
+			res = res ? res : ast_play_and_wait(chan, "vm-old-ych");
+			res = res ? res : ast_play_and_wait(chan, "vm-messages");
+		}
+	}
+
+	return res;
+}
+
 /* SWEDISH syntax */
 static int vm_intro_se(struct ast_channel *chan, struct vm_state *vms)
 {
@@ -4615,8 +4766,17 @@
 }
 
 
-static int vm_intro(struct ast_channel *chan,struct vm_state *vms)
-{
+static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)
+{
+	char prefile[256];
+	
+	/* Notify the user that the temp greeting is set and give them the option to remove it */
+	snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
+	if (ast_test_flag(vmu, VM_TEMPGREETWARN)) {
+		if (ast_fileexists(prefile, NULL, NULL) > 0)
+			ast_play_and_wait(chan, "vm-tempgreetactive");
+	}
+
 	/* Play voicemail intro - syntax is different for different languages */
 	if (!strcasecmp(chan->language, "de")) {	/* GERMAN syntax */
 		return vm_intro_de(chan, vms);
@@ -4634,6 +4794,8 @@
 		return vm_intro_cz(chan, vms);
 	} else if (!strcasecmp(chan->language, "gr")) {	/* GREEK syntax */
 		return vm_intro_gr(chan, vms);
+	} else if (!strcasecmp(chan->language, "pl")) {	/* POLISH syntax */
+		return vm_intro_pl(chan, vms);
 	} else if (!strcasecmp(chan->language, "se")) {	/* SWEDISH syntax */
 		return vm_intro_se(chan, vms);
 	} else if (!strcasecmp(chan->language, "no")) {	/* NORWEGIAN syntax */
@@ -5342,7 +5504,7 @@
 	if (play_auto) {
 		cmd = '1';
 	} else {
-		cmd = vm_intro(chan, &vms);
+		cmd = vm_intro(chan, vmu, &vms);
 	}
 
 	vms.repeats = 0;
@@ -5997,6 +6159,7 @@
 	char *send_voicemail;
 	char *astcallop;
 	char *astreview;
+	char *asttempgreetwarn;
 	char *astskipcmd;
 	char *asthearenv;
 	char *astsaydurationinfo;
@@ -6207,6 +6370,15 @@
 			astreview = "no";
 		}
 		ast_set2_flag((&globalflags), ast_true(astreview), VM_REVIEW);	
+
+		/*Temperary greeting reminder */
+		if (!(asttempgreetwarn = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
+			ast_log(LOG_DEBUG, "VM Temperary Greeting Reminder Option disabled globally\n");
+			asttempgreetwarn = "no";
+		} else {
+			ast_log(LOG_DEBUG, "VM Temperary Greeting Reminder Option enabled globally\n");
+		}
+		ast_set2_flag((&globalflags), ast_true(asttempgreetwarn), VM_TEMPGREETWARN);
 
 		if (!(astcallop = ast_variable_retrieve(cfg, "general", "operator"))){
 			ast_log(LOG_DEBUG,"VM Operator break disabled globally\n");

Modified: team/group/new_loader_completion/apps/app_while.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_while.c?rev=25569&r1=25568&r2=25569&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_while.c (original)
+++ team/group/new_loader_completion/apps/app_while.c Mon May  8 09:58:44 2006
@@ -18,7 +18,7 @@
 
 /*! \file
  *
- * \brief While Loop and ExecIf Implementations
+ * \brief While Loop Implementation
  *
  * \author Anthony Minessale <anthmct at yahoo.com>
  * 
@@ -47,14 +47,6 @@
 #define ALL_DONE(u,ret) {ast_module_user_remove(u); return ret;}
 
 
-static char *exec_app = "ExecIf";

[... 3032 lines stripped ...]


More information about the asterisk-commits mailing list