iRule to create successful log of Diameter

Hi:

I have created one iRule to create just one log of success after we detect that a Diameter failure is solve, For example a 3002 or 3010. Here is the iRule:

when DIAMETER_INGRESS {

set contador 2001

if{[DIAMETER::is_response] && [DIAMETER::result] =! 2001} {

set static::contador 3000

}

else if{[DIAMETER::result]==2001 && $contador==3000} {

set static::contador 2001

log local0.alert “DIAMETER success 2001 after a failure (IP::local_addr)”

}

}

when DIAMETER_EGRESS {

if{[DIAMETER::is_response] && [DIAMETER::result] =! 2001} {

set static::contador 3000

}

else if{[DIAMETER::result]==2001 && $contador==3000} {

set static::contador 2001

log local0.alert “DIAMETER success 2001 after a failure (IP::local_addr)”

}

}

Regards.