use of javax.sip.TransactionUnavailableException in project load-balancer by RestComm.
the class TestSipListener method sendBye.
/**
* @throws SipException
* @throws TransactionUnavailableException
* @throws TransactionDoesNotExistException
*/
public void sendBye(final Dialog dialog) throws SipException, TransactionUnavailableException, TransactionDoesNotExistException {
Thread th = new Thread() {
public void run() {
try {
if (sendByeInNewThread)
Thread.sleep(600);
Request byeRequest = dialog.createRequest(Request.BYE);
URI uri = ((FromHeader) byeRequest.getHeader(FromHeader.NAME)).getAddress().getURI();
if (uri.isSipURI()) {
((SipURI) uri).removeParameter("fromParam");
}
ClientTransaction ct = sipProvider.getNewClientTransaction(byeRequest);
logger.info("Sending BYE " + byeRequest);
if (!sendSubsequentRequestsThroughSipProvider) {
dialog.sendRequest(ct);
} else {
sipProvider.sendRequest(byeRequest);
}
byeSent = true;
} catch (Exception e) {
e.printStackTrace();
}
}
};
if (sendByeInNewThread) {
th.start();
} else {
th.run();
}
}
Aggregations