Forum Discussion

Jeff_47438's avatar
Jeff_47438
Icon for Altocumulus rankAltocumulus
Mar 05, 2018

SIP "TO" header string map replacement

I am trying to manipulate a portion of a SIP INVITE with an irule. This is a version 12 F5. The irule is this: when SIP_REQUEST { log local0. "The TO header before changes is [SIP::header "To...
  • Jeff_47438's avatar
    Mar 06, 2018

    Figured it out. Here is the solution I used.

     

    when SIP_REQUEST { set TO_HEADER1 [SIP::header "To"] log local0. "Rewrite before is $TO_HEADER1" if { ($TO_HEADER1 contains "TENANT_SG1_105_85TEST") } then { set TO_HEADER2 [string map -nocase {"TENANT_SG1_105_85TEST" "3035555555"} $TO_HEADER1] log local0. "Rewrite after is $TO_HEADER2" SIP::header remove "To" SIP::header insert "To" "$TO_HEADER2" } }