How to control access to RTSP/RTP streams

Example module that illustrates the basic API for controlling access to an RTSP/RTP stream.

package com.wowza.wms.example.module;

import com.wowza.wms.rtp.model.*;
import com.wowza.wms.application.*;
import com.wowza.wms.module.*;

public class ModuleAccessControlRTSP extends ModuleBase
{
	public void onRTPSessionCreate(RTPSession rtpSession)
	{
		boolean isGood = true;

		String ipAddress = rtpSession.getIp();
		String queryStr = rtpSession.getQueryStr();
		String referrer = rtpSession.getReferrer();
		String userAgent = rtpSession.getUserAgent();

		IApplicationInstance appInstance = rtpSession.getAppInstance();
		String uriStr = rtpSession.getUri();

		// Here you can use the request and session information above to determine 
		// if you want to reject the connection
		// isGood = true/false;

		if (!isGood)
			rtpSession.rejectSession();
	}
}

Originally Published: 10-03-2010.

If you're having problems or want to discuss this article, post in our forum.