Re: [asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-21 Thread Thorsten Göllner


  
  
What does "but this didn't work" mean?

Am 20.07.2011 15:25, schrieb Danny Nicholas:

  
  
  
  
Hello,
 Im putting Asterisk in to
  replace an existing IVR and that PBX system uses * to
  terminate number input instead of #. I thought it would be a
  matter of simply making a new app_read that replaced \# with
  \* but this didnt work. Any suggestions (besides bopping the
  client up side the head for wanting this?).

  
  


  


--
_
-- 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

Re: [asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-21 Thread Danny Nicholas
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Thorsten
Göllner
Sent: Thursday, July 21, 2011 1:50 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] HELP - Client wants to reverse Asterisk
Functionality

 

What does but this didn't work mean?

Am 20.07.2011 15:25, schrieb Danny Nicholas: 

Hello,

I’m putting Asterisk in to replace an existing IVR and that PBX
system uses * to terminate number input instead of #.  I thought it would be
a matter of simply making a new app_read that replaced \# with \* but this
didn’t work.  Any suggestions (besides bopping the client up side the head
for wanting this?).

 

I took apps/app_read.c in asterisk 1.4.37 (same source in all 1.4 modules
after that) and modified lines 71, 72 and 183 replacing # with * and save
the modified source as app_readstar.c.  I then did make menuselect and got
the new module app_readstar available for selection.  Selected it and built
Asterisk as normal.  In my dialplan I replaced Read(var,file,blah) with
Readstar(var,file,blah).  It gives the “right” message if you do core show
application readstar, but * does not terminate input as I had hoped/expected
it would.





 

--
_
-- 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

[asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-20 Thread Danny Nicholas
Hello,

I'm putting Asterisk in to replace an existing IVR and that PBX
system uses * to terminate number input instead of #.  I thought it would be
a matter of simply making a new app_read that replaced \# with \* but this
didn't work.  Any suggestions (besides bopping the client up side the head
for wanting this?).

 

Thanks

Danny Nicholas

 

--
_
-- 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

Re: [asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-20 Thread Steve Edwards

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 #.


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


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  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

Re: [asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-20 Thread Eric Wieling


Sent from my Computer

 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of
 Steve Edwards
 Sent: Wednesday, July 20, 2011 4:19 PM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] HELP - Client wants to reverse
 Asterisk Functionality

 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 #.

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

Or you can use WaitExten instead of Read.

--
_
-- 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

Re: [asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-20 Thread Danny Nicholas
-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Eric Wieling
Sent: Wednesday, July 20, 2011 3:24 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] HELP - Client wants to reverse Asterisk
Functionality



Sent from my Computer

 -Original Message-
 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve 
 Edwards
 Sent: Wednesday, July 20, 2011 4:19 PM
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] HELP - Client wants to reverse Asterisk 
 Functionality

 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 #.

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

Or you can use WaitExten instead of Read.

This sounded like a great idea, but I need numbers that are 4-16 digits in
length,  so I'm going to explore Steve's AGI suggestion (at least in 1.4,
waitexten seems to be only good for 1 digit responses)


--
_
-- 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


Re: [asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-20 Thread Danny Nicholas


-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
Sent: Wednesday, July 20, 2011 3:19 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] HELP - Client wants to reverse Asterisk
Functionality

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 #.

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

--
Great idea Steve (what else should I expect).  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)

Here it is if anyone cares -
#!/usr/bin/perl
use strict;

$|=1;

# Setup some variables
my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;
my ($retvar, $rettime, $retlen) = @ARGV;
if (! $retvar) {
   $retvar='digitacct';
   $retlen=16;
   $rettime=1;
   }
if (! $retlen) {
   $retlen=16;
   $rettime=1;
   }
if (! $rettime) {
   $rettime=1;
   }
while(STDIN) {
chomp;
last unless length($_);
if (/^agi_(\w+)\:\s+(.*)$/) {
$AGI{$1} = $2;
}
}
print STDERR AGI Environment Dump:\n;
foreach my $i (sort keys %AGI) {
print STDERR  -- $i = $AGI{$i}\n;
}
sub checkresult {
my ($res) = @_;
my $retval;
$tests++;
chomp $res;
if ($res =~ /^200/) {
$res =~ /result=(-?\d+)/;
if (!length($1)) {
print STDERR FAIL ($res)\n;
$fail++;
} else {
print STDERR PASS ($1)\n;
$pass++;
}
} else {
print STDERR FAIL (unexpected result '$res')\n;
$fail++;
}
}
print STDERR 1.  Testing 'get data'...;
print GET DATA beep $rettime $retlen\\\n;
my $result = STDIN;
checkresult($result);
my $nresult=$result;
#my $rdigit=' ';
#while (length($nresult)16  $rdigit ne '*') {
#   print WAIT DTMF 4000\n;
#   $rdigit=STDIN;
#   checkresult($rdigit);
#   $nresult=$nresult.$rdigit if $nresult;
#   $nresult=$rdigit if !$nresult;
#   }
print STDOUT SET VARIABLE $retvar $nresult\n;
my $result2 = STDIN;
checkresult($result2);
print STDERR == Complete ==\n;
print STDERR $tests tests completed, $pass passed, $fail failed\n;
print STDERR ==


--
_
-- 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


Re: [asterisk-users] HELP - Client wants to reverse Asterisk Functionality

2011-07-20 Thread Steve Edwards

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,1,*)
exten = *,n,verbose(1,${RESPONSE})

--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  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