pbx*CLI> console dial 415@local
[Jan 30 18:18:02] WARNING[2460]: chan_oss.c:682 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
-- Executing [415@local:1] AGI("OSS/dsp", "/home/asterisk/substitute.agi|test string|t|T") in new stack
-- Launched AGI Script /home/asterisk/substitute.agi
-- AGI Script /home/asterisk/substitute.agi completed, returning 0
-- Executing [415@local:2] NoOp("OSS/dsp", "") in new stack
== Auto fallthrough, channel 'OSS/dsp' status is 'UNKNOWN'
<< Hangup on console >>
exten => 415,1,AGI(substitute.agi,test string,t,T)
exten => 415,n,NoOp(${RESULT})
substitution.agi
#!/usr/bin/perl
# I want to use regular expression subsitituions in asterisk
# and this looks to be the easiest way to get them!
use strict;
use Asterisk::AGI;
my $AGI = new Asterisk::AGI;
my $string = $ARGV[0];
my $match = $ARGV[1];
my $replace = $ARGV[2];
$AGI->Noop("$string,$match,$repace,$result");
my $result = "Test";
$AGI->set_variable("RESULT", $result);