use of gov.nist.javax.sip.header.RetryAfter in project XobotOS by xamarin.
the class DialogFilter method sendRequestPendingResponse.
/**
* Send back a Request Pending response.
*
* @param sipRequest
* @param transaction
*/
private void sendRequestPendingResponse(SIPRequest sipRequest, SIPServerTransaction transaction) {
SIPResponse sipResponse = sipRequest.createResponse(Response.REQUEST_PENDING);
ServerHeader serverHeader = MessageFactoryImpl.getDefaultServerHeader();
if (serverHeader != null) {
sipResponse.setHeader(serverHeader);
}
try {
RetryAfter retryAfter = new RetryAfter();
retryAfter.setRetryAfter(1);
sipResponse.setHeader(retryAfter);
if (sipRequest.getMethod().equals(Request.INVITE)) {
sipStack.addTransactionPendingAck(transaction);
}
transaction.sendResponse(sipResponse);
transaction.releaseSem();
} catch (Exception ex) {
sipStack.getStackLogger().logError("Problem sending error response", ex);
transaction.releaseSem();
sipStack.removeTransaction(transaction);
}
}
use of gov.nist.javax.sip.header.RetryAfter in project XobotOS by xamarin.
the class DialogFilter method sendServerInternalErrorResponse.
/**
* Send back an error Response.
*
* @param sipRequest
* @param transaction
*/
private void sendServerInternalErrorResponse(SIPRequest sipRequest, SIPServerTransaction transaction) {
if (sipStack.isLoggingEnabled())
sipStack.getStackLogger().logDebug("Sending 500 response for out of sequence message");
SIPResponse sipResponse = sipRequest.createResponse(Response.SERVER_INTERNAL_ERROR);
sipResponse.setReasonPhrase("Request out of order");
if (MessageFactoryImpl.getDefaultServerHeader() != null) {
ServerHeader serverHeader = MessageFactoryImpl.getDefaultServerHeader();
sipResponse.setHeader(serverHeader);
}
try {
RetryAfter retryAfter = new RetryAfter();
retryAfter.setRetryAfter(10);
sipResponse.setHeader(retryAfter);
sipStack.addTransactionPendingAck(transaction);
transaction.sendResponse(sipResponse);
transaction.releaseSem();
} catch (Exception ex) {
sipStack.getStackLogger().logError("Problem sending response", ex);
transaction.releaseSem();
sipStack.removeTransaction(transaction);
}
}
Aggregations