Hi,
Ideally you should init the vars before their usage, rather than trying
to reset afterwards. It is much safer.
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 14.09.2016 16:59, Benjamin Cropley wrote:
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.
eg..
route{
if (method=="INVITE") {
if(is_present_hf("X-Info")){
# assign values to vars...
$var(c)=$hdr(X-Info);
$var(d)=$(var(c){s.select,2,;});
$var(e)=$(var(c){s.select,3,;});
$var(f)=$(var(c){s.select,4,;});
}
#Set the flag for counting the dialogs. We user flag=4 for
counting dialogs
setflag(2);
setflag(4);
xlog( "L_NOTICE", "CallCenter_Info & $ci,$var(c) \n" );
xlog( "L_NOTICE", "3CLogicCDR & $ci,$fU,$oU,$rd \n" );
xlog("L_NOTICE", " Source IP ($si) : method ($rm) r-uri ($ru)
: callID $ci \n");
# set vars back to null..
$var(c)="";
$var(d)="";
$var(e)="";
$var(f)="";
exit;
}
}
I think this feature will have existed in both 1.6 and 1.11 (see
https://www.opensips.org/Documentation/Script-CoreVar-1-6#toc1 and
https://www.opensips.org/Documentation/Script-CoreVar-1-11#toc1).
Maybe something else is going on to make it 'work' in 1.6?
On Wed, Sep 14, 2016 at 2:34 PM, Sasmita Panda <[email protected]
<mailto:[email protected]>> wrote:
Hi All ,
I am using opensips-1.11 .
My config file looks like bellow .
* if (method=="INVITE") {*
*
*
*if(is_present_hf("X-Info"))
*
* {*
*$var(c)=$hdr(X-Info);*
*$var(d)=$(var(c){s.select,2,;});*
*$var(e)=$(var(c){s.select,3,;});*
*$var(f)=$(var(c){s.select,4,;});*
* }*
*
*
*
*
* #Set the flag for counting the dialogs. We user flag=4 for
counting dialogs*
* setflag(2);*
* setflag(4);*
* xlog( "L_NOTICE", "CallCenter_Info &
$ci,$var(c) \n" );*
* xlog( "L_NOTICE", "3CLogicCDR &
$ci,$fU,$oU,$rd \n" );*
*xlog("L_NOTICE", " Source IP ($si) : method ($rm) r-uri ($ru) :
callID $ci \n");*
*}*
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 .
*This is working fine in opensips-1.6 . For each and every call
the $var(c) is getting updated . *
*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)" **its printing the previous value .*
*
*
*
*
* 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 . *
How can I solve this problem . Its very critical for me . It
will affect my CDR . Please help me .
*/Thanks & Regards/*
/Sasmita Panda/
/Network Testing and Software Engineer/
/3CLogic , ph:07827611765/
_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
--
All the best,
Ben Cropley
07539 366 905
_______________________________________________
Users mailing list
[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