RAJNIKANT VANZA
2011-Apr-21 11:20 UTC
[asterisk-users] [asterisk-user] Can't get hostname on asterisk dialplan by ENV()
Hi Friend, Can't get hostname environment variable on asterisk dialplan. Help me about how to get hostname environment variable on asterisk dialplan. I have written "export HOSTNAME" in /root/.bash_profile and when i execute "echo $HOSTNAME" then get right hostname but not success through asterisk dialplan. Get environment variable path right value through below statement. exten => XXX,n,NoOp(----------- ${ENV(PATH)}) *I have tried like this:* exten => XXX,n,Set(CDR(hostname)=${System(echo $HOSTNAME)}) exten => XXX,n,Set(CDR(hostname)=${ENV(HOSTNAME)}) Thanks in advance. -- Best Regards, Rajnikant Vanza Call : +91-9737456583 Software Engineer ------------------------------------------------------- Working On Linux,C/C++,Asterisk Technology Gandhinagar - Gujarat -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110421/d6c25c33/attachment.htm>
Mark Deneen
2011-Apr-21 18:21 UTC
[asterisk-users] [asterisk-user] Can't get hostname on asterisk dialplan by ENV()
Rajnikant, This surely depends on how you start asterisk. How are you starting the asterisk process? -M On Thu, Apr 21, 2011 at 7:20 AM, RAJNIKANT VANZA <rajnivanza at gmail.com> wrote:> Hi Friend, > > Can't get hostname environment variable on asterisk dialplan. > Help me about how to get hostname environment variable on asterisk dialplan. > I have written "export HOSTNAME" in /root/.bash_profile and when i execute > "echo $HOSTNAME" then get right hostname but not success through asterisk > dialplan. > Get environment variable path right value through below statement. > exten => XXX,n,NoOp(----------- ${ENV(PATH)}) > I have tried like this: > exten => XXX,n,Set(CDR(hostname)=${System(echo $HOSTNAME)}) > exten => XXX,n,Set(CDR(hostname)=${ENV(HOSTNAME)}) > > Thanks in advance. > -- > Best Regards, > > Rajnikant Vanza > Call : +91-9737456583 > Software Engineer > ------------------------------------------------------- > Working On Linux,C/C++,Asterisk Technology > Gandhinagar - Gujarat > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > ? ? ? ? ? ? ? http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > ? http://lists.digium.com/mailman/listinfo/asterisk-users >
Steve Edwards
2011-Apr-21 19:23 UTC
[asterisk-users] [asterisk-user] Can't get hostname on asterisk dialplan by ENV()
On Thu, 21 Apr 2011, RAJNIKANT VANZA wrote:> Can't get hostname environment variable on asterisk dialplan.1) Is HOSTNAME in the Asterisk process's environment? What does executing: tr '\000' '\n' < /proc/$(cat /var/run/asterisk.pid)/environ show on the shell console? 2) What does executing: exten = *,n, verbose(1,${ENV(HOSTNAME)}) show on the Asterisk console? I start my Asterisk with a minimal environment using the following snippet: nice --adjustment=-20\ env --ignore-environment\ HOSTNAME=${HOSTNAME}\ PATH=${PATH}\ $ASTERISK $START_OPTIONS -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000