Gil Kloepfer wrote:
> On Mon, Feb 05, 2007 at 10:34:55PM -0600, Larry Alkoff
wrote:
>> How can I access an environmental variable in
Asterisk 1.2.5?
> [...]
>> 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?
>
> Did you export the environment variable? If MYIP was
not exported
> when you started Asterisk, then Asterisk won't see it.
Additionally,
> if you set an environment variable in the shell, for
example, and
> then you connect to Asterisk in console mode (asterisk
-r), that
> environment variable is not seen by the dialplan.
>
> My money would be on the "not exported"
problem (see your shell's
> man pages for details).
>
> ---
> Gil Kloepfer
> aaug kloepfer.org
>
Yes the MYIP variable is exported to bash.
It can be seen by the Asterisk CLI by
! echo $MYIP
It's not so important that the variable be seen by the
dialplan
but I want to use it in sip.conf to set externip.
Right now I use externhost=me.dyndns.org but the Asterisk
book says:
"externhost: Force Asterisk to perform DNS queries
periodically.
Not recommended for production
environments!
Use externip instead."
OTOH, externhost seems to work.
Larry
--
Larry Alkoff N2LA - Austin TX
Using Thunderbird on Linux
_______________________________________________
Austin-Asterisk-Users-Group mailing list
Austin-Asterisk-Users-Group bybent.com
http://buzzard.onr.com/mailman/listinfo/austi
n-asterisk-users-group
AAUG Web Site: http://aaug.bybent.com/
|