Forum Discussion

Amit_Grover_171's avatar
Amit_Grover_171
Icon for Nimbostratus rankNimbostratus
Sep 21, 2015

Is it possible to print full SIP packet in logs using Irule

Hi,

 

I have a requirement wherein I have to print full SIP packet in human readable format using Irule. Please suggest how can i do that.

 

/Regards Amit Grover

 

6 Replies

  • Vernon_97235's avatar
    Vernon_97235
    Historic F5 Account

    Firstly, I would strongly recommend against logging locally for this, and I would apply such an iRule only for debugging. If you really want the entire content of each SIP packet, you could simply log the contents of each TCP segment (since SIP metadata is text and the body is generally text), as in (untested!):

    when CLIENT_ACCEPTED {
       if { [catch { HSL::open -publisher some_log_publisher } hsl] } {
           log local0.warn "Failed to open HSL to publisher (some_log_publisher): $hsl"
       } else {
           TCP::collect
       }
    }
    
    
    when CLIENT_DATA {
        set data [TCP::payload]
    
        TCP::release
        TCP::collect
        
        HSL::send $hsl $data
    }
    
    • Vernon_97235's avatar
      Vernon_97235
      Historic F5 Account
      Oh, and naturally, you'd need to define the Log Publisher "some_log_publisher" first :).
  • Firstly, I would strongly recommend against logging locally for this, and I would apply such an iRule only for debugging. If you really want the entire content of each SIP packet, you could simply log the contents of each TCP segment (since SIP metadata is text and the body is generally text), as in (untested!):

    when CLIENT_ACCEPTED {
       if { [catch { HSL::open -publisher some_log_publisher } hsl] } {
           log local0.warn "Failed to open HSL to publisher (some_log_publisher): $hsl"
       } else {
           TCP::collect
       }
    }
    
    
    when CLIENT_DATA {
        set data [TCP::payload]
    
        TCP::release
        TCP::collect
        
        HSL::send $hsl $data
    }
    
    • VernonWells's avatar
      VernonWells
      Icon for Employee rankEmployee
      Oh, and naturally, you'd need to define the Log Publisher "some_log_publisher" first :).
  • Vernon thanks for your response,

     

    Will same Irule work for normal logging with changes as I am not having log publisher in my lab setup.

     

    /Regards Amit Grover

     

  • Hi,

    I tried below Irule and it worked once to print only first SIP packet but not continues SIP traffic Please suggest further.

    when CLIENT_ACCEPTED {
      TCP::collect 15
    }
    when CLIENT_DATA {
    log local0.alert "SIP payload is [TCP::payload]"
    TCP::release
    }
    

    /Regards Amit Grover