Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Can't read environment variable


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
joris at bitnetwerk.nl
Guest





PostPosted: Wed Jan 30, 2008 7:54 am    Post subject: [asterisk-users] Can't read environment variable Reply with quote

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:
Quote:
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
Back to top
tzafrir.cohen at xorco...
Guest





PostPosted: Wed Jan 30, 2008 7:57 am    Post subject: [asterisk-users] Can't read environment variable Reply with quote

On Wed, Jan 30, 2008 at 01:38:48PM +0100, Joost Kuif | Mobillion wrote:
Quote:
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
Back to top
steve.langstaff at cit...
Guest





PostPosted: Wed Jan 30, 2008 8:05 am    Post subject: [asterisk-users] Can't read environment variable Reply with quote

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
Back to top
Joost.kuif at mobillio...
Guest





PostPosted: Wed Jan 30, 2008 8:28 am    Post subject: [asterisk-users] Can't read environment variable Reply with quote

This pointed me into the right direction, thanks Tzafrir!

i added a export HOSTNAME=$HOSTNAME into my .bash_profile

Grtz,
Joost

-----Oorspronkelijk bericht-----
Van: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] Namens Tzafrir Cohen
Verzonden: Wednesday, January 30, 2008 1:58 PM
Aan: asterisk-users at lists.digium.com
Onderwerp: Re: [asterisk-users] Can't read environment variable

On Wed, Jan 30, 2008 at 01:38:48PM +0100, Joost Kuif | Mobillion wrote:
Quote:
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

_______________________________________________
-- 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
Back to top
asterisk.org at sedwar...
Guest





PostPosted: Wed Jan 30, 2008 9:25 am    Post subject: [asterisk-users] Can't read environment variable Reply with quote

On Wed, 30 Jan 2008, Joost Kuif | Mobillion wrote:

Quote:
This pointed me into the right direction, thanks Tzafrir!

i added a export HOSTNAME=$HOSTNAME into my .bash_profile

Grtz,
Joost

I explicitly pass it to Asterisk in this snippet from my
/etc/init.d/asterisk file.

daemon\
env -i\
HOST=$HOST\
PATH=/usr/local/bin/:/bin/\
nice --adjustment=-20\
$ASTERISK $START_OPTIONS

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
Back to top
philipp_subx at redfis...
Guest





PostPosted: Thu Jan 31, 2008 1:48 pm    Post subject: [asterisk-users] Can't read environment variable Reply with quote

Uhhh... just

export HOSTNAME

should be enough once it's been set.
Joost Kuif | Mobillion wrote:
Quote:
This pointed me into the right direction, thanks Tzafrir!

i added a export HOSTNAME=$HOSTNAME into my .bash_profile

Grtz,
Joost

-----Oorspronkelijk bericht-----
Van: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] Namens Tzafrir Cohen
Verzonden: Wednesday, January 30, 2008 1:58 PM
Aan: asterisk-users at lists.digium.com
Onderwerp: Re: [asterisk-users] Can't read environment variable

On Wed, Jan 30, 2008 at 01:38:48PM +0100, Joost Kuif | Mobillion wrote:

Quote:
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=

Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services