AGI and retreiving data, how to use this data in extensions.conf

Home » Asterisk Users » AGI and retreiving data, how to use this data in extensions.conf
Asterisk Users 3 Comments

Hi All;

I know that I can use the AGI to call (run) a script (php or python or any other kind of scripts), but the question is:

If I have information that I need to build a decision in the extensions.conf based on it, and these informations can be obtained using this script, so how I will read these informations? What is the method to read it from the database and store it in a variable that I can use it in the extensions.conf to do proper call routing? How?

Regards
Bilal

3 thoughts on - AGI and retreiving data, how to use this data in extensions.conf

  • Easiest thing is to have your AGI script set channel variables, which can be read in the dial plan.

  • You would set a dialplan variable from inside your AGI.

    In PHPAGI it might be something this:

    $agi->set_variable(“CUST_ID”, $cust_id);

    Then in your dialplan after your script runs you can use the variable like any other.

    You can also get dialplan variables AND functions:

    $tmp = $agi->get_var(“VMCOUNT(1234@accounting)”);
    $vmcount = $tmp[“data”];