本文整理汇总了Java中javax.sip.ServerTransaction.sendResponse方法的典型用法代码示例。如果您正苦于以下问题:Java ServerTransaction.sendResponse方法的具体用法?Java ServerTransaction.sendResponse怎么用?Java ServerTransaction.sendResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sip.ServerTransaction
的用法示例。
在下文中一共展示了ServerTransaction.sendResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processBye
import javax.sip.ServerTransaction; //导入方法依赖的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.ServerTransaction; //导入方法依赖的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();
logger.info("shootme: local party = " + dialog.getLocalParty());
try {
logger.info("shootme: got a bye sending OK.");
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
logger.info("shootme: Dialog State is "
+ serverTransactionId.getDialog().getState());
} catch (Exception ex) {
logger.error("UNexpected exception",ex);
fail("UNexpected exception");
}
}
示例3: processCancel
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processCancel(RequestEvent requestEvent,
ServerTransaction serverTransactionId) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
logger.info("shootme: got a cancel.");
if (serverTransactionId == null) {
logger.info("shootme: null tid.");
return;
}
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
if (dialog.getState() != DialogState.CONFIRMED) {
response = messageFactory.createResponse(
Response.REQUEST_TERMINATED, inviteRequest);
inviteTid.sendResponse(response);
}
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例4: processBye
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processBye(Request request,
ServerTransaction serverTransactionId) {
try {
logger.info("shootist: got a bye .");
if (serverTransactionId == null) {
logger.info("shootist: null TID.");
return;
}
Response response = protocolObjects.messageFactory.createResponse(
200, request);
serverTransactionId.sendResponse(response);
} catch (Exception ex) {
logger.error("unexpected exception",ex);
fail("unexpected exception");
}
}
示例5: processCancel
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processCancel(RequestEvent requestEvent,
ServerTransaction serverTransactionId) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
System.out.println("shootme: got a cancel.");
if (serverTransactionId == null) {
System.out.println("shootme: null tid.");
return;
}
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
if (dialog.getState() != DialogState.CONFIRMED) {
response = messageFactory.createResponse(
Response.REQUEST_TERMINATED, inviteRequest);
inviteTid.sendResponse(response);
}
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例6: processBye
import javax.sip.ServerTransaction; //导入方法依赖的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.");
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
logger.info("Dialog State is "
+ serverTransactionId.getDialog().getState());
} catch (Exception ex) {
TestHarness.fail(ex.getMessage());
System.exit(0);
}
}
示例7: processBye
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processBye(Request request,
ServerTransaction serverTransactionId) {
try {
logger.info("shootist: got a bye .");
if (serverTransactionId == null) {
logger.info("shootist: null TID.");
return;
}
Dialog dialog = serverTransactionId.getDialog();
logger.info("Dialog State = " + dialog.getState());
Response response = messageFactory.createResponse(
200, request);
serverTransactionId.sendResponse(response);
logger.info("shootist: Sending OK.");
logger.info("Dialog State = " + dialog.getState());
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例8: processBye
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processBye(
Request request,
ServerTransaction serverTransactionId) {
try {
System.out.println("shootist: got a bye .");
if (serverTransactionId == null) {
System.out.println("shootist: null TID.");
return;
}
Dialog dialog = serverTransactionId.getDialog();
System.out.println("Dialog State = " + dialog.getState());
Response response = messageFactory.createResponse
(200, request);
serverTransactionId.sendResponse(response);
System.out.println("shootist: Sending OK.");
System.out.println("Dialog State = " + dialog.getState());
this.byeSeen = true;
} catch (Exception ex) {
ex.printStackTrace();
TlsTest.fail("unepxected exception");
}
}
示例9: processBye
import javax.sip.ServerTransaction; //导入方法依赖的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);
}
}
示例10: processBye
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processBye(Request request,
ServerTransaction serverTransactionId) {
try {
logger.info("shootist: got a bye .");
if (serverTransactionId == null) {
logger.info("shootist: null TID.");
return;
}
Dialog dialog = serverTransactionId.getDialog();
SctpTest.assertSame("dialog mismatch", dialog,this.dialog);
logger.info("Dialog State = " + dialog.getState());
Response response = protocolObjects.messageFactory.createResponse(
200, request);
serverTransactionId.sendResponse(response);
logger.info("shootist: Sending OK.");
logger.info("Dialog State = " + dialog.getState());
SctpTest.assertEquals("Should be terminated", dialog.getState() , DialogState.TERMINATED);
} catch (Exception ex) {
logger.error("unexpected exception",ex);
SctpTest.fail("unexpected exception");
}
}
示例11: processInvite
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
/**
* Process the invite request.
*/
public void processInvite(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
if ( serverTransaction == null) {
serverTransaction = sipProvider.getNewServerTransaction(request);
}
Response okResponse = messageFactory.createResponse(Response.OK,
request);
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
ContactHeader contactHeader = headerFactory
.createContactHeader(address);
ToHeader toHeader = (ToHeader) okResponse.getHeader(ToHeader.NAME);
toHeader.setTag("4321"); // Application is supposed to set.
okResponse.addHeader(contactHeader);
serverTransaction.sendResponse(okResponse); // Send it through the transaction layer.
} catch (Exception ex) {
ex.printStackTrace();
fail("Unexpected exception ");
}
}
示例12: processBye
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processBye(Request request,
ServerTransaction serverTransactionId) {
try {
if (serverTransactionId == null) {
return;
}
Dialog dialog = serverTransactionId.getDialog();
Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
Appdata appdata = (Appdata) dialog.getApplicationData();
appdata.cancelTimer();
int ndialogs = nbConcurrentInvite.decrementAndGet();
// System.out.println(nbConcurrentInvite);
if ( ndialogs > MAXCONCURRENTINVITE ) System.out.println("Concurrent invites = " + ndialogs);
synchronized( this) {
if ( ndialogs < MAXCONCURRENTINVITE/2 ) this.notify();
}
// Synchronization necessary for Multiprocessor machine
// noted by Matt Porter.
this.byeCount++;
// System.out.println("bye count = " + byeCount);
if (byeCount == NDIALOGS) {
long current = System.currentTimeMillis();
float sec = (float) (current - start) / 1000f;
System.out.println("Thrupt = " + (float) (NDIALOGS / sec));
}
// dialog.delete();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例13: sendInviteOK
import javax.sip.ServerTransaction; //导入方法依赖的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();
}
}
示例14: processTimeout
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
Transaction transaction;
if (timeoutEvent.isServerTransaction()) {
transaction = timeoutEvent.getServerTransaction();
} else {
transaction = timeoutEvent.getClientTransaction();
}
logger.info("state = " + transaction.getState());
logger.info("dialog = " + transaction.getDialog());
logger.info("dialogState = " + transaction.getDialog().getState());
logger.info("Transaction Timed out");
transactionTimedOut = true;
if(transaction instanceof ServerTransaction) {
try {
Response response = messageFactory.createResponse(Response.SERVER_INTERNAL_ERROR,
transaction.getRequest());
ServerTransaction st = (ServerTransaction) transaction;
if (st == null) {
st = sipProvider.getNewServerTransaction(transaction.getRequest());
}
dialog = st.getDialog();
st.sendResponse(response);
errorResponseSent = true;
} catch (Exception ex) {
TestHarness.fail(ex.getMessage());
System.exit(0);
}
}
}
示例15: processInvite
import javax.sip.ServerTransaction; //导入方法依赖的package包/类
/**
* Process the invite request.
*/
public void processInvite(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
serverTransaction = sipProvider.getNewServerTransaction(request);
dialog = (DialogExt) sipProvider.getNewDialog(serverTransaction);
dialog.disableSequenceNumberValidation();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
Response okResponse = messageFactory.createResponse(Response.OK,
request);
FromHeader from = (FromHeader) okResponse.getHeader(FromHeader.NAME);
from.removeParameter("tag");
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
ContactHeader contactHeader = headerFactory
.createContactHeader(address);
ToHeader toHeader = (ToHeader) okResponse.getHeader(ToHeader.NAME);
toHeader.setTag("4321"); // Application is supposed to set.
FromHeader fromHeader = (FromHeader)okResponse.getHeader(FromHeader.NAME);
fromHeader.setTag("12345");
okResponse.addHeader(contactHeader);
serverTransaction.sendResponse(okResponse);
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}