<commit_before>package org.nebula;

import java.text.ParseException;
import java.util.Timer;

import javax.sip.Dialog;
import javax.sip.InvalidArgumentException;
import javax.sip.RequestEvent;
import javax.sip.ServerTransaction;
import javax.sip.SipException;
import javax.sip.TransactionAlreadyExistsException;
import javax.sip.TransactionUnavailableException;
import javax.sip.address.Address;
import javax.sip.header.ContactHeader;
import javax.sip.header.HeaderFactory;
import javax.sip.message.Request;
import javax.sip.message.Response;

import org.nebula.sipClient.*;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class SIPTest extends Activity implements SIPInterface {
	private SIPClient sip;
	private Dialog dialog;
	private String myName = "Michel";
	private String myAddress = "192.168.3.11";
	private int myPort = 5060;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		Request request;
		Response response;
		
		Log.v("nebula", "Start!");
		SIPClient sip;
		try {
			Log.v("nebula", "1");
			sip = new SIPClient(myAddress, myPort, myName, myAddress, "123", this);

			Log.v("nebula", "2");
			/*request = sip.register();
			Log.v("nebula", "3");
			response = sip.send(request);
			Log.v("nebula", "4");
			if(response.getStatusCode() == Response.UNAUTHORIZED) {
				Log.v("nebula", "unauthorized");				
				System.out.println("Authentication problem");
			}*/
			Log.v("nebula", "5");
			
			/*request = sip.invite("michel", "192.168.3.11");
			response = sip.send(request);*/
			
		} catch (Exception e) {
			Log.v("nebula", "6");
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		Log.v("nebula", "waiting..");
		
		boolean wait = true;
		while(wait){}
		
/*
		request = sip.invite("nina", "192.168.127.12");

		response = sip.send(request);
		
		sip.bye();*/
		
		/*request = sip.refer("nina", "192.168.127.12", "sdfdsf", "baba.com");

		response = sip.send(request);*/
		
		//System.out.println(response);
		System.out.println("End!");
	}

	public void sipRequest(RequestEvent requestReceivedEvent) {
		try {
			Request request = requestReceivedEvent.getRequest();
			ServerTransaction serverTransactionId = requestReceivedEvent
					.getServerTransaction();
			if (serverTransactionId == null)
					serverTransactionId = SIPClient.getSipProvider().getNewServerTransaction(request);
	
			Log.v("nebula", "\n\nRequest " + request.getMethod()
					+ " received at " + SIPClient.getSipStack().getStackName()
					+ " with server transaction id " + serverTransactionId);
			
			if (request.getMethod().equals(Request.BYE))
				sip.processBye(request, serverTransactionId);
			else if (request.getMethod().equals(Request.INVITE)) {
				/*Log.v("nebula", "send 100");
				serverTransactionId.sendResponse( SIPClient.getMessageFactory().createResponse(100, request) );
				Log.v("nebula", "send 101");
				serverTransactionId.sendResponse( SIPClient.getMessageFactory().createResponse(101, request) );*/
				Log.v("nebula", "send 180");
				//dialog = serverTransactionId.getDialog();
				serverTransactionId.sendResponse( SIPClient.getMessageFactory().createResponse(Response.RINGING, request) );
				Thread.sleep(1000);
				Log.v("nebula", "send 200");
				HeaderFactory headerFactory = SIPClient.getHeaderFactory();
				Response response = SIPClient.getMessageFactory().createResponse(Response.OK, request);
				Address address = SIPClient.getAddressFactory().createAddress(myName+" <sip:"
						+ myAddress + ":" + myPort + ">");
				ContactHeader contactHeader = headerFactory
						.createContactHeader(address);
				response.addHeader(contactHeader);
				serverTransactionId.sendResponse( response );

		        /*long lserverTransactionId = requestReceivedEvent.getTransactionId();
				sip.getSipProvider().sendResponse(lserverTransactionId, Response.RINGING);
				sip.getSipProvider().se
                Thread.sleep(500);
                sip.getSipProvider().sendResponse(lserverTransactionId, Response.OK);*/
				Log.v("nebula", "done");
			}
			else {
				serverTransactionId.sendResponse( SIPClient.getMessageFactory().createResponse(202,request) );
			}
		} catch (Exception e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
			System.exit(-1);
		}
	}
}<commit_msg>inviteRespond and inviteProcess<commit_after>package org.nebula;

import java.text.ParseException;
import java.util.Timer;

import javax.sip.Dialog;
import javax.sip.InvalidArgumentException;
import javax.sip.RequestEvent;
import javax.sip.ServerTransaction;
import javax.sip.SipException;
import javax.sip.TransactionAlreadyExistsException;
import javax.sip.TransactionUnavailableException;
import javax.sip.address.Address;
import javax.sip.header.ContactHeader;
import javax.sip.header.HeaderFactory;
import javax.sip.message.Request;
import javax.sip.message.Response;

import org.nebula.sipClient.*;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class SIPTest extends Activity implements SIPInterface {
	private SIPClient sip;
	private Dialog dialog;
	private String myName = "Michel";
	private String myAddress = "192.168.3.11";
	private int myPort = 5060;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		Request request;
		Response response;
		
		Log.v("nebula", "Start!");
		SIPClient sip;
		try {
			Log.v("nebula", "1");
			sip = new SIPClient(myAddress, myPort, myName, myAddress, "123", this);

			Log.v("nebula", "2");
			/*request = sip.register();
			Log.v("nebula", "3");
			response = sip.send(request);
			Log.v("nebula", "4");
			if(response.getStatusCode() == Response.UNAUTHORIZED) {
				Log.v("nebula", "unauthorized");				
				System.out.println("Authentication problem");
			}*/
			Log.v("nebula", "5");
			
			/*request = sip.invite("michel", "192.168.3.11");
			response = sip.send(request);*/
			
		} catch (Exception e) {
			Log.v("nebula", "6");
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		Log.v("nebula", "waiting..");
		
		boolean wait = true;
		while(wait){}
		
/*
		request = sip.invite("nina", "192.168.127.12");

		response = sip.send(request);
		
		sip.bye();*/
		
		/*request = sip.refer("nina", "192.168.127.12", "sdfdsf", "baba.com");

		response = sip.send(request);*/
		
		//System.out.println(response);
		System.out.println("End!");
	}

	public void sipRequest(RequestEvent requestReceivedEvent) {
		try {
			Request request = requestReceivedEvent.getRequest();
			ServerTransaction serverTransactionId = requestReceivedEvent
					.getServerTransaction();
			if (serverTransactionId == null)
					serverTransactionId = SIPClient.getSipProvider().getNewServerTransaction(request);
	
			Log.v("nebula", "\n\nRequest " + request.getMethod()
					+ " received at " + SIPClient.getSipStack().getStackName()
					+ " with server transaction id " + serverTransactionId);
			
			if (request.getMethod().equals(Request.BYE))
				sip.processBye(request, serverTransactionId);
			else if (request.getMethod().equals(Request.INVITE))
				inviteRequest(request, serverTransactionId);
			else
				serverTransactionId.sendResponse( SIPClient.getMessageFactory().createResponse(202,request) );
		} catch (Exception e1) {
			e1.printStackTrace();
			System.exit(-1);
		}
	}

	private void inviteRequest(Request request, ServerTransaction st) {
		/*Log.v("nebula", "send 100");
		serverTransactionId.sendResponse( SIPClient.getMessageFactory().createResponse(100, request) );
		Log.v("nebula", "send 101");
		serverTransactionId.sendResponse( SIPClient.getMessageFactory().createResponse(101, request) );*/
		Log.v("nebula", "send 180");
		//dialog = serverTransactionId.getDialog();
		
		try {
			st.sendResponse( SIPClient.getMessageFactory().createResponse(Response.RINGING, request) );
		} catch (Exception e) {
			e.printStackTrace();
		}
		inviteRespond(request, st);
		
        /*long lserverTransactionId = requestReceivedEvent.getTransactionId();
		sip.getSipProvider().sendResponse(lserverTransactionId, Response.RINGING);
		sip.getSipProvider().se
        Thread.sleep(500);
        sip.getSipProvider().sendResponse(lserverTransactionId, Response.OK);*/
		Log.v("nebula", "done");
	}

	private void inviteRespond(Request request, ServerTransaction st) {
		try {
			Thread.sleep(1000);
			Log.v("nebula", "send 200");
			HeaderFactory headerFactory = SIPClient.getHeaderFactory();
			Response response = SIPClient.getMessageFactory().createResponse(Response.OK, request);
			Address address = SIPClient.getAddressFactory().createAddress(myName+" <sip:"
					+ myAddress + ":" + myPort + ">");
			ContactHeader contactHeader = headerFactory
					.createContactHeader(address);
			response.addHeader(contactHeader);
			st.sendResponse( response );
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
{'fraction_non_alphanumeric': 0.1439265056141545, 'fraction_numerical': 0.01905410003402518, 'mean_word_length': 4.344242424242425, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1333215', 'n_tokens_mistral': 3240, 'n_tokens_neox': 2700, 'n_words': 510}