Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5977097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:19:18+00:00 2026-05-22T21:19:18+00:00

Ok, so I have a ruby script that grabs some data from FM Server

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:19:19+00:00Added an answer on May 22, 2026 at 9:19 pm

    I’m not sure what an Asterix AGI script is, but if its anything like CGI, where your code is being run by a server, then its probably running as a different user as you. Hopefully it is and not root and it probably can’t read /root/rfm-query.rb.

    You can check this by trying to open and print the file for reading.

    my $rfm_query_file = "/root/rfm-query.rb";
    open my $fh, "<", $rfm_query_file or die "Cant open $rfm_query_file: $!";
    

    (Also, shame on you if you’re developing and testing code as root.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ruby script that downloads URLs from an RSS server and then
I have a simple Ruby script that looks like this require 'csv' while line
I have recently written some complex ruby script that eventually fails with segfaults in
I have rails website that shows information from database. And I have ruby script
I have a ruby script that executes another ruby script via backticks. Like this:
so i have ruby script that simply writes to a test.txt file with hello
I have a Ruby script that generates a UTF8 CSV file remotely in a
I have a ruby script that does a few perforce operations (through the scripting
I have a ruby script that is simultaneously and asynchronously receiving and displaying messages
I have a Ruby script in my Rails app that I use to load

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.