Use this SMM rule example to manipulate how to treat hostpart based on the received format:

  • SMM rule to make the hostpart of Request-URI From/To headers in IP Address format when the hostpart of the dialog initiating INVITE Request-URI is in IP Address format.

  • Alternatively, an SMM rule to make the hostpart of Request-URI From/To in FQDN format when the hostpart of the dialog initiating INVITE Request-URI is in FQDN format.

SMM Rule:

  1. Create and apply an inputAdapterProfile for initial INVITE requests to an IP Trunk Group using the following rules: 
    1. If hostpart of Request-URI is an IP Address, store variable "var-x=1" (where x is any valid numeric number assigned to a variable) using "dialog" as the variableScopeValue. 
       
    2. If hostpart is not in IP Address format: var-1 is not created.

      SMM rule part 1
      # #################################################################################################################
      # Use the SMM rule achieve the following
      # Check whether initial incoming INVITE's (absent of tag parameter in the To header) hostname in Request Uri uses IP or FQDN format
      # store variable var-x (any available SMM variable) with variableScopeValue "Dialog" if hostname uses IP format
      ##################################################################################################################
      configure
      # Rule 1: Decide initial invite or not base on absent of ToTag
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" applyMatchHeader "one"
      
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" criterion "1" type "message"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" criterion "1" message messageTypes "request" methodTypes "invite"
      
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" criterion "2" type "header"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" criterion "2" header name "To" condition "exist" hdrInstance "all"
      
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" criterion "3" type "parameter"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" criterion "3" parameter condition "absent" paramType "generic" name "tag"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" action "1" type "variable" operation "store"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" action "1" from type "value" value "initialInvite"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "1" action "1" to type "variable" variableValue "var1" variableScopeValue "local"
      
      commit

       

      SMM rule part 2
       # Rule #2
      # Decide whether hostName of Request-line appears in IP format by matching regular expression
      # Store var2 with variableScopeValue "Dialog" if hostName appears in IP format and var1 exist (indicating initial Invite)
      
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" applyMatchHeader "one"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "1" type "message"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "1" message messageTypes "request" methodTypes "invite"
      
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "2" type "header"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "2" header name "Request-Line" condition "exist" hdrInstance "one"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "3" type "token"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "3" token condition "regex-match" tokenType "urihostname"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "3" token regexp string "(([0-9]{1,3}\.){3}[0-9]{1,3})"
      
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "4" type "variable"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" criterion "4" variable condition "exist" variableID "var1"
      
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" action "1" type "variable" operation "store"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" action "1" from type "value" value "hostNameInIpFormat"
      set profiles signaling sipAdaptorProfile "ReplaceIpWithFqdnIn" rule "2" action "1" to type "variable" variableValue "var2" variableScopeValue "dialog"
      commit


       

  2. Create and apply an outAdapterProfile to the IP Trunk Group with the following SMM rules to all outgoing request:
    1. If dialog state variable "var-x" exists, do not modify hostpart for Reqeust-URI/To/From (received value will be passed through).
    2. If dialog state variable "var-x" does not exist, modify hostpart for Request-URI/To/From with the desired FQDN.

      outAdapterProfile part 1
      #################################################################################################################
      # Use the SMM rule to achieve the following:
      # Replace hostname with FQDN in request-line, To Header, and FromHdr if dialog state variable var-x, e.g. var2 does NOT exist
      # Note: input sipAdaptorProfile would have store an value to dialog variable var-x, e.g. var2 if the hostname of initial incoming INVITE is in IP format
      ##################################################################################################################
      configure 
      # Rule 1
      # Replace hostname with FQDN in request-line if dialog state varialbe var2 does NOT exist
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 criterion 1 type message
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 criterion 1 message messageTypes requestAll
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 criterion 2 type header
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 criterion 2 header name request-line
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 criterion 2 header condition exist
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 criterion 3 type "variable"
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 criterion 3 variable condition "absent" variableID "var2"
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 type token
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 operation regsub
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 from type value
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 from value cae.ds.com
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 to type token
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 to tokenValue urihostname
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 regexp string .*
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 1 action 1 regexp matchInstance all
      commit
      outAdapterProfile part 2
       # Rule 2
      # Replace hostname with FQDN in To Header if dialog state varialbe VAR2 does NOT exist
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 criterion 1 type message
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 criterion 1 message messageTypes requestAll
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 criterion 2 type header
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 criterion 2 header name To
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 criterion 2 header condition exist
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 criterion 3 type "variable"
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 criterion 3 variable condition "absent" variableID "var2"
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 type token
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 operation regsub
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 from type value
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 from value cae.ds.com
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 to type token
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 to tokenValue urihostname
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 regexp string .*
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 2 action 1 regexp matchInstance all
      commit
      outAdapterProfile part 3
       # Rule 2
      # Replace hostname with FQDN in From header if dialog state varialbe VAR2 does NOT exist
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 criterion 1 type message
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 criterion 1 message messageTypes requestAll
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 criterion 2 type header
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 criterion 2 header name From
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 criterion 2 header condition exist
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 criterion 3 type "variable"
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 criterion 3 variable condition "absent" variableID "var2"
      
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 type token
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 operation regsub
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 from type value
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 from value cae.ds.com
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 to type token
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 to tokenValue urihostname
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 regexp string .*
      set profiles signaling sipAdaptorProfile replaceIpWithFqdnOut rule 3 action 1 regexp matchInstance all
      commit
      exit
  3. Enable "advancedSMM" for both the input and output SMM profile.

    set profiles signaling sipAdaptorProfile smmProfileName advancedSMM enabled


Refer to SIP Adaptor Profile - CLI for command line details.

  • No labels