[OpenSIPS-Users] Defines/vars in opensips.cfg before route{
Daniel Nihlén
daniel at room40.se
Mon Apr 23 17:17:59 CEST 2012
Thanks,
I was hoping to do it without pre-processing. But this is an excellent solutions to fall back to.
Best regards
Daniel
On Monday 23 April 2012 at 15:25, Pauba, Kevin L wrote:
>
> Here's one way:
>
>
>
>
>
> $ m4 <<'EOF' > foo.cfg
>
>
> > define(`myIP',1.2.3.4)dnl
>
>
> >
>
>
> > route {
>
>
> > if (dst_ip == myIP) {
>
>
> > ...
>
>
> > }
>
>
> > }
>
>
> > EOF
>
>
> $ cat foo.cfg
>
>
>
>
>
> route {
>
>
> if (dst_ip == 1.2.3.4) {
>
>
> ...
>
>
> }
>
>
> }
>
>
>
>
>
>
>
>
> From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Daniel Nihlén
> Sent: Monday, April 23, 2012 4:28 AM
> To: OpenSIPS users mailling list
> Subject: [OpenSIPS-Users] Defines/vars in opensips.cfg before route{
>
>
>
>
>
>
> Hi,
>
>
>
>
>
>
>
> I been trying to find this in documentation but didn't mange. Sorry if I ask a question already answered.
>
>
>
>
>
>
>
>
>
>
>
> I would like to have something like a static variable / define that is accessible outside and inside route{} allowing for having my IP's written only once in .cfg.
>
>
>
>
>
>
>
> Something like this:
>
>
>
> myIP="1.2.3.4"
>
>
>
> listen=udp:<myIP>:5060
>
>
>
>
>
>
>
>
>
>
>
> route{
>
>
>
> …
>
>
>
> if(dst_ip==<myIP>){
>
>
>
> ...
>
>
>
> }
>
>
>
>
>
>
>
>
> ...
>
>
>
> }
>
>
>
>
>
>
>
>
>
>
>
> Anything like this possible?
>
>
>
>
>
>
>
> Thanks
>
>
>
> Daniel Nihlen
>
>
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org (mailto: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/20120423/6122df8d/attachment-0001.htm>
More information about the Users
mailing list