#241 else not executed in script

1.5.x
closed-invalid
core (110)
5
2009-12-29
2009-12-29
No

If we write the following code in opensips.cfg

if ( $du != "" )
{
// Destination URI is set. Use it
$avp(s:req_dest_ip) = $(du{uri.host});
}
else
{
// Use request URI by default
$avp(s:req_dest_ip) = $(ru{uri.host});
}

if $du is defined, then no problem

if $du is NOT define, the "else" clause is not executed.

We need to have a clean way to test for pseudo-variable existence. Even though, is the current behavior acceptable ?
som

Discussion

  • Bogdan-Andrei Iancu

    Hi Emmanuel,

    The correct test is
    if ($du!=NULL)

    if a pvar is not defined, NULL is returned.

    Regards,
    Bogdan

     
  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> bogdan_iancu
    • status: open --> closed-invalid
     

Log in to post a comment.