On Mon, 19 Jan 2009, didier.cuffaut wrote:

> 2) From my first post, are these lines OK or wrong? (syntax error?)
>
>  tmsp = the delay in future.. say 100 seconds
>  exten=> ra,n,System(NOW='date %S')
>  exten=> ra,n,System(let NOW=$NOW+$tmsp)
>  exten=> ra,n,System(TOUCH_TMSP='date -d "1970-01-01 $NOW sec GMT+1" 
> +%Y%m%d%H%M. %S)  < NOTE THE 'M. %S'
>
>  *********
>
>  or this way ?
>
>  exten=> ra,n,Set(touchtime=$[${EPOCH} + ${tmsp}])
>  exten=> ra,n,Set(TOUCH_TMSP=${STRFM(${touchtime},GMT+1,%C%y%m%d%H%M%S)
>
>  *********

Each invocation of system() executes a separate process. The environment 
variables do not survive across processes. This method will not work.

Setting a channel variable and then passing it will work.

Your choices are to use system() or agi(). I'm leaning towards system() 
because the script/executable does not interact with Asterisk and may have 
value to you as a stand-alone command line utility.

You can write either in whatever language you are comfortable with. My 
sharpest tool is C but if execution speed is not important any scripting 
language (like shell) will do.

I'm a big fan of the getopt facility as it does all the nasty command line 
parsing for you so your utilities have a consistent, self-documenting look 
and feel. I even use it when I write AGIs. A year from now, which would 
you rather "re-discover" in your dialplan:

exten = 
s,n,agi(schedule-future-call,--archive,--max-retries=2,--offset=${TMSP},--retry-time=60,--wait-time=20)

or

exten = s,n,agi(schedule-future-call,${TMSP},60,,,20,a,,2)

I think I would pass the offset rather than the absolute. I don't like to 
clutter up my dialplans too much.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      [email protected]      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to