use of javax.sip.message.Response in project XobotOS by xamarin.
the class SipSessionGroup method extractExternalAddress.
private void extractExternalAddress(ResponseEvent evt) {
Response response = evt.getResponse();
ViaHeader viaHeader = (ViaHeader) (response.getHeader(SIPHeaderNames.VIA));
if (viaHeader == null)
return;
int rport = viaHeader.getRPort();
String externalIp = viaHeader.getReceived();
if ((rport > 0) && (externalIp != null)) {
mExternalIp = externalIp;
mExternalPort = rport;
Log.d(TAG, " got external addr " + externalIp + ":" + rport + " on " + mSipStack);
}
}
use of javax.sip.message.Response 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.Response in project XobotOS by xamarin.
the class SipHelper method sendInviteRequestTerminated.
public void sendInviteRequestTerminated(Request inviteRequest, ServerTransaction inviteTransaction) throws SipException {
try {
Response response = mMessageFactory.createResponse(Response.REQUEST_TERMINATED, inviteRequest);
if (DEBUG)
Log.d(TAG, "send response: " + response);
inviteTransaction.sendResponse(response);
} catch (ParseException e) {
throw new SipException("sendInviteRequestTerminated()", e);
}
}
use of javax.sip.message.Response 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.Response 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);
}
}
Aggregations