<div dir="ltr">Sorry - just realised what you mean. You're saying do it like..<br><br><div><font face="monospace, monospace">route{</font></div><div><font face="monospace, monospace"> # set vars back to null/init them..</font></div><div><font face="monospace, monospace"> $var(c)="";</font></div><div><font face="monospace, monospace"> $var(d)="";</font></div><div><font face="monospace, monospace"> $var(e)="";</font></div><div><font face="monospace, monospace"> $var(f)="";</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> if (method=="INVITE") { </font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> if(is_present_hf("X-Info")){</font></div><div><font face="monospace, monospace"> # assign values to vars...</font></div><div><font face="monospace, monospace"> $var(c)=$hdr(X-Info);</font></div><div><font face="monospace, monospace"> $var(d)=$(var(c){s.select,2,;});</font></div><div><font face="monospace, monospace"> $var(e)=$(var(c){s.select,3,;});</font></div><div><font face="monospace, monospace"> $var(f)=$(var(c){s.select,4,;});</font></div><div><font face="monospace, monospace"> }</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> #Set the flag for counting the dialogs. We user flag=4 for counting dialogs</font></div><div><font face="monospace, monospace"> setflag(2);</font></div><div><font face="monospace, monospace"> setflag(4);</font></div><div><font face="monospace, monospace"> xlog( "L_NOTICE", "CallCenter_Info & $ci,$var(c) \n" );</font></div><div><font face="monospace, monospace"> xlog( "L_NOTICE", "3CLogicCDR & $ci,$fU,$oU,$rd \n" );</font></div><div><font face="monospace, monospace"> xlog("L_NOTICE", " Source IP ($si) : method ($rm) r-uri ($ru) : callID $ci \n");</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> }</font></div><div><font face="monospace, monospace">}</font></div><div><br></div><div>??</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 14, 2016 at 3:40 PM, Benjamin Cropley <span dir="ltr"><<a href="mailto:benjamin.cropley@gmail.com" target="_blank">benjamin.cropley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I was just following the doc :)<div><br></div>"if you want to start using a script variable in a route, better initialize it with same value <b>(or reset it)</b>, otherwise you may inherit a value from a previous route that was executed by the same process."</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 14, 2016 at 3:23 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<tt>Hi,<br>
<br>
Ideally you should init the vars before their usage, rather than
trying to reset afterwards. It is much safer.<br>
<br>
Regards,<br>
</tt>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a></pre><div><div>
<div>On 14.09.2016 16:59, Benjamin Cropley
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>the value of script variables persists over any given
OpenSIPS process. Therefore, to ensure the value is null on
every entry to the route (if a subsequent packet is recieved
on the same process) you must set the value back to Null
before the route is exited.</div>
<div><br>
</div>
<div>eg..</div>
<div><font face="monospace, monospace">route{</font></div>
<div><font face="monospace, monospace"> if (method=="INVITE")
{</font></div>
<div><font face="monospace, monospace">
if(is_present_hf("X-Info")){</font></div>
<div><font face="monospace, monospace"> # assign
values to vars...</font></div>
<div><font face="monospace, monospace">
$var(c)=$hdr(X-Info);</font></div>
<div><font face="monospace, monospace">
$var(d)=$(var(c){s.select,2,;}<wbr>);</font></div>
<div><font face="monospace, monospace">
$var(e)=$(var(c){s.select,3,;}<wbr>);</font></div>
<div><font face="monospace, monospace">
$var(f)=$(var(c){s.select,4,;}<wbr>);</font></div>
<div><font face="monospace, monospace"> }</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
<div><font face="monospace, monospace"> #Set the flag for
counting the dialogs. We user flag=4 for counting dialogs</font></div>
<div><font face="monospace, monospace"> setflag(2);</font></div>
<div><font face="monospace, monospace"> setflag(4);</font></div>
<div><font face="monospace, monospace"> xlog( "L_NOTICE",
"CallCenter_Info & $ci,$var(c) \n" );</font></div>
<div><font face="monospace, monospace"> xlog( "L_NOTICE",
"3CLogicCDR & $ci,$fU,$oU,$rd \n" );</font></div>
<div><font face="monospace, monospace"> xlog("L_NOTICE",
" Source IP ($si) : method ($rm) r-uri ($ru) : callID $ci
\n");</font></div>
<div><font face="monospace, monospace"> </font></div>
<div><font face="monospace, monospace"> # set vars back
to null..</font></div>
<div><font face="monospace, monospace"> $var(c)="";</font></div>
<div><font face="monospace, monospace"> $var(d)="";</font></div>
<div><font face="monospace, monospace"> $var(e)="";</font></div>
<div><font face="monospace, monospace"> $var(f)="";</font></div>
<div><font face="monospace, monospace"> exit;</font></div>
<div><font face="monospace, monospace"> }</font></div>
<div><font face="monospace, monospace">}</font></div>
<div><br>
</div>
<div>I think this feature will have existed in both 1.6 and 1.11
(see <a href="https://www.opensips.org/Documentation/Script-CoreVar-1-6#toc1" target="_blank">https://www.opensips.org/Docum<wbr>entation/Script-CoreVar-1-6#<wbr>toc1</a>
and <a href="https://www.opensips.org/Documentation/Script-CoreVar-1-11#toc1" target="_blank">https://www.opensips.org/Docum<wbr>entation/Script-CoreVar-1-11#<wbr>toc1</a>).
Maybe something else is going on to make it 'work' in 1.6?</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Sep 14, 2016 at 2:34 PM,
Sasmita Panda <span dir="ltr"><<a href="mailto:spanda@3clogic.com" target="_blank">spanda@3clogic.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi All ,
<div><br>
</div>
<div> I am using opensips-1.11 . </div>
<div><br>
</div>
<div>My config file looks like bellow .</div>
<div><br>
</div>
<div><b> <font color="#20124d"> if (method=="INVITE") {</font></b>
<div><b><font color="#20124d"><br>
</font></b></div>
<div><b><font color="#20124d">
if(is_present_hf("X-Info"))<br>
</font></b></div>
<div><b><font color="#20124d"> {</font></b></div>
<div><b><font color="#20124d">
$var(c)=$hdr(X-Info);</font></b></div>
<div><b><font color="#20124d">
$var(d)=$(var(c){s.select,2,;}<wbr>);</font></b></div>
<div><b><font color="#20124d">
$var(e)=$(var(c){s.select,3,;}<wbr>);</font></b></div>
<div><b><font color="#20124d">
$var(f)=$(var(c){s.select,4,;}<wbr>);</font></b></div>
<div><b><font color="#20124d"> }</font></b></div>
<div><b><font color="#20124d"><br>
</font></b></div>
<div><b><font color="#20124d"><br>
</font></b></div>
<div><b><font color="#20124d"><span style="white-space:pre-wrap">        </span>
#Set the flag for counting the dialogs. We
user flag=4 for counting dialogs</font></b></div>
<div><b><font color="#20124d"><span style="white-space:pre-wrap">                </span>
setflag(2);</font></b></div>
<div><b><font color="#20124d"><span style="white-space:pre-wrap">                </span>
setflag(4);</font></b></div>
<div><b><font color="#20124d"> xlog(
"L_NOTICE", "CallCenter_Info & $ci,$var(c) \n"
);</font></b></div>
<div><b><font color="#20124d"> xlog(
"L_NOTICE", "3CLogicCDR & $ci,$fU,$oU,$rd \n"
);</font></b></div>
<div><b><font color="#20124d">
xlog("L_NOTICE", " Source IP ($si) : method ($rm)
r-uri ($ru) : callID $ci \n");</font></b></div>
<div><b><font color="#20124d"><span style="white-space:pre-wrap">                                        </span>}</font></b></div>
<div><br>
</div>
<div><br>
</div>
<div> What I am trying to do is , I am
extracting "X-Info" from INVITE message and printing
it in logs in place of "$var(c)" . When an INVITE
message doesn't have "X-Info" header it prints
"<null>" in place of "$var(c)" in logs .</div>
<div><br>
</div>
<div><br>
</div>
<div> <b> This is working fine in opensips-1.6 .
For each and every call the $var(c) is getting
updated . </b></div>
<div><br>
</div>
<div> <b>I am facing some problem in
opensips-1.11 . For example : When I am doing a call
which has "X-Info" it prints the value
corresponding to that . In the next call , lets the
INVITE message don't have "X-Info" , for this rather
than printing "<null>" in place of "$var(c)" </b><b>its
printing the previous value .</b></div>
<div><b><br>
</b></div>
<div><b><br>
</b></div>
<div><b> I am not getting why this is happening .
Please help me . I think the variable is getting
saved somewhere and getting printed again and again
. </b></div>
<div><br>
</div>
<div> How can I solve this problem . Its very
critical for me . It will affect my CDR . Please help
me .</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr"><b><i>Thanks & Regards</i></b><span><font color="#888888">
<div><i>Sasmita Panda</i></div>
<div><i>Network Testing and Software Engineer</i></div>
<div><i>3CLogic , ph:07827611765</i></div>
</font></span></div>
</div>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div data-smartmail="gmail_signature">
<div dir="ltr">All the best,
<div>Ben Cropley</div>
<div>07539 366 905</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>______________________________<wbr>_________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr">All the best,<div>Ben Cropley</div><div>07539 366 905</div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">All the best,<div>Ben Cropley</div><div>07539 366 905</div></div></div>
</div>