[asterisk-users] Correct syntax to access a shell variable?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sat Nov 25 04:12:19 MST 2006


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 at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir


More information about the asterisk-users mailing list