[Asterisk-Dev] AST_FLAG_DEFER_DTMF (would like dialogic-r4 like semantics)

Steven Critchfield critch at basesys.com
Wed Nov 30 13:37:17 MST 2005


On Wed, 2005-11-30 at 14:27 -0500, Greg Lim wrote:
> Could someone enlighten me on the use of this flag? It appears to be
> only used in channel.c, and only for ast_read()...
> The direction I'd like to go in is to create an AGI module that will
> allow me to make use of Dialogic-R4-like semantics.
> For example, there is no easy way in AGI currently to do this:
> 
> 0. clear dtmf buffer
> 1. play (menu1, interruptible)
> 2. if (specialcustomer) play (menu2, interruptible)
> 3. play (menu3, interruptible)
> 4. collect dtmf digits
> etc.

This is already possible. What you may not realise is that any time you
are playing an interuptable prompt, you need to check the exit status to
see if digits where received.

Let me expand your list above but in a psuedo code style so it might
make more sense.

# don't need to clear dtmf buffer as agi doesn't buffer.
play($menu1, $valid_interupt_keys);
$res = checkresult();
if($res <> 'timeout'){
	# received a keystroke or hangup, handle it.
	jumpto($nexthop[$res]);
}
if($specialcustomer){
	play($menu2, $valid_interupt_keys);
	$res = checkresult();
	if($res <> 'timeout'){
		# received a keystroke or hangup, handle it.
		jumpto($nexthop[$res]);
	}
}
play($menu4, $valid_interupt_keys);
$res = checkresult();
if($res <> 'timeout'){
	# received a keystroke or hangup, handle it.
	jumpto($nexthop[$res]);
}
# no keys yet so pause and ask for digits.
while( ask_for_digits($valid_interupt_keys) ){
	$res = checkresult();
	if($res == 'timeout' and $timeout < $hugewait){
		next;
	}elsif($timeout < $hugewait){
		jumpto($nexthop[$res]);
	}
	update($timeout);
}


Of course, it is much easier putting this logic into the dialplan itself
as all the checking and collecting of digits is done there.

I'll let someone else do the dialplan example(Tilghman, wanna show how
it is done?). It will probably look much shorter than the above list.
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-dev mailing list