[OpenSIPS-Users] Config include file

Brett Nemeroff brett at nemeroff.com
Thu Sep 30 23:58:21 CEST 2010


Cookbook stuff.. I'd post this on the m4 page. :)
-Brett


On Thu, Sep 30, 2010 at 4:54 PM, Pauba, Kevin L <KLPauba at west.com> wrote:

>  This works:
>
>
>
> define(`_OPENSER_HOST',`regexp(esyscmd(curl -s
> http://checkip.dyndns.org/|grep <http://checkip.dyndns.org/%7Cgrep> -o
> "[[:digit:].]\+"),`\<.*\>',\&)')dnl
>
> advertise_address="_OPENSER_HOST"
>
>
>
> l8r
>
>
>
> *From:* users-bounces at lists.opensips.org [mailto:
> users-bounces at lists.opensips.org] *On Behalf Of *Daniel Goepp
> *Sent:* Thursday, September 30, 2010 4:45 PM
>
> *To:* OpenSIPS users mailling list
> *Subject:* Re: [OpenSIPS-Users] Config include file
>
>
>
> 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:
>
> My m4 file:
>
> define(`_OPENSER_HOST',esyscmd(`curl -s http://checkip.dyndns.org/ | grep
> -o "[[:digit:].]\+"'))dnl
> advertise_address="_OPENSER_HOST"
>
> But this generates:
>
> advertise_address="67.218.120.85
> "
>
> 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't appear
> to be.  Thoughts?
>
> Thanks
>
> -dg
>
>  On Thu, Sep 30, 2010 at 1:49 PM, Daniel Goepp <dan at goepp.net> wrote:
>
> Just found this:
>
> http://snippets.dzone.com/posts/show/7256
>
> Which has:
>
> curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
>
> It works!
>
> So I'm thinking combining this with uname -a, you guys might have a better
> solution here.  Going to test now :)
>
> Thanks!
>
> -dg
>
>
>
>  On Thu, Sep 30, 2010 at 1:43 PM, Daniel Goepp <dan at goepp.net> wrote:
>
> I'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't
> know.  I could however merge some of these comments, and just have a file on
> each server that is it'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'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'll just stick with the
> original m4 suggestion.
>
> Thanks all.
>
> -dg
>
>
>
>  On Thu, Sep 30, 2010 at 1:23 PM, Brett Nemeroff <brett at nemeroff.com>
> wrote:
>
> The point is, inside the ticks `` you place a shell command that returns
> whatever you want there.. :)
>
> -Brett
>
>
>
> On Thu, Sep 30, 2010 at 3:07 PM, Daniel Goepp <dan at goepp.net> wrote:
>
> 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 ;)
>
> -dg
>
>
>
>  On Thu, Sep 30, 2010 at 1:00 PM, Pauba, Kevin L <KLPauba at west.com> wrote:
>
> define(`_OPENSER_HOST',`regexp(esyscmd(`hostname -f'),`\<.+\>',\&)')dnl
>
>>
> alias="_OPENSER_HOST"
>
>
>
> Take special note of the backquote (`).
>
>
>
> *From:* users-bounces at lists.opensips.org [mailto:
> users-bounces at lists.opensips.org] *On Behalf Of *Brett Nemeroff
> *Sent:* Thursday, September 30, 2010 12:22 PM
> *To:* OpenSIPS users mailling list
> *Subject:* Re: [OpenSIPS-Users] Config include file
>
>
>
> Check out m4:
>
> http://www.opensips.org/Resources/DocsTools
>
>
>
> On Thu, Sep 30, 2010 at 12:19 PM, Daniel Goepp <dan at goepp.net> wrote:
>
> 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:
>
> In the global parameters:
> advertised_address
>
> Then in our routes for:
> record_route_preset
> rtpproxy_offer
> rtpproxy_answer
>
> 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?
>
> Thanks
>
> -dg
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100930/4b4c0398/attachment-0001.htm 


More information about the Users mailing list