title: How can I get the extension entered by user in a Perl AGI script?
body: <p>I'm new to Asterisk AGI programming. Im trying to create a simple IVR, using <a href="http://search.cpan.org/dist/asterisk-perl" rel="nofollow noreferrer">asterisk-perl</a>, where a user can enter any extension from 1 to 4. Here is my code so far:</p>
  
  <pre><code>use Asterisk::AGI;
  
  $AGI = new Asterisk::AGI;
  
  for($i = 0 ; $i &lt; 2 ; $i++)
  {
      $AGI-&gt;exec('Playback','welcome');
  
      $AGI-&gt;exec('WaitExten','5|m');
  
  
  }
  </code></pre>
  
  <p>Now, I want to know the extension the user entered and take some action accordingly. How to get the extension entered by the user?</p>
  
  <p>Thank You.</p>