Cookbook stuff.. I&#39;d post this on the m4 page. :)<br>-Brett<div><br><br><div class="gmail_quote">On Thu, Sep 30, 2010 at 4:54 PM, Pauba, Kevin L <span dir="ltr">&lt;<a href="mailto:KLPauba@west.com">KLPauba@west.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">








<div lang="EN-US" link="blue" vlink="purple">

<div>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">This works:</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">define(`_OPENSER_HOST&#39;,`regexp(esyscmd(curl -s
<a href="http://checkip.dyndns.org/%7Cgrep" target="_blank">http://checkip.dyndns.org/|grep</a> -o
&quot;[[:digit:].]\+&quot;),`\&lt;.*\&gt;&#39;,\&amp;)&#39;)dnl</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">advertise_address=&quot;_OPENSER_HOST&quot;</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">l8r</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">

<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a> [mailto:<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>] <b>On
Behalf Of </b>Daniel Goepp<br>
<b>Sent:</b> Thursday, September 30, 2010 4:45 PM</span></p><div><div></div><div class="h5"><br>
<b>To:</b> OpenSIPS users mailling list<br>
<b>Subject:</b> Re: [OpenSIPS-Users] Config include file</div></div><p></p>

</div><div><div></div><div class="h5">

<p class="MsoNormal"> </p>

<p class="MsoNormal" style="margin-bottom:12.0pt">Sorry for asking an m4 question
here, but it kinda relates to getting a config going for OpenSIPS, and you guys
seem to know all about it ;)  I almost have my test working here, very
simple to start:<br>
<br>
My m4 file:<br>
<br>
define(`_OPENSER_HOST&#39;,esyscmd(`curl -s <a href="http://checkip.dyndns.org/" target="_blank">http://checkip.dyndns.org/</a>
| grep -o &quot;[[:digit:].]\+&quot;&#39;))dnl<br>
advertise_address=&quot;_OPENSER_HOST&quot;<br clear="all">
<br>
But this generates:<br>
<br>
advertise_address=&quot;67.218.120.85<br>
&quot;<br>
<br>
My understanding from reading the m4 page is that dnl should be trimming the
carriage return on the end of the curl response.  But it doesn&#39;t appear to
be.  Thoughts?<br>
<br>
Thanks<br>
<br>
-dg<br>
<br>
</p>

<div>

<p class="MsoNormal">On Thu, Sep 30, 2010 at 1:49 PM, Daniel Goepp &lt;<a href="mailto:dan@goepp.net" target="_blank">dan@goepp.net</a>&gt; wrote:</p>

<p class="MsoNormal">Just found this:<br>
<br>
<a href="http://snippets.dzone.com/posts/show/7256" target="_blank">http://snippets.dzone.com/posts/show/7256</a><br>
<br>
Which has:<br>
<br>
curl -s <a href="http://checkip.dyndns.org/" target="_blank">http://checkip.dyndns.org/</a>
| grep -o &quot;[[:digit:].]\+&quot;<br>
<br>
It works!<br>
<br>
So I&#39;m thinking combining this with uname -a, you guys might have a better
solution here.  Going to test now :)<br>
<br>
Thanks!<br clear="all">
<span style="color:#888888"><br>
-dg</span></p>

<div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
</p>

<div>

<p class="MsoNormal">On Thu, Sep 30, 2010 at 1:43 PM, Daniel Goepp &lt;<a href="mailto:dan@goepp.net" target="_blank">dan@goepp.net</a>&gt; wrote:</p>

<p class="MsoNormal">I&#39;m definitely familiar with back tick and how this command
works, I was just mentioning that the information I need to provide, the system
doesn&#39;t know.  I could however merge some of these comments, and just have
a file on each server that is it&#39;s public ip, and execute `cat
my_public_ip.txt`  However, after more investigation, some of our boxes do
have other differences, for example I just noticed that our 64bit vs 32bit
systems have different mpaths.  I&#39;m sure we could get more fancy with
executing these commands, check the OS, and set accordingly.  This is very
useful information, but for simplicity for now, I think we&#39;ll just stick with
the original m4 suggestion.<br clear="all">
<br>
Thanks all.<br>
<span style="color:#888888"><br>
-dg</span></p>

<div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
</p>

<div>

<p class="MsoNormal">On Thu, Sep 30, 2010 at 1:23 PM, Brett Nemeroff &lt;<a href="mailto:brett@nemeroff.com" target="_blank">brett@nemeroff.com</a>&gt;
wrote:</p>

<p class="MsoNormal">The point is, inside the ticks `` you place a shell command
that returns whatever you want there.. :)</p>

<div>

<p class="MsoNormal">-Brett</p>

</div>

<div>

<div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt"> </p>

<div>

<p class="MsoNormal">On Thu, Sep 30, 2010 at 3:07 PM, Daniel Goepp &lt;<a href="mailto:dan@goepp.net" target="_blank">dan@goepp.net</a>&gt; wrote:</p>

<p class="MsoNormal">Unfortunately the hostname is not what we are using, but
rather a public IP address which is on the other side of NAT, so the proxies
are not aware of what it is.  I believe the m4 solution posted earlier
will meet our need though for now, but thanks for the feedback, this is a
creative solution ;)<br clear="all">
<span style="color:#888888"><br>
-dg</span></p>

<div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
</p>

<div>

<p class="MsoNormal">On Thu, Sep 30, 2010 at 1:00 PM, Pauba, Kevin L &lt;<a href="mailto:KLPauba@west.com" target="_blank">KLPauba@west.com</a>&gt; wrote:</p>

<div>

<div>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">define(`_OPENSER_HOST&#39;,`regexp(esyscmd(`hostname
-f&#39;),`\&lt;.+\&gt;&#39;,\&amp;)&#39;)dnl</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">…</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">alias=&quot;_OPENSER_HOST&quot;</span></p>

<div style="border:none;border-bottom:solid windowtext 1.0pt;padding:0in 0in 1.0pt 0in;border-color:-moz-use-text-color -moz-use-text-color windowtext">

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

</div>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Take special note of the backquote (`).</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:-moz-use-text-color -moz-use-text-color">

<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>
[mailto:<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Brett Nemeroff<br>
<b>Sent:</b> Thursday, September 30, 2010 12:22 PM<br>
<b>To:</b> OpenSIPS users mailling list<br>
<b>Subject:</b> Re: [OpenSIPS-Users] Config include file</span></p>

</div>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Check
out m4:</p>

<div>

<p class="MsoNormal"><a href="http://www.opensips.org/Resources/DocsTools" target="_blank">http://www.opensips.org/Resources/DocsTools</a></p>

</div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt"> </p>

<div>

<p class="MsoNormal">On
Thu, Sep 30, 2010 at 12:19 PM, Daniel Goepp &lt;<a href="mailto:dan@goepp.net" target="_blank">dan@goepp.net</a>&gt; wrote:</p>

<p class="MsoNormal" style="margin-bottom:12.0pt">We have
many proxies that have an identical configuration other than their public IP
address.  We set this IP address only for a few things:<br>
<br>
In the global parameters:<br>
advertised_address<br>
<br>
Then in our routes for:<br>
record_route_preset<br clear="all">
rtpproxy_offer<br>
rtpproxy_answer<br>
<br>
What I would like to do is create a file on each of these servers (or a DB)
that contains that servers public IP, and then put something like an include
into the script.  This would make managing our config a lot easier. 
So each system would have an identical config and could be updated very
easily.  Does this make sense?  Any comments on how this might be
done?<br>
<br>
Thanks<br>
<span style="color:#888888"><br>
-dg<br>
</span><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></p>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

</div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></p>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></p>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

</div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></p>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

</div>

<p class="MsoNormal"> </p>

</div></div></div>

</div>


<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>