Ok, so I have a ruby script that grabs some data from FM Server and returns a tuple. I had to do this because there's no good perl FM module that I'm aware of.
[test.pl]
$ret = `ruby /root/rfm-query.rb $cid`; @extens = split(/,/, $ret, 2); print "DIAL SIP/$extens[0]";
So when I run this it will print "DIAL SIP/215" as expected but when using the same code in an Asterisk AGI script and using $extens[0] it always returns nothing.
#!/usr/bin/env perl use Asterisk::AGI; $|=1; $AGI = new Asterisk::AGI; %input = $AGI->ReadParse(); $cid = substr $input{'callerid'}, 1; $cid =~ s/\+//g; $ret = `ruby /root/rfm-query.rb $cid`; #rets nothing @extens = split(/,/, $ret, 2); $AGI->exec("DIAL SIP/$extens[0]");
Why does it work in a test script but not in an AGI?