Methods Summary |
---|
private javax.sip.header.CSeqHeader | createCSeqHeader(java.lang.String method)
long sequence = (long) (Math.random() * 10000);
return mHeaderFactory.createCSeqHeader(sequence, method);
|
private javax.sip.header.CallIdHeader | createCallIdHeader()
return mSipProvider.getNewCallId();
|
private javax.sip.header.ContactHeader | createContactHeader(android.net.sip.SipProfile profile)
return createContactHeader(profile, null, 0);
|
private javax.sip.header.ContactHeader | createContactHeader(android.net.sip.SipProfile profile, java.lang.String ip, int port)
SipURI contactURI = (ip == null)
? createSipUri(profile.getUserName(), profile.getProtocol(),
getListeningPoint())
: createSipUri(profile.getUserName(), profile.getProtocol(),
ip, port);
Address contactAddress = mAddressFactory.createAddress(contactURI);
contactAddress.setDisplayName(profile.getDisplayName());
return mHeaderFactory.createContactHeader(contactAddress);
|
private javax.sip.header.FromHeader | createFromHeader(android.net.sip.SipProfile profile, java.lang.String tag)
return mHeaderFactory.createFromHeader(profile.getSipAddress(), tag);
|
private javax.sip.header.MaxForwardsHeader | createMaxForwardsHeader()
return mHeaderFactory.createMaxForwardsHeader(70);
|
private javax.sip.header.MaxForwardsHeader | createMaxForwardsHeader(int max)
return mHeaderFactory.createMaxForwardsHeader(max);
|
private javax.sip.message.Request | createRequest(java.lang.String requestType, android.net.sip.SipProfile userProfile, java.lang.String tag)
FromHeader fromHeader = createFromHeader(userProfile, tag);
ToHeader toHeader = createToHeader(userProfile);
String replaceStr = Pattern.quote(userProfile.getUserName() + "@");
SipURI requestURI = mAddressFactory.createSipURI(
userProfile.getUriString().replaceFirst(replaceStr, ""));
List<ViaHeader> viaHeaders = createViaHeaders();
CallIdHeader callIdHeader = createCallIdHeader();
CSeqHeader cSeqHeader = createCSeqHeader(requestType);
MaxForwardsHeader maxForwards = createMaxForwardsHeader();
Request request = mMessageFactory.createRequest(requestURI,
requestType, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
Header userAgentHeader = mHeaderFactory.createHeader("User-Agent",
"SIPAUA/0.1.001");
request.addHeader(userAgentHeader);
return request;
|
private javax.sip.message.Request | createRequest(java.lang.String requestType, android.net.sip.SipProfile caller, android.net.sip.SipProfile callee, java.lang.String tag)
FromHeader fromHeader = createFromHeader(caller, tag);
ToHeader toHeader = createToHeader(callee);
SipURI requestURI = callee.getUri();
List<ViaHeader> viaHeaders = createViaHeaders();
CallIdHeader callIdHeader = createCallIdHeader();
CSeqHeader cSeqHeader = createCSeqHeader(requestType);
MaxForwardsHeader maxForwards = createMaxForwardsHeader();
Request request = mMessageFactory.createRequest(requestURI,
requestType, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
request.addHeader(createContactHeader(caller));
return request;
|
private javax.sip.address.SipURI | createSipUri(java.lang.String username, java.lang.String transport, javax.sip.ListeningPoint lp)
return createSipUri(username, transport, lp.getIPAddress(), lp.getPort());
|
private javax.sip.address.SipURI | createSipUri(java.lang.String username, java.lang.String transport, java.lang.String ip, int port)
SipURI uri = mAddressFactory.createSipURI(username, ip);
try {
uri.setPort(port);
uri.setTransportParam(transport);
} catch (InvalidArgumentException e) {
throw new RuntimeException(e);
}
return uri;
|
private javax.sip.header.ToHeader | createToHeader(android.net.sip.SipProfile profile)
return createToHeader(profile, null);
|
private javax.sip.header.ToHeader | createToHeader(android.net.sip.SipProfile profile, java.lang.String tag)
return mHeaderFactory.createToHeader(profile.getSipAddress(), tag);
|
private java.util.List | createViaHeaders()
List<ViaHeader> viaHeaders = new ArrayList<ViaHeader>(1);
ListeningPoint lp = getListeningPoint();
ViaHeader viaHeader = mHeaderFactory.createViaHeader(lp.getIPAddress(),
lp.getPort(), lp.getTransport(), null);
viaHeader.setRPort();
viaHeaders.add(viaHeader);
return viaHeaders;
|
private javax.sip.header.ContactHeader | createWildcardContactHeader()
ContactHeader contactHeader = mHeaderFactory.createContactHeader();
contactHeader.setWildCard();
return contactHeader;
|
public static java.lang.String | getCallId(java.util.EventObject event)
if (event == null) return null;
if (event instanceof RequestEvent) {
return getCallId(((RequestEvent) event).getRequest());
} else if (event instanceof ResponseEvent) {
return getCallId(((ResponseEvent) event).getResponse());
} else if (event instanceof DialogTerminatedEvent) {
Dialog dialog = ((DialogTerminatedEvent) event).getDialog();
return getCallId(((DialogTerminatedEvent) event).getDialog());
} else if (event instanceof TransactionTerminatedEvent) {
TransactionTerminatedEvent e = (TransactionTerminatedEvent) event;
return getCallId(e.isServerTransaction()
? e.getServerTransaction()
: e.getClientTransaction());
} else {
Object source = event.getSource();
if (source instanceof Transaction) {
return getCallId(((Transaction) source));
} else if (source instanceof Dialog) {
return getCallId((Dialog) source);
}
}
return "";
|
public static java.lang.String | getCallId(javax.sip.Transaction transaction)
return ((transaction != null) ? getCallId(transaction.getRequest())
: "");
|
private static java.lang.String | getCallId(javax.sip.message.Message message)
CallIdHeader callIdHeader =
(CallIdHeader) message.getHeader(CallIdHeader.NAME);
return callIdHeader.getCallId();
|
private static java.lang.String | getCallId(javax.sip.Dialog dialog)
return dialog.getCallId().getCallId();
|
private javax.sip.ListeningPoint | getListeningPoint()
ListeningPoint lp = mSipProvider.getListeningPoint(ListeningPoint.UDP);
if (lp == null) lp = mSipProvider.getListeningPoint(ListeningPoint.TCP);
if (lp == null) {
ListeningPoint[] lps = mSipProvider.getListeningPoints();
if ((lps != null) && (lps.length > 0)) lp = lps[0];
}
if (lp == null) {
throw new SipException("no listening point is available");
}
return lp;
|
public javax.sip.ServerTransaction | getServerTransaction(javax.sip.RequestEvent event)
ServerTransaction transaction = event.getServerTransaction();
if (transaction == null) {
Request request = event.getRequest();
return mSipProvider.getNewServerTransaction(request);
} else {
return transaction;
}
|
public javax.sip.ClientTransaction | handleChallenge(javax.sip.ResponseEvent responseEvent, gov.nist.javax.sip.clientauthutils.AccountManager accountManager)
AuthenticationHelper authenticationHelper =
((SipStackExt) mSipStack).getAuthenticationHelper(
accountManager, mHeaderFactory);
ClientTransaction tid = responseEvent.getClientTransaction();
ClientTransaction ct = authenticationHelper.handleChallenge(
responseEvent.getResponse(), tid, mSipProvider, 5);
if (DBG) log("send request with challenge response: "
+ ct.getRequest());
ct.sendRequest();
return ct;
|
private void | log(java.lang.String s)
Rlog.d(TAG, s);
|
public void | sendBye(javax.sip.Dialog dialog)
Request byeRequest = dialog.createRequest(Request.BYE);
if (DBG) log("send BYE: " + byeRequest);
dialog.sendRequest(mSipProvider.getNewClientTransaction(byeRequest));
|
public void | sendCancel(javax.sip.ClientTransaction inviteTransaction)
Request cancelRequest = inviteTransaction.createCancel();
if (DBG) log("send CANCEL: " + cancelRequest);
mSipProvider.getNewClientTransaction(cancelRequest).sendRequest();
|
public javax.sip.ClientTransaction | sendInvite(android.net.sip.SipProfile caller, android.net.sip.SipProfile callee, java.lang.String sessionDescription, java.lang.String tag, gov.nist.javax.sip.header.extensions.ReferredByHeader referredBy, java.lang.String replaces)
try {
Request request = createRequest(Request.INVITE, caller, callee, tag);
if (referredBy != null) request.addHeader(referredBy);
if (replaces != null) {
request.addHeader(mHeaderFactory.createHeader(
ReplacesHeader.NAME, replaces));
}
request.setContent(sessionDescription,
mHeaderFactory.createContentTypeHeader(
"application", "sdp"));
ClientTransaction clientTransaction =
mSipProvider.getNewClientTransaction(request);
if (DBG) log("send INVITE: " + request);
clientTransaction.sendRequest();
return clientTransaction;
} catch (ParseException e) {
throw new SipException("sendInvite()", e);
}
|
public void | sendInviteAck(javax.sip.ResponseEvent event, javax.sip.Dialog dialog)
Response response = event.getResponse();
long cseq = ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
.getSeqNumber();
Request ack = dialog.createAck(cseq);
if (DBG) log("send ACK: " + ack);
dialog.sendAck(ack);
|
public void | sendInviteBusyHere(javax.sip.RequestEvent event, javax.sip.ServerTransaction inviteTransaction)
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 (DBG) log("send BUSY HERE: " + response);
inviteTransaction.sendResponse(response);
}
} catch (ParseException e) {
throw new SipException("sendInviteBusyHere()", e);
}
|
public javax.sip.ServerTransaction | sendInviteOk(javax.sip.RequestEvent event, android.net.sip.SipProfile localProfile, java.lang.String sessionDescription, javax.sip.ServerTransaction inviteTransaction, java.lang.String externalIp, int externalPort)
try {
Request request = event.getRequest();
Response response = mMessageFactory.createResponse(Response.OK,
request);
response.addHeader(createContactHeader(localProfile, externalIp,
externalPort));
response.setContent(sessionDescription,
mHeaderFactory.createContentTypeHeader(
"application", "sdp"));
if (inviteTransaction == null) {
inviteTransaction = getServerTransaction(event);
}
if (inviteTransaction.getState() != TransactionState.COMPLETED) {
if (DBG) log("send OK: " + response);
inviteTransaction.sendResponse(response);
}
return inviteTransaction;
} catch (ParseException e) {
throw new SipException("sendInviteOk()", e);
}
|
public void | sendInviteRequestTerminated(javax.sip.message.Request inviteRequest, javax.sip.ServerTransaction inviteTransaction)
try {
Response response = mMessageFactory.createResponse(
Response.REQUEST_TERMINATED, inviteRequest);
if (DBG) log("send response: " + response);
inviteTransaction.sendResponse(response);
} catch (ParseException e) {
throw new SipException("sendInviteRequestTerminated()", e);
}
|
public javax.sip.ClientTransaction | sendOptions(android.net.sip.SipProfile caller, android.net.sip.SipProfile callee, java.lang.String tag)
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);
}
|
public void | sendReferNotify(javax.sip.Dialog dialog, java.lang.String content)
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 (DBG) log("send NOTIFY: " + request);
dialog.sendRequest(mSipProvider.getNewClientTransaction(request));
} catch (ParseException e) {
throw new SipException("sendReferNotify()", e);
}
|
public javax.sip.ClientTransaction | sendRegister(android.net.sip.SipProfile userProfile, java.lang.String tag, int expiry)
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);
}
|
public javax.sip.ClientTransaction | sendReinvite(javax.sip.Dialog dialog, java.lang.String sessionDescription)
try {
Request request = dialog.createRequest(Request.INVITE);
request.setContent(sessionDescription,
mHeaderFactory.createContentTypeHeader(
"application", "sdp"));
// Adding rport argument in the request could fix some SIP servers
// in resolving the initiator's NAT port mapping for relaying the
// response message from the other end.
ViaHeader viaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
if (viaHeader != null) viaHeader.setRPort();
ClientTransaction clientTransaction =
mSipProvider.getNewClientTransaction(request);
if (DBG) log("send RE-INVITE: " + request);
dialog.sendRequest(clientTransaction);
return clientTransaction;
} catch (ParseException e) {
throw new SipException("sendReinvite()", e);
}
|
public void | sendResponse(javax.sip.RequestEvent event, int responseCode)
try {
Request request = event.getRequest();
Response response = mMessageFactory.createResponse(
responseCode, request);
if (DBG && (!Request.OPTIONS.equals(request.getMethod())
|| DBG_PING)) {
log("send response: " + response);
}
getServerTransaction(event).sendResponse(response);
} catch (ParseException e) {
throw new SipException("sendResponse()", e);
}
|
public javax.sip.ServerTransaction | sendRinging(javax.sip.RequestEvent event, java.lang.String tag)
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 (DBG) log("send RINGING: " + response);
transaction.sendResponse(response);
return transaction;
} catch (ParseException e) {
throw new SipException("sendRinging()", e);
}
|