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:
@ -56,8 +56,8 @@ abstract class SipConnectionBase extends Connection {
|
|||||||
private DisconnectCause mCause = DisconnectCause.NOT_DISCONNECTED;
|
private DisconnectCause mCause = DisconnectCause.NOT_DISCONNECTED;
|
||||||
private PostDialState postDialState = PostDialState.NOT_STARTED;
|
private PostDialState postDialState = PostDialState.NOT_STARTED;
|
||||||
|
|
||||||
SipConnectionBase(String calleeSipUri) {
|
SipConnectionBase(String dialString) {
|
||||||
dialString = calleeSipUri;
|
this.dialString = dialString;
|
||||||
|
|
||||||
postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
|
postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
|
||||||
|
|
||||||
|
@ -387,7 +387,8 @@ public class SipPhone extends SipPhoneBase {
|
|||||||
try {
|
try {
|
||||||
SipProfile callee =
|
SipProfile callee =
|
||||||
new SipProfile.Builder(calleeSipUri).build();
|
new SipProfile.Builder(calleeSipUri).build();
|
||||||
SipConnection c = new SipConnection(this, callee);
|
SipConnection c = new SipConnection(this, callee,
|
||||||
|
originalNumber);
|
||||||
connections.add(c);
|
connections.add(c);
|
||||||
c.dial();
|
c.dial();
|
||||||
setState(Call.State.DIALING);
|
setState(Call.State.DIALING);
|
||||||
@ -578,6 +579,7 @@ public class SipPhone extends SipPhoneBase {
|
|||||||
private SipAudioCall mSipAudioCall;
|
private SipAudioCall mSipAudioCall;
|
||||||
private Call.State mState = Call.State.IDLE;
|
private Call.State mState = Call.State.IDLE;
|
||||||
private SipProfile mPeer;
|
private SipProfile mPeer;
|
||||||
|
private String mOriginalNumber; // may be a PSTN number
|
||||||
private boolean mIncoming = false;
|
private boolean mIncoming = false;
|
||||||
|
|
||||||
private SipAudioCallAdapter mAdapter = new SipAudioCallAdapter() {
|
private SipAudioCallAdapter mAdapter = new SipAudioCallAdapter() {
|
||||||
@ -659,10 +661,16 @@ public class SipPhone extends SipPhoneBase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public SipConnection(SipCall owner, SipProfile callee) {
|
public SipConnection(SipCall owner, SipProfile callee,
|
||||||
super(getUriString(callee));
|
String originalNumber) {
|
||||||
|
super(originalNumber);
|
||||||
mOwner = owner;
|
mOwner = owner;
|
||||||
mPeer = callee;
|
mPeer = callee;
|
||||||
|
mOriginalNumber = originalNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SipConnection(SipCall owner, SipProfile callee) {
|
||||||
|
this(owner, callee, getUriString(callee));
|
||||||
}
|
}
|
||||||
|
|
||||||
void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) {
|
void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) {
|
||||||
@ -735,7 +743,10 @@ public class SipPhone extends SipPhoneBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAddress() {
|
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
|
@Override
|
||||||
|
Reference in New Issue
Block a user