本文整理汇总了Java中javax.sip.RequestEvent.getRequest方法的典型用法代码示例。如果您正苦于以下问题:Java RequestEvent.getRequest方法的具体用法?Java RequestEvent.getRequest怎么用?Java RequestEvent.getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sip.RequestEvent
的用法示例。
在下文中一共展示了RequestEvent.getRequest方法的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();
Dialog dialog = requestEvent.getDialog();
System.out.println("local party = " + dialog.getLocalParty());
try {
System.out.println("shootme: got a bye sending OK.");
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
System.out.println("Shootme : Dialog State is "
+ serverTransactionId.getDialog().getState());
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例3: 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);
}
}
示例4: 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 "
+ protocolObjects.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.INFO))
processInfo(requestReceivedEvent);
else
TestHarness.fail("Unexpected request ! : " + request);
}
示例5: 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);
}
}
示例6: 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();
Dialog dialog = requestEvent.getDialog();
System.out.println("local party = " + dialog.getLocalParty());
try {
System.out.println("shootme: got a bye sending OK.");
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
System.out.println("Dialog State is "
+ serverTransactionId.getDialog().getState());
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例7: processCancel
import javax.sip.RequestEvent; //导入方法依赖的package包/类
public void processCancel(RequestEvent requestEvent,
ServerTransaction serverTransactionId) {
Request request = requestEvent.getRequest();
SipProvider sipProvider = (SipProvider)requestEvent.getSource();
try {
logger.info("shootme: got a cancel. " );
// Because this is not an In-dialog request, you will get a null server Tx id here.
if (serverTransactionId == null) {
serverTransactionId = sipProvider.getNewServerTransaction(request);
}
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
String serverTxId = ((ViaHeader)response.getHeader(ViaHeader.NAME)).getBranch();
ServerTransaction serverTx = (ServerTransaction) this.serverTxTable.get(serverTxId);
if ( serverTx != null && (serverTx.getState().equals(TransactionState.TRYING) ||
serverTx.getState().equals(TransactionState.PROCEEDING))) {
Request originalRequest = serverTx.getRequest();
Response resp = messageFactory.createResponse(Response.REQUEST_TERMINATED,originalRequest);
serverTx.sendResponse(resp);
}
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例8: 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);
}
}
示例9: sendInviteOK
import javax.sip.RequestEvent; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
try {
logger.info("sendInviteOK: " + inviteTid);
if (inviteTid.getState() != TransactionState.COMPLETED) {
logger.info("shootme: Dialog state before OK: "
+ inviteTid.getDialog().getState());
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
Response okResponse = messageFactory.createResponse(Response.OK,
request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
((ToHeader)okResponse.getHeader(ToHeader.NAME)).setTag(toTag);
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
ContactHeader contactHeader = headerFactory
.createContactHeader(address);
okResponse.addHeader(contactHeader);
inviteTid.sendResponse(okResponse);
logger.info("shootme: Dialog state after OK: "
+ inviteTid.getDialog().getState());
TestCase.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
} else {
logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例10: sendInviteOK
import javax.sip.RequestEvent; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
try {
logger.info("sendInviteOK: " + inviteTid);
if (inviteTid.getState() != TransactionState.COMPLETED) {
logger.info("shootme: Dialog state before OK: "
+ inviteTid.getDialog().getState());
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
Response okResponse = messageFactory.createResponse(Response.OK,
request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
((ToHeader)okResponse.getHeader(ToHeader.NAME)).setTag(toTag);
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ";transport=" + transport+ ">");
ContactHeader contactHeader = headerFactory
.createContactHeader(address);
okResponse.addHeader(contactHeader);
inviteTid.sendResponse(okResponse);
logger.info("shootme: Dialog state after OK: "
+ inviteTid.getDialog().getState());
TestCase.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
} else {
logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例11: processRequest
import javax.sip.RequestEvent; //导入方法依赖的package包/类
public void processRequest(RequestEvent requestReceivedEvent) {
Request request = requestReceivedEvent.getRequest();
ServerTransaction serverTransactionId = requestReceivedEvent
.getServerTransaction();
System.out.println("GOT REQUEST (we shouldnt get that): "
+ request.getMethod());
DialogTimeoutTest.fail("Shouldnt receive any request:\n"
+ request);
}
示例12: 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);
}
示例13: processRequest
import javax.sip.RequestEvent; //导入方法依赖的package包/类
public void processRequest(RequestEvent requestReceivedEvent) {
Request request = requestReceivedEvent.getRequest();
ServerTransaction serverTransactionId = requestReceivedEvent
.getServerTransaction();
// We are the UAC so the only request we get is the BYE.
if (request.getMethod().equals(Request.BYE))
processBye(request, serverTransactionId);
}
示例14: processInvite
import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
* Process the invite request.
*/
public void processInvite(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
this.inviteRequest = request;
}
示例15: processRequest
import javax.sip.RequestEvent; //导入方法依赖的package包/类
public void processRequest(RequestEvent requestReceivedEvent) {
Request request = requestReceivedEvent.getRequest();
ServerTransaction serverTransactionId = requestReceivedEvent
.getServerTransaction();
System.out.println("\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.NOTIFY))
processNotify(request, serverTransactionId);
}