Forum Discussion
nshelton85
Altostratus
Sep 28, 2018Trying to use an iRule to match a pattern of dialed digits in a SIP message
I am trying to make an iRule to look at the called number in a SIP call to perform an action when a specific pattern of digits is dialed. For instance, if terminating phone number is an international call that starts with 011 and then has at least 7 more digits that can be anything in the range of 0-9 in each position. For instance 011[0-9][0-9][0-9][0-9][0-9][0-9][0-9]. What would be the best way to handle this?
when SIP_REQUEST {
Set SRC_IP variable to the client's IP address
set SRC_IP [clientside {IP::remote_addr}]
Set DST_IP to the server's IP address
set DST_IP [IP::server_addr]
Defines how long an IP address is blocked on the dynamic blacklist (in seconds)
set static::holdtime 3600
if {([SIP::method] == "INVITE") and ([class match $DST_IP equals SBCAdresses]) and ([class match $SRC_IP != SIP_Whitelist])}
{
set ToNumber [SIP::to]
set FromNumber [SIP::from]
if {$FromNumber contains "011[0-9][0-9][0-9][0-9][0-9][0-9][0-9]"}
{
drop
}
}
}
1 Reply
Sort By
- Stanislas_Piro2
Cumulonimbus
You can use string match command
if {[string match {*011[0-9][0-9][0-9][0-9][0-9][0-9][0-9]*} $FromNumber]}
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