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: [email protected] 
> [mailto:[email protected]] 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
> [email protected] (mailto:[email protected])
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  
>  


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to