[asterisk-users] How to set externip in sip.conf automatically?

Watkins, Bradley Bradley.Watkins at compuware.com
Wed Aug 23 04:01:20 MST 2006


If you already have the IP in a file, why don't you set it up so the
file itself says:  externip=xx.xx.xx.xx and then do a #include in
sip.conf for the /etc/myip file?  I believe you'll have to do a sip
reload either way (which can obviously be part of your cron job) if
you're not already, but that should do what you're looking to do.

- Brad 

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Larry
Alkoff
Sent: Tuesday, August 22, 2006 9:34 PM
To: Asterisk-users; Austin-asterisk-users
Subject: [asterisk-users] How to set externip in sip.conf automatically?

  I need to give Asterisk access to my external IP address to prevent
the NAT problem where caller cannot hear the callee's voice.

According to Asterisk - The Future of Telephony page 92 Environment
Variables:

   "Environment variables are a way of accessing Unix environment
variables from within Asterisk.  They are referenced in the form of
   ${ENV{var}}
where var is the Unix environment variable you wish to reference."

My external IP is placed each night in a file call /etc/myip and placed
in the $MYIP variable by /etc/bashrc when an shell is loaded.

So I have /etc/myip refreshed each night in a cron job and when a shell
is opened /etc/bashrc does:
export MYIP=`cat /etc/myip`

To access the variable in sip.conf I have tried:

     externip=${ENV(EXTERNIP)}
and
     ${ENV($EXTERNIP)}
but neither seems to work.
Is this the correct syntax?  Did I misinterpret the book?

I say neither seems to work because When I hard code
externip=69.91.84.176
there are no NAT problems but when I try to access the $MYIP variable
either of the ways above NAT prevents me hearing the callee's voice.

I have tried but not found a way to directly access the contents of MYIP
to the console using the CLI.  Is there a way to see or set _any_ Linux
enviromnent variable using the CLI?  More generally, how do I access the
Linux shell from the CLI?

The problem with simply using
externip=69.91.94.176
is that number is subject to change and I don't know an easy way to
automatically write the value into sip.conf programatically.

I could have just said "how do I do this" but wanted to show that I've
done my homework.
Thanks for any help.

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

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. 



More information about the asterisk-users mailing list