Forum Discussion

Rdouglas_80332's avatar
Rdouglas_80332
Icon for Nimbostratus rankNimbostratus
Feb 01, 2010

Using irule to replace IP in SIP INVITE

I want to replace the IP address in the SIP INVITE (which happens to be the virtual IP) with that of a server behind the F5.

 

 

I have the following irule... but when it runs tmm crashes and is restarted. I am running "BIG-IP 10.1.0 Build 3341.0 Final"... any help would be appreciated.

 

 

 

when CLIENT_DATA {

 

if {[regexp -indices {(172.16.10.4)} [UDP::payload] location] == 1} {

 

set offset [lindex $location 0]

 

log local0. "Offset = $offset"

 

}

 

}

 

 

when SIP_REQUEST_SEND {

 

log local0. "LB Server: [LB::server addr]"

 

UDP::payload replace $offset [string length [LB::server addr]] [LB::server addr]

 

 

}

 

 

 

Incidentally, if I were to move the "UDP::payload" line to CLIENT_DATA and hardcode the lenth and ip address tmm doesn't crash. If I put it in SIP_REQUEST_SEND with the hardcoded information it crashes.
  • I have a case open with support... tmm will be fixed to throw an error instead of crashing. To solve my initial issue I am using SIP::uri which works quite elegantly.

     

     

    when RULE_INIT {

     

    set vs_ip 172.16.10.5

     

    }

     

     

    when SIP_REQUEST_SEND {

     

     

    set my_ip_map [list $vs_ip [LB::server addr]]

     

    log local0. "Current uri: [SIP::uri] "

     

    set new_uri [string map $my_ip_map [SIP::uri] ]

     

    SIP::uri $new_uri

     

    log local0. "New uri: [SIP::uri]"

     

    }