use of javax.sip.SipException 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.SipException 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.SipException 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.SipException 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);
}
}
use of javax.sip.SipException in project XobotOS by xamarin.
the class SipHelper method sendRegister.
public ClientTransaction sendRegister(SipProfile userProfile, String tag, int expiry) throws SipException {
try {
Request request = createRequest(Request.REGISTER, userProfile, tag);
if (expiry == 0) {
// remove all previous registrations by wildcard
// rfc3261#section-10.2.2
request.addHeader(createWildcardContactHeader());
} else {
request.addHeader(createContactHeader(userProfile));
}
request.addHeader(mHeaderFactory.createExpiresHeader(expiry));
ClientTransaction clientTransaction = mSipProvider.getNewClientTransaction(request);
clientTransaction.sendRequest();
return clientTransaction;
} catch (ParseException e) {
throw new SipException("sendRegister()", e);
}
}
Aggregations