use of javax.sip.message.Request in project XobotOS by xamarin.
the class SipHelper method sendRinging.
/**
* @param event the INVITE request event
*/
public ServerTransaction sendRinging(RequestEvent event, String tag) throws SipException {
try {
Request request = event.getRequest();
ServerTransaction transaction = getServerTransaction(event);
Response response = mMessageFactory.createResponse(Response.RINGING, request);
ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
toHeader.setTag(tag);
response.addHeader(toHeader);
if (DEBUG)
Log.d(TAG, "send RINGING: " + response);
transaction.sendResponse(response);
return transaction;
} catch (ParseException e) {
throw new SipException("sendRinging()", e);
}
}
use of javax.sip.message.Request in project XobotOS by xamarin.
the class SipHelper method sendInviteBusyHere.
public void sendInviteBusyHere(RequestEvent event, ServerTransaction inviteTransaction) throws SipException {
try {
Request request = event.getRequest();
Response response = mMessageFactory.createResponse(Response.BUSY_HERE, request);
if (inviteTransaction == null) {
inviteTransaction = getServerTransaction(event);
}
if (inviteTransaction.getState() != TransactionState.COMPLETED) {
if (DEBUG)
Log.d(TAG, "send BUSY HERE: " + response);
inviteTransaction.sendResponse(response);
}
} catch (ParseException e) {
throw new SipException("sendInviteBusyHere()", e);
}
}
use of javax.sip.message.Request in project XobotOS by xamarin.
the class SipHelper method sendResponse.
public void sendResponse(RequestEvent event, int responseCode) throws SipException {
try {
Request request = event.getRequest();
Response response = mMessageFactory.createResponse(responseCode, request);
if (DEBUG && (!Request.OPTIONS.equals(request.getMethod()) || DEBUG_PING)) {
Log.d(TAG, "send response: " + response);
}
getServerTransaction(event).sendResponse(response);
} catch (ParseException e) {
throw new SipException("sendResponse()", e);
}
}
use of javax.sip.message.Request in project XobotOS by xamarin.
the class SipHelper method sendReferNotify.
public void sendReferNotify(Dialog dialog, String content) throws SipException {
try {
Request request = dialog.createRequest(Request.NOTIFY);
request.addHeader(mHeaderFactory.createSubscriptionStateHeader("active;expires=60"));
// set content here
request.setContent(content, mHeaderFactory.createContentTypeHeader("message", "sipfrag"));
request.addHeader(mHeaderFactory.createEventHeader(ReferencesHeader.REFER));
if (DEBUG)
Log.d(TAG, "send NOTIFY: " + request);
dialog.sendRequest(mSipProvider.getNewClientTransaction(request));
} catch (ParseException e) {
throw new SipException("sendReferNotify()", e);
}
}
use of javax.sip.message.Request in project XobotOS by xamarin.
the class SipHelper method sendOptions.
public ClientTransaction sendOptions(SipProfile caller, SipProfile callee, String tag) throws SipException {
try {
Request request = (caller == callee) ? createRequest(Request.OPTIONS, caller, tag) : createRequest(Request.OPTIONS, caller, callee, tag);
ClientTransaction clientTransaction = mSipProvider.getNewClientTransaction(request);
clientTransaction.sendRequest();
return clientTransaction;
} catch (Exception e) {
throw new SipException("sendOptions()", e);
}
}
Aggregations