[asterisk-users] How to access environment variable?

James Fromm fromm at omnis.com
Wed Feb 7 08:48:01 MST 2007


'export MYIP' in the startup script for Asterisk.

Larry Alkoff wrote:
> I was only trying to demonstrate that my special variable MYIP was 
> indeed in the environment of the shell.  I suspect it's not in the 
> Asterisk process environment - why I dunno.
> 
> I'll look at that tomorrow but suspect I'll never be able to read the 
> MYIP variable from Asterisk.
> 
> Larry
> 
> 
> Tzafrir Cohen wrote:
>> On Tue, Feb 06, 2007 at 08:04:23AM -0600, Larry Alkoff wrote:
>>> Thanks for your reply Ioan.
>>>
>>> Very interesting.  ${ENV(PATH)} works to display the path
>>> but ${ENV(MYIP)} does not!
>>>
>>> There must be a list in Asterisk that only allows cerain 
>>> environmental variables to be shown.  A very unnecessary bummer.
>>>
>>
>> Right.
>>
>>> However, at the CLI prompt:
>>> ! echo $PATH and  ! echo $MYIP
>>> both work fine.
>>
>> However This is incorrect: '!' only works in a remote asterisk 
>> terminal: a connection from a different process (on the same system) 
>> to the running
>> Asterisk process.
>>
>> It will run a subshell of thatremote process. So it is not necessarily
>> related to the environment of the Asterisk process.
>>
>> Also: when running something in System(), note that you run a
>> subprocess, and that this subprocess may have its own separate
>> environment.
>>
> 
> 



More information about the asterisk-users mailing list