// Path: src/com/tt/reaper/sip/CollectorStack.java
// public class CollectorStack {
// 	private static final String STACK_NAME = "CollectorStack";
// 	private static Logger logger = Logger.getLogger(CollectorStack.class);
// 	public static CollectorStack instance = new CollectorStack();
// 	private SipProvider collectorProvider;
// 	private static boolean initialized = false;
// 	public String lastSendData;
// 	
// 	private CollectorStack()
// 	{
// 	}
// 	
// 	public synchronized boolean init()
// 	{
// 		if (initialized == true)
// 			return true;
// 		initialized = true;
// 		logger.info("Starting the collector stack...");
// 		try {
// 			SipStack sipStack;
// 			Configuration configuration;
// 			configuration = new Configuration();
// 			configuration.setStackName(STACK_NAME);
// 			SipFactory.getInstance().setPathName("gov.nist");
// 			sipStack = SipFactory.getInstance().createSipStack(configuration);
// 			RequestMessage.initFactory(SipFactory.getInstance(), configuration);
// 			ListeningPoint reaperUdp = sipStack.createListeningPoint(configuration.getWriteInterface(), configuration.getWritePort(), "udp");
// 			collectorProvider = sipStack.createSipProvider(reaperUdp);
// 			collectorProvider.addSipListener(new CollectorListener());
// 			collectorProvider.setAutomaticDialogSupportEnabled(false);
// 			logger.info("Collector SIP stack initialized successfully");
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error initializing stack: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendResponse(ResponseMessage response) {
// 		try {
// 			ServerTransaction st = collectorProvider.getNewServerTransaction(response.getRequest());
// 			st.sendResponse(response.getResponse());
// 		}
// 		catch (Exception e) {
// 			logger.error("Error sending response: ", e);
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendMessage(String data) {
// 		lastSendData = data;
// 		try {
// 			PublishMessage publish = new PublishMessage(data);
// 			collectorProvider.sendRequest(publish.getRequest());
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error sending message: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public CallIdHeader getNewCallId() {
// 		logger.info("Get new call id: " + collectorProvider);
// 		return collectorProvider.getNewCallId();
// 	}
// }
// 
// Path: src/com/tt/reaper/vq/LocalMetrics.java
// public class LocalMetrics extends Metrics {
// 	private static final String NAME = "LocalMetrics";
// 	
// 	LocalMetrics()
// 	{
// 		super(NAME);
// 	}
// 
// 	public LocalMetrics(CallContext context, AudioData data) {
// 		super(NAME, context, data);
// 	}
// }
// 
// Path: src/com/tt/reaper/vq/VQSessionReport.java
// public class VQSessionReport extends VQReportEvent {
// 	private static final String HEADER = "VQSessionReport : CallTerm\r\n";
// 
// 	public VQSessionReport(LocalMetrics localMetrics) {
// 		super(HEADER, localMetrics);
// 	}
// }


import java.util.Iterator;
import com.tt.reaper.message.Message;
import com.tt.reaper.message.RtpPacket;
import com.tt.reaper.sip.CollectorStack;
import com.tt.reaper.vq.LocalMetrics;
import com.tt.reaper.vq.VQSessionReport;
package com.tt.reaper.call;



public class StateTerminating extends State {
	public static final StateTerminating instance = new StateTerminating();
	
	private StateTerminating()
	{
	}
	
	State process(CallContext context, Message message)
	{
		switch (message.getType())
		{
		case Message.SUCCESS:
		case Message.FAILURE:
// Path: src/com/tt/reaper/sip/CollectorStack.java
// public class CollectorStack {
// 	private static final String STACK_NAME = "CollectorStack";
// 	private static Logger logger = Logger.getLogger(CollectorStack.class);
// 	public static CollectorStack instance = new CollectorStack();
// 	private SipProvider collectorProvider;
// 	private static boolean initialized = false;
// 	public String lastSendData;
// 	
// 	private CollectorStack()
// 	{
// 	}
// 	
// 	public synchronized boolean init()
// 	{
// 		if (initialized == true)
// 			return true;
// 		initialized = true;
// 		logger.info("Starting the collector stack...");
// 		try {
// 			SipStack sipStack;
// 			Configuration configuration;
// 			configuration = new Configuration();
// 			configuration.setStackName(STACK_NAME);
// 			SipFactory.getInstance().setPathName("gov.nist");
// 			sipStack = SipFactory.getInstance().createSipStack(configuration);
// 			RequestMessage.initFactory(SipFactory.getInstance(), configuration);
// 			ListeningPoint reaperUdp = sipStack.createListeningPoint(configuration.getWriteInterface(), configuration.getWritePort(), "udp");
// 			collectorProvider = sipStack.createSipProvider(reaperUdp);
// 			collectorProvider.addSipListener(new CollectorListener());
// 			collectorProvider.setAutomaticDialogSupportEnabled(false);
// 			logger.info("Collector SIP stack initialized successfully");
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error initializing stack: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendResponse(ResponseMessage response) {
// 		try {
// 			ServerTransaction st = collectorProvider.getNewServerTransaction(response.getRequest());
// 			st.sendResponse(response.getResponse());
// 		}
// 		catch (Exception e) {
// 			logger.error("Error sending response: ", e);
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendMessage(String data) {
// 		lastSendData = data;
// 		try {
// 			PublishMessage publish = new PublishMessage(data);
// 			collectorProvider.sendRequest(publish.getRequest());
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error sending message: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public CallIdHeader getNewCallId() {
// 		logger.info("Get new call id: " + collectorProvider);
// 		return collectorProvider.getNewCallId();
// 	}
// }
// 
// Path: src/com/tt/reaper/vq/LocalMetrics.java
// public class LocalMetrics extends Metrics {
// 	private static final String NAME = "LocalMetrics";
// 	
// 	LocalMetrics()
// 	{
// 		super(NAME);
// 	}
// 
// 	public LocalMetrics(CallContext context, AudioData data) {
// 		super(NAME, context, data);
// 	}
// }
// 
// Path: src/com/tt/reaper/vq/VQSessionReport.java
// public class VQSessionReport extends VQReportEvent {
// 	private static final String HEADER = "VQSessionReport : CallTerm\r\n";
// 
// 	public VQSessionReport(LocalMetrics localMetrics) {
// 		super(HEADER, localMetrics);
// 	}
// }


// Path: src/com/tt/reaper/call/StateTerminating.java
import java.util.Iterator;
import com.tt.reaper.message.Message;
import com.tt.reaper.message.RtpPacket;
import com.tt.reaper.sip.CollectorStack;
import com.tt.reaper.vq.LocalMetrics;
import com.tt.reaper.vq.VQSessionReport;

package com.tt.reaper.call;



public class StateTerminating extends State {
	public static final StateTerminating instance = new StateTerminating();
	
	private StateTerminating()
	{
	}
	
	State process(CallContext context, Message message)
	{
		switch (message.getType())
		{
		case Message.SUCCESS:
		case Message.FAILURE:
			Iterator<AudioData> it;