This rule removes '+' from the username of the R-URI and the To Header.

 

#
# Create REMOVE_PLUS rule
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1
# Configure the message criteria 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 criterion 1 type message message messageTypes requestAll
# Configure the Header criteria 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 criterion 2 type header header condition exist name request-line
# Configure the Token criteria 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 criterion 3 type token token tokenType uriusername condition exist regexp string "[^:digit:].*\+" numMatch match
# Collect digits preceding '+' 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 1 type token operation regstore from type token tokenValue uriusername
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 1 regexp string "[^[:digit:]]*([[:digit:]]{1,})" matchInstance all
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 1 to type variable variableValue var1
# Collect digits following '+' 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 2 type token operation regstore from type token tokenValue uriusername
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 2 type token regexp string "([[:digit:]]*[[:digit:]]{1,})$" matchInstance all
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 2 type token to type variable variableValue var2
# Append VAR 2 to VAR1 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 3 type variable operation append from type variable variableValue var2
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 3 type variable operation append to type variable variableValue var1
# Replace Username with VAR1 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 4 type token operation modify from type variable variableValue var1
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 1 action 4 type token operation modify to type token tokenValue uriusername
# Repeat the above steps to remove '+' from the username of the To Header 
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 criterion 1 type message message messageTypes requestAll
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 criterion 2 type header header condition exist name to
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 criterion 3 type token token tokenType uriusername condition exist regexp string "[^:digit:].*\+" numMatch match
#
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 1 type token operation regstore from type token tokenValue uriusername
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 1 regexp string [^[:digit:]]*([[:digit:]]{1,}) matchInstance all
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 1 to type variable variableValue var1
#
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 2 type token operation regstore from type token tokenValue uriusername
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 2 type token regexp string ([[:digit:]]*[[:digit:]]{1,})$ matchInstance all
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 2 type token to type variable variableValue var2
#
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 3 type variable operation append from type variable variableValue var2
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 3 type variable operation append to type variable variableValue var1
#
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 4 type token operation modify from type variable variableValue var1
set profiles signaling sipAdaptorProfile REMOVE_PLUS rule 2 action 4 type token operation modify to type token tokenValue uriusername
#
set profiles signaling sipAdaptorProfile REMOVE_PLUS state enabled
#
commit
  • No labels