I do something similar like below. Shouldn't this be done by freeswitch itself? After an ip change, i do notice that external_rtp_ip is correctly got from stun, but external_sip_ip is still set to its old value at load time.<div>
<br></div><div><br><div><br><div><div>while [ 1 ]; do</div><div> if ip=`wget -q -O - <a href="http://myip.dnsomatic.com">myip.dnsomatic.com</a>`; then</div><div> if [ "$ip" == "`cat $CACHE_DIR/last_ip_freeswitch`" ]; then</div>
<div> : # do nothing</div><div> else </div><div> $log_info "ip address has changed"</div><div> $log_info "executing freeswitch profile restarts"</div><div> # reload freeswitch external profiles</div>
<div> /usr/local/freeswitch/bin/fs_cli -x 'sofia profile remote_extensions rescan' 2>&1 | $log_info</div><div> /usr/local/freeswitch/bin/fs_cli -x 'sofia profile remote_extensions restart' 2>&1 | $log_info</div>
<div><br></div><div> /usr/local/freeswitch/bin/fs_cli -x 'sofia profile external rescan' 2>&1 | $log_info</div><div> /usr/local/freeswitch/bin/fs_cli -x 'sofia profile external restart' 2>&1 | $log_info</div>
<div> echo $ip > $CACHE_DIR/last_ip_freeswitch</div><div> fi</div><div><br></div><br><div class="gmail_quote">On Wed, Feb 8, 2012 at 12:30 PM, Brian West <span dir="ltr"><<a href="mailto:brian@freeswitch.org">brian@freeswitch.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">#!/usr/bin/perl<br>
<br>
$ip = `/usr/bin/snmpget -c m00se -v1 192.168.1.1 IP-MIB::ipAdEntAddr.5 | /usr/bin/awk '{print \$4}'`;<br>
$ip =~ s/\n//g;<br>
chomp($ip);<br>
<br>
print "<include>\n\t<X-PRE-PROCESS cmd=\"set\" data=\"external_ip=$ip\"/>\n</include>\n";<br>
<br>
<br>
I do something like this in mine before.<br>
<br>
/b<br>
<div><div class="h5"><br>
On Feb 8, 2012, at 1:12 PM, Brian West wrote:<br>
<br>
> You'll need to understand how FreeSWITCH works. that external_sip_ip variable is probably fake and in vars.xml and is setup to stun: something... You can't really depend on that in your case so you'll need to get creative to set your variables properly that get used down in the sofia configs to bind to the proper IP's. This exercise is sadly left up to you to do.<br>
><br>
> I use a script to write out some XML that gets included but if your IP changes you need to restart the sofia profiles.<br>
><br>
> /b<br>
><br>
> On Feb 8, 2012, at 12:35 PM, Anurag Srivastava wrote:<br>
><br>
>> Hi,<br>
>> Could anybody help with this.<br>
><br>
> --<br>
> Brian West<br>
> FreeSWITCH Solutions, LLC<br>
> Phone: <a href="tel:%2B1%20%28918%29%20420-9266" value="+19184209266">+1 (918) 420-9266</a><br>
> Fax: <a href="tel:%2B1%20%28918%29%20420-9267" value="+19184209267">+1 (918) 420-9267</a><br>
> <a href="mailto:brian@freeswitch.org">brian@freeswitch.org</a><br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
><br>
<br>
--<br>
Brian West<br>
FreeSWITCH Solutions, LLC<br>
Phone: <a href="tel:%2B1%20%28918%29%20420-9266" value="+19184209266">+1 (918) 420-9266</a><br>
Fax: <a href="tel:%2B1%20%28918%29%20420-9267" value="+19184209267">+1 (918) 420-9267</a><br>
<a href="mailto:brian@freeswitch.org">brian@freeswitch.org</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
<br>
</div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards<br>Anurag <br>
</div></div></div>