Control access to RTSP/RTP streams with the Wowza Streaming Engine Java API

The following example module illustrates how to use the Wowza Streaming Engine™ Java 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();
	}
}