[Asterisk-Users] ${EPOCH} and ${DATETIME} patch

duncan duncan at impede.net
Tue Apr 29 04:16:38 MST 2003


i need to set the AbsoluteTimeout and value of Dial from an perl AGI 
script.  i dont know if there is a way to set the absolutetimeout from 
within AGI so i can only think that i need to pass a variable out of the 
script and into the extensions.conf.  i know you can dial out from an AGI - 
but doesnt it use the console dial?  what happens if i want to dial several 
times with the same AGI?

the email below shows a method, but im not entirely sure i understand how 
it works if i want the variable to be set differently each time from the 
perl AGI script.  any ideas on a better way to do this?

exten => s,1,AGI,plt_record.agi
exten => s,2,AbsoluteTimeout,${timeout}-${ARG1}
exten => s,3,Dial,${dialednumber}-${ARG1}


thanks

duncan

>This is actually fairly useful.  I did the equivalent (again, for a 
>filename like you did) with an AGI.  Here is my method below.  It's less 
>elegant (requires an AGI call every time) but more flexible (uses the 
>Linux built-in "date" program to produce any number of variations on 
>date/time).  I suppose a quick extension could be written into the AGI to 
>also specify the time/date format, but I didn't get that fancy with this 
>version.
>
>Contents of the file /var/lib/asterisk/agi-bin/set-timestamp.agi:
>
>#!/bin/sh
>longtime=`date +%Y%m%d-%H%M%S`
>echo SET VARIABLE timestamp $longtime
>
>;(snippet from extensions.conf)
>;Now, I call the AGI:
>exten => s,1,AGI(set-timestamp.agi)
>; and the results are set in $timestamp
>exten => s,2,SetVar(CALLFILENAME=${timestamp}-${ARG2}-${ARG1})




More information about the asterisk-users mailing list