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

Greg Lim glim at InfiStar.com
Thu Dec 1 09:04:59 MST 2005


Sorry to be a bother, but I'm seeking *understanding* here, not a quick
fix.

I got a couple of answers to my post, but no-one actually answered my
question, namely:
What does AST_FLAG_DEFER_DTMF do? The pseudocode I posted is not
actually what I am
trying to do; it was merely an example. I have 1000's of lines of code
from an
already-written non-asterisk solution that I am trying to port to
Asterisk.

AST_FLAG_DEFER_DTMF is apparently not documented, and the one nonobvious
comment in
the sourcecode appears to not match what the code is actually doing.
Further, it has been
that way since before ast_test_flag() was a macro.

I did not know about app_externalivr before. That's new info to me.
Thank you. It'll be
another good place to look at behavior like that. I don't think I can
use that directly,
because it would require rewriting the logic for my "scripts" in dozens
of places. Also,
a dialplan is not really the correct place to do this, as there's a ton
of code that
talks directly to proprietary in-house TCP-socket apps.

Again, sorry to be a bother; I thought the asterisk-dev list would be
the correct place
to ask about one of the internal channel flags. If I am mistaken in
that, could someone
please correct me?

Thanks again for reading,
-Greg



-----Original Message-----
From: asterisk-dev-bounces at lists.digium.com
[mailto:asterisk-dev-bounces at lists.digium.com] On Behalf Of Steven
Critchfield
Sent: Wednesday, November 30, 2005 3:37 PM
To: Asterisk Developers Mailing List
Subject: Re: [Asterisk-Dev] AST_FLAG_DEFER_DTMF (would like
dialogic-r4like semantics)

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>

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
Confidentiality Notice
This message (including any attachments) is intended only for the person or entity to which it is addressed and may contain proprietary or confidential information. If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately and please delete all copies of this message. All e-mail sent to the originating address will be received by the InfiCorp e-mail system and is subject to archiving and review by someone other than the addressee.




More information about the asterisk-dev mailing list