summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-05-18 19:02:37 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-05-18 19:02:37 -0700
commiteadf8c3b6a6cadd53e2892f10f77d91d9aa4e73b (patch)
tree8b7d49b2f6f9ab26531fc1c4724b9fdc81fd1393
parent81d867cc213f822a39ab6c7e0a3e2735ce4b460c (diff)
parentf7a6c825de652666ff2782b65a46e3fc273eff3d (diff)
downloadandroid_external_nist-sip-eadf8c3b6a6cadd53e2892f10f77d91d9aa4e73b.tar.gz
android_external_nist-sip-eadf8c3b6a6cadd53e2892f10f77d91d9aa4e73b.tar.bz2
android_external_nist-sip-eadf8c3b6a6cadd53e2892f10f77d91d9aa4e73b.zip
Merge "Fix the invite ok issue for incoming call in sip channel with tcp transport."
-rw-r--r--src/com/android/sip/SipHelper.java19
-rw-r--r--src/com/android/sip/SipSessionGroup.java8
2 files changed, 15 insertions, 12 deletions
diff --git a/src/com/android/sip/SipHelper.java b/src/com/android/sip/SipHelper.java
index c127fa2..eda63d0 100644
--- a/src/com/android/sip/SipHelper.java
+++ b/src/com/android/sip/SipHelper.java
@@ -290,13 +290,19 @@ class SipHelper {
/**
* @param event the INVITE request event
*/
- public ServerTransaction sendRinging(RequestEvent event)
+ public ServerTransaction sendRinging(RequestEvent event, String tag)
throws SipException {
try {
Request request = event.getRequest();
ServerTransaction transaction = getServerTransaction(event);
- transaction.sendResponse(
- mMessageFactory.createResponse(Response.RINGING, request));
+
+ Response response = mMessageFactory.createResponse(Response.RINGING,
+ request);
+
+ ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
+ toHeader.setTag(tag);
+ response.addHeader(toHeader);
+ transaction.sendResponse(response);
return transaction;
} catch (ParseException e) {
throw new SipException("sendRinging()", e);
@@ -308,17 +314,13 @@ class SipHelper {
*/
public ServerTransaction sendInviteOk(RequestEvent event,
SipProfile localProfile, SessionDescription sessionDescription,
- String tag, ServerTransaction inviteTransaction)
+ ServerTransaction inviteTransaction)
throws SipException {
try {
Request request = event.getRequest();
Response response = mMessageFactory.createResponse(Response.OK,
request);
response.addHeader(createContactHeader(localProfile));
- ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
- toHeader.setTag(tag);
- response.addHeader(toHeader);
-
response.setContent(sessionDescription.getContent(),
mHeaderFactory.createContentTypeHeader(
"application", sessionDescription.getType()));
@@ -329,6 +331,7 @@ class SipHelper {
if (inviteTransaction.getState() != TransactionState.COMPLETED) {
inviteTransaction.sendResponse(response);
}
+
return inviteTransaction;
} catch (ParseException e) {
throw new SipException("sendInviteOk()", e);
diff --git a/src/com/android/sip/SipSessionGroup.java b/src/com/android/sip/SipSessionGroup.java
index 7903767..585ea83 100644
--- a/src/com/android/sip/SipSessionGroup.java
+++ b/src/com/android/sip/SipSessionGroup.java
@@ -264,7 +264,8 @@ class SipSessionGroup implements SipListener {
if (isRequestEvent(Request.INVITE, evt)) {
RequestEvent event = (RequestEvent) evt;
SipSessionImpl newSession = new SipSessionImpl(mProxy);
- newSession.mServerTransaction = mSipHelper.sendRinging(event);
+ newSession.mServerTransaction = mSipHelper.sendRinging(event,
+ generateTag());
newSession.mDialog = newSession.mServerTransaction.getDialog();
newSession.mInviteReceived = event;
newSession.mPeerProfile = createPeerProfile(event.getRequest());
@@ -393,7 +394,7 @@ class SipSessionGroup implements SipListener {
}
}
- private String generateTag() {
+ protected String generateTag() {
// TODO: based on myself's profile
return String.valueOf((long) (Math.random() * 1000000L));
}
@@ -588,10 +589,9 @@ class SipSessionGroup implements SipListener {
// expect MakeCallCommand(answering) , END_CALL cmd , Cancel
if (evt instanceof MakeCallCommand) {
// answer call
- String tag = mInCall ? mDialog.getLocalTag() : generateTag();
mServerTransaction = mSipHelper.sendInviteOk(mInviteReceived,
mLocalProfile,
- ((MakeCallCommand) evt).getSessionDescription(), tag,
+ ((MakeCallCommand) evt).getSessionDescription(),
mServerTransaction);
mState = SipSessionState.INCOMING_CALL_ANSWERING;
return true;