Trim Mobile Number
Hi
The SMS Company does not accept more than 10 caracters in http request as of MobileNumber. And also they don't accept these "+" sign or "+90". So it should look like "5431231020". This is the only valid pattern.
On the other hand, in the Active Directory server, user's mobile numbers are stored with "+" sign like this "+905431231020" and they are more more than 10 caracters.
When I try to use an iRule to achieve this pattern I have used below rule.
when ACCESS_POLICY_AGENT_EVENT { log local0. "Start"
set mobile [ACCESS::session data get "session.ad.last.attr.mobile"] log local0. "Mobile is $mobile"
regexp {(5[0-9]*)} [string map -nocase {" " ""} $mobile] mobile log local0. "New Number is $mobile"
ACCESS::session data set "session.logon.last.username" $mobile
}
But, after inserting the the iRule, it was never executed. I haven't see the logging parts in the those log files /var/log/{ltm,apm}
I just change the way and put below assignment in a "Variable Assign" object and it works.
session.logon.last.username = expr { [string map -nocase {"+90" ""} [mcget {session.ad.last.attr.mobile} ]] }
But, now I could not check the OTP because it is allways true! It doesn't matter what I type. After delete above Variable Assingment from Policy Path, it comes back again.
Why I can not use my iRules (yes there are many of them and all works good) ? Why I can not use my Variable Assingment ?