[OpenSIPS-Users] Defines/vars in opensips.cfg before route{

Pauba, Kevin L KLPauba at west.com
Mon Apr 23 15:25:45 CEST 2012


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120423/ac7e4a34/attachment-0001.htm>


More information about the Users mailing list