title: Asterisk get_variable, in Perl AGI
body: <p>I am little new to Asterisk AGI. I am using perl with asterisk agi.</p>
  
  <p>I need to design an IVR solution using Perl asterisk agi.</p>
  
  <p>I have write a little code and it is executing fine.</p>
  
  <h2>Perl Code:-</h2>
  
  <pre><code>#!/usr/bin/perl -w
  use strict;
  use warnings;
    use Asterisk::AGI;
    my $agi = new Asterisk::AGI;
    my $option1 = "";
    my $option2 = "";
  
  $agi-&gt;exec("Read","option1,recording-201503252343,1,,,");
  $option2 = $agi-&gt;get_variable("$option1");
  $agi-&gt;exec("NoOp","$option1");
  
  if($option2 == 1)
  {
    $agi-&gt;exec("Playback","hello-world");
    $agi-&gt;exec("Goto","English,s,1");
  }
  </code></pre>
  
  <hr>
  
  <h2>Asterisk Dialplan:-</h2>
  
  <pre><code>exten =&gt; 12345,1,Answer()
  exten =&gt; 12345,2,AGI(agi_new-new.pl)
  exten =&gt; 12345,n,NoOP(${AGISTATUS})
  exten =&gt; 12345,n,Hangup()
  </code></pre>
  
  <hr>
  
  <p>Actually what i did in the code is that i want a user to dial the extension lead by the IVR in which 2 options are prompted and he has to choose between 2 options when he/she enter the options i want to store that digit into a variable so that i use condition on that variable.
  I use get_variable to get the variable but when i press the desired option it gets that dtmf input but it is not storing in the variable via the command get_variable.</p>
  
  <p>please i need little help on this.</p>
  
  <p>if anyone could help it will be highly appreciated.</p>