On Wed, 20 Jul 2011, Danny Nicholas wrote:

I?m putting Asterisk in to replace an existing IVR and that PBX system uses * to terminate number input instead of #.

On Wed, 20 Jul 2011, Steve Edwards wrote:

How about an AGI executing some mix of get data, get option, stream file, or wait for digit and accumulate the digits yourself.

On Wed, 20 Jul 2011, Danny Nicholas wrote:

I modified the agi-test.agi that comes in the can to do just this, it just doesn't terminate when the user presses * (still have to wait for the timeout)

On Wed, 20 Jul 2011, Steve Edwards wrote:

I was thinking more like (in PHP, sorry -- my Perl skills suck):

#!/usr/bin/php -q
<?php

// initialize the AGI environment
        require('phpagi.php');
        $agi = new AGI();

// extract our parameters
        $idx = 1;
        $variable = $argv[$idx++];
        $filename = $argv[$idx++];
        $max_digits = $argv[$idx++];
        $timeout = $argv[$idx++];
        $terminator = $argv[$idx++];

// play the file and get the first digit
        $dtmf = '';
        $result = $agi->get_data($filename, $timeout, 1);
        $key = $result['result'];

// loop for the remaining digits
        while   ((strlen($dtmf) < $max_digits)
        &&       ($key != $terminator))
                {
                $dtmf .= $key;
                $result = $agi->wait_for_digit($timeout);
                $key = chr($result['result']);
                }

// set the channel variable
        $agi->set_variable($variable, $dtmf);

?>

And then, in your dialplan:

        exten = 
*,n,agi(read-with-terminator.php,RESPONSE,demo-congrats,10,10000,*)
        exten = *,n,verbose(1,${RESPONSE})

--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       [email protected]      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
              http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to