Find and Replace All

To manipulate a particular portion of the MIME attachment, for example when removing a certain attribute within the content type of application/sdp, the Oracle® Enterprise Session Border Controller (E-SBC) would need to search the content multiple times because:

  • SDP can have more than one media line
  • The SIP message body can contain more than one application/sdp.

The find-replace-all action type works for SIP header rules and for element rules. You can use it for all manipulation types from the entire header value, to the URI specific parameters, to MIME attachment.

For this action type, it does not matter what you configure the comparison type, which is atypical for actions types, as the comparison type is vital to the others. Find-replace-all, however, binds the comparison type to the pattern rule. Thus, the E-SBC treats the match value as a regular expression, and it ignores any configured comparison type value in favor of the pattern rule. This type of action is both a comparison and action: For each regular expression match within the supplied string, the E-SBC substitutes the new value for that match. Yet if you want to replace a certain portion of the regular expression and not the entire matched expression, you need to use a subgroup of expressions and the right syntax to indicate the sub-group replacement index.

You can indicate the sub-group replacement syntax by adding the string [[:n:]] to the end of the regular expression—where n is a number between 0 and 9. For example, given the following settings:

  • action=find-replace-all
  • match-value=sip:(user)@host[[:1:]]
  • new-value=bob

you create a new rule to replace only the user portion of the URI that searches for the regular expression and replaces all instances of the user subgroup with the value bob.

Taking advantage of the find-replace-all’s recursive nature, you can replace all the 0 digits in a telephone number with 1:

  • action=find-replace-all
  • match-value=0
  • new-value=1

So for the user portion of a URI—or for any other string—with a value 1-781-308-4400 would be replaced as 1-781-318-4411.

If you leave the new-value parameter blank for find-replace-all, the E-SBC replaces the matched sub-group with an empty string—an equivalent of deleting the sub-group match. You can also replace empty sub-groups, which is like inserting a value within the second sub-group match. For example, user()@host.com[[:1:]]with a configured new-value _bob yields user_bob@host.com.

When you use find-replace-all, you cannot use the following parameter-type values: uri-param-name, uri-header-name, and header-param-name. These values are unusable because the E-SBC only uses case-sensitive matches for the match-value to find the parameter name within the URI. Since it can only be found by exact match, the E-SBC does not support finding and replacing that parameter.