Yes :)

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 14.09.2016 17:44, Benjamin Cropley wrote:
Sorry - just realised what you mean. You're saying do it like..

route{
    # set vars back to null/init them..
    $var(c)="";
    $var(d)="";
    $var(e)="";
    $var(f)="";

    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");
    }
}

??

On Wed, Sep 14, 2016 at 3:40 PM, Benjamin Cropley <benjamin.crop...@gmail.com <mailto:benjamin.crop...@gmail.com>> wrote:

    I was just following the doc :)

    "if you want to start using a script variable in a route, better
    initialize it with same value *(or reset it)*, otherwise you may
    inherit a value from a previous route that was executed by the
    same process."

    On Wed, Sep 14, 2016 at 3:23 PM, Bogdan-Andrei Iancu
    <bog...@opensips.org <mailto:bog...@opensips.org>> wrote:

        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
        <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
        <https://www.opensips.org/Documentation/Script-CoreVar-1-6#toc1>
        and
        https://www.opensips.org/Documentation/Script-CoreVar-1-11#toc1
        <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
        <spa...@3clogic.com <mailto:spa...@3clogic.com>> 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 Users@lists.opensips.org
            <mailto:Users@lists.opensips.org>
            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
        Users@lists.opensips.org <mailto:Users@lists.opensips.org>
        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

--
All the best,
Ben Cropley
07539 366 905
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to