[asterisk-commits] jpeeler: branch jpeeler/chan_dahdi r121681 - in /team/jpeeler/chan_dahdi: ./ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 10 15:37:46 CDT 2008


Author: jpeeler
Date: Tue Jun 10 15:37:46 2008
New Revision: 121681

URL: http://svn.digium.com/view/asterisk?view=rev&rev=121681
Log:
sync with trunk

Added:
    team/jpeeler/chan_dahdi/configs/ais.conf.sample
      - copied unchanged from r121649, trunk/configs/ais.conf.sample
    team/jpeeler/chan_dahdi/doc/distributed_devstate.txt
      - copied unchanged from r121649, trunk/doc/distributed_devstate.txt
    team/jpeeler/chan_dahdi/res/ais/
      - copied from r121649, trunk/res/ais/
    team/jpeeler/chan_dahdi/res/ais/ais.h
      - copied unchanged from r121649, trunk/res/ais/ais.h
    team/jpeeler/chan_dahdi/res/ais/amf.c
      - copied unchanged from r121649, trunk/res/ais/amf.c
    team/jpeeler/chan_dahdi/res/ais/ckpt.c
      - copied unchanged from r121649, trunk/res/ais/ckpt.c
    team/jpeeler/chan_dahdi/res/ais/clm.c
      - copied unchanged from r121649, trunk/res/ais/clm.c
    team/jpeeler/chan_dahdi/res/ais/evt.c
      - copied unchanged from r121649, trunk/res/ais/evt.c
    team/jpeeler/chan_dahdi/res/ais/lck.c
      - copied unchanged from r121649, trunk/res/ais/lck.c
    team/jpeeler/chan_dahdi/res/res_ais.c
      - copied unchanged from r121649, trunk/res/res_ais.c
Removed:
    team/jpeeler/chan_dahdi/configs/pbx_realtime.conf
Modified:
    team/jpeeler/chan_dahdi/   (props changed)
    team/jpeeler/chan_dahdi/CHANGES
    team/jpeeler/chan_dahdi/Makefile
    team/jpeeler/chan_dahdi/UPGRADE.txt
    team/jpeeler/chan_dahdi/apps/app_chanisavail.c
    team/jpeeler/chan_dahdi/apps/app_channelredirect.c
    team/jpeeler/chan_dahdi/apps/app_dial.c
    team/jpeeler/chan_dahdi/apps/app_disa.c
    team/jpeeler/chan_dahdi/apps/app_exec.c
    team/jpeeler/chan_dahdi/apps/app_meetme.c
    team/jpeeler/chan_dahdi/apps/app_parkandannounce.c
    team/jpeeler/chan_dahdi/apps/app_privacy.c
    team/jpeeler/chan_dahdi/apps/app_queue.c
    team/jpeeler/chan_dahdi/apps/app_stack.c
    team/jpeeler/chan_dahdi/apps/app_voicemail.c
    team/jpeeler/chan_dahdi/build_tools/menuselect-deps.in
    team/jpeeler/chan_dahdi/channels/chan_agent.c
    team/jpeeler/chan_dahdi/channels/chan_console.c
    team/jpeeler/chan_dahdi/channels/chan_gtalk.c
    team/jpeeler/chan_dahdi/channels/chan_iax2.c
    team/jpeeler/chan_dahdi/channels/chan_jingle.c
    team/jpeeler/chan_dahdi/channels/chan_local.c
    team/jpeeler/chan_dahdi/channels/chan_sip.c
    team/jpeeler/chan_dahdi/channels/misdn/isdn_lib.c
    team/jpeeler/chan_dahdi/channels/misdn/isdn_lib.h
    team/jpeeler/chan_dahdi/codecs/codec_ilbc.c
    team/jpeeler/chan_dahdi/configs/dundi.conf.sample
    team/jpeeler/chan_dahdi/configs/res_pgsql.conf.sample
    team/jpeeler/chan_dahdi/configure.ac
    team/jpeeler/chan_dahdi/contrib/init.d/rc.debian.asterisk
    team/jpeeler/chan_dahdi/contrib/init.d/rc.gentoo.asterisk
    team/jpeeler/chan_dahdi/contrib/init.d/rc.mandrake.asterisk
    team/jpeeler/chan_dahdi/contrib/init.d/rc.redhat.asterisk
    team/jpeeler/chan_dahdi/contrib/init.d/rc.slackware.asterisk
    team/jpeeler/chan_dahdi/contrib/init.d/rc.suse.asterisk
    team/jpeeler/chan_dahdi/contrib/scripts/dbsep.cgi
    team/jpeeler/chan_dahdi/contrib/scripts/get_ilbc_source.sh
    team/jpeeler/chan_dahdi/contrib/scripts/safe_asterisk
    team/jpeeler/chan_dahdi/doc/tex/asterisk-conf.tex
    team/jpeeler/chan_dahdi/doc/tex/channelvariables.tex
    team/jpeeler/chan_dahdi/funcs/func_channel.c
    team/jpeeler/chan_dahdi/include/asterisk/agi.h
    team/jpeeler/chan_dahdi/include/asterisk/autoconfig.h.in
    team/jpeeler/chan_dahdi/include/asterisk/config.h
    team/jpeeler/chan_dahdi/include/asterisk/devicestate.h
    team/jpeeler/chan_dahdi/include/asterisk/dundi.h
    team/jpeeler/chan_dahdi/include/asterisk/event.h
    team/jpeeler/chan_dahdi/include/asterisk/event_defs.h
    team/jpeeler/chan_dahdi/include/asterisk/frame.h
    team/jpeeler/chan_dahdi/include/asterisk/lock.h
    team/jpeeler/chan_dahdi/include/asterisk/logger.h
    team/jpeeler/chan_dahdi/include/asterisk/options.h
    team/jpeeler/chan_dahdi/include/asterisk/res_odbc.h
    team/jpeeler/chan_dahdi/include/asterisk/rtp.h
    team/jpeeler/chan_dahdi/include/asterisk/utils.h
    team/jpeeler/chan_dahdi/main/asterisk.c
    team/jpeeler/chan_dahdi/main/autoservice.c
    team/jpeeler/chan_dahdi/main/channel.c
    team/jpeeler/chan_dahdi/main/config.c
    team/jpeeler/chan_dahdi/main/devicestate.c
    team/jpeeler/chan_dahdi/main/dsp.c
    team/jpeeler/chan_dahdi/main/event.c
    team/jpeeler/chan_dahdi/main/features.c
    team/jpeeler/chan_dahdi/main/loader.c
    team/jpeeler/chan_dahdi/main/logger.c
    team/jpeeler/chan_dahdi/main/manager.c
    team/jpeeler/chan_dahdi/main/netsock.c
    team/jpeeler/chan_dahdi/main/pbx.c
    team/jpeeler/chan_dahdi/main/rtp.c
    team/jpeeler/chan_dahdi/main/taskprocessor.c
    team/jpeeler/chan_dahdi/main/utils.c
    team/jpeeler/chan_dahdi/makeopts.in
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-ntest10
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-test1
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-test15
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-test18
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-test3
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-test5
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-test8
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-vtest13
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-vtest17
    team/jpeeler/chan_dahdi/pbx/ael/ael-test/ref.ael-vtest21
    team/jpeeler/chan_dahdi/pbx/dundi-parser.c
    team/jpeeler/chan_dahdi/pbx/dundi-parser.h
    team/jpeeler/chan_dahdi/pbx/pbx_config.c
    team/jpeeler/chan_dahdi/pbx/pbx_dundi.c
    team/jpeeler/chan_dahdi/pbx/pbx_loopback.c
    team/jpeeler/chan_dahdi/pbx/pbx_realtime.c
    team/jpeeler/chan_dahdi/res/Makefile
    team/jpeeler/chan_dahdi/res/ael/pval.c
    team/jpeeler/chan_dahdi/res/res_agi.c
    team/jpeeler/chan_dahdi/res/res_config_curl.c
    team/jpeeler/chan_dahdi/res/res_config_odbc.c
    team/jpeeler/chan_dahdi/res/res_config_pgsql.c
    team/jpeeler/chan_dahdi/res/res_jabber.c
    team/jpeeler/chan_dahdi/utils/ael_main.c
    team/jpeeler/chan_dahdi/utils/conf2ael.c

Propchange: team/jpeeler/chan_dahdi/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/jpeeler/chan_dahdi/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/jpeeler/chan_dahdi/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 10 15:37:46 2008
@@ -1,1 +1,1 @@
-/trunk:1-119068
+/trunk:1-121680

Modified: team/jpeeler/chan_dahdi/CHANGES
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/CHANGES?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/CHANGES (original)
+++ team/jpeeler/chan_dahdi/CHANGES Tue Jun 10 15:37:46 2008
@@ -1,6 +1,17 @@
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.0 to Asterisk 1.6.1  -------------
 ------------------------------------------------------------------------------
+
+Device State Handling
+---------------------
+ * The event infrastructure in Asterisk got another big update to help support
+    distributed events.  It currently supports distributed device state and
+    distributed Voicemail MWI (Message Waiting Indication).  A new module has
+    been merged, res_ais, which facilitates communicating events between servers.
+    It uses the SAForum AIS (Service Availability Forum Application Interface
+    Specification) CLM (Cluster Management) and EVT (Event) services to maintain
+    a cluster of Asterisk servers, and to share events between them.  For more
+    information on setting this up, see doc/distributed_devstate.txt.
 
 Dialplan Functions
 ------------------
@@ -17,10 +28,12 @@
  * TIMEOUT() has been modified to be accurate down to the millisecond.
  * ENUM*() functions now include the following new options:
      - 'u' returns the full URI and does not strip off the URI-scheme.
-	 - 's' triggers ISN specific rewriting
-	 - 'i' looks for branches into an Infrastructure ENUM tree
-	 - 'd' for a direct DNS lookup without any flipping of digits.
+     - 's' triggers ISN specific rewriting
+     - 'i' looks for branches into an Infrastructure ENUM tree
+     - 'd' for a direct DNS lookup without any flipping of digits.
  * TXCIDNAME() has a new zone-suffix parameter (which defaults to 'e164.arpa')
+ * CHANNEL() now has options for the maximum, minimum, and standard or normal
+   deviation of jitter, rtt, and loss for a call using chan_sip.
 
 Zaptel channel driver (chan_zap) Changes
 ----------------------------------------
@@ -77,6 +90,9 @@
    complete documentation.
  * ChanIsAvail has a new option, 'a', which will return all available channels instead
    of just the first one if you give the function more then one channel to check.
+ * PrivacyManager now takes an option where you can specify a context where the 
+   given number will be matched. This way you have more control over who is allowed
+   and it stops the people who blindly enter 10 digits.
 
 SIP Changes
 -----------
@@ -98,6 +114,7 @@
  * Added support for T140 RED - redundancy in T.140 to prevent text loss due to
    lost packets.
  * Added t38pt_usertpsource option. See sip.conf.sample for details.
+ * Added SIPnotify AMI command, for sending arbitrary SIP notify commands.
 
 IAX Changes
 -----------
@@ -110,9 +127,9 @@
      which shows which configuration files are in use.
   * New CLI commands, "pri show version" and "ss7 show version" that will
      display which version of libpri and libss7 are being used, respectively.
-	 A new API call was added so trunk will now have to be compiled against
-	 a versions of libpri and libss7 that have them or it will not know that
-	 these libraries exist.
+     A new API call was added so trunk will now have to be compiled against
+     a versions of libpri and libss7 that have them or it will not know that
+     these libraries exist.
 
 DNS manager changes
 -------------------
@@ -437,10 +454,10 @@
      a web interface of some kind).
   * Added the support for marking messages as "urgent." There are two methods to accomplish
      this. One is to pass the 'U' option to VoiceMail(). Another way to mark a message as urgent
-	 is to specify "review=yes" in voicemail.conf. Doing this will cause allow the user to mark
-	 the message as urgent after he has recorded a voicemail by following the voice instructions.
-	When listening to voicemails using VoiceMailMain urgent messages will be presented before other
-	 messages
+     is to specify "review=yes" in voicemail.conf. Doing this will cause allow the user to mark
+     the message as urgent after he has recorded a voicemail by following the voice instructions.
+    When listening to voicemails using VoiceMailMain urgent messages will be presented before other
+     messages
 
 Queue changes
 -------------
@@ -474,13 +491,18 @@
     device state reported.
   * New configuration option: randomperiodicannounce. If a list of periodic announcements is
     specified by the periodic-announce option, then one will be chosen randomly when it is time
-	to play a periodic announcment
+    to play a periodic announcment
   * New configuration options: announce-position now takes two more values in addition to "yes" and
     "no." Two new options, "limit" and "more," are allowed. These are tied to another option,
-	announce-position-limit. By setting announce-position to "limit" callers will only have their
-	position announced if their position is less than what is specified by announce-position-limit.
-	If announce-position is set to "more" then callers beyond the position specified by announce-position-limit
-	will be told that their are more than announce-position-limit callers waiting.
+    announce-position-limit. By setting announce-position to "limit" callers will only have their
+    position announced if their position is less than what is specified by announce-position-limit.
+    If announce-position is set to "more" then callers beyond the position specified by announce-position-limit
+    will be told that their are more than announce-position-limit callers waiting.
+  * Two new queue log events have been added. An ADDMEMBER event will be logged
+    when a realtime queue member is added and a REMOVEMEMBER event will be logged
+    when a realtime queue member is removed. Since there is no calling channel associated
+    with these events, the string "REALTIME" is placed where the channel's unique id
+    is typically placed.
 
 MeetMe Changes
 --------------
@@ -623,6 +645,9 @@
 -----------
   * Added SPEECH commands for speech recognition. A complete listing can be found
      using agi show.
+  * If app_stack is loaded, GOSUB is a native AGI command that may be used to
+    invoke subroutines in the dialplan.  Note that calling EXEC with Gosub
+    does not behave as expected; the native command needs to be used, instead.
 
 Logger changes
 --------------
@@ -747,7 +772,7 @@
   * iLBC source code no longer included (see UPGRADE.txt for details)
   * If compiled with DETECT_DEADLOCKS enabled and if you have glibc, then if 
      deadlock is detected, a backtrace of the stack which led to the lock calls
-	 will be output to the CLI.
+     will be output to the CLI.
   * If compiled with DEBUG_THREADS enabled and if you have glibc, then issuing
      the "core show locks" CLI command will give lock information output as well
-	 as a backtrace of the stack which led to the lock calls.
+     as a backtrace of the stack which led to the lock calls.

Modified: team/jpeeler/chan_dahdi/Makefile
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/Makefile?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/Makefile (original)
+++ team/jpeeler/chan_dahdi/Makefile Tue Jun 10 15:37:46 2008
@@ -688,6 +688,11 @@
 		echo ";astctlowner = root" ; \
 		echo ";astctlgroup = apache" ; \
 		echo ";astctl = asterisk.ctl" ; \
+		echo "" ; \
+		echo "[compat]" ; \
+		echo "pbx_realtime=1.6" ; \
+		echo "res_agi=1.6" ; \
+		echo "app_set=1.6" ; \
 		) > $(DESTDIR)$(ASTCONFPATH) ; \
 	else \
 		echo "Skipping asterisk.conf creation"; \

Modified: team/jpeeler/chan_dahdi/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/UPGRADE.txt?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/UPGRADE.txt (original)
+++ team/jpeeler/chan_dahdi/UPGRADE.txt Tue Jun 10 15:37:46 2008
@@ -47,7 +47,14 @@
   remove the obscene level of backslashing that was necessary for the dialplan
   to work correctly in 1.4 and previous versions.  This should make writing
   dialplans less painful in the future, albeit with the pain of a one-time
-  conversion.
+  conversion.  If you would like to avoid this conversion immediately, set
+  pbx_realtime=1.4 in the [compat] section of asterisk.conf.  After
+  transitioning, set pbx_realtime=1.6 in the same section.
+
+* For the same purpose as above, you may set res_agi=1.4 in the [compat]
+  section of asterisk.conf to continue to use the '|' delimiter in the EXEC
+  arguments of AGI applications.  After converting to use the ',' delimiter,
+  change this option to res_agi=1.6.
 
 * The logger.conf option 'rotatetimestamp' has been deprecated in favor of
   'rotatestrategy'.  This new option supports a 'rotate' strategy that more
@@ -120,6 +127,13 @@
   correctly set up, it now is dependent on app_voicemail being compiled as well.
 * The arguments in ExecIf changed a bit, to be more like other applications.
   The syntax is now ExecIf(<cond>?appiftrue(args):appiffalse(args)).
+* The behavior of the Set application now depends upon a compatibility option,
+  set in asterisk.conf.  To use the old 1.4 behavior, which allowed Set to take
+  multiple key/value pairs, set app_set=1.4 in [compat] in asterisk.conf.  To
+  use the new behavior, which permits variables to be set with embedded commas,
+  set app_set=1.6 in [compat] in asterisk.conf.  Note that you can have both
+  behaviors at the same time, if you switch to using MSet if you want the old
+  behavior.
 
 Dialplan Functions:
 

Modified: team/jpeeler/chan_dahdi/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_chanisavail.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_chanisavail.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_chanisavail.c Tue Jun 10 15:37:46 2008
@@ -165,7 +165,8 @@
 
 static int load_module(void)
 {
-	return ast_register_application(app, chanavail_exec, synopsis, descrip);
+	return ast_register_application(app, chanavail_exec, synopsis, descrip) ?
+		AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Check channel availability");

Modified: team/jpeeler/chan_dahdi/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_channelredirect.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_channelredirect.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_channelredirect.c Tue Jun 10 15:37:46 2008
@@ -89,7 +89,8 @@
 
 static int load_module(void)
 {
-	return ast_register_application(app, asyncgoto_exec, synopsis, descrip);
+	return ast_register_application(app, asyncgoto_exec, synopsis, descrip) ?
+		AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Redirects a given channel to a dialplan target");

Modified: team/jpeeler/chan_dahdi/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_dial.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_dial.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_dial.c Tue Jun 10 15:37:46 2008
@@ -225,7 +225,7 @@
 "  RetryDial(announce,sleep,retries,dialargs): This application will attempt to\n"
 "place a call using the normal Dial application. If no channel can be reached,\n"
 "the 'announce' file will be played. Then, it will wait 'sleep' number of\n"
-"seconds before retying the call. After 'retires' number of attempts, the\n"
+"seconds before retrying the call. After 'retries' number of attempts, the\n"
 "calling channel will continue at the next priority in the dialplan. If the\n"
 "'retries' setting is set to 0, this application will retry endlessly.\n"
 "  While waiting to retry a call, a 1 digit extension may be dialed. If that\n"
@@ -1776,13 +1776,13 @@
 				ast_copy_string(peer->exten, "s", sizeof(peer->exten));
 				peer->priority = 0;
 
-				gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], '|');
+				gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], ',');
 				if (gosub_argstart) {
 					*gosub_argstart = 0;
-					asprintf(&gosub_args, "%s|s|1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], gosub_argstart + 1);
-					*gosub_argstart = '|';
+					asprintf(&gosub_args, "%s,s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], gosub_argstart + 1);
+					*gosub_argstart = ',';
 				} else {
-					asprintf(&gosub_args, "%s|s|1", opt_args[OPT_ARG_CALLEE_GOSUB]);
+					asprintf(&gosub_args, "%s,s,1", opt_args[OPT_ARG_CALLEE_GOSUB]);
 				}
 
 				if (gosub_args) {

Modified: team/jpeeler/chan_dahdi/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_disa.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_disa.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_disa.c Tue Jun 10 15:37:46 2008
@@ -363,7 +363,8 @@
 
 static int load_module(void)
 {
-	return ast_register_application(app, disa_exec, synopsis, descrip);
+	return ast_register_application(app, disa_exec, synopsis, descrip) ?
+		AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "DISA (Direct Inward System Access) Application");

Modified: team/jpeeler/chan_dahdi/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_exec.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_exec.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_exec.c Tue Jun 10 15:37:46 2008
@@ -148,7 +148,7 @@
 static int execif_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	char *truedata = NULL, *falsedata = NULL, *end;
+	char *truedata = NULL, *falsedata = NULL, *end, *firstcomma, *firstquestion;
 	struct ast_app *app = NULL;
 	AST_DECLARE_APP_ARGS(expr,
 		AST_APP_ARG(expr);
@@ -160,24 +160,49 @@
 	);
 	char *parse = ast_strdupa(data);
 
-	AST_NONSTANDARD_APP_ARGS(expr, parse, '?');
-	if (ast_strlen_zero(expr.remainder)) {
-		ast_log(LOG_ERROR, "Usage: ExecIf(<expr>?<appiftrue>(<args>)[:<appiffalse>(<args)])\n");
-		return -1;
-	}
-
-	AST_NONSTANDARD_APP_ARGS(apps, expr.remainder, ':');
-
-	if (apps.t && (truedata = strchr(apps.t, '('))) {
-		*truedata++ = '\0';
-		if ((end = strrchr(truedata, ')')))
-			*end = '\0';
-	}
-
-	if (apps.f && (falsedata = strchr(apps.f, '('))) {
-		*falsedata++ = '\0';
-		if ((end = strrchr(falsedata, ')')))
-			*end = '\0';
+	firstcomma = strchr(parse, ',');
+	firstquestion = strchr(parse, '?');
+
+	if ((firstcomma != NULL && firstquestion != NULL && firstcomma < firstquestion) || (firstquestion == NULL)) {
+		/* Deprecated syntax */
+		AST_DECLARE_APP_ARGS(depr,
+			AST_APP_ARG(expr);
+			AST_APP_ARG(appname);
+			AST_APP_ARG(appargs);
+		);
+		AST_STANDARD_APP_ARGS(depr, parse);
+
+		ast_log(LOG_WARNING, "Deprecated syntax found.  Please upgrade to using ExecIf(<expr>?%s(%s))\n", depr.appname, depr.appargs);
+
+		/* Make the two syntaxes look the same */
+		expr.expr = depr.expr;
+		apps.t = depr.appname;
+		apps.f = NULL;
+		truedata = depr.appargs;
+	} else {
+		/* Preferred syntax */
+
+		AST_NONSTANDARD_APP_ARGS(expr, parse, '?');
+		if (ast_strlen_zero(expr.remainder)) {
+			ast_log(LOG_ERROR, "Usage: ExecIf(<expr>?<appiftrue>(<args>)[:<appiffalse>(<args)])\n");
+			return -1;
+		}
+
+		AST_NONSTANDARD_APP_ARGS(apps, expr.remainder, ':');
+
+		if (apps.t && (truedata = strchr(apps.t, '('))) {
+			*truedata++ = '\0';
+			if ((end = strrchr(truedata, ')'))) {
+				*end = '\0';
+			}
+		}
+
+		if (apps.f && (falsedata = strchr(apps.f, '('))) {
+			*falsedata++ = '\0';
+			if ((end = strrchr(falsedata, ')'))) {
+				*end = '\0';
+			}
+		}
 	}
 
 	if (pbx_checkcondition(expr.expr)) {

Modified: team/jpeeler/chan_dahdi/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_meetme.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_meetme.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_meetme.c Tue Jun 10 15:37:46 2008
@@ -1743,6 +1743,10 @@
 	if (rt_log_members) {
 		/* Update table */
 		snprintf(members, sizeof(members), "%d", conf->users);
+		ast_realtime_require_field("meetme",
+			"confno", strlen(conf->confno) > 7 ? RQ_UINTEGER4 : strlen(conf->confno) > 4 ? RQ_UINTEGER3 : RQ_UINTEGER2, strlen(conf->confno),
+			"members", RQ_UINTEGER1, strlen(members),
+			NULL);
 		ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL);
 	}
 	setusercount = 1;
@@ -2682,6 +2686,10 @@
 			if (rt_log_members) {
 				/* Update table */
 				snprintf(members, sizeof(members), "%d", conf->users);
+				ast_realtime_require_field("meetme",
+					"confno", strlen(conf->confno) > 7 ? RQ_UINTEGER4 : strlen(conf->confno) > 4 ? RQ_UINTEGER3 : RQ_UINTEGER2, strlen(conf->confno),
+					"members", RQ_UINTEGER1, strlen(members),
+					NULL);
 				ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL);
 			}
 			if (confflags & CONFFLAG_MARKEDUSER) 
@@ -5677,6 +5685,7 @@
 	sla_destroy();
 	
 	res |= ast_custom_function_unregister(&meetme_info_acf);
+	ast_unload_realtime("meetme");
 
 	return res;
 }
@@ -5707,12 +5716,14 @@
 	res |= ast_devstate_prov_add("SLA", sla_state);
 
 	res |= ast_custom_function_register(&meetme_info_acf);
+	ast_realtime_require_field("meetme", "confno", RQ_UINTEGER2, 3, "members", RQ_UINTEGER1, 3, NULL);
 
 	return res;
 }
 
 static int reload(void)
 {
+	ast_unload_realtime("meetme");
 	return load_config(1);
 }
 

Modified: team/jpeeler/chan_dahdi/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_parkandannounce.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_parkandannounce.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_parkandannounce.c Tue Jun 10 15:37:46 2008
@@ -144,9 +144,12 @@
 
 	ast_verb(4, "Announce Template:%s\n", args.template);
 
-	for (looptemp = 0, tmp[looptemp++] = strsep(&args.template, ":");
-		 looptemp < sizeof(tmp) / sizeof(tmp[0]);
-		 tmp[looptemp++] = strsep(&args.template, ":"));
+	for (looptemp = 0; looptemp < sizeof(tmp) / sizeof(tmp[0]); looptemp++) {
+		if ((tmp[looptemp] = strsep(&args.template, ":")) != NULL)
+			continue;
+		else
+			break;
+	}
 
 	for (i = 0; i < looptemp; i++) {
 		ast_verb(4, "Announce:%s\n", tmp[i]);

Modified: team/jpeeler/chan_dahdi/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_privacy.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_privacy.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_privacy.c Tue Jun 10 15:37:46 2008
@@ -46,13 +46,14 @@
 static char *synopsis = "Require phone number to be entered, if no CallerID sent";
 
 static char *descrip =
-  "  PrivacyManager([maxretries][,minlength]): If no Caller*ID \n"
+  "  PrivacyManager([maxretries][,minlength][,context]): If no Caller*ID \n"
   "is sent, PrivacyManager answers the channel and asks the caller to\n"
   "enter their phone number. The caller is given 'maxretries' attempts to do so.\n"
   "The application does nothing if Caller*ID was received on the channel.\n"
   "   maxretries  default 3  -maximum number of attempts the caller is allowed \n"
   "               to input a callerid.\n"
   "   minlength   default 10 -minimum allowable digits in the input callerid number.\n"
+  "   context     context to check the given Caller*ID against patterns.\n"
   "The application sets the following channel variable upon completion: \n"
   "PRIVACYMGRSTATUS  The status of the privacy manager's attempt to collect \n"
   "                  a phone number from the user. A text string that is either:\n" 
@@ -73,6 +74,7 @@
 		AST_APP_ARG(maxretries);
 		AST_APP_ARG(minlength);
 		AST_APP_ARG(options);
+		AST_APP_ARG(checkcontext);
 	);
 
 	if (!ast_strlen_zero(chan->cid.cid_num)) {
@@ -101,7 +103,6 @@
 				else
 					ast_log(LOG_WARNING, "Invalid min length argument\n");
 			}
-
 		}		
 
 		/* Play unidentified call */
@@ -125,9 +126,21 @@
 				break;
 
 			/* Make sure we get at least digits */
-			if (strlen(phone) >= minlength ) 
-				break;
-			else {
+			if (strlen(phone) >= minlength ) {
+				/* if we have a checkcontext argument, do pattern matching */
+				if (!ast_strlen_zero(args.checkcontext)) {
+					if (!ast_exists_extension(NULL, args.checkcontext, phone, 1, NULL)) {
+						res = ast_streamfile(chan, "privacy-incorrect", chan->language);
+						if (!res) {
+							res = ast_waitstream(chan, "");
+						}
+					} else {
+						break;
+					}
+				} else {
+					break;
+				}
+			} else {
 				res = ast_streamfile(chan, "privacy-incorrect", chan->language);
 				if (!res)
 					res = ast_waitstream(chan, "");

Modified: team/jpeeler/chan_dahdi/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_queue.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_queue.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_queue.c Tue Jun 10 15:37:46 2008
@@ -1358,6 +1358,7 @@
 			m->realtime = 1;
 			ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
 			add_to_interfaces(m->state_interface);
+			ast_queue_log(q->name, "REALTIME", m->interface, "ADDMEMBER", "%s", "");
 			ao2_link(q->members, m);
 			ao2_ref(m, -1);
 			m = NULL;
@@ -1542,6 +1543,7 @@
 	mem_iter = ao2_iterator_init(q->members, 0);
 	while ((m = ao2_iterator_next(&mem_iter))) {
 		if (m->dead) {
+			ast_queue_log(q->name, "REALTIME", m->interface, "REMOVEMEMBER", "%s", "");
 			ao2_unlink(q->members, m);
 			remove_from_interfaces(m->state_interface);
 			q->membercount--;
@@ -1649,6 +1651,7 @@
 	mem_iter = ao2_iterator_init(q->members, 0);
 	while ((m = ao2_iterator_next(&mem_iter))) {
 		if (m->dead) {
+			ast_queue_log(q->name, "REALTIME", m->interface, "REMOVEMEMBER", "%s", "");
 			ao2_unlink(q->members, m);
 			remove_from_interfaces(m->state_interface);
 			q->membercount--;
@@ -1678,9 +1681,9 @@
 	stat = get_member_status(q, qe->max_penalty, qe->min_penalty);
 	if (!q->joinempty && (stat == QUEUE_NO_MEMBERS))
 		*reason = QUEUE_JOINEMPTY;
-	else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS))
+	else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS || stat == QUEUE_NO_MEMBERS))
 		*reason = QUEUE_JOINUNAVAIL;
-	else if ((q->joinempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS))
+	else if ((q->joinempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_MEMBERS))
 		*reason = QUEUE_JOINUNAVAIL;
 	else if (q->maxlen && (q->count >= q->maxlen))
 		*reason = QUEUE_FULL;
@@ -5954,10 +5957,10 @@
 			if (!strncasecmp(word, m->membername, wordlen) && ++which > state) {
 				char *tmp;
 				ao2_unlock(q);
-				tmp = m->membername;
+				tmp = ast_strdup(m->interface);
 				ao2_ref(m, -1);
 				queue_unref(q);
-				return ast_strdup(tmp);
+				return tmp;
 			}
 			ao2_ref(m, -1);
 		}
@@ -6281,6 +6284,7 @@
 	}
 	ao2_ref(queues, -1);
 	devicestate_tps = ast_taskprocessor_unreference(devicestate_tps);
+	ast_unload_realtime("queue_members");
 	return res;
 }
 
@@ -6330,14 +6334,18 @@
 		ast_log(LOG_WARNING, "devicestate taskprocessor reference failed - devicestate notifications will not occur\n");
 	}
 
-	if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END)))
+	if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE_CHANGE, device_state_cb, NULL, AST_EVENT_IE_END))) {
 		res = -1;
+	}
+
+	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, NULL);
 
 	return res ? AST_MODULE_LOAD_DECLINE : 0;
 }
 
 static int reload(void)
 {
+	ast_unload_realtime("queue_members");
 	reload_queues(1);
 	return 0;
 }

Modified: team/jpeeler/chan_dahdi/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_stack.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_stack.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_stack.c Tue Jun 10 15:37:46 2008
@@ -34,6 +34,9 @@
 #include "asterisk/app.h"
 #include "asterisk/manager.h"
 #include "asterisk/channel.h"
+#include "asterisk/agi.h"
+
+static int agi_loaded = 0;
 
 static const char *app_gosub = "Gosub";
 static const char *app_gosubif = "GosubIf";
@@ -61,7 +64,6 @@
 "  StackPop():\n"
 "Removes last label on the stack, discarding it.\n";
 
-
 static void gosub_free(void *data);
 
 static struct ast_datastore_info stack_info = {
@@ -234,7 +236,7 @@
 	);
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_ERROR, "%s requires an argument: %s([[context|]exten|]priority[(arg1[|...][|argN])])\n", app_gosub, app_gosub);
+		ast_log(LOG_ERROR, "%s requires an argument: %s([[context,]exten,]priority[(arg1[,...][,argN])])\n", app_gosub, app_gosub);
 		return -1;
 	}
 
@@ -394,8 +396,111 @@
 	.read = local_read,
 };
 
+static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+{
+	int old_priority, priority;
+	char old_context[AST_MAX_CONTEXT], old_extension[AST_MAX_EXTENSION];
+	struct ast_app *theapp;
+	char *gosub_args;
+
+	if (argc < 4 || argc > 5) {
+		return RESULT_SHOWUSAGE;
+	}
+
+	ast_debug(1, "Gosub called with %d arguments: 0:%s 1:%s 2:%s 3:%s 4:%s\n", argc, argv[0], argv[1], argv[2], argv[3], argc == 5 ? argv[4] : "");
+
+	if (sscanf(argv[3], "%d", &priority) != 1 || priority < 1) {
+		/* Lookup the priority label */
+		if ((priority = ast_findlabel_extension(chan, argv[1], argv[2], argv[3], chan->cid.cid_num)) < 0) {
+			ast_log(LOG_ERROR, "Priority '%s' not found in '%s@%s'\n", argv[3], argv[2], argv[1]);
+			ast_agi_fdprintf(chan, agi->fd, "200 result=-1 Gosub label not found\n");
+			return RESULT_FAILURE;
+		}
+	} else if (!ast_exists_extension(chan, argv[1], argv[2], priority, chan->cid.cid_num)) {
+		ast_agi_fdprintf(chan, agi->fd, "200 result=-1 Gosub label not found\n");
+		return RESULT_FAILURE;
+	}
+
+	/* Save previous location, since we're going to change it */
+	ast_copy_string(old_context, chan->context, sizeof(old_context));
+	ast_copy_string(old_extension, chan->exten, sizeof(old_extension));
+	old_priority = chan->priority;
+
+	if (!(theapp = pbx_findapp("Gosub"))) {
+		ast_log(LOG_ERROR, "Gosub() cannot be found in the list of loaded applications\n");
+		ast_agi_fdprintf(chan, agi->fd, "503 result=-2 Gosub is not loaded\n");
+		return RESULT_FAILURE;
+	}
+
+	/* Apparently, if you run ast_pbx_run on a channel that already has a pbx
+	 * structure, you need to add 1 to the priority to get it to go to the
+	 * right place.  But if it doesn't have a pbx structure, then leaving off
+	 * the 1 is the right thing to do.  See how this code differs when we
+	 * call a Gosub for the CALLEE channel in Dial or Queue.
+	 */
+	if (argc == 5) {
+		asprintf(&gosub_args, "%s,%s,%d(%s)", argv[1], argv[2], priority + 1, argv[4]);
+	} else {
+		asprintf(&gosub_args, "%s,%s,%d", argv[1], argv[2], priority + 1);
+	}
+
+	if (gosub_args) {
+		int res;
+
+		ast_debug(1, "Trying gosub with arguments '%s'\n", gosub_args);
+		ast_copy_string(chan->context, "app_stack_gosub_virtual_context", sizeof(chan->context));
+		ast_copy_string(chan->exten, "s", sizeof(chan->exten));
+		chan->priority = 0;
+
+		if ((res = pbx_exec(chan, theapp, gosub_args)) == 0) {
+			struct ast_pbx *pbx = chan->pbx;
+			/* Suppress warning about PBX already existing */
+			chan->pbx = NULL;
+			ast_agi_fdprintf(chan, agi->fd, "100 result=0 Trying...\n");
+			ast_pbx_run(chan);
+			ast_agi_fdprintf(chan, agi->fd, "200 result=0 Gosub complete\n");
+			if (chan->pbx) {
+				ast_free(chan->pbx);
+			}
+			chan->pbx = pbx;
+		} else {
+			ast_agi_fdprintf(chan, agi->fd, "200 result=%d Gosub failed\n", res);
+		}
+		ast_free(gosub_args);
+	} else {
+		ast_agi_fdprintf(chan, agi->fd, "503 result=-2 Memory allocation failure\n");
+		return RESULT_FAILURE;
+	}
+
+	/* Restore previous location */
+	ast_copy_string(chan->context, old_context, sizeof(chan->context));
+	ast_copy_string(chan->exten, old_extension, sizeof(chan->exten));
+	chan->priority = old_priority;
+
+	return RESULT_SUCCESS;
+}
+
+static char usage_gosub[] =
+" Usage: GOSUB <context> <extension> <priority> [<optional-argument>]\n"
+"   Cause the channel to execute the specified dialplan subroutine, returning\n"
+" to the dialplan with execution of a Return()\n";
+
+struct agi_command gosub_agi_command =
+	{ { "gosub", NULL }, handle_gosub, "Execute a dialplan subroutine", usage_gosub , 0 };
+
 static int unload_module(void)
 {
+	struct ast_context *con;
+
+	if (agi_loaded) {
+		ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
+
+		if ((con = ast_context_find("app_stack_gosub_virtual_context"))) {
+			ast_context_remove_extension2(con, "s", 1, NULL);
+			ast_context_destroy(con, "app_stack"); /* leave nothing behind */
+		}
+	}
+
 	ast_unregister_application(app_return);
 	ast_unregister_application(app_pop);
 	ast_unregister_application(app_gosubif);
@@ -407,6 +512,28 @@
 
 static int load_module(void)
 {
+	struct ast_context *con;
+
+	if (!ast_module_check("res_agi.so")) {
+		if (ast_load_resource("res_agi.so") == AST_MODULE_LOAD_SUCCESS) {
+			agi_loaded = 1;
+		}
+	} else {
+		agi_loaded = 1;
+	}
+
+	if (agi_loaded) {
+		con = ast_context_find_or_create(NULL, NULL, "app_stack_gosub_virtual_context", "app_stack");
+		if (!con) {
+			ast_log(LOG_ERROR, "Virtual context 'app_stack_gosub_virtual_context' does not exist and unable to create\n");
+			return AST_MODULE_LOAD_DECLINE;
+		} else {
+			ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_stack");
+		}
+
+		ast_agi_register(ast_module_info->self, &gosub_agi_command);
+	}
+
 	ast_register_application(app_pop, pop_exec, pop_synopsis, pop_descrip);
 	ast_register_application(app_return, return_exec, return_synopsis, return_descrip);
 	ast_register_application(app_gosubif, gosubif_exec, gosubif_synopsis, gosubif_descrip);

Modified: team/jpeeler/chan_dahdi/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_voicemail.c?view=diff&rev=121681&r1=121680&r2=121681
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_voicemail.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_voicemail.c Tue Jun 10 15:37:46 2008
@@ -928,6 +928,9 @@
 {
 	int res;
 	if (!ast_strlen_zero(vmu->uniqueid)) {
+		if (strlen(password) > 10) {
+			ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), NULL);
+		}
 		res = ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, NULL);
 		if (res > 0) {
 			ast_copy_string(vmu->password, password, sizeof(vmu->password));
@@ -9367,6 +9370,9 @@
 	int tmpadsi[4];
 	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 
+	ast_unload_realtime("voicemail");
+	ast_unload_realtime("voicemail_data");
+
 	if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
 		if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
 			return 0;
@@ -10050,6 +10056,8 @@
 		stop_poll_thread();
 
 	mwi_subscription_tps = ast_taskprocessor_unreference(mwi_subscription_tps);
+	ast_unload_realtime("voicemail");
+	ast_unload_realtime("voicemail_data");
 	return res;
 }
 
@@ -10081,6 +10089,8 @@
 	ast_cli_register_multiple(cli_voicemail, sizeof(cli_voicemail) / sizeof(struct ast_cli_entry));
 
 	ast_install_vm_functions(has_voicemail, inboxcount, messagecount, sayname);
+	ast_realtime_require_field("voicemail", "uniqueid", RQ_UINTEGER3, 11, "password", RQ_CHAR, 10, NULL);
+	ast_realtime_require_field("voicemail_data", "filename", RQ_CHAR, 30, "duration", RQ_UINTEGER3, 5, NULL);
 
 	return res;
 }

Modified: team/jpeeler/chan_dahdi/build_tools/menuselect-deps.in

[... 13318 lines stripped ...]



More information about the asterisk-commits mailing list