diff options
author | Pooja Jain <quic_poojain@quicinc.com> | 2019-12-13 02:16:13 +0530 |
---|---|---|
committer | Pooja Jain <quic_poojain@quicinc.com> | 2020-01-31 10:47:08 +0000 |
commit | df9b8f232f27f6c382f00c057dfb41b9eb7c278c (patch) | |
tree | 628feecdef7d7018eb6a132e5eddfdbaaedb99f1 | |
parent | 4f82ed36b68c49ab794037862d4948472b306bcd (diff) | |
download | ims-df9b8f232f27f6c382f00c057dfb41b9eb7c278c.tar.gz |
IMS: Explicit Call transfer APIS.
Test: Manual
Bug: 62170207
Change-Id: Ie36c097d3f5db5a31303326bfb6fb63026e20675
-rwxr-xr-x[-rw-r--r--] | src/java/com/android/ims/ImsCall.java | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/java/com/android/ims/ImsCall.java b/src/java/com/android/ims/ImsCall.java index 5ff6d361..edf4194d 100644..100755 --- a/src/java/com/android/ims/ImsCall.java +++ b/src/java/com/android/ims/ImsCall.java @@ -487,6 +487,17 @@ public class ImsCall implements ICall { } /** + * Notifies the result of transfer request. + * + * @param imsCall ImsCall object + */ + public void onCallSessionTransferred(ImsCall imsCall) { + } + + public void onCallSessionTransferFailed(ImsCall imsCall, ImsReasonInfo reasonInfo) { + } + + /** * Called when the call quality has changed. * * @param imsCall ImsCall object @@ -1253,6 +1264,56 @@ public class ImsCall implements ICall { } } + /** + * Transfers a call. + * + * @param number number to be transferred to. + * @param isConfirmationRequired indicates blind or assured transfer. + * @throws ImsException if the IMS service fails to transfer the call. + */ + public void transfer(String number, boolean isConfirmationRequired) throws ImsException { + logi("transfer :: session=" + mSession + ", number=" + Rlog.pii(TAG, number) + + ", isConfirmationRequired=" + isConfirmationRequired); + + synchronized(mLockObj) { + if (mSession == null) { + throw new ImsException("No call to transfer", + ImsReasonInfo.CODE_LOCAL_CALL_TERMINATED); + } + + try { + mSession.transfer(number, isConfirmationRequired); + } catch (Throwable t) { + loge("transfer :: ", t); + throw new ImsException("transfer()", t, 0); + } + } + } + + /** + * Transfers a call to another ongoing call. + * + * @param transferToImsCall the other ongoing call to which this call will be transferred. + * @throws ImsException if the IMS service fails to transfer the call. + */ + public void consultativeTransfer(ImsCall transferToImsCall) throws ImsException { + logi("consultativeTransfer :: session=" + mSession + ", other call=" + transferToImsCall); + + synchronized(mLockObj) { + if (mSession == null) { + throw new ImsException("No call to transfer", + ImsReasonInfo.CODE_LOCAL_CALL_TERMINATED); + } + + try { + mSession.transfer(transferToImsCall.getSession()); + } catch (Throwable t) { + loge("consultativeTransfer :: ", t); + throw new ImsException("consultativeTransfer()", t, 0); + } + } + } + public void terminate(int reason, int overrideReason) { logi("terminate :: reason=" + reason + " ; overrideReason=" + overrideReason); mOverrideReason = overrideReason; @@ -3237,6 +3298,40 @@ public class ImsCall implements ICall { } @Override + public void callSessionTransferred(ImsCallSession session) { + ImsCall.Listener listener; + + synchronized(ImsCall.this) { + listener = mListener; + } + + if (listener != null) { + try { + listener.onCallSessionTransferred(ImsCall.this); + } catch (Throwable t) { + loge("callSessionTransferred:: ", t); + } + } + } + + @Override + public void callSessionTransferFailed(ImsCallSession session, ImsReasonInfo reasonInfo) { + ImsCall.Listener listener; + + synchronized(ImsCall.this) { + listener = mListener; + } + + if (listener != null) { + try { + listener.onCallSessionTransferFailed(ImsCall.this, reasonInfo); + } catch (Throwable t) { + loge("callSessionTransferFailed:: ", t); + } + } + } + + @Override public void callQualityChanged(CallQuality callQuality) { ImsCall.Listener listener; |