Reject incoming and outgoing calls to incall people.
This commit is contained in:
parent
134a98fdc2
commit
ea94d00d2c
6 changed files with 37 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<string name="bad_target_uri">Bad URI : %s</string>
|
||||||
<string name="authenticationTokenFormat">Authentication token is %s</string>
|
<string name="authenticationTokenFormat">Authentication token is %s</string>
|
||||||
<string name="not_encrypted">Communication not encrypted</string>
|
<string name="not_encrypted">Communication not encrypted</string>
|
||||||
|
|
||||||
|
|
|
@ -822,6 +822,24 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkValidTargetUri(String uri) {
|
||||||
|
boolean invalidUri;
|
||||||
|
try {
|
||||||
|
String target = lc().interpretUrl(uri).asStringUriOnly();
|
||||||
|
LinphoneCall alreadyInCall = lc().findCallFromUri(target);
|
||||||
|
invalidUri = alreadyInCall != null || lc().isMyself(target);
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
invalidUri = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invalidUri) {
|
||||||
|
String msg = String.format(getString(R.string.bad_target_uri), uri);
|
||||||
|
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private LinphoneCall callToTransfer;
|
private LinphoneCall callToTransfer;
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
@ -838,6 +856,11 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
String uri = data.getStringExtra(UriPickerActivity.EXTRA_CALLEE_URI);
|
String uri = data.getStringExtra(UriPickerActivity.EXTRA_CALLEE_URI);
|
||||||
|
if (!checkValidTargetUri(uri)) {
|
||||||
|
eventuallyResumeConfOrCallOnPickerReturn(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case ID_ADD_CALL:
|
case ID_ADD_CALL:
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -316,6 +316,10 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
LinphoneAddress lAddress;
|
LinphoneAddress lAddress;
|
||||||
try {
|
try {
|
||||||
lAddress = mLc.interpretUrl(to);
|
lAddress = mLc.interpretUrl(to);
|
||||||
|
if (mLc.isMyself(lAddress.asStringUriOnly())) {
|
||||||
|
listenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress();
|
||||||
|
return;
|
||||||
|
}
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
listenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress();
|
listenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -588,4 +588,8 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
public int getMaxCalls() {
|
public int getMaxCalls() {
|
||||||
return getMaxCalls(nativePtr);
|
return getMaxCalls(nativePtr);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isMyself(String uri) {
|
||||||
|
return uri.equals(getDefaultProxyConfig().getIdentity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 65dc7621f45449893de50c28b94653c9af0ecb22
|
Subproject commit f203f8218267fcc6e06846b19f8e432dee719397
|
|
@ -324,6 +324,10 @@ public class TestConferenceActivity extends ConferenceActivity {
|
||||||
public int getMaxCalls() {
|
public int getMaxCalls() {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isMyself(String uri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue