<div style="font-family: Helvetica; font-size: 13px; ">Thanks,<div><br></div><div>I was hoping to do it without pre-processing. But this is an excellent solutions to fall back to.</div><div><br></div><div>Best regards</div><div>Daniel</div></div>
<div></div>
<p style="color: #A0A0A8;">On Monday 23 April 2012 at 15:25, Pauba, Kevin L wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 12 (filtered medium)"><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Here's one way:<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">$ m4 <<'EOF' > foo.cfg<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">> define(`myIP',1.2.3.4)dnl<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">><o:p> </o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">> route {<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">> if (dst_ip == myIP) {<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">> ...<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">> }<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">> }<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">> EOF<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">$ cat foo.cfg<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">route {<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> if (dst_ip == 1.2.3.4) {<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> ...<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> }<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">}<o:p></o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> users-bounces@lists.opensips.org [<a href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>] <b>On Behalf Of </b>Daniel Nihlén<br><b>Sent:</b> Monday, April 23, 2012 4:28 AM<br><b>To:</b> OpenSIPS users mailling list<br><b>Subject:</b> [OpenSIPS-Users] Defines/vars in opensips.cfg before route{<o:p></o:p></span></p></div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi, <o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I been trying to find this in documentation but didn't mange. Sorry if I ask a question already answered.<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">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.<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Something like this:<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">myIP="1.2.3.4"<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">listen=udp:<myIP>:5060<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">route{<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">…<o:p></o:p></p></div><div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> if(dst_ip==<myIP>){<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> ... <o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> }<o:p></o:p></p></div></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">...<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">}<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Anything like this possible?<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Daniel Nihlen<o:p></o:p></p></div><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><o:p> </o:p></p></div></div></div><div><div>_______________________________________________</div><div>Users mailing list</div><div><a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a></div><div><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>