<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[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]-->
</head>
<body lang=SV link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Hi all,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I’m new to Opensips and love the
speed of the code. Even in the VmWare dev server I’m running on my (ancient)
desktop machine!<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>As a first attempt at my new job I thought
I could try and rewrite the config-scripts used at my company so that one
script easily could be used in both dev and all the different Live
environments.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Basically I could change a variable early
in the opensips.cfg, and this would assign the correct IP’s for me to be
used later in the config.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>But I suspect I’m using Opensips variables
in the wrong way…<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Example of original code:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> rewritehostport(“10.0.1.100:5060”);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Which I try changing to:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> $var(GateWay_5060)=”10.0.1.100:5060”;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> rewritehostport(“$var(GateWay_5060)”);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>(This gives me runtime error: ERROR:tm:uri2proxy:
bad host name in URI <sip:$var(GateWay_5060)>)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Actually also tried rewritehostport($var(GateWay_5060));
which also gives error: String expected…<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>So basically, I suppose I’m asking;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>How can I cast variables in Opensips? Or
should I do this some other, smarter, way?<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Thanks in advance,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Matti Zemack<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Stockholm<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Sweden<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
</div>
</body>
</html>