0
votes

Consider the following AGI script. The dialplan entry for it is simply exten => *,1,AGI(test.agi). Analog card TDM410P is used.

#!/bin/sh
read REPLY; while [ "$REPLY" ]; do
  read REPLY
done
#sleep 5
echo ANSWER; read REPLY
#sleep 5
while [ 1 ]; do
  echo WAIT FOR DIGIT -1; read REPLY
  echo $REPLY >>/tmp/agi
done

The problem is this: I take the phone off-hook and press *12345 very fast; the result is that the first one or two digits are sometimes lost (i.e., not recorded to /tmp/agi).

How to make it so that asterisk will buffer DTMF digits until they are read?


EDIT

I guess I need to create pseudoterminal (because it can buffer data) in the channel and write dtmf digits to it as soon as they are decoded, and set the name of the pseudoterminal slave in channel variables. Then AGI script will take the name of pty slave from AGI initialization data and will just read from the pty slave instead of via "WAIT FOR DIGIT".

So, does anybody know how to hack asterisk chan_dahdi? Or maybe there is a higher channel layer, not tied to specific module? Where should I look? Any hints...

1

1 Answers

1
votes

AGI script already have STDIN which do buffering for you.

If you are not reading it, it will be in buffer.

Your issue with DTMF not related to AGI nor buffering. Check "DTMF Radio Relax" or just check you have correct DTMF settings on trunk.