[svn-commits] eliel: branch group/appdocsxml r152803 - in /team/group/appdocsxml: ./ apps/ ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 30 05:23:26 CDT 2008


Author: eliel
Date: Thu Oct 30 05:23:26 2008
New Revision: 152803

URL: http://svn.digium.com/view/asterisk?view=rev&rev=152803
Log:
Resolve conflicts, and setup automerge *again*.

Modified:
    team/group/appdocsxml/   (props changed)
    team/group/appdocsxml/CHANGES
    team/group/appdocsxml/apps/app_directory.c
    team/group/appdocsxml/configs/extensions.conf.sample

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

Propchange: team/group/appdocsxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Oct 30 05:23:26 2008
@@ -1,1 +1,1 @@
-/trunk:1-152696
+/trunk:1-152802

Modified: team/group/appdocsxml/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/CHANGES?view=diff&rev=152803&r1=152802&r2=152803
==============================================================================
--- team/group/appdocsxml/CHANGES (original)
+++ team/group/appdocsxml/CHANGES Thu Oct 30 05:23:26 2008
@@ -33,6 +33,9 @@
    using MeetMeAdmin.
  * app_authenticate now gives the ability to select a prompt other than
    the default.
+ * app_directory now pays attention to the searchcontexts setting in
+   voicemail.conf and will look through all contexts, if no context is
+   specified in the initial argument.
 
 Miscellaneous
 -------------

Modified: team/group/appdocsxml/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_directory.c?view=diff&rev=152803&r1=152802&r2=152803
==============================================================================
--- team/group/appdocsxml/apps/app_directory.c (original)
+++ team/group/appdocsxml/apps/app_directory.c Thu Oct 30 05:23:26 2008
@@ -48,8 +48,10 @@
 			Provide directory of voicemail extensions.
 		</synopsis>
 		<syntax>
-			<parameter name="vm-context" required="true">
-				<para>This is the context within voicemail.conf to use for the Directory.</para>
+			<parameter name="vm-context">
+				<para>This is the context within voicemail.conf to use for the Directory. If not specified and
+				<literal>searchcontexts=no</literal> in <filename>voicemail.conf</filename>, then <literal>default</literal>
+				will be assumed.</para>
 			</parameter>
 			<parameter name="dial-context" required="false">
 				<para>This is the dialplan context to use when looking for an
@@ -102,7 +104,7 @@
 		<description>
 			<para>This application will present the calling channel with a directory of extensions from which they can search
 			by name. The list of names and corresponding extensions is retrieved from the
-			voicemail configuration file, voicemail.conf.</para>
+			voicemail configuration file, <filename>voicemail.conf</filename>.</para>
 			<para>This application will immediately exit if one of the following DTMF digits are
 			received and the extension to jump to exists:</para>
 			<para><literal>0</literal> - Jump to the 'o' extension, if it exists.</para>
@@ -140,6 +142,7 @@
 struct directory_item {
 	char exten[AST_MAX_EXTENSION + 1];
 	char name[AST_MAX_EXTENSION + 1];
+	char context[AST_MAX_CONTEXT + 1];
 	char key[50]; /* Text to order items. Either lastname+firstname or firstname+lastname */
 
 	AST_LIST_ENTRY(directory_item) entry;
@@ -262,25 +265,25 @@
 	return res;
 }
 
-static int select_entry(struct ast_channel *chan, const char *context, const char *dialcontext, const struct directory_item *item, struct ast_flags *flags)
-{
-	ast_debug(1, "Selecting '%s' - %s@%s\n", item->name, item->exten, dialcontext);
+static int select_entry(struct ast_channel *chan, const char *dialcontext, const struct directory_item *item, struct ast_flags *flags)
+{
+	ast_debug(1, "Selecting '%s' - %s@%s\n", item->name, item->exten, S_OR(dialcontext, item->context));
 
 	if (ast_test_flag(flags, OPT_FROMVOICEMAIL)) {
 		/* We still want to set the exten though */
 		ast_copy_string(chan->exten, item->exten, sizeof(chan->exten));
-	} else if (ast_goto_if_exists(chan, dialcontext, item->exten, 1)) {
+	} else if (ast_goto_if_exists(chan, S_OR(dialcontext, item->context), item->exten, 1)) {
 		ast_log(LOG_WARNING,
 			"Can't find extension '%s' in context '%s'.  "
 			"Did you pass the wrong context to Directory?\n",
-			item->exten, dialcontext);
+			item->exten, S_OR(dialcontext, item->context));
 		return -1;
 	}
 
 	return 0;
 }
 
-static int select_item_seq(struct ast_channel *chan, struct directory_item **items, int count, const char *context, const char *dialcontext, struct ast_flags *flags)
+static int select_item_seq(struct ast_channel *chan, struct directory_item **items, int count, const char *dialcontext, struct ast_flags *flags)
 {
 	struct directory_item *item, **ptr;
 	int i, res, loop;
@@ -289,7 +292,7 @@
 		item = *ptr;
 
 		for (loop = 3 ; loop > 0; loop--) {
-			res = play_mailbox_owner(chan, context, item->exten, item->name, flags);
+			res = play_mailbox_owner(chan, item->context, item->exten, item->name, flags);
 
 			if (!res)
 				res = ast_stream_and_wait(chan, "dir-instr", AST_DIGIT_ANY);
@@ -298,7 +301,7 @@
 			ast_stopstream(chan);
 	
 			if (res == '1') { /* Name selected */
-				return select_entry(chan, context, dialcontext, item, flags) ? -1 : 1;
+				return select_entry(chan, dialcontext, item, flags) ? -1 : 1;
 			} else if (res == '*') {
 				/* Skip to next match in list */
 				break;
@@ -315,7 +318,7 @@
 	return 0;
 }
 
-static int select_item_menu(struct ast_channel *chan, struct directory_item **items, int count, const char *context, const char *dialcontext, struct ast_flags *flags)
+static int select_item_menu(struct ast_channel *chan, struct directory_item **items, int count, const char *dialcontext, struct ast_flags *flags)
 {
 	struct directory_item **block, *item;
 	int i, limit, res = 0;
@@ -343,7 +346,7 @@
 			if (!res)
 				res = ast_waitstream(chan, AST_DIGIT_ANY);
 			if (!res)
-				res = play_mailbox_owner(chan, context, item->exten, item->name, flags);
+				res = play_mailbox_owner(chan, item->context, item->exten, item->name, flags);
 			if (!res)
 				res = ast_waitstream(chan, AST_DIGIT_ANY);
 			if (!res)
@@ -362,7 +365,7 @@
 		}
 
 		if (res && res > '0' && res < '1' + limit) {
-			return select_entry(chan, context, dialcontext, block[res - '1'], flags) ? -1 : 1;
+			return select_entry(chan, dialcontext, block[res - '1'], flags) ? -1 : 1;
 		}
 
 		if (res < 0)
@@ -383,7 +386,7 @@
 	struct ast_variable *var;
 	char *mailbox;
 	const char *fullname;
-	const char *hidefromdir;
+	const char *hidefromdir, *searchcontexts = NULL;
 	char tmp[100];
 	struct ast_flags config_flags = { 0 };
 
@@ -401,49 +404,64 @@
 
 	/* Get realtime entries, categorized by their mailbox number
 	   and present in the requested context */
-	rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, SENTINEL);
+	if (ast_strlen_zero(context) && (searchcontexts = ast_variable_retrieve(cfg, "general", "searchcontexts"))) {
+		if (ast_true(searchcontexts)) {
+			rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", SENTINEL);
+			context = NULL;
+		} else {
+			rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", "default", SENTINEL);
+			context = "default";
+		}
+	} else {
+		rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, SENTINEL);
+	}
 
 	/* if there are no results, just return the entries from the config file */
-	if (!rtdata)
+	if (!rtdata) {
 		return cfg;
-
-	/* Does the context exist within the config file? If not, make one */
-	cat = ast_category_get(cfg, context);
-	if (!cat) {
-		cat = ast_category_new(context, "", 99999);
-		if (!cat) {
-			ast_log(LOG_WARNING, "Out of memory\n");
-			ast_config_destroy(cfg);
-			return NULL;
-		}
-		ast_category_append(cfg, cat);
 	}
 
 	mailbox = NULL;
 	while ( (mailbox = ast_category_browse(rtdata, mailbox)) ) {
+		const char *context = ast_variable_retrieve(rtdata, mailbox, "context");
+
 		fullname = ast_variable_retrieve(rtdata, mailbox, "fullname");
 		if (ast_true((hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir")))) {
 			/* Skip hidden */
 			continue;
 		}
 		snprintf(tmp, sizeof(tmp), "no-password,%s", S_OR(fullname, ""));
-		var = ast_variable_new(mailbox, tmp, "");
-		if (var)
+
+		/* Does the context exist within the config file? If not, make one */
+		if (!(cat = ast_category_get(cfg, context))) {
+			if (!(cat = ast_category_new(context, "", 99999))) {
+				ast_log(LOG_WARNING, "Out of memory\n");
+				ast_config_destroy(cfg);
+				return NULL;
+			}
+			ast_category_append(cfg, cat);
+		}
+
+		if ((var = ast_variable_new(mailbox, tmp, ""))) {
 			ast_variable_append(cat, var);
-		else
+		} else {
 			ast_log(LOG_WARNING, "Out of memory adding mailbox '%s'\n", mailbox);
+		}
 	}
 	ast_config_destroy(rtdata);
 
 	return cfg;
 }
 
-static int check_match(struct directory_item **result, const char *item_fullname, const char *item_ext, const char *pattern_ext, int use_first_name)
+static int check_match(struct directory_item **result, const char *item_context, const char *item_fullname, const char *item_ext, const char *pattern_ext, int use_first_name)
 {
 	struct directory_item *item;
 	const char *key = NULL;
 	int namelen;
 
+	if (ast_strlen_zero(item_fullname)) {
+		return 0;
+	}
 
 	/* Set key to last name or first name depending on search mode */
 	if (!use_first_name)
@@ -457,10 +475,13 @@
 	if (compare(key, pattern_ext))
 		return 0;
 
+	ast_debug(1, "Found match %s@%s\n", item_ext, item_context);
+
 	/* Match */
 	item = ast_calloc(1, sizeof(*item));
 	if (!item)
 		return -1;
+	ast_copy_string(item->context, item_context, sizeof(item->context));
 	ast_copy_string(item->name, item_fullname, sizeof(item->name));
 	ast_copy_string(item->exten, item_ext, sizeof(item->exten));
 
@@ -479,7 +500,7 @@
 
 typedef AST_LIST_HEAD_NOLOCK(, directory_item) itemlist;
 
-static int search_directory(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
+static int search_directory_sub(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
 {
 	struct ast_variable *v;
 	char buf[AST_MAX_EXTENSION + 1], *pos, *bufptr, *cat;
@@ -503,10 +524,10 @@
 
 		res = 0;
 		if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
-			res = check_match(&item, pos, v->name, ext, 0 /* use_first_name */);
+			res = check_match(&item, context, pos, v->name, ext, 0 /* use_first_name */);
 		}
 		if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
-			res = check_match(&item, pos, v->name, ext, 1 /* use_first_name */);
+			res = check_match(&item, context, pos, v->name, ext, 1 /* use_first_name */);
 		}
 
 		if (!res)
@@ -532,10 +553,10 @@
 
 			res = 0;
 			if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
-				res = check_match(&item, position, cat, ext, 0 /* use_first_name */);
+				res = check_match(&item, context, position, cat, ext, 0 /* use_first_name */);
 			}
 			if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
-				res = check_match(&item, position, cat, ext, 1 /* use_first_name */);
+				res = check_match(&item, context, position, cat, ext, 1 /* use_first_name */);
 			}
 
 			if (!res)
@@ -547,6 +568,35 @@
 		}
 	}
 	return 0;
+}
+
+static int search_directory(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
+{
+	const char *searchcontexts = ast_variable_retrieve(vmcfg, "general", "searchcontexts");
+	if (ast_strlen_zero(context)) {
+		if (!ast_strlen_zero(searchcontexts) && ast_true(searchcontexts)) {
+			/* Browse each context for a match */
+			int res;
+			const char *catg;
+			for (catg = ast_category_browse(vmcfg, NULL); catg; catg = ast_category_browse(vmcfg, catg)) {
+				if (!strcmp(catg, "general") || !strcmp(catg, "zonemessages")) {
+					continue;
+				}
+
+				if ((res = search_directory_sub(catg, vmcfg, ucfg, ext, flags, alist))) {
+					return res;
+				}
+			}
+			return 0;
+		} else {
+			ast_debug(1, "Searching by category default\n");
+			return search_directory_sub("default", vmcfg, ucfg, ext, flags, alist);
+		}
+	} else {
+		/* Browse only the listed context for a match */
+		ast_debug(1, "Searching by category %s\n", context);
+		return search_directory_sub(context, vmcfg, ucfg, ext, flags, alist);
+	}
 }
 
 static void sort_items(struct directory_item **sorted, int count)
@@ -593,18 +643,11 @@
 	int count, i;
 	char ext[10] = "";
 
-	if (ast_strlen_zero(context)) {
-		ast_log(LOG_WARNING,
-			"Directory must be called with an argument "
-			"(context in which to interpret extensions)\n");
-		return -1;
-	}
-
-	if (digit == '0' && !goto_exten(chan, dialcontext, "o")) {
+	if (digit == '0' && !goto_exten(chan, S_OR(dialcontext, "default"), "o")) {
 		return 0;
 	}
 
-	if (digit == '*' && !goto_exten(chan, dialcontext, "a")) {
+	if (digit == '*' && !goto_exten(chan, S_OR(dialcontext, "default"), "a")) {
 		return 0;
 	}
 
@@ -642,16 +685,16 @@
 	if (option_debug) {
 		ast_debug(2, "Listing matching entries:\n");
 		for (ptr = sorted, i = 0; i < count; i++, ptr++) {
-			ast_log(LOG_DEBUG, "%s: %s\n", ptr[0]->exten, ptr[0]->name);
+			ast_debug(2, "%s: %s\n", ptr[0]->exten, ptr[0]->name);
 		}
 	}
 
 	if (ast_test_flag(flags, OPT_SELECTFROMMENU)) {
 		/* Offer multiple entries at the same time */
-		res = select_item_menu(chan, sorted, count, context, dialcontext, flags);
+		res = select_item_menu(chan, sorted, count, dialcontext, flags);
 	} else {
 		/* Offer entries one by one */
-		res = select_item_seq(chan, sorted, count, context, dialcontext, flags);
+		res = select_item_seq(chan, sorted, count, dialcontext, flags);
 	}
 
 	if (!res) {
@@ -673,7 +716,7 @@
 	int res = 0, digit = 3;
 	struct ast_config *cfg, *ucfg;
 	const char *dirintro;
-	char *parse, *opts[OPT_ARG_ARRAY_SIZE];
+	char *parse, *opts[OPT_ARG_ARRAY_SIZE] = { 0, };
 	struct ast_flags flags = { 0 };
 	struct ast_flags config_flags = { 0 };
 	enum { FIRST, LAST, BOTH } which = LAST;
@@ -684,11 +727,6 @@
 		AST_APP_ARG(options);
 	);
 
-	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "Directory requires an argument (context[,dialcontext])\n");
-		return -1;
-	}
-
 	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
@@ -696,11 +734,7 @@
 	if (args.options && ast_app_parse_options(directory_app_options, &flags, opts, args.options))
 		return -1;
 
-	if (ast_strlen_zero(args.dialcontext))
-		args.dialcontext = args.vmcontext;
-
-	cfg = realtime_directory(args.vmcontext);
-	if (!cfg) {
+	if (!(cfg = realtime_directory(args.vmcontext))) {
 		ast_log(LOG_ERROR, "Unable to read the configuration data!\n");
 		return -1;
 	}

Modified: team/group/appdocsxml/configs/extensions.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/configs/extensions.conf.sample?view=diff&rev=152803&r1=152802&r2=152803
==============================================================================
--- team/group/appdocsxml/configs/extensions.conf.sample (original)
+++ team/group/appdocsxml/configs/extensions.conf.sample Thu Oct 30 05:23:26 2008
@@ -213,10 +213,11 @@
 ;
 ;
 [dundi-e164-canonical]
+;include => stdexten
 ;
 ; List canonical entries here
 ;
-;exten => 12564286000,1,Gosub(stdexten,s,1(6000,IAX2/foo))
+;exten => 12564286000,1,Gosub(stdexten(6000,IAX2/foo))
 ;exten => 12564286000,n,Goto(default,s,1)	; exited Voicemail
 ;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7})
 
@@ -401,28 +402,28 @@
 ; variable on top of an existing variable, and its value will revert to its
 ; previous value (before being declared as LOCAL()) upon Return.
 ;
-exten => s,1,NoOp(Start stdexten)
-exten => s,n,Set(LOCAL(ext)=${ARG1})
-exten => s,n,Set(LOCAL(dev)=${ARG2})
-exten => s,n,Set(LOCAL(cntx)=${ARG3})
-
-exten => s,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
-exten => s,n,Dial(${dev},20)			; Ring the interface, 20 seconds maximum
-exten => s,n,Goto(s-${DIALSTATUS},1)		; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
-
-exten => s-NOANSWER,1,Voicemail(${mbx},u)	; If unavailable, send to voicemail w/ unavail announce
-exten => s-NOANSWER,n,NoOp(Finish stdexten NOANSWER)
-exten => s-NOANSWER,n,Return()			; If they press #, return to start
-
-exten => s-BUSY,1,Voicemail(${mbx},b)
+exten => _X.,50000(stdexten),NoOp(Start stdexten)
+exten => _X.,n,Set(LOCAL(ext)=${ARG1})
+exten => _X.,n,Set(LOCAL(dev)=${ARG2})
+exten => _X.,n,Set(LOCAL(cntx)=${ARG3})
+
+exten => _X.,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
+exten => _X.,n,Dial(${dev},20)			; Ring the interface, 20 seconds maximum
+exten => _X.,n,Goto(stdexten-${DIALSTATUS},1)		; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
+
+exten => stdexten-NOANSWER,1,Voicemail(${mbx},u)	; If unavailable, send to voicemail w/ unavail announce
+exten => stdexten-NOANSWER,n,NoOp(Finish stdexten NOANSWER)
+exten => stdexten-NOANSWER,n,Return()			; If they press #, return to start
+
+exten => stdexten-BUSY,1,Voicemail(${mbx},b)
 						; If busy, send to voicemail w/ busy announce
-exten => s-BUSY,n,NoOp(Finish stdexten BUSY)
-exten => s-BUSY,n,Return()			; If they press #, return to start
-
-exten => _s-.,1,Goto(s-NOANSWER,1)		; Treat anything else as no answer
+exten => stdexten-BUSY,n,NoOp(Finish stdexten BUSY)
+exten => stdexten-BUSY,n,Return()			; If they press #, return to start
+
+exten => _stdexten[\-].,1,Goto(s-NOANSWER,1)		; Treat anything else as no answer
 
 exten => a,1,VoicemailMain(${mbx})		; If they press *, send the user into VoicemailMain
-						; does this ever return?
+exten => a,n,Return()
 
 [stdPrivacyexten]
 ;
@@ -435,34 +436,34 @@
 ;
 ; See above note in stdexten about priority handling on exit.
 ;
-exten => s,1,NoOp(Start stdPrivacyexten)
-exten => s,n,Set(LOCAL(ext)=${ARG1})
-exten => s,n,Set(LOCAL(dev)=${ARG2})
-exten => s,n,Set(LOCAL(dontcntx)=${ARG3})
-exten => s,n,Set(LOCAL(tortcntx)=${ARG4})
-exten => s,n,Set(LOCAL(cntx)=${ARG5})
-
-exten => s,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
-exten => s,n,Dial(${dev},20,p)			; Ring the interface, 20 seconds maximum, call screening 
-						; option (or use P for databased call screening)
-exten => s,n,Goto(s-${DIALSTATUS},1)		; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
-
-exten => s-NOANSWER,1,Voicemail(${mbx},u)	; If unavailable, send to voicemail w/ unavail announce
-exten => s-NOANSWER,n,NoOp(Finish stdPrivacyexten NOANSWER)
-exten => s-NOANSWER,n,Return()			; If they press #, return to start
-
-exten => s-BUSY,1,Voicemail(${mbx},b)		; If busy, send to voicemail w/ busy announce
-exten => s-BUSY,n,NoOp(Finish stdPrivacyexten BUSY)
-exten => s-BUSY,n,Return()			; If they press #, return to start
-
-exten => s-DONTCALL,1,Goto(${dontcntx},s,1)	; Callee chose to send this call to a polite "Don't call again" script.
-
-exten => s-TORTURE,1,Goto(${tortcntx},s,1)	; Callee chose to send this call to a telemarketer torture script.
-
-exten => _s-.,1,Goto(s-NOANSWER,1)		; Treat anything else as no answer
+exten => _X.,60000(stdPrivacyexten),NoOp(Start stdPrivacyexten)
+exten => _X.,n,Set(LOCAL(ext)=${ARG1})
+exten => _X.,n,Set(LOCAL(dev)=${ARG2})
+exten => _X.,n,Set(LOCAL(dontcntx)=${ARG3})
+exten => _X.,n,Set(LOCAL(tortcntx)=${ARG4})
+exten => _X.,n,Set(LOCAL(cntx)=${ARG5})
+
+exten => _X.,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
+exten => _X.,n,Dial(${dev},20,p)			; Ring the interface, 20 seconds maximum, call screening 
+						; option (or use P for databased call _X.creening)
+exten => _X.,n,Goto(s-${DIALSTATUS},1)		; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
+
+exten => stdexten-NOANSWER,1,Voicemail(${mbx},u)	; If unavailable, send to voicemail w/ unavail announce
+exten => stdexten-NOANSWER,n,NoOp(Finish stdPrivacyexten NOANSWER)
+exten => stdexten-NOANSWER,n,Return()			; If they press #, return to start
+
+exten => stdexten-BUSY,1,Voicemail(${mbx},b)		; If busy, send to voicemail w/ busy announce
+exten => stdexten-BUSY,n,NoOp(Finish stdPrivacyexten BUSY)
+exten => stdexten-BUSY,n,Return()			; If they press #, return to start
+
+exten => stdexten-DONTCALL,1,Goto(${dontcntx},s,1)	; Callee chose to send this call to a polite "Don't call again" script.
+
+exten => stdexten-TORTURE,1,Goto(${tortcntx},s,1)	; Callee chose to send this call to a telemarketer torture script.
+
+exten => _stdexten-.,1,Goto(s-NOANSWER,1)		; Treat anything else as no answer
 
 exten => a,1,VoicemailMain(${mbx})		; If they press *, send the user into VoicemailMain
-						; does this ever return?
+exten => a,n,Return
 
 [macro-page];
 ;
@@ -482,6 +483,7 @@
 
 
 [demo]
+include => stdexten
 ;
 ; We start with what to do when a call first comes in.
 ;
@@ -506,7 +508,7 @@
 ;
 exten => 1234,1,Playback(transfer,skip)		; "Please hold while..." 
 					; (but skip if channel is not up)
-exten => 1234,n,Gosub(stdexten,s,1(1234,${GLOBAL(CONSOLE)}))
+exten => 1234,n,Gosub(stdexten(1234,${GLOBAL(CONSOLE)}))
 exten => 1234,n,Goto(default,s,1)		; exited Voicemail
 
 exten => 1235,1,Voicemail(1234,u)		; Right to voicemail
@@ -623,11 +625,11 @@
 ;exten => 6391,1,Dial(JINGLE/asterisk at digium.com/mogorman at astjab.org) ;Dial via jingle using asterisk as the transport and calling mogorman.
 ;exten => 6394,1,Dial(Local/6275/n)		; this will dial ${MARK}
 
-;exten => 6275,1,Gosub(stdexten,s,1(6275,${MARK}))
+;exten => 6275,1,Gosub(stdexten(6275,${MARK}))
 						; assuming ${MARK} is something like DAHDI/2
 ;exten => 6275,n,Goto(default,s,1)		; exited Voicemail
 ;exten => mark,1,Goto(6275,1)			; alias mark to 6275
-;exten => 6536,1,Gosub(stdexten,s,1(6236,${WIL}))
+;exten => 6536,1,Gosub(stdexten(6236,${WIL}))
 						; Ditto for wil
 ;exten => 6536,n,Goto(default,s,1)		; exited Voicemail
 ;exten => wil,1,Goto(6236,1)
@@ -693,10 +695,11 @@
 ; grouping of acme's extensions... never used directly, always included.
 ;
 ;[acme-extens]
-;exten => 111,1,Gosub(stdexten,s,1(111,SIP/pete_1,acme))
+;include => stdexten
+;exten => 111,1,Gosub(stdexten(111,SIP/pete_1,acme))
 ;exten => 111,n,Goto(s,exten)
 ;
-;exten => 112,1,Gosub(stdexten,s,1(112,SIP/nancy_1,acme))
+;exten => 112,1,Gosub(stdexten(112,SIP/nancy_1,acme))
 ;exten => 112,n,Goto(s,end)
 ;
 ; end of acme example




More information about the svn-commits mailing list