Joost Kuif | Mobillion
2008-Jan-30 12:38 UTC
[asterisk-users] Can't read environment variable
Hi,
I can't read a environment variable in a asterisk dialplan.
When logged in as user root on the system an 'echo $HOSTNAME' gives the
hostame of the machine.
Asterisk (1.4) is started from the same console.
I try to read it like this:
exten => s,n,NoOp(host=${ENV(HOSTNAME)})
Does anyone know what i am missing?
Ipv een saaie e-mail een leuk videobericht? Ga naar www.KletsKoppies.nl
<http://www.kletskoppies.nl/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20080130/96515256/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 22907 bytes
Desc: kuif_joost.gif
Url :
http://lists.digium.com/pipermail/asterisk-users/attachments/20080130/96515256/attachment-0001.gif
You're using the variables wrong.
This is what you could do is either:
exten => s,1,NoOp(${ENV(HOSTNAME)})
or
In globals section
;; Defing hostname
host=${ENV(HOSTNAME)})
In you dailplan section
exten => s,1,NoOp(${host})
You will manage,
Greets
Joris
Joost Kuif | Mobillion wrote:> Hi,
>
> I can't read a environment variable in a asterisk dialplan.
> When logged in as user root on the system an 'echo $HOSTNAME'
> gives the hostame of the machine.
> Asterisk (1.4) is started from the same console.
>
> I try to read it like this:
> exten => s,n,NoOp(host=${ENV(HOSTNAME)})
>
> Does anyone know what i am missing?
>
>
> Ipv een saaie e-mail een leuk videobericht? Ga naar/
> //www.KletsKoppies.nl <http://www.kletskoppies.nl/>/
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> -- 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
On Wed, Jan 30, 2008 at 01:38:48PM +0100, Joost Kuif | Mobillion wrote:> Hi, > > I can't read a environment variable in a asterisk dialplan. > When logged in as user root on the system an 'echo $HOSTNAME' gives the > hostame of the machine. > Asterisk (1.4) is started from the same console. > > I try to read it like this: > exten => s,n,NoOp(host=${ENV(HOSTNAME)}) > > Does anyone know what i am missing?Is that variable set? cat /proc/PID_OF_ASTERISK/environ | tr '\0' '\n' | grep ^HOSTNAME -- Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen at xorcom.com +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
Maybe...
exten => s,n,NoOp(SET(host=${ENV(HOSTNAME))})
?
________________________________
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Joost Kuif
| Mobillion
Sent: 30 January 2008 12:39
To: asterisk-users at lists.digium.com
Subject: [asterisk-users] Can't read environment variable
Hi,
I can't read a environment variable in a asterisk dialplan.
When logged in as user root on the system an 'echo $HOSTNAME'
gives the hostame of the machine.
Asterisk (1.4) is started from the same console.
I try to read it like this:
exten => s,n,NoOp(host=${ENV(HOSTNAME)})
Does anyone know what i am missing?
Ipv een saaie e-mail een leuk videobericht? Ga naar
www.KletsKoppies.nl <http://www.kletskoppies.nl/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20080130/28648e94/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 22907 bytes
Desc: kuif_joost.gif
Url :
http://lists.digium.com/pipermail/asterisk-users/attachments/20080130/28648e94/attachment.gif