[asterisk-users] How to access environment variable?

Ioan Indreias ioan.indreias at modulo.ro
Tue Feb 6 06:10:09 MST 2007


Hello Larry,

Probably your variable (MYIP) is not accessible to asterisk process 
environment.
Test it with ${ENV(PATH)} and you will have a result there....

exten => s,n,Set(test=${ENV(PATH)})
 -- Executing Set("IAX2/test_iax", 
"test=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin") in new stack

-- 
Best regards,
## nini @ www.modulo.ro ##



Larry Alkoff wrote:
> How can I access an environmental variable in Asterisk 1.2.5?
>
> It should be possible according to:
> http://www.voip-info.org/wiki/view/Asterisk+variables
> which says:
>
> Environment Variables
> You may access unix environment variables using the syntax:
>    ${ENV(foo)}
> ${ENV(ASTERISK_PROMPT)}: the current Asterisk CLI prompt.
> ${ENV(RECORDED_FILE)}: the filename of the last file saved by the 
> Record command
>
>
> I have an environmental variable MYIP which contains my current IP 
> address but when I execute exten _4XX the following line only says
> 'myip is  ' and the rest is blank instead of showing
> 'myip is   www.xxx.yyy.zzz'
>
> exten => _4XX,n,VERBOSE("myip is  ${ENV(MYIP)}")
>
> Why doesn't it work?
>
> Larry
>
>


More information about the asterisk-users mailing list