本文整理汇总了Java中javax.sip.RequestEvent类的典型用法代码示例。如果您正苦于以下问题:Java RequestEvent类的具体用法?Java RequestEvent怎么用?Java RequestEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestEvent类属于javax.sip包,在下文中一共展示了RequestEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processBye
import javax.sip.RequestEvent; //导入依赖的package包/类
/**
* Process the bye request.
*/
public void processBye(RequestEvent requestEvent,
ServerTransaction serverTransactionId) {
Request request = requestEvent.getRequest();
try {
logger.info("shootme: got a bye sending OK.");
logger.info("shootme: dialog = " + requestEvent.getDialog());
logger.info("shootme: dialogState = " + requestEvent.getDialog().getState());
Response response = messageFactory.createResponse(200, request);
if ( serverTransactionId != null) {
serverTransactionId.sendResponse(response);
}
logger.info("shootme: dialogState = " + requestEvent.getDialog().getState());
this.byeSeen = true;
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例2: processBye
import javax.sip.RequestEvent; //导入依赖的package包/类
/** Process the bye request.
*/
public void processBye(
RequestEvent requestEvent,
ServerTransaction serverTransactionId) {
// SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
System.out.println("shootme: got a bye sending OK.");
Response response =
messageFactory.createResponse(200, request, null, null);
serverTransactionId.sendResponse(response);
System.out.println("Dialog State is " + serverTransactionId.getDialog().getState());
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例3: processAck
import javax.sip.RequestEvent; //导入依赖的package包/类
/**
* Process the ACK request. Send the bye and complete the call flow.
*/
public void processAck(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
try {
System.out.println("shootme: got an ACK! ");
System.out.println("Dialog State = " + dialog.getState());
SipProvider provider = (SipProvider) requestEvent.getSource();
if (!callerSendsBye) {
Request byeRequest = dialog.createRequest(Request.BYE);
ClientTransaction ct = provider
.getNewClientTransaction(byeRequest);
dialog.sendRequest(ct);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例4: processRequest
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestReceivedEvent) {
Request request = requestReceivedEvent.getRequest();
ServerTransaction serverTransactionId = requestReceivedEvent
.getServerTransaction();
String viaBranch = ((ViaHeader)(request.getHeaders(ViaHeader.NAME).next())).getParameter("branch");
logger.info("\n\nRequest " + request.getMethod() + " received at "
+ sipStack.getStackName() + " with server transaction id "
+ serverTransactionId +
" branch ID = " + viaBranch);
//logger.info( request );
if (request.getMethod().equals(Request.NOTIFY)) {
processNotify(requestReceivedEvent, serverTransactionId);
} else if ( request.getMethod().equals(Request.INVITE)) {
processInvite( requestReceivedEvent );
} else if ( request.getMethod().equals(Request.ACK)) {
processAck( requestReceivedEvent );
} else if ( request.getMethod().equals(Request.BYE)) {
processBye( requestReceivedEvent );
} else {
TestHarness.fail( "Unexpected request type:" + request.getMethod() );
}
}
示例5: processRequest
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
Request request = requestEvent.getRequest();
ServerTransaction serverTransactionId = requestEvent
.getServerTransaction();
System.out.println("\n\nRequest " + request.getMethod()
+ " received at " + sipStack.getStackName()
+ " with server transaction id " + serverTransactionId);
if (request.getMethod().equals(Request.INVITE)) {
processInvite(requestEvent, serverTransactionId);
} else if(request.getMethod().equals(Request.ACK)) {
processAck(requestEvent, serverTransactionId);
}
}
示例6: processRequest
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
Request request = requestEvent.getRequest();
ServerTransaction serverTransactionId = requestEvent
.getServerTransaction();
logger.info("\n\nRequest " + request.getMethod()
+ " received at " + protocolObjects.sipStack.getStackName()
+ " with server transaction id " + serverTransactionId);
if (request.getMethod().equals(Request.INVITE)) {
processInvite(requestEvent, serverTransactionId);
} else if (request.getMethod().equals(Request.ACK)) {
processAck(requestEvent, serverTransactionId);
}
}
示例7: processInvite
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processInvite(RequestEvent requestEvent) {
//System.out.println("Got invite: "+requestEvent.getRequest());
try {
serverTransaction = requestEvent.getServerTransaction();
if (serverTransaction == null) {
try {
serverTransaction = sipProvider.getNewServerTransaction(requestEvent.getRequest());
}
catch (Exception e) {
e.printStackTrace();
return;
}
}
//serverTransaction.sendResponse(messageFactory.createResponse(100, requestEvent.getRequest()));
setupIncomingDialog();
forwardInvite();
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例8: processBye
import javax.sip.RequestEvent; //导入依赖的package包/类
/**
* Process the bye request.
*/
public void processBye(RequestEvent requestEvent, ServerTransaction serverTransactionId) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
logger.info("shootme: got a bye sending OK.");
Response response = protocolObjects.messageFactory.createResponse(200, request);
if (serverTransactionId != null) {
serverTransactionId.sendResponse(response);
logger.info("Dialog State is " + serverTransactionId.getDialog().getState());
} else {
logger.info("null server tx.");
// sipProvider.sendResponse(response);
}
} catch (Exception ex) {
String s = "Unexpected exception";
logger.error(s, ex);
ReInviteBusyTest.fail(s);
}
}
示例9: processRequest
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
Request request = requestEvent.getRequest();
ServerTransaction serverTransactionId = requestEvent
.getServerTransaction();
logger.info("\n\nRequest " + request.getMethod()
+ " received at " + sipStack.getStackName()
+ " with server transaction id " + serverTransactionId);
if (request.getMethod().equals(Request.INVITE)) {
processInvite(requestEvent, serverTransactionId);
} else if (request.getMethod().equals(Request.ACK)) {
processAck(requestEvent, serverTransactionId);
} else if (request.getMethod().equals(Request.BYE)) {
processBye(requestEvent, serverTransactionId);
}
}
示例10: processRequest
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestReceivedEvent) {
Request request = requestReceivedEvent.getRequest();
ServerTransaction serverTransactionId = requestReceivedEvent
.getServerTransaction();
logger.info("\n\nRequest " + request.getMethod()
+ " received at " + sipStack.getStackName()
+ " with server transaction id " + serverTransactionId);
// We are the UAC so the only request we get is the BYE.
if (request.getMethod().equals(Request.BYE))
processBye(request, serverTransactionId);
else {
try {
serverTransactionId.sendResponse(messageFactory
.createResponse(202, request));
} catch (Exception e) {
fail("Unexpected exception");
logger.error("Unexpected exception", e);
}
}
}
示例11: processInvite
import javax.sip.RequestEvent; //导入依赖的package包/类
/**
* Process the invite request.
*/
public void processInvite(RequestEvent requestEvent, ServerTransaction serverTransaction) {
try {
// System.out.println("ProcessInvite");
Request request = requestEvent.getRequest();
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
// Note you need to create the Server Transaction
// before the listener returns but you can delay sending the
// response
ServerTransaction st = sipProvider.getNewServerTransaction(request);
TTask ttask = new TTask(requestEvent, st);
int ttime = 100;
new Timer().schedule(ttask, ttime);
} catch (Exception ex) {
ex.printStackTrace();
TxTimeoutTest.fail("Shootme: Failed on process INVITE", ex);
}
}
示例12: processRequest
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
Request request = requestEvent.getRequest();
ServerTransaction serverTransactionId = requestEvent.getServerTransaction();
System.out.println("GOT REQUEST: " + request.getMethod());
if (request.getMethod().equals(Request.INVITE) || request.getMethod().equals(Request.MESSAGE)) {
processInvite(requestEvent, serverTransactionId);
} else if (request.getMethod().equals(Request.ACK)) {
processAck(requestEvent, serverTransactionId);
} else if (request.getMethod().equals(Request.INFO)) {
processInfo(requestEvent);
} else if (request.getMethod().equals(Request.BYE)) {
processBye(requestEvent, serverTransactionId);
}
}
示例13: processInfo
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processInfo(RequestEvent requestEvent, ServerTransaction serverTransactionId) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
logger.info("shootme: got a INFO sending OK.");
Response response = protocolObjects.messageFactory.createResponse(200, request);
if (serverTransactionId != null) {
serverTransactionId.sendResponse(response);
logger.info("Dialog State is " + serverTransactionId.getDialog().getState());
} else {
logger.info("null server tx.");
// sipProvider.sendResponse(response);
}
} catch (Exception ex) {
String s = "Unexpected exception";
logger.error(s, ex);
ReInviteInfoAckOverlapTest.fail(s);
}
}
示例14: processAck
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processAck(RequestEvent requestEvent, ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
try {
logger.info("shootme: got an ACK " + requestEvent.getRequest());
CSeqHeader cseq = (CSeqHeader) requestEvent.getRequest().getHeader(CSeqHeader.NAME);
if(cseq.getSeqNumber() == 2) this.ack2Received = true;
/* int ackCount = ((ApplicationData) dialog.getApplicationData()).ackCount;*/
dialog = inviteTid.getDialog();
Thread.sleep(1000);
logger.info("shootme is sending RE INVITE now");
System.out.println("Got an ACK " );
this.reInviteCount++;
this.sendReInvite(sipProvider);
} catch (Exception ex) {
String s = "Unexpected error";
logger.error(s, ex);
ReInviteInfoAckOverlapTest.fail(s);
}
}
示例15: processRequest
import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
Request request = requestEvent.getRequest();
ServerTransaction serverTransactionId = requestEvent.getServerTransaction();
System.out.println("GOT REQUEST: " + request.getMethod());
if (request.getMethod().equals(Request.INVITE)) {
processInvite(requestEvent, serverTransactionId);
} else if (request.getMethod().equals(Request.ACK)) {
processAck(requestEvent, serverTransactionId);
} else if (request.getMethod().equals(Request.INFO)) {
processInfo(requestEvent);
} else if (request.getMethod().equals(Request.BYE)) {
processBye(requestEvent, serverTransactionId);
}
}