Forum Discussion
Mike_Finney_119
Nimbostratus
Sep 06, 2013iRule regex to normalize phone numbers?
Been searching but no luck so far looking for a iRule with a regex or some other method to normalize phone numbers from AD for use to pass to an SMS gateway.
I have adapted the method here: https://...
Mike_Finney_119
Nimbostratus
Sep 06, 2013OK, two steps got it to work.
Code
when ACCESS_POLICY_AGENT_EVENT {
expr srand([clock clicks])
set otp [string range [format "%08d" [expr int(rand() * 1e9)]] 1 6 ]
set mail [ACCESS::session data get "session.ldap.last.attr.mail"]
set mobile [ACCESS::session data get "session.ldap.last.attr.mobile"]
set mobile2 [string map {"." "" " " "" "-" "" "(" "" ")" "" "+" ""} $mobile]
ACCESS::session data set session.user.otp.pw $otp
ACCESS::session data set session.user.otp.mobile $mobile2
ACCESS::session data set session.user.otp.username [ACCESS::session data get "session.logon.last.username"]
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects