Larry Alkoff
2006-Nov-24 19:59 UTC
[asterisk-users] Correct syntax to access a shell variable?
I would like to access my shell environment variable MYIP from within sip.conf to put in externip. I've tried some variations of syntax after reading "The Future of Telephony" but it's not working yet. Should it be externip=${ENV{$MYIP}} or some other syntax?? Larry -- Larry Alkoff N2LA - Austin TX Using Thunderbird on Linux
Dominique Dartois
2006-Nov-25 03:57 UTC
[asterisk-users] Correct syntax to access a shell variable?
The right syntax should be externip=${ENV(MYIP)} but I **think** variables are only allowed in extensions.* and not in sip.conf. --- Dominique Dartois -----Message d'origine----- De : asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] De la part de Larry Alkoff Envoy? : samedi 25 novembre 2006 04:01 ? : Asterisk-users Objet : [asterisk-users] Correct syntax to access a shell variable? I would like to access my shell environment variable MYIP from within sip.conf to put in externip. I've tried some variations of syntax after reading "The Future of Telephony" but it's not working yet. Should it be externip=${ENV{$MYIP}} or some other syntax?? Larry -- Larry Alkoff N2LA - Austin TX Using Thunderbird on Linux _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Tzafrir Cohen
2006-Nov-25 04:12 UTC
[asterisk-users] Correct syntax to access a shell variable?
On Sat, Nov 25, 2006 at 11:58:01AM +0100, Dominique Dartois wrote:> The right syntax should be externip=${ENV(MYIP)} but I **think** variables > are only allowed in extensions.* and not in sip.conf.Right, they are. As a workaround, use a trivial shell script (with sed -i) to rewrite the IP address in the place you currently want to pass it through the environment. In sip.conf : #include sip-externip.conf sip-externip.conf: externip = 1.2.3.4 A command to rewrite it: sed -i "/^externip/s/=.*/= $MYIP/" /etc/asterisk/sip-externip.conf -- Tzafrir Cohen icq#16849755 jabber:tzafrir@jabber.org +972-50-7952406 mailto:tzafrir.cohen@xorcom.com http://www.xorcom.com iax:guest@local.xorcom.com/tzafrir