Keep original phone number in SipConnection.

In case it's a PSTN number carried by an Internet call, the phone app can still
get the original phone number from Connection.getAddress() instead of getting a
SIP URI.

http://b/issue?id=3085996

Change-Id: Ie6c66100a4b5b2ce3f73baa1b446761cd51d7727
This commit is contained in:
Hung-ying Tyan
2010-10-12 11:22:54 +08:00
parent a28d5aff54
commit f5201ab71f
2 changed files with 17 additions and 6 deletions

View File

@ -56,8 +56,8 @@ abstract class SipConnectionBase extends Connection {
private DisconnectCause mCause = DisconnectCause.NOT_DISCONNECTED;
private PostDialState postDialState = PostDialState.NOT_STARTED;
SipConnectionBase(String calleeSipUri) {
dialString = calleeSipUri;
SipConnectionBase(String dialString) {
this.dialString = dialString;
postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);

View File

@ -387,7 +387,8 @@ public class SipPhone extends SipPhoneBase {
try {
SipProfile callee =
new SipProfile.Builder(calleeSipUri).build();
SipConnection c = new SipConnection(this, callee);
SipConnection c = new SipConnection(this, callee,
originalNumber);
connections.add(c);
c.dial();
setState(Call.State.DIALING);
@ -578,6 +579,7 @@ public class SipPhone extends SipPhoneBase {
private SipAudioCall mSipAudioCall;
private Call.State mState = Call.State.IDLE;
private SipProfile mPeer;
private String mOriginalNumber; // may be a PSTN number
private boolean mIncoming = false;
private SipAudioCallAdapter mAdapter = new SipAudioCallAdapter() {
@ -659,10 +661,16 @@ public class SipPhone extends SipPhoneBase {
}
};
public SipConnection(SipCall owner, SipProfile callee) {
super(getUriString(callee));
public SipConnection(SipCall owner, SipProfile callee,
String originalNumber) {
super(originalNumber);
mOwner = owner;
mPeer = callee;
mOriginalNumber = originalNumber;
}
public SipConnection(SipCall owner, SipProfile callee) {
this(owner, callee, getUriString(callee));
}
void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) {
@ -735,7 +743,10 @@ public class SipPhone extends SipPhoneBase {
@Override
public String getAddress() {
return getUriString(mPeer);
// Phone app uses this to query caller ID. Return the original dial
// number (which may be a PSTN number) instead of the peer's SIP
// URI.
return mOriginalNumber;
}
@Override