Menu

AbsoluteTimeout, ${DATETIME} and AGI?

Alborz
2005-08-27
2013-04-29
  • Alborz

    Alborz - 2005-08-27

    Hi,

    I have defined a time frame for each extension, it means each extension can receive calls during that time frame( Start Time to End Time). Now I want to use AbsoluteTimeout command to finish the calls if they was outside the time frame. For this reason I need to find out the current time ( when that extension receive a new call) and see how long that call can last, and it means {End Time} - {Current Time}. If I can calculate this time in second, then I can use it in AbsoluteTimeout(seconds), and then it is easy to hangup that call, if it was out of predefined limit.

    Is it possible to calculate that time based on seconds with asterisk commands or it must be done in AGI? Can somebody show me how to do it in AGI please? Any hints would be appreciated.

    Thanks,
    Tochal

     
    • Alborz

      Alborz - 2005-08-27

      The following code is what I put together for the above question.
      How can I send the $closinghr from dialplan or extensions.conf to this file? and how can I send $diff, to dialplan? or if I use AbsoluteTimeout, here it can do the job? Do I need to disconnect this at the end?

      <?php
      require('phpagi.php');
      $agi = new AGI();
      $now = time();
      $closinghr = "17:30";
      $diff = strtotime($closinghr) - $now ;
      $agi->AbsoluteTimeout($diff)
      ?>

      Thanks,
      Tochal

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.