Review Board 1.7.16


app_directory, support option 'p(n)' as documented with CLI online help, branches 1.6.1 to trunk.

Review Request #481 - Created Feb. 1, 2010 and submitted

Alec Davis
trunk
16751
Reviewers
asterisk-dev
Asterisk
finish off preliminary work done for initial pause before presenting directory name to caller.

Currently, 'core show application DIRECTORY' from 1.6.1 through to trunk indicates the 'p(n)' option is available, where in fact there is no code to act on it, other than to populate opts[OPT_ARG_PAUSE].
1.6.1 production server.
'p' on it own doesn't introduce delay, as expected.
'p(1000)' introduces 1 second delay after intial 3 letters are entered, then presents names individually.
'mp(1000)' introduces 1 second delay after intial 3 letters are entered, then presents names as a list.
'p(6000)' enforces a maximum of a 3 second delay.

Changes between revision 2 and 3

1 2 3 4
1 2 3 4

  1. trunk/apps/app_directory.c: Loading...
trunk/apps/app_directory.c
Diff Revision 2 Diff Revision 3
[20] 287 lines
[+20] [+] static int select_entry(struct ast_channel *chan, const char *dialcontext, const struct directory_item *item, struct ast_flags *flags)
288
	return 0;
288
	return 0;
289
}
289
}
290

    
   
290

   
291
static int select_item_pause(struct ast_channel *chan, struct ast_flags *flags, char *opts[])
291
static int select_item_pause(struct ast_channel *chan, struct ast_flags *flags, char *opts[])
292
{
292
{
293
	int res = 0, opt_pause=0;
293
	int res = 0, opt_pause = 0;
294

    
   
294

   
295
	if (ast_test_flag(flags, OPT_PAUSE) && !ast_strlen_zero(opts[OPT_ARG_PAUSE])) {
295
	if (ast_test_flag(flags, OPT_PAUSE) && !ast_strlen_zero(opts[OPT_ARG_PAUSE])) {
296
		opt_pause = atoi(opts[OPT_ARG_PAUSE]);
296
		opt_pause = atoi(opts[OPT_ARG_PAUSE]);
297
		if (opt_pause > 3000) {
297
		if (opt_pause > 3000) {
298
			opt_pause = 3000;
298
			opt_pause = 3000;
[+20] [20] 7 lines
[+20] static int select_item_pause(struct ast_channel *chan, struct ast_flags *flags, char *opts[])
306
{
306
{
307
	struct directory_item *item, **ptr;
307
	struct directory_item *item, **ptr;
308
	int i, res, loop;
308
	int i, res, loop;
309

    
   
309

   
310
	/* option p(n): cellphone pause option */
310
	/* option p(n): cellphone pause option */

    
   
311
	/* allow early press of selection key */
311
	res = select_item_pause(chan, flags, opts);
312
	res = select_item_pause(chan, flags, opts);
312

    
   
313

   
313
	for (ptr = items, i = 0; i < count; i++, ptr++) {
314
	for (ptr = items, i = 0; i < count; i++, ptr++) {
314
		item = *ptr;
315
		item = *ptr;
315

    
   
316

   
316
		for (loop = 3 ; loop > 0; loop--) {
317
		for (loop = 3 ; loop > 0; loop--) {

    
   
318
			if (!res)
317
			res = play_mailbox_owner(chan, item->context, item->exten, item->name, flags);
319
				res = play_mailbox_owner(chan, item->context, item->exten, item->name, flags);
318

    
   

   
319
			if (!res)
320
			if (!res)
320
				res = ast_stream_and_wait(chan, "dir-instr", AST_DIGIT_ANY);
321
				res = ast_stream_and_wait(chan, "dir-instr", AST_DIGIT_ANY);
321
			if (!res)
322
			if (!res)
322
				res = ast_waitfordigit(chan, 3000);
323
				res = ast_waitfordigit(chan, 3000);
323
			ast_stopstream(chan);
324
			ast_stopstream(chan);
[+20] [20] 21 lines
[+20] [+] static int select_item_menu(struct ast_channel *chan, struct directory_item **items, int count, const char *dialcontext, struct ast_flags *flags, char *opts[])
345
	struct directory_item **block, *item;
346
	struct directory_item **block, *item;
346
	int i, limit, res = 0;
347
	int i, limit, res = 0;
347
	char buf[9];
348
	char buf[9];
348

    
   
349

   
349
	/* option p(n): cellphone pause option */
350
	/* option p(n): cellphone pause option */
350
	res = select_item_pause(chan, flags, opts);
351
	select_item_pause(chan, flags, opts);
351

    
   
352

   
352
	for (block = items; count; block += limit, count -= limit) {
353
	for (block = items; count; block += limit, count -= limit) {
353
		limit = count;
354
		limit = count;
354
		if (limit > 8)
355
		if (limit > 8)
355
			limit = 8;
356
			limit = 8;
[+20] [20] 524 lines
  1. trunk/apps/app_directory.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.