VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
we at deuromedia.at Guest
|
Posted: Wed Jan 02, 2008 5:45 am Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
Hi all,
Im using Asterisk 1.4.11 and I want to proceed some time and date operations
in my dial plan. (for a time shifted callback).
Should look like:
CURRENT TIME + x minutes.
Of course it should increase the hours for example in this case:
10.59 + 5 minutes = 11.04
I guess I've to use the math function in 1.4 but how can I manage easily the
time operations?
Kind Regards,
Erik |
|
Back to top |
|
|
support at drdos.info Guest
|
Posted: Wed Jan 02, 2008 7:23 am Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
Erik Wartusch wrote:
Quote: | Hi all,
Im using Asterisk 1.4.11 and I want to proceed some time and date operations
in my dial plan. (for a time shifted callback).
| If you'll be using call files to do this, you can 'touch' them to a
future date and Asterisk will not act on them until that date is reached.
Doug
--
Ben Franklin quote:
"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety." |
|
Back to top |
|
|
we at deuromedia.at Guest
|
Posted: Wed Jan 02, 2008 8:16 am Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
Thanks Doug.
Yes. Thats what I plan to do and allready knew about. But I want to know
wether there is an easy option to operate with times (add x minutes to a
time) or not? My research until now wasn't successful and I'm wondering that
nobody before had this problem... (date and time manipulation)
Cheers,
Erik
Am Mittwoch, 2. Januar 2008 13:23 schrieb Doug Lytle:
Quote: | Erik Wartusch wrote:
Quote: | Hi all,
Im using Asterisk 1.4.11 and I want to proceed some time and date
operations in my dial plan. (for a time shifted callback).
|
If you'll be using call files to do this, you can 'touch' them to a
future date and Asterisk will not act on them until that date is reached.
Doug |
|
|
Back to top |
|
|
we at deuromedia.at Guest
|
Posted: Wed Jan 02, 2008 10:34 am Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
daveC,
No it's even simpler. ( I dont need an IF case)
I just want to add e.g. 15 minutes to the current date / time:
So simply said:
${STRFTIME(${EPOCH},,%Y%m%d%H%M)} + 15 minutes!
My question was how can I do that.? Of yourse e.g. if it's 23.57 pm and I add
15 minutes the day should increase +1 and the hours start with 0 the
minutes with 12 ( and not 72 as the normal addition would result).
Kind Regards,
Erik
Am Mittwoch, 2. Januar 2008 16:02 schrieb dave cantera:
--
=======================================
Erik Wartusch
Deuromedia Technologies GmbH
Barichgasse 40-42
1030 Wien
Austria
Phone: +43 16986442 1205
Fax: +43 16986442 200
email: we at deuromedia.at
www.deuromedia.com |
|
Back to top |
|
|
tilghman at mail.jeffa... Guest
|
Posted: Wed Jan 02, 2008 10:43 am Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
On Wednesday 02 January 2008 07:16:15 Erik Wartusch wrote:
Quote: | Yes. Thats what I plan to do and allready knew about. But I want to know
wether there is an easy option to operate with times (add x minutes to a
time) or not? My research until now wasn't successful and I'm wondering
that nobody before had this problem... (date and time manipulation)
|
There is not. However, if you convert your time to seconds, then it's
naturally easy to do math, and you can then convert the format back.
You can use the dialplan functions STRPTIME() and STRFTIME() to help you
with the conversions.
--
Tilghman |
|
Back to top |
|
|
david.cantera at iacne... Guest
|
Posted: Wed Jan 02, 2008 11:11 am Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
erik,
cool, there are so many functions in *, it takes a long time to learn
the shortcuts!
thanks erik!
daveC
Erik Wartusch wrote:
Quote: | daveC,
No it's even simpler. ( I dont need an IF case)
I just want to add e.g. 15 minutes to the current date / time:
So simply said:
${STRFTIME(${EPOCH},,%Y%m%d%H%M)} + 15 minutes!
My question was how can I do that.? Of yourse e.g. if it's 23.57 pm and I add
15 minutes the day should increase +1 and the hours start with 0 the
minutes with 12 ( and not 72 as the normal addition would result).
Kind Regards,
Erik
Am Mittwoch, 2. Januar 2008 16:02 schrieb dave cantera:
|
--
My wife's sister is in California.
I should buy her a Videophone2008!
Truly, The Next Best Thing to Being There!
--
WorldWideVideoPhones.com
856.380.0894 |
|
Back to top |
|
|
tilghman at mail.jeffa... Guest
|
Posted: Wed Jan 02, 2008 12:59 pm Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
On Wednesday 02 January 2008 09:34:24 Erik Wartusch wrote:
Quote: | No it's even simpler. ( I dont need an IF case)
I just want to add e.g. 15 minutes to the current date / time:
So simply said:
${STRFTIME(${EPOCH},,%Y%m%d%H%M)} + 15 minutes!
My question was how can I do that.? Of yourse e.g. if it's 23.57 pm and I
add 15 minutes the day should increase +1 and the hours start with 0 the
minutes with 12 ( and not 72 as the normal addition would result).
|
${STRFTIME($[${EPOCH} + (15 * 60)],,%Y%m%d%H%M)}
--
Tilghman |
|
Back to top |
|
|
we at deuromedia.at Guest
|
Posted: Thu Jan 03, 2008 4:02 am Post subject: [asterisk-users] Asterisk dialplan date and time operations |
|
|
Thanks!
I got it now!
Here is a sample for a delayed callback after a caller gets to a users
voicemailbox. Purpose: Reminder for people that they got a message on their
v. box.
exten => 1002,1,Answer
exten => 1002,2,Set(CHANNEL(musicclass)=default)
exten => 1002,3,Queue(test|t|||5)
exten => 1002,4,Voicemail(b1205)
exten => 1002,5,System(echo -e "Channel: SIP/we-static\\nCallerID:
VOICEMAIL
<8500>\\nContext: test\\nExtension: 444" > /tmp/${UNIQUEID}.call)
; add 15 minutes (in seconds 900) to the epoch time
exten => 1002,6,Set(newepoch=${MATH(${EPOCH} + 900 |int)})
; write it out for debugging purpose
exten => 1002,7,NoOp(${newepoch})
exten => 1002,8,System(touch -t ${STRFTIME(${newepoch},,
%Y%m%d%H%M)} /tmp/${
UNIQUEID}.call)
exten =>
1002,9,System(mv /tmp/${UNIQUEID}.call /var/spool/asterisk/outgoing
/)
exten => 1002,10,Hangup
Kind Regards,
Erik
Am Mittwoch, 2. Januar 2008 18:59 schrieb Tilghman Lesher:
Quote: | On Wednesday 02 January 2008 09:34:24 Erik Wartusch wrote:
Quote: | No it's even simpler. ( I dont need an IF case)
I just want to add e.g. 15 minutes to the current date / time:
So simply said:
${STRFTIME(${EPOCH},,%Y%m%d%H%M)} + 15 minutes!
My question was how can I do that.? Of yourse e.g. if it's 23.57 pm and I
add 15 minutes the day should increase +1 and the hours start with 0
the minutes with 12 ( and not 72 as the normal addition would result).
|
${STRFTIME($[${EPOCH} + (15 * 60)],,%Y%m%d%H%M)} |
|
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|