am 1d158357: SipPhone: do not append SIP domain to PSTN number
Merge commit '1d1583573d2099756bbbeef48d97c280edc393e0' into gingerbread-plus-aosp * commit '1d1583573d2099756bbbeef48d97c280edc393e0': SipPhone: do not append SIP domain to PSTN number
This commit is contained in:
@@ -394,25 +394,45 @@ public class SipPhone extends SipPhoneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CallerInfo getCallerInfo(String number) {
|
private CallerInfo createCallerInfo(String number, SipProfile callee) {
|
||||||
|
SipProfile p = callee;
|
||||||
|
String name = p.getDisplayName();
|
||||||
|
if (TextUtils.isEmpty(name)) name = p.getUserName();
|
||||||
|
CallerInfo info = new CallerInfo();
|
||||||
|
info.name = name;
|
||||||
|
info.phoneNumber = number;
|
||||||
|
Log.v(LOG_TAG, "create caller info from scratch:");
|
||||||
|
Log.v(LOG_TAG, " name: " + info.name);
|
||||||
|
Log.v(LOG_TAG, " numb: " + info.phoneNumber);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
// from contacts
|
||||||
|
private CallerInfo findCallerInfo(String number) {
|
||||||
CallerInfo info = CallerInfo.getCallerInfo(mContext, number);
|
CallerInfo info = CallerInfo.getCallerInfo(mContext, number);
|
||||||
if ((info == null) || (info.name == null)) return null;
|
if ((info == null) || (info.name == null)) return null;
|
||||||
Log.v(LOG_TAG, "++******++ got info from contact:");
|
Log.v(LOG_TAG, "got caller info from contact:");
|
||||||
Log.v(LOG_TAG, " name: " + info.name);
|
Log.v(LOG_TAG, " name: " + info.name);
|
||||||
Log.v(LOG_TAG, " numb: " + info.phoneNumber);
|
Log.v(LOG_TAG, " numb: " + info.phoneNumber);
|
||||||
Log.v(LOG_TAG, " pres: " + info.numberPresentation);
|
Log.v(LOG_TAG, " pres: " + info.numberPresentation);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection dial(String calleeSipUri) throws SipException {
|
private CallerInfo getCallerInfo(String number, SipProfile callee) {
|
||||||
CallerInfo info = getCallerInfo(calleeSipUri);
|
CallerInfo info = findCallerInfo(number);
|
||||||
|
if (info == null) info = createCallerInfo(number, callee);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection dial(String originalNumber) throws SipException {
|
||||||
|
String calleeSipUri = originalNumber;
|
||||||
if (!calleeSipUri.contains("@")) {
|
if (!calleeSipUri.contains("@")) {
|
||||||
calleeSipUri += "@" + getSipDomain(mProfile);
|
calleeSipUri += "@" + getSipDomain(mProfile);
|
||||||
if (info != null) info.phoneNumber = calleeSipUri;
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SipProfile callee =
|
SipProfile callee =
|
||||||
new SipProfile.Builder(calleeSipUri).build();
|
new SipProfile.Builder(calleeSipUri).build();
|
||||||
|
CallerInfo info = getCallerInfo(originalNumber, callee);
|
||||||
SipConnection c = new SipConnection(this, callee, info);
|
SipConnection c = new SipConnection(this, callee, info);
|
||||||
connections.add(c);
|
connections.add(c);
|
||||||
c.dial();
|
c.dial();
|
||||||
@@ -444,9 +464,9 @@ public class SipPhone extends SipPhoneBase {
|
|||||||
|
|
||||||
void initIncomingCall(SipAudioCall sipAudioCall, boolean makeCallWait) {
|
void initIncomingCall(SipAudioCall sipAudioCall, boolean makeCallWait) {
|
||||||
SipProfile callee = sipAudioCall.getPeerProfile();
|
SipProfile callee = sipAudioCall.getPeerProfile();
|
||||||
CallerInfo info = getCallerInfo(getUriString(callee));
|
CallerInfo info = findCallerInfo(getUriString(callee));
|
||||||
if (info == null) info = getCallerInfo(callee.getUserName());
|
if (info == null) info = findCallerInfo(callee.getUserName());
|
||||||
if (info == null) info = getCallerInfo(callee.getDisplayName());
|
if (info == null) info = findCallerInfo(callee.getDisplayName());
|
||||||
SipConnection c = new SipConnection(this, callee, info);
|
SipConnection c = new SipConnection(this, callee, info);
|
||||||
connections.add(c);
|
connections.add(c);
|
||||||
|
|
||||||
@@ -654,20 +674,9 @@ public class SipPhone extends SipPhoneBase {
|
|||||||
super(getUriString(callee));
|
super(getUriString(callee));
|
||||||
mOwner = owner;
|
mOwner = owner;
|
||||||
mPeer = callee;
|
mPeer = callee;
|
||||||
if (info == null) info = createCallerInfo();
|
|
||||||
setUserData(info);
|
setUserData(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CallerInfo createCallerInfo() {
|
|
||||||
SipProfile p = mPeer;
|
|
||||||
String name = p.getDisplayName();
|
|
||||||
if (TextUtils.isEmpty(name)) name = p.getUserName();
|
|
||||||
CallerInfo info = new CallerInfo();
|
|
||||||
info.name = name;
|
|
||||||
info.phoneNumber = getUriString(p);
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) {
|
void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) {
|
||||||
setState(newState);
|
setState(newState);
|
||||||
mSipAudioCall = sipAudioCall;
|
mSipAudioCall = sipAudioCall;
|
||||||
|
|||||||
Reference in New Issue
Block a user