[asterisk-commits] branch oej/test-this-branch r19733 - in /team/oej/test-this-branch: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Apr 13 04:56:52 MST 2006


Author: oej
Date: Thu Apr 13 06:56:26 2006
New Revision: 19733

URL: http://svn.digium.com/view/asterisk?rev=19733&view=rev
Log:
Update to trunk

Modified:
    team/oej/test-this-branch/   (props changed)
    team/oej/test-this-branch/Makefile
    team/oej/test-this-branch/UPGRADE.txt
    team/oej/test-this-branch/acl.c
    team/oej/test-this-branch/apps/app_adsiprog.c
    team/oej/test-this-branch/apps/app_alarmreceiver.c
    team/oej/test-this-branch/apps/app_amd.c
    team/oej/test-this-branch/apps/app_authenticate.c
    team/oej/test-this-branch/apps/app_chanisavail.c
    team/oej/test-this-branch/apps/app_channelredirect.c
    team/oej/test-this-branch/apps/app_controlplayback.c
    team/oej/test-this-branch/apps/app_db.c
    team/oej/test-this-branch/apps/app_dial.c
    team/oej/test-this-branch/apps/app_directory.c
    team/oej/test-this-branch/apps/app_page.c
    team/oej/test-this-branch/apps/app_speech_utils.c
    team/oej/test-this-branch/apps/app_voicemail.c
    team/oej/test-this-branch/asterisk.c
    team/oej/test-this-branch/channel.c
    team/oej/test-this-branch/channels/chan_iax2.c
    team/oej/test-this-branch/channels/chan_sip.c
    team/oej/test-this-branch/channels/chan_skinny.c
    team/oej/test-this-branch/channels/misdn/isdn_lib.c
    team/oej/test-this-branch/configs/iax.conf.sample
    team/oej/test-this-branch/configs/modules.conf.sample
    team/oej/test-this-branch/doc/00README.1st
    team/oej/test-this-branch/doc/speechrec.txt
    team/oej/test-this-branch/formats/format_wav_gsm.c
    team/oej/test-this-branch/include/asterisk.h
    team/oej/test-this-branch/include/asterisk/compat.h
    team/oej/test-this-branch/include/asterisk/linkedlists.h
    team/oej/test-this-branch/include/asterisk/lock.h
    team/oej/test-this-branch/include/asterisk/module.h
    team/oej/test-this-branch/include/asterisk/speech.h
    team/oej/test-this-branch/loader.c
    team/oej/test-this-branch/manager.c
    team/oej/test-this-branch/pbx/pbx_config.c
    team/oej/test-this-branch/res/res_agi.c
    team/oej/test-this-branch/res/res_clioriginate.c
    team/oej/test-this-branch/res/res_config_odbc.c
    team/oej/test-this-branch/res/res_config_pgsql.c
    team/oej/test-this-branch/res/res_convert.c
    team/oej/test-this-branch/res/res_crypto.c
    team/oej/test-this-branch/res/res_speech.c
    team/oej/test-this-branch/translate.c
    team/oej/test-this-branch/utils.c
    team/oej/test-this-branch/utils/astman.c

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Apr 13 06:56:26 2006
@@ -1,1 +1,1 @@
-/trunk:1-19128
+/trunk:1-19732

Modified: team/oej/test-this-branch/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/Makefile?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/Makefile (original)
+++ team/oej/test-this-branch/Makefile Thu Apr 13 06:56:26 2006
@@ -676,7 +676,6 @@
 	if [ -n "$(OLDHEADERS)" ]; then \
 		rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
 	fi
-	rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
@@ -695,7 +694,6 @@
 	else \
 		echo "You need to do cvs update -d not just cvs update" ; \
 	fi 
-	( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
 	if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
 	@echo " +---- Asterisk Installation Complete -------+"  
 	@echo " +                                           +"

Modified: team/oej/test-this-branch/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/UPGRADE.txt?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/UPGRADE.txt (original)
+++ team/oej/test-this-branch/UPGRADE.txt Thu Apr 13 06:56:26 2006
@@ -35,6 +35,15 @@
   using indication tones, so typing in skip would give you unexpected results.
 
 * OSPAuth is added to authenticate OSP tokens in in_bound call setup messages.
+
+Manager:
+
+* After executing the 'status' manager action, the "Status" manager events
+  included the header "CallerID:" which was actually only the CallerID number,
+  and not the full CallerID string.  This header has been renamed to
+  "CallerIDNum".  For compatibility purposes, the CallerID parameter will remain
+  until after the release of 1.4, when it will be removed.  Please use the time
+  during the 1.4 release to make this transition.
 
 Variables:
 

Modified: team/oej/test-this-branch/acl.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/acl.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/acl.c (original)
+++ team/oej/test-this-branch/acl.c Thu Apr 13 06:56:26 2006
@@ -70,10 +70,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/srv.h"
 #include "asterisk/compat.h"
-
-#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
-AST_MUTEX_DEFINE_STATIC(routeseq_lock);
-#endif
 
 struct ast_ha {
 	/* Host access rule */

Modified: team/oej/test-this-branch/apps/app_adsiprog.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_adsiprog.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_adsiprog.c (original)
+++ team/oej/test-this-branch/apps/app_adsiprog.c Thu Apr 13 06:56:26 2006
@@ -48,8 +48,6 @@
 #include "asterisk/options.h"
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
-
-static char *tdesc = "Asterisk ADSI Programming Application";
 
 static char *app = "ADSIProg";
 
@@ -1588,7 +1586,7 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Asterisk ADSI Programming Application";
 }
 
 int usecount(void)
@@ -1598,7 +1596,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_alarmreceiver.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_alarmreceiver.c (original)
+++ team/oej/test-this-branch/apps/app_alarmreceiver.c Thu Apr 13 06:56:26 2006
@@ -67,8 +67,6 @@
 };
 
 typedef struct event_node event_node_t;
-
-static char *tdesc = "Alarm Receiver for Asterisk";
 
 static char *app = "AlarmReceiver";
 
@@ -839,7 +837,7 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Alarm Receiver for Asterisk";
 }
 
 int usecount(void)
@@ -849,7 +847,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_amd.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_amd.c (original)
+++ team/oej/test-this-branch/apps/app_amd.c Thu Apr 13 06:56:26 2006
@@ -35,7 +35,6 @@
 #include "asterisk/app.h"
 
 
-static char *tdesc = "Answering Machine Detection Application";
 static char *app = "AMD";
 static char *synopsis = "Attempts to detect answering machines";
 static char *descrip =
@@ -413,7 +412,7 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Answering Machine Detection Application";
 }
 
 int usecount(void)
@@ -423,7 +422,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_authenticate.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_authenticate.c (original)
+++ team/oej/test-this-branch/apps/app_authenticate.c Thu Apr 13 06:56:26 2006
@@ -62,7 +62,6 @@
 	AST_APP_OPTION('r', OPT_REMOVE),
 });
 
-static char *tdesc = "Authentication Application";
 
 static char *app = "Authenticate";
 
@@ -254,7 +253,7 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Authentication Application";
 }
 
 int usecount(void)
@@ -264,7 +263,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_chanisavail.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_chanisavail.c (original)
+++ team/oej/test-this-branch/apps/app_chanisavail.c Thu Apr 13 06:56:26 2006
@@ -47,8 +47,6 @@
 #include "asterisk/app.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/options.h"
-
-static char *tdesc = "Check channel availability";
 
 static char *app = "ChanIsAvail";
 
@@ -175,7 +173,7 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Check channel availability";
 }
 
 int usecount(void)
@@ -185,7 +183,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_channelredirect.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_channelredirect.c (original)
+++ team/oej/test-this-branch/apps/app_channelredirect.c Thu Apr 13 06:56:26 2006
@@ -41,7 +41,6 @@
 #include "asterisk/app.h"
 #include "asterisk/features.h"
 
-static char *tdesc = "Channel Redirect";
 static char *app = "ChannelRedirect";
 static char *synopsis = "Redirects given channel to a dialplan target.";
 static char *descrip = 
@@ -139,7 +138,7 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Channel Redirect";
 }
 
 int usecount(void)
@@ -151,7 +150,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_controlplayback.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_controlplayback.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_controlplayback.c (original)
+++ team/oej/test-this-branch/apps/app_controlplayback.c Thu Apr 13 06:56:26 2006
@@ -43,8 +43,6 @@
 #include "asterisk/translate.h"
 #include "asterisk/utils.h"
 #include "asterisk/options.h"
-
-static const char *tdesc = "Control Playback Application";
 
 static const char *app = "ControlPlayback";
 
@@ -174,7 +172,7 @@
 
 const char *description(void)
 {
-	return (char *) tdesc;
+	return "Control Playback Application";
 }
 
 int usecount(void)
@@ -185,7 +183,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_db.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_db.c (original)
+++ team/oej/test-this-branch/apps/app_db.c Thu Apr 13 06:56:26 2006
@@ -47,8 +47,6 @@
 #include "asterisk/astdb.h"
 #include "asterisk/lock.h"
 #include "asterisk/options.h"
-
-static char *tdesc = "Database Access Functions";
 
 static char *d_descrip =
 "  DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
@@ -169,7 +167,7 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Database Access Functions";
 }
 
 int usecount(void)
@@ -179,7 +177,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/oej/test-this-branch/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_dial.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_dial.c (original)
+++ team/oej/test-this-branch/apps/app_dial.c Thu Apr 13 06:56:26 2006
@@ -60,8 +60,6 @@
 #include "asterisk/manager.h"
 #include "asterisk/privacy.h"
 #include "asterisk/stringfields.h"
-
-static char *tdesc = "Dialing Application";
 
 static char *app = "Dial";
 
@@ -308,6 +306,8 @@
 		if (chan->cdr) \
 			ast_cdr_failed(chan->cdr); \
 		numnochan++; \
+		break; \
+	case AST_CAUSE_NORMAL_CLEARING: \
 		break; \
 	default: \
 		numnochan++; \
@@ -734,12 +734,12 @@
 
 static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags)
 {
-	int res=-1;
+	int res = -1;
 	struct localuser *u;
 	char *tech, *number, *rest, *cur;
 	char privcid[256];
 	char privintro[1024];
-	struct dial_localuser *outgoing=NULL, *tmp;
+	struct dial_localuser *outgoing = NULL, *tmp;
 	struct ast_channel *peer;
 	int to;
 	int numbusy = 0;
@@ -750,20 +750,20 @@
 	char cidname[AST_MAX_EXTENSION];
 	char toast[80];
 	char *l;
-	int privdb_val=0;
-	unsigned int calldurationlimit=0;
+	int privdb_val = 0;
+	unsigned int calldurationlimit = 0;
 	struct ast_bridge_config config;
 	long timelimit = 0;
 	long play_warning = 0;
-	long warning_freq=0;
-	const char *warning_sound=NULL;
-	const char *end_sound=NULL;
-	const char *start_sound=NULL;
-	char *dtmfcalled=NULL, *dtmfcalling=NULL;
+	long warning_freq = 0;
+	const char *warning_sound = NULL;
+	const char *end_sound = NULL;
+	const char *start_sound = NULL;
+	char *dtmfcalled = NULL, *dtmfcalling = NULL;
 	const char *var;
 	char status[256];
-	int play_to_caller=0,play_to_callee=0;
-	int sentringing=0, moh=0;
+	int play_to_caller = 0, play_to_callee = 0;
+	int sentringing = 0, moh = 0;
 	const char *outbound_group = NULL;
 	const char *macro_result = NULL;
 	char *macro_transfer_dest = NULL;
@@ -810,8 +810,13 @@
 
 	if (ast_test_flag(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
 		calldurationlimit = atoi(opt_args[OPT_ARG_DURATION_STOP]);
+		if (!calldurationlimit) {
+			ast_log(LOG_WARNING, "Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
+			LOCAL_USER_REMOVE(u);
+			return -1;
+		}
 		if (option_verbose > 2)
-			ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n", calldurationlimit);			
+			ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n", calldurationlimit);
 	}
 
 	if (ast_test_flag(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
@@ -835,8 +840,24 @@
 			warning_freq = atol(warnfreq_str);
 
 		if (!timelimit) {
-			timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0;
-			warning_sound = NULL;
+			ast_log(LOG_WARNING, "Dial does not accept L(%s), hanging up.\n", limit_str);
+			LOCAL_USER_REMOVE(u);
+			return -1;
+		} else if (play_warning > timelimit) {
+			/* If the first warning is requested _after_ the entire call would end,
+			   and no warning frequency is requested, then turn off the warning. If
+			   a warning frequency is requested, reduce the 'first warning' time by
+			   that frequency until it falls within the call's total time limit.
+			*/
+
+			if (!warning_freq) {
+				play_warning = 0;
+			} else {
+				while (play_warning > timelimit)
+					play_warning -= warning_freq;
+				if (play_warning < 1)
+					play_warning = warning_freq = 0;
+			}
 		}
 
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
@@ -846,33 +867,35 @@
 		play_to_callee = var ? ast_true(var) : 0;
 		
 		if (!play_to_caller && !play_to_callee)
-			play_to_caller=1;
+			play_to_caller = 1;
 		
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_WARNING_FILE");
-		warning_sound = var ? var : "timeleft";
+		warning_sound = (!ast_strlen_zero(var)) ? var : "timeleft";
 		
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_TIMEOUT_FILE");
-		end_sound = var ? var : NULL;
+		end_sound = (!ast_strlen_zero(var)) ? var : NULL;
 		
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_CONNECT_FILE");
-		start_sound = var ? var : NULL;
+		start_sound = (!ast_strlen_zero(var)) ? var : NULL;
 
 		/* undo effect of S(x) in case they are both used */
-		calldurationlimit = 0; 
-		/* more efficient do it like S(x) does since no advanced opts*/
-		if (!play_warning && !start_sound && !end_sound && timelimit) { 
-			calldurationlimit = timelimit/1000;
+		calldurationlimit = 0;
+		/* more efficient to do it like S(x) does since no advanced opts */
+		if (!play_warning && !start_sound && !end_sound && timelimit) {
+			calldurationlimit = timelimit / 1000;
+			if (option_verbose > 2)
+				ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n", calldurationlimit);
 			timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0;
 		} else if (option_verbose > 2) {
 			ast_verbose(VERBOSE_PREFIX_3 "Limit Data for this call:\n");
-			ast_verbose(VERBOSE_PREFIX_3 "- timelimit     = %ld\n", timelimit);
-			ast_verbose(VERBOSE_PREFIX_3 "- play_warning  = %ld\n", play_warning);
-			ast_verbose(VERBOSE_PREFIX_3 "- play_to_caller= %s\n", play_to_caller ? "yes" : "no");
-			ast_verbose(VERBOSE_PREFIX_3 "- play_to_callee= %s\n", play_to_callee ? "yes" : "no");
-			ast_verbose(VERBOSE_PREFIX_3 "- warning_freq  = %ld\n", warning_freq);
-			ast_verbose(VERBOSE_PREFIX_3 "- start_sound   = %s\n", start_sound ? start_sound : "UNDEF");
-			ast_verbose(VERBOSE_PREFIX_3 "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF");
-			ast_verbose(VERBOSE_PREFIX_3 "- end_sound     = %s\n", end_sound ? end_sound : "UNDEF");
+			ast_verbose(VERBOSE_PREFIX_4 "timelimit      = %ld\n", timelimit);
+			ast_verbose(VERBOSE_PREFIX_4 "play_warning   = %ld\n", play_warning);
+			ast_verbose(VERBOSE_PREFIX_4 "play_to_caller = %s\n", play_to_caller ? "yes" : "no");
+			ast_verbose(VERBOSE_PREFIX_4 "play_to_callee = %s\n", play_to_callee ? "yes" : "no");
+			ast_verbose(VERBOSE_PREFIX_4 "warning_freq   = %ld\n", warning_freq);
+			ast_verbose(VERBOSE_PREFIX_4 "start_sound    = %s\n", start_sound);
+			ast_verbose(VERBOSE_PREFIX_4 "warning_sound  = %s\n", warning_sound);
+			ast_verbose(VERBOSE_PREFIX_4 "end_sound      = %s\n", end_sound);
 		}
 	}
 
@@ -1730,7 +1753,8 @@
 
 STATIC_MODULE const char *description(void)
 {
-	return tdesc;
+	return "Dialing Application";
+
 }
 
 STATIC_MODULE int usecount(void)

Modified: team/oej/test-this-branch/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_directory.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_directory.c (original)
+++ team/oej/test-this-branch/apps/app_directory.c Thu Apr 13 06:56:26 2006
@@ -65,8 +65,10 @@
 "                   extension that the user has selected, or when jumping to the\n"
 "                   'o' or 'a' extension.\n\n"
 "  Options:\n"
+"    e - In addition to the name, also read the extension number to the\n"
+"        caller before presenting dialing options.\n"
 "    f - Allow the caller to enter the first name of a user in the directory\n"
-"        instead of using the last name.\n"; 
+"        instead of using the last name.\n";
 
 /* For simplicity, I'm keeping the format compatible with the voicemail config,
    but i'm open to suggestions for isolating it */
@@ -152,7 +154,7 @@
  *           '1' for selected entry from directory
  *           '*' for skipped entry from directory
  */
-static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dialcontext, char *ext, char *name) {
+static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dialcontext, char *ext, char *name, int readext) {
 	int res = 0;
 	int loop = 3;
 	char fn[256];
@@ -172,15 +174,38 @@
 			res = ast_waitstream(chan, AST_DIGIT_ANY);
 		}
 		ast_stopstream(chan);
+		/* If Option 'e' was specified, also read the extension number with the name */
+		if (readext) {
+			res = ast_streamfile(chan, "vm-extension", chan->language);
+			if (!res) {
+				res = ast_waitstream(chan, AST_DIGIT_ANY);
+			}
+			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
+		}
 	} else if (ast_fileexists(fn2, NULL, chan->language) > 0) {
 		res = ast_streamfile(chan, fn2, chan->language);
 		if (!res) {
 			res = ast_waitstream(chan, AST_DIGIT_ANY);
 		}
 		ast_stopstream(chan);
+		/* If Option 'e' was specified, also read the extension number with the name */
+		if (readext) {
+			res = ast_streamfile(chan, "vm-extension", chan->language);
+			if (!res) {
+				res = ast_waitstream(chan, AST_DIGIT_ANY);
+			}
+			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
+		}
 	} else {
 		res = ast_say_character_str(chan, S_OR(name, ext),
 					AST_DIGIT_ANY, chan->language);
+		if (!ast_strlen_zero(name) && readext) {
+			res = ast_streamfile(chan, "vm-extension", chan->language);
+			if (!res) {
+				res = ast_waitstream(chan, AST_DIGIT_ANY);
+			}
+			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
+		}
 	}
 
 	while (loop) {
@@ -289,7 +314,7 @@
 	return cfg;
 }
 
-static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *context, char *dialcontext, char digit, int last)
+static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *context, char *dialcontext, char digit, int last, int readext)
 {
 	/* Read in the first three digits..  "digit" is the first digit, already read */
 	char ext[NUMDIGITS + 1];
@@ -368,7 +393,7 @@
 
 			if (v) {
 				/* We have a match -- play a greeting if they have it */
-				res = play_mailbox_owner(chan, context, dialcontext, v->name, name);
+				res = play_mailbox_owner(chan, context, dialcontext, v->name, name, readext);
 				switch (res) {
 					case -1:
 						/* user pressed '1' but extension does not exist, or
@@ -415,6 +440,7 @@
 	struct localuser *u;
 	struct ast_config *cfg;
 	int last = 1;
+	int readext = 0;
 	char *dirintro, *parse;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(vmcontext);
@@ -439,6 +465,8 @@
 	if (args.options) {
 		if (strchr(args.options, 'f'))
 			last = 0;
+		if (strchr(args.options, 'e'))
+			readext = 1;
 	}
 
 	if (ast_strlen_zero(args.dialcontext))	
@@ -473,7 +501,7 @@
 		if (!res)
 			res = ast_waitfordigit(chan, 5000);
 		if (res > 0) {
-			res = do_directory(chan, cfg, args.vmcontext, args.dialcontext, res, last);
+			res = do_directory(chan, cfg, args.vmcontext, args.dialcontext, res, last, readext);
 			if (res > 0) {
 				res = ast_waitstream(chan, AST_DIGIT_ANY);
 				ast_stopstream(chan);

Modified: team/oej/test-this-branch/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_page.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_page.c (original)
+++ team/oej/test-this-branch/apps/app_page.c Thu Apr 13 06:56:26 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (c) 2004 - 2005 Digium, Inc.  All rights reserved.
+ * Copyright (c) 2004 - 2006 Digium, Inc.  All rights reserved.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -147,6 +147,7 @@
 	struct ast_app *app;
 	char *tmp;
 	int res=0;
+	char originator[AST_CHANNEL_NAME];
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "This application requires at least one argument (destination(s) to page)\n");
@@ -171,7 +172,16 @@
 		ast_app_parse_options(page_opts, &flags, NULL, options);
 
 	snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%sqxdw", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m");
+
+	ast_copy_string(originator, chan->name, sizeof(originator));
+	if ((tmp = strchr(originator, '-')))
+		*tmp = '\0';
+
 	while ((tech = strsep(&tmp, "&"))) {
+		/* don't call the originating device */
+		if (!strcasecmp(tech, originator))
+			continue;
+
 		if ((resource = strchr(tech, '/'))) {
 			*resource++ = '\0';
 			launch_page(chan, meetmeopts, tech, resource);
@@ -179,6 +189,7 @@
 			ast_log(LOG_WARNING, "Incomplete destination '%s' supplied.\n", tech);
 		}
 	}
+
 	if (!ast_test_flag(&flags, PAGE_QUIET)) {
 		res = ast_streamfile(chan, "beep", chan->language);
 		if (!res)

Modified: team/oej/test-this-branch/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_speech_utils.c?rev=19733&r1=19732&r2=19733&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_speech_utils.c (original)
+++ team/oej/test-this-branch/apps/app_speech_utils.c Thu Apr 13 06:56:26 2006
@@ -86,6 +86,15 @@
 "If you call this application but end up wanting to recognize more speech, you must call SpeechCreate\n"
 	"again before calling any other application. It takes no arguments.\n";
 
+static char *speechload_descrip =
+"SpeechLoadGrammar(Grammar Name|Path)\n"
+"Load a grammar only on the channel, not globally.\n"
+"It takes the grammar name as first argument and path as second.\n";
+
+static char *speechunload_descrip =
+"SpeechUnloadGrammar(Grammar Name)\n"
+"Unload a grammar. It takes the grammar name as the only argument.\n";
+
 /*! \brief Helper function used by datastores to destroy the speech structure upon hangup */
 static void destroy_callback(void *data)
 {
@@ -121,6 +130,161 @@
 
 	return speech;
 }
+
+/* Helper function to find a specific speech recognition result by number */
+static struct ast_speech_result *find_result(struct ast_speech_result *results, int num)
+{
+	struct ast_speech_result *result = NULL;
+	int i = 0;
+
+	result = results;
+	while (result) {
+		if (i == num)
+			break;
+		i++;
+		result = result->next;
+	}
+
+	return result;
+}
+
+/*! \brief SPEECH_SCORE() Dialplan Function */
+static int speech_score(struct ast_channel *chan, char *cmd, char *data,
+		       char *buf, size_t len)
+{
+	struct ast_speech_result *result = NULL;
+	struct ast_speech *speech = find_speech(chan);
+	char tmp[128] = "";
+
+	if (data == NULL || speech == NULL || !(result = find_result(speech->results, atoi(data))))
+		return -1;
+	
+	snprintf(tmp, sizeof(tmp), "%d", result->score);
+	
+	ast_copy_string(buf, tmp, len);
+
+	return 0;
+}
+
+static struct ast_custom_function speech_score_function = {
+        .name = "SPEECH_SCORE",
+        .synopsis = "Gets the confidence score of a result.\n",
+        .syntax = "SPEECH_SCORE(result number)",
+        .desc =
+        "Gets the confidence score of a result.\n",
+        .read = speech_score,
+        .write = NULL,
+};
+
+/*! \brief SPEECH_TEXT() Dialplan Function */
+static int speech_text(struct ast_channel *chan, char *cmd, char *data,
+			char *buf, size_t len)
+{
+        struct ast_speech_result *result = NULL;
+        struct ast_speech *speech = find_speech(chan);
+
+	if (data == NULL || speech == NULL || !(result = find_result(speech->results, atoi(data))))
+                return -1;
+
+	if (result->text != NULL)
+		ast_copy_string(buf, result->text, len);
+
+        return 0;
+}
+
+static struct ast_custom_function speech_text_function = {
+        .name = "SPEECH_TEXT",
+        .synopsis = "Gets the recognized text of a result.\n",
+        .syntax = "SPEECH_TEXT(result number)",
+        .desc =
+        "Gets the recognized text of a result.\n",
+        .read = speech_text,
+        .write = NULL,
+};
+
+/*! \brief SPEECH_GRAMMAR() Dialplan Function */
+static int speech_grammar(struct ast_channel *chan, char *cmd, char *data,
+			char *buf, size_t len)
+{
+        struct ast_speech_result *result = NULL;
+        struct ast_speech *speech = find_speech(chan);
+
+	if (data == NULL || speech == NULL || !(result = find_result(speech->results, atoi(data))))
+                return -1;
+
+	if (result->grammar != NULL)
+		ast_copy_string(buf, result->grammar, len);
+
+        return 0;
+}
+
+static struct ast_custom_function speech_grammar_function = {
+        .name = "SPEECH_GRAMMAR",
+        .synopsis = "Gets the matched grammar of a result if available.",
+        .syntax = "SPEECH_GRAMMAR(result number)",
+        .desc =
+        "Gets the matched grammar of a result if available.\n",
+        .read = speech_grammar,
+        .write = NULL,
+};
+
+/*! \brief SPEECH() Dialplan Function */
+static int speech_read(struct ast_channel *chan, char *cmd, char *data,
+			char *buf, size_t len)
+{
+	int results = 0;
+	struct ast_speech_result *result = NULL;
+	struct ast_speech *speech = find_speech(chan);
+	char tmp[128] = "";
+
+	/* Now go for the various options */
+	if (!strcasecmp(data, "status")) {
+		if (speech != NULL)
+			ast_copy_string(buf, "1", len);
+		else
+			ast_copy_string(buf, "0", len);
+		return 0;
+	}
+
+	/* Make sure we have a speech structure for everything else */
+	if (speech == NULL) {
+		return -1;
+	}
+
+	/* Check to see if they are checking for silence */
+	if (!strcasecmp(data, "spoke")) {
+		if (ast_test_flag(speech, AST_SPEECH_SPOKE))
+			ast_copy_string(buf, "1", len);
+		else
+			ast_copy_string(buf, "0", len);
+	} else if (!strcasecmp(data, "results")) {
+		/* Count number of results */
+		result = speech->results;
+		while (result) {
+			results++;
+			result = result->next;
+		}
+		snprintf(tmp, sizeof(tmp), "%d", results);
+		ast_copy_string(buf, tmp, len);
+	}
+
+	return 0;
+}
+
+static struct ast_custom_function speech_function = {
+        .name = "SPEECH",
+        .synopsis = "Gets information about speech recognition results.",
+        .syntax = "SPEECH(argument)",
+        .desc =
+	"Gets information about speech recognition results.\n"
+	"status:   Returns 1 upon speech object existing, or 0 if not\n"
+	"spoke:  Returns 1 if spoker spoke, or 0 if not\n"
+	"results:  Returns number of results that were recognized\n",
+        .read = speech_read,
+        .write = NULL,
+};
+
+
 
 /*! \brief SpeechCreate() Dialplan Application */
 static int speech_create(struct ast_channel *chan, void *data)
@@ -153,6 +317,63 @@
 	LOCAL_USER_REMOVE(u);
 
 	return 0;
+}
+
+/*! \brief SpeechLoadGrammar(Grammar Name|Path) Dialplan Application */
+static int speech_load(struct ast_channel *chan, void *data)
+{
+	int res = 0, argc = 0;
+	struct localuser *u = NULL;
+	struct ast_speech *speech = find_speech(chan);
+	char *argv[2], *args = NULL, *name = NULL, *path = NULL;
+
+	if (!(args = ast_strdupa(data)))
+                return -1;
+
+	LOCAL_USER_ADD(u);
+
+	if (speech == NULL) {
+		LOCAL_USER_REMOVE(u);
+                return -1;
+        }
+
+	/* Parse out arguments */
+	argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0]));
+	if (argc != 2) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
+	name = argv[0];
+	path = argv[1];
+
+        /* Load the grammar locally on the object */
+        res = ast_speech_grammar_load(speech, name, path);
+
+        LOCAL_USER_REMOVE(u);
+
+        return res;
+}
+
+/*! \brief SpeechUnloadGrammar(Grammar Name) Dialplan Application */
+static int speech_unload(struct ast_channel *chan, void *data)
+{
+        int res = 0;
+        struct localuser *u = NULL;
+        struct ast_speech *speech = find_speech(chan);
+
+        LOCAL_USER_ADD(u);
+
+        if (speech == NULL) {
+                LOCAL_USER_REMOVE(u);
+                return -1;
+        }
+
+        /* Unload the grammar */
+        res = ast_speech_grammar_unload(speech, data);
+
+        LOCAL_USER_REMOVE(u);
+
+        return res;
 }
 
 /*! \brief SpeechDeactivateGrammar(Grammar Name) Dialplan Application */
@@ -272,224 +493,207 @@
 /*! \brief SpeechBackground(Sound File|Timeout) Dialplan Application */
 static int speech_background(struct ast_channel *chan, void *data)
 {
-	unsigned int timeout = 0;
-	int res = 0, done = 0, concepts = 0, argc = 0, started = 0;
-	struct localuser *u = NULL;
-	struct ast_speech *speech = find_speech(chan);
-	struct ast_speech_result *results = NULL, *result = NULL;
-	struct ast_frame *f = NULL;
-	int oldreadformat = AST_FORMAT_SLINEAR;
-	char tmp[256] = "", tmp2[256] = "";
-	char dtmf[AST_MAX_EXTENSION] = "";
-	time_t start, current;
-	struct ast_datastore *datastore = NULL;
-	char *argv[2], *args = NULL, *filename = NULL;
-
-	if (!(args = ast_strdupa(data)))
-                return -1;
-
-	LOCAL_USER_ADD(u);
-
-	if (speech == NULL) {
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
-
-	/* Record old read format */
-	oldreadformat = chan->readformat;
-
-	/* Change read format to be signed linear */
-	if (ast_set_read_format(chan, AST_FORMAT_SLINEAR)) {
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
-
-	/* Parse out options */
-	argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0]));
-	if (argc > 0) {
-		/* Yay sound file */
-		filename = argv[0];
-		if (argv[1] != NULL)
-			timeout = atoi(argv[1]);
-	}
-
-	/* Start streaming the file if possible and specified */
-	if (filename != NULL && ast_streamfile(chan, filename, chan->language)) {
-		/* An error occured while streaming */
-		ast_set_read_format(chan, oldreadformat);
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
-
-	/* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
-	if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) {
-		speech->state = AST_SPEECH_STATE_NOT_READY;
-		ast_speech_start(speech);
-	}
-
-	/* Okay it's streaming so go into a loop grabbing frames! */
-	while (done == 0) {
-		/* Run scheduled stuff */
+        unsigned int timeout = 0;
+        int res = 0, done = 0, argc = 0, started = 0;
+        struct localuser *u = NULL;
+        struct ast_speech *speech = find_speech(chan);
+        struct ast_frame *f = NULL;
+        int oldreadformat = AST_FORMAT_SLINEAR;
+        char dtmf[AST_MAX_EXTENSION] = "";
+        time_t start, current;
+        struct ast_datastore *datastore = NULL;
+        char *argv[2], *args = NULL, *filename = NULL, tmp[2] = "";
+
+        if (!(args = ast_strdupa(data)))
+                return -1;
+
+        LOCAL_USER_ADD(u);
+
+        if (speech == NULL) {
+                LOCAL_USER_REMOVE(u);
+                return -1;
+        }
+
+        /* Record old read format */
+        oldreadformat = chan->readformat;
+
+        /* Change read format to be signed linear */
+        if (ast_set_read_format(chan, AST_FORMAT_SLINEAR)) {
+                LOCAL_USER_REMOVE(u);
+                return -1;
+        }
+
+        /* Parse out options */
+        argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0]));
+        if (argc > 0) {
+                /* Yay sound file */
+                filename = argv[0];
+                if (argv[1] != NULL)
+                        timeout = atoi(argv[1]);
+        }
+
+        /* Start streaming the file if possible and specified */
+        if (filename != NULL && ast_streamfile(chan, filename, chan->language)) {
+                /* An error occured while streaming */
+                ast_set_read_format(chan, oldreadformat);
+                LOCAL_USER_REMOVE(u);
+                return -1;
+        }
+
+        /* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
+        if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) {
+		ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
+                ast_speech_start(speech);
+        }
+
+        /* Okay it's streaming so go into a loop grabbing frames! */
+        while (done == 0) {
+                /* Run scheduled stuff */
                 ast_sched_runq(chan->sched);
 
-		/* Yay scheduling */
-		res = ast_sched_wait(chan->sched);
-		if (res < 0) {
-			res = 1000;
-		}
-
-		/* If there is a frame waiting, get it - if not - oh well */
-		if (ast_waitfor(chan, res) > 0) {
-			f = ast_read(chan);
-			if (f == NULL) {
-				/* The channel has hung up most likely */
-				done = 3;
+                /* Yay scheduling */
+                res = ast_sched_wait(chan->sched);
+                if (res < 0) {
+                        res = 1000;
+                }
+
+                /* If there is a frame waiting, get it - if not - oh well */
+                if (ast_waitfor(chan, res) > 0) {
+                        f = ast_read(chan);
+                        if (f == NULL) {
+                                /* The channel has hung up most likely */
+                                done = 3;
+                                break;
+                        }
+                }
+
+		/* Do timeout check (shared between audio/dtmf) */
+		if (started == 1) {
+			time(&current);
+			if ((current-start) >= timeout) {
+				done = 1;
 				break;
 			}
 		}
 
-		/* Do checks on speech structure to see if it's changed */
-		ast_mutex_lock(&speech->lock);
-		if (ast_test_flag(speech, AST_SPEECH_QUIET) && chan->stream != NULL) {
-			ast_stopstream(chan);
+                /* Do checks on speech structure to see if it's changed */
+                ast_mutex_lock(&speech->lock);
+                if (ast_test_flag(speech, AST_SPEECH_QUIET) && chan->stream != NULL) {
+                        ast_stopstream(chan);
 			ast_clear_flag(speech, AST_SPEECH_QUIET);
-		}
-		/* Check state so we can see what to do */
-		switch (speech->state) {
-		case AST_SPEECH_STATE_READY:
-			/* If audio playback has stopped do a check for timeout purposes */
-			if (chan->streamid == -1 && chan->timingfunc == NULL)
-				ast_stopstream(chan);
-			if (chan->stream == NULL && timeout > 0) {
-				/* If start time is not yet done... do it */
-				if (started == 0) {
-					time(&start);
-					started = 1;
-				} else {
-					time(&current);
-					if ((current-start) >= timeout) {
-						done = 1;
-						break;
-					}
-				}
-			}
-			/* Deal with audio frames if present */
-			if (f != NULL && f->frametype == AST_FRAME_VOICE) {
-				ast_speech_write(speech, f->data, f->datalen);
-			}
-			break;
-		case AST_SPEECH_STATE_WAIT:
-			/* Cue up waiting sound if not already playing */
-			if (chan->stream == NULL) {
-				if (speech->processing_sound != NULL) {
+                }
+                /* Check state so we can see what to do */
+                switch (speech->state) {
+                case AST_SPEECH_STATE_READY:
+                        /* If audio playback has stopped do a check for timeout purposes */
+                        if (chan->streamid == -1 && chan->timingfunc == NULL)
+                                ast_stopstream(chan);
+                        if (chan->stream == NULL && timeout > 0 && started == 0) {
+				time(&start);
+				started = 1;
+                        }
+                        /* Deal with audio frames if present */
+                        if (f != NULL && f->frametype == AST_FRAME_VOICE) {
+                                ast_speech_write(speech, f->data, f->datalen);
+                        }
+                        break;
+                case AST_SPEECH_STATE_WAIT:
+                        /* Cue up waiting sound if not already playing */
+                        if (chan->stream == NULL) {
+                                if (speech->processing_sound != NULL) {

[... 3144 lines stripped ...]


More information about the asterisk-commits mailing list