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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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
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