Please help me understand this Irule

when SIP_REQUEST_SEND {

if { not ([SIP::via 0] contains “F5Tag=F5-Inserted-Header”)}{

log local0. “Call-id : [SIP::call_id] Modified-sent :: From [IP::local_addr]/[UDP::local_port] To [IP::remote_addr]/[UDP::remote_port]”

SIP::header insert Via [format “SIP/2.0/UDP %s:%s;branch=%sf5;F5Tag=F5-Inserted-Header” [IP::local_addr] [UDP::local_port] [SIP::via branch 0]]

log local0. “Call-id : [SIP::call_id] Added-via :: [SIP::via 0]”

}

}

when SIP_RESPONSE {

if { [SIP::via 0] contains “F5Tag=F5-Inserted-Header”}{

log local0. “Call-id : [SIP::call_id] Modified-received :: From [IP::remote_addr]/[UDP::remote_port] To [IP::local_addr]/[UDP::local_port]”

if { [SIP::via 0] contains “[IP::local_addr]:[UDP::local_port]”}{

log local0. “Call-id : [SIP::call_id] Removed-via :: [SIP::via]”

SIP::header remove Via 0

}

}

}

Please reply i need to get solution wahtever u understand with this irule please guyss help me

Nobody is helping me Guys oh comman

OK, I can’t comment so much on the contents of the header but this rule is inserting a header (if it doesn’t already exist) into the request sent to the Pool Member and, if present, removing it from any responses from the Pool Member back to the client but only if the IP and UDP port specified match that used by the F5 when sending the request.

thanks much local addr is self ip of bigip and cleint ip is the from where clint ip comeing from

no SIP expert present here.

i understand it adds Via header (e.g. Via: SIP/2.0/UDP 200.200.200.14:5060;branch=z9hG4bK-7941-4484-0f5;F5Tag=F5-Inserted-Header) to request and remove it (e.g. Via: SIP/2.0/UDP 200.200.200.14:5060;branch=z9hG4bK-7941-4484-0f5;F5Tag=F5-Inserted-Header, SIP/2.0/UDP 172.28.67.36:5060;branch=z9hG4bK-7941-4484-0) from response.

i use SIPp (http://sipp.sourceforge.net/index.html) as uac and uas. on uas, SIPp combines 2 Via headers together. so, when irule removes it, both are removed.

e.g.

root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar-sip
ltm virtual bar-sip {
    destination 172.28.20.16:5060
    mask 255.255.255.255
    pool foo-sip
    profiles {
        sip { }
        udp { }
    }
    source 0.0.0.0/0
    source-address-translation {
        type automap
    }
    vlans-disabled
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm pool foo-sip
ltm pool foo-sip {
    members {
        200.200.200.101:5060 {
            address 200.200.200.101
        }
    }
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
    when SIP_REQUEST_SEND {
  if { not ([SIP::via 0] contains "F5Tag=F5-Inserted-Header")}{
    log local0. "Call-id : [SIP::call_id] Modified-sent :: From [IP::local_addr]/[UDP::local_port] To [IP::remote_addr]/[UDP::remote_port]"
    SIP::header insert Via [format "SIP/2.0/UDP %s:%s;branch=%sf5;F5Tag=F5-Inserted-Header" [IP::local_addr] [UDP::local_port] [SIP::via branch 0]]
    log local0. "Call-id : [SIP::call_id] Added-via :: [SIP::via 0]"
  }
}
when SIP_RESPONSE {
  if { [SIP::via 0] contains "F5Tag=F5-Inserted-Header"}{
    log local0. "Call-id : [SIP::call_id] Modified-received :: From [IP::remote_addr]/[UDP::remote_port] To [IP::local_addr]/[UDP::local_port]"
    if { [SIP::via 0] contains "[IP::local_addr]:[UDP::local_port]"}{
      log local0. "Call-id : [SIP::call_id] Removed-via :: [SIP::via]"
      SIP::header remove Via 0
    }
  }
}
}

 /var/log/ltm
Jun 22 22:12:02 ve11a info tmm[8299]: Rule /Common/myrule : Call-id : 4484-7941@172.28.67.36 Modified-sent :: From 200.200.200.14/5060 To 200.200.200.101/5060
Jun 22 22:12:02 ve11a info tmm[8299]: Rule /Common/myrule : Call-id : 4484-7941@172.28.67.36 Added-via :: SIP/2.0/UDP 200.200.200.14:5060;branch=z9hG4bK-7941-4484-0f5;F5Tag=F5-Inserted-Header
Jun 22 22:12:02 ve11a info tmm[8299]: Rule /Common/myrule : Call-id : 4484-7941@172.28.67.36 Modified-received :: From 200.200.200.101/5060 To 200.200.200.14/5060
Jun 22 22:12:02 ve11a info tmm[8299]: Rule /Common/myrule : Call-id : 4484-7941@172.28.67.36 Removed-via :: SIP/2.0/UDP 200.200.200.14:5060;branch=z9hG4bK-7941-4484-0f5;F5Tag=F5-Inserted-Header, SIP/2.0/UDP 172.28.67.36:5060;branch=z9hG4bK-7941-4484-0

 packet trace
 pkt 2 and 3 are requests. pkt 2 is on client-side (uac and bigip). pkt 3 is on server-side (bigip and uas).
 pkt 4 and 6 are response. pkt 4 is on server-side and pkt 6 is on client-side.

No.     Time                       Delta Time  Source                Src port Destination           Protocol Dst port Window     BiF        Vlan id Length Info
      2 2013-06-22 22:12:02.004454 0.000000    172.28.19.251         5060     172.28.20.16          SIP/SDP  5060                           4094    665    IN  s1/tmm0 : Request: INVITE sip:service@172.28.20.16:5060, with session description

Frame 2: 665 bytes on wire (5320 bits), 665 bytes captured (5320 bits)
Ethernet II, Src: Force10N_d5:d4:47 (00:01:e8:d5:d4:47), Dst: Vmware_b3:1c:32 (00:50:56:b3:1c:32)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 4094
Internet Protocol Version 4, Src: 172.28.19.251 (172.28.19.251), Dst: 172.28.20.16 (172.28.20.16)
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5060 (5060)
Session Initiation Protocol
    Request-Line: INVITE sip:service@172.28.20.16:5060 SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 172.28.67.36:5060;branch=z9hG4bK-7941-4484-0
        From: sipp ;tag=7941SIPpTag004484
        To: service 
        Call-ID: 4484-7941@172.28.67.36
        CSeq: 1 INVITE
        Contact: sip:sipp@172.28.67.36:5060
        Max-Forwards: 70
        Subject: Performance Test
        Content-Type: application/sdp
        Content-Length:   136
    Message Body

No.     Time                       Delta Time  Source                Src port Destination           Protocol Dst port Window     BiF        Vlan id Length Info
      3 2013-06-22 22:12:02.004796 0.000342    200.200.200.14        5060     200.200.200.101       SIP/SDP  5060                           4093    772    OUT s1/tmm0 : Request: INVITE sip:service@172.28.20.16:5060, with session description

Frame 3: 772 bytes on wire (6176 bits), 772 bytes captured (6176 bits)
Ethernet II, Src: Vmware_b3:1c:33 (00:50:56:b3:1c:33), Dst: Vmware_b3:01:0b (00:50:56:b3:01:0b)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 4093
Internet Protocol Version 4, Src: 200.200.200.14 (200.200.200.14), Dst: 200.200.200.101 (200.200.200.101)
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5060 (5060)
Session Initiation Protocol
    Request-Line: INVITE sip:service@172.28.20.16:5060 SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 200.200.200.14:5060;branch=z9hG4bK-7941-4484-0f5;F5Tag=F5-Inserted-Header
        Via: SIP/2.0/UDP 172.28.67.36:5060;branch=z9hG4bK-7941-4484-0
        From: sipp ;tag=7941SIPpTag004484
        To: service 
        Call-ID: 4484-7941@172.28.67.36
        CSeq: 1 INVITE
        Contact: sip:sipp@172.28.67.36:5060
        Max-Forwards: 70
        Subject: Performance Test
        Content-Type: application/sdp
        Content-Length:   136
    Message Body

No.     Time                       Delta Time  Source                Src port Destination           Protocol Dst port Window     BiF        Vlan id Length Info
      4 2013-06-22 22:12:02.006572 0.001776    200.200.200.101       5060     200.200.200.14        SIP      5060                           4093    563    IN  s1/tmm0 : Status: 180 Ringing

Frame 4: 563 bytes on wire (4504 bits), 563 bytes captured (4504 bits)
Ethernet II, Src: Vmware_b3:01:0b (00:50:56:b3:01:0b), Dst: Vmware_b3:1c:33 (00:50:56:b3:1c:33)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 4093
Internet Protocol Version 4, Src: 200.200.200.101 (200.200.200.101), Dst: 200.200.200.14 (200.200.200.14)
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5060 (5060)
Session Initiation Protocol
    Status-Line: SIP/2.0 180 Ringing
    Message Header
        Via: SIP/2.0/UDP 200.200.200.14:5060;branch=z9hG4bK-7941-4484-0f5;F5Tag=F5-Inserted-Header, SIP/2.0/UDP 172.28.67.36:5060;branch=z9hG4bK-7941-4484-0
        From: sipp ;tag=7941SIPpTag004484
        To: service ;tag=26498SIPpTag014484
        Call-ID: 4484-7941@172.28.67.36
        CSeq: 1 INVITE
        Contact: 
        Content-Length: 0

No.     Time                       Delta Time  Source                Src port Destination           Protocol Dst port Window     BiF        Vlan id Length Info
      6 2013-06-22 22:12:02.006668 0.000087    172.28.20.16          5060     172.28.19.251         SIP      5060                           4094    413    OUT s1/tmm0 : Status: 180 Ringing

Frame 6: 413 bytes on wire (3304 bits), 413 bytes captured (3304 bits)
Ethernet II, Src: Vmware_b3:1c:32 (00:50:56:b3:1c:32), Dst: Force10N_d5:d4:47 (00:01:e8:d5:d4:47)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 4094
Internet Protocol Version 4, Src: 172.28.20.16 (172.28.20.16), Dst: 172.28.19.251 (172.28.19.251)
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5060 (5060)
Session Initiation Protocol
    Status-Line: SIP/2.0 180 Ringing
    Message Header
        From: sipp ;tag=7941SIPpTag004484
        To: service ;tag=26498SIPpTag014484
        Call-ID: 4484-7941@172.28.67.36
        CSeq: 1 INVITE
        Contact: 
        Content-Length: 0