Forum Discussion

mnowina_63180's avatar
mnowina_63180
Icon for Nimbostratus rankNimbostratus
May 30, 2008

RTSP::method

Hi,

 

 

This is my first attempt at using an iRule and I think I'm having a formating issue with the RTSP header/body in this rule:

 

 

when RTSP_REQUEST {

 

if { [RTSP::method] contains "DESCRIBE" and [RTSP::uri] contains "foo" }

 

{

 

RTSP::respond 302 Found "REDIRECT rtsp://1.1.1.1/foo.3gp RTSP/1.0\nLocation: rtsp://2.2.2.2/bar.3gp\n"

 

}

 

}

 

 

When the above rule is applied I don't get any response on the client side. I've tried looking through the forums, but unfortunately I haven't found anything with RTSP::respond examples.

 

 

Any help you can provide would be greatly appreciated!

 

 

Thanks,

 

 

Matt

6 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    The first thing I would do is to add some logging inside your if statement to be sure the if comparison string is matching. If it's not, I'd try using the string tolower command on the method and uri respectively, and using single case comparisons to try and match.

     

     

    colin
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    I think the format for the RTSP::respond command might be slightly off. Following the format for HTTP::respond, can you try this syntax instead?

     

     

    RTSP::respond 302 Location "rtsp://1.1.1.1/foo.3gp"

     

     

    Aaron
  • I agree that its likely a formatting issue, however I'm still stumped. It seems no matter what I put the LTM doesn't send a response. Logging shows the following:

     

     

    Jun 2 10:00:09 tmm tmm[1591]: Rule RTSP_REDIRECT_TEST :

     

     

    and the client just seems to hang waiting for a response. I'm basically trying to simulate the following:

     

     

    DESCRIBE rtsp://1.1.1.1/foo.3gp RTSP/1.0

     

    CSeq: 1

     

    Accept: application/sdp

     

    Bandwidth: 2147483647

     

    Accept-Language: en-US

     

    User-Agent: QuickTime/7.1.6 (qtver=7.1.6;cpu=IA32;os=Mac 10.4.9)

     

     

     

    RTSP/1.0 302 Found

     

    Server: QTSS/5.5.5 (Build/489.16; Platform/MacOSX; Release/Darwin; state/beta; )

     

    Cseq: 1

     

    Connection: Close

     

    Location: rtsp://2.2.2.2/bar.3gp

     

     

    but I cant figure out how to properly respond with this information.

     

     

    Matt
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    I think the format is:

     

     

    RTSP::respond 302 Location "rtsp://2.2.2.2/bar.3gp" Connection Close Cseq 1 Server "QTSS/5.5.5 (Build/489.16; Platform/MacOSX; Release/Darwin; state/beta; )"

     

     

    If you're on 9.4 or above, you can use netcat to connect from the command line of the BIG-IP to the VIP to test this. Type netcat 1.1.1.1 80 where 1.1.1.1 is the VIP address and 80 is the port. Then paste/type in the request:

     

     

     

    DESCRIBE rtsp://1.1.1.1/foo.3gp RTSP/1.0

     

    CSeq: 1

     

    Accept: application/sdp

     

    Bandwidth: 2147483647

     

    Accept-Language: en-US

     

    User-Agent: QuickTime/7.1.6 (qtver=7.1.6;cpu=IA32;os=Mac 10.4.9)

     

     

    The response from the iRule should be echo'd back to you.

     

     

    Aaron
  • Hi Aaron,

     

     

    Thanks for all of your help! I was able to get this functionality working with a slightly modified string, but your suggestion to use netcat was really what helped the most. So now with the following irule, I am able to redirect certain clients to an alternate file:

     

     

    when RTSP_REQUEST {

     

    if { [RTSP::method] contains "SETUP" and [RTSP::uri] contains "foo" }

     

    {

     

    RTSP::respond 302 "Moved Temporarily" "Location: rtsp://2.2.2.2/bar.3gp\n\r\r"

     

    }

     

    }

     

     

    Unfortunately at this point, I've only been able to redirect connection attempts from the Real Player client. Quicktime and VLC just appear to hang. It was also interesting to note that the trailing "\n\r\r" are necessary for Real to work as well, without them the client just appears to hang. I'm now trying to see if there is a way to have the LTM respond with "REDIRECT rstp://1.1.1.1/foo.3gp RTSP/1.0" (and subsequent headers) which in theory can be applied at any time during the stream. I just haven't seen a way to respond without a numeric status code.

     

     

    Matt
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    I have an open CR to get examples for these new commands, but don't yet have working examples for the wiki.

     

     

    Assuming RTSP::respond uses similar syntax as HTTP::respond, you'll see duplicate Connect and "Server" headers in the response sent to the client if you insert them as parameters. THere's already a CR for that, and if one of you can confirm for RTSP, I will add another CR to address this for RTSP as well.

     

     

    thx

     

    /deb