android.telecom.DisconnectCause Java Examples
The following examples show how to use
android.telecom.DisconnectCause.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
protected void callFailed(int errorCode){ try{ throw new Exception("Call "+getCallID()+" failed with error code "+errorCode); }catch(Exception x){ FileLog.e(x); } lastError = errorCode; dispatchStateChanged(STATE_FAILED); if(errorCode!=VoIPController.ERROR_LOCALIZED && soundPool!=null){ playingSound=true; soundPool.play(spFailedID, 1, 1, 0, 0, 1); AndroidUtilities.runOnUIThread(afterSoundRunnable, 1000); } if(USE_CONNECTION_SERVICE && systemCallConnection!=null){ systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); systemCallConnection.destroy(); systemCallConnection=null; } stopSelf(); }
Example #2
Source File: VoIPBaseService.java From Telegram with GNU General Public License v2.0 | 6 votes |
protected void callFailed(String error) { try { throw new Exception("Call " + getCallID() + " failed with error: " + error); } catch (Exception x) { FileLog.e(x); } lastError = error; dispatchStateChanged(STATE_FAILED); if (TextUtils.equals(error, TgVoip.ERROR_LOCALIZED) && soundPool != null) { playingSound = true; soundPool.play(spFailedID, 1, 1, 0, 0, 1); AndroidUtilities.runOnUIThread(afterSoundRunnable, 1000); } if (USE_CONNECTION_SERVICE && systemCallConnection != null) { systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); systemCallConnection.destroy(); systemCallConnection = null; } stopSelf(); }
Example #3
Source File: VoiceConnection.java From react-native-callkeep with ISC License | 6 votes |
public void reportDisconnect(int reason) { super.onDisconnect(); switch (reason) { case 1: setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); break; case 2: case 5: setDisconnected(new DisconnectCause(DisconnectCause.REMOTE)); break; case 3: setDisconnected(new DisconnectCause(DisconnectCause.BUSY)); break; case 4: setDisconnected(new DisconnectCause(DisconnectCause.ANSWERED_ELSEWHERE)); break; case 6: setDisconnected(new DisconnectCause(DisconnectCause.MISSED)); break; default: break; } ((VoiceConnectionService)context).deinitConnection(handle.get(EXTRA_CALL_UUID)); destroy(); }
Example #4
Source File: VoIPBaseService.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
protected void callFailed(String error) { try { throw new Exception("Call " + getCallID() + " failed with error: " + error); } catch (Exception x) { FileLog.e(x); } lastError = error; dispatchStateChanged(STATE_FAILED); if (TextUtils.equals(error, TgVoip.ERROR_LOCALIZED) && soundPool != null) { playingSound = true; soundPool.play(spFailedID, 1, 1, 0, 0, 1); AndroidUtilities.runOnUIThread(afterSoundRunnable, 1000); } if (USE_CONNECTION_SERVICE && systemCallConnection != null) { systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); systemCallConnection.destroy(); systemCallConnection = null; } stopSelf(); }
Example #5
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
protected void callFailed(int errorCode){ try{ throw new Exception("Call "+getCallID()+" failed with error code "+errorCode); }catch(Exception x){ FileLog.e(x); } lastError = errorCode; dispatchStateChanged(STATE_FAILED); if(errorCode!=VoIPController.ERROR_LOCALIZED && soundPool!=null){ playingSound=true; soundPool.play(spFailedID, 1, 1, 0, 0, 1); AndroidUtilities.runOnUIThread(afterSoundRunnable, 1000); } if(USE_CONNECTION_SERVICE && systemCallConnection!=null){ systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); systemCallConnection.destroy(); systemCallConnection=null; } stopSelf(); }
Example #6
Source File: VoIPBaseService.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void onDisconnect(){ if(BuildVars.LOGS_ENABLED) FileLog.d("ConnectionService onDisconnect"); setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); destroy(); systemCallConnection=null; hangUp(); }
Example #7
Source File: VoIPBaseService.java From Telegram with GNU General Public License v2.0 | 5 votes |
protected void endConnectionServiceCall(long delay){ if(USE_CONNECTION_SERVICE){ Runnable r=new Runnable(){ @Override public void run(){ if(systemCallConnection!=null){ switch(callDiscardReason){ case DISCARD_REASON_HANGUP: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.LOCAL : DisconnectCause.REJECTED)); break; case DISCARD_REASON_DISCONNECT: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); break; case DISCARD_REASON_LINE_BUSY: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.BUSY)); break; case DISCARD_REASON_MISSED: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.CANCELED : DisconnectCause.MISSED)); break; default: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.REMOTE)); break; } systemCallConnection.destroy(); systemCallConnection=null; } } }; if(delay>0) AndroidUtilities.runOnUIThread(r, delay); else r.run(); } }
Example #8
Source File: VoIPBaseService.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onDisconnect(){ if(BuildVars.LOGS_ENABLED) FileLog.d("ConnectionService onDisconnect"); setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); destroy(); systemCallConnection=null; hangUp(); }
Example #9
Source File: VoIPBaseService.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
protected void endConnectionServiceCall(long delay){ if(USE_CONNECTION_SERVICE){ Runnable r=new Runnable(){ @Override public void run(){ if(systemCallConnection!=null){ switch(callDiscardReason){ case DISCARD_REASON_HANGUP: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.LOCAL : DisconnectCause.REJECTED)); break; case DISCARD_REASON_DISCONNECT: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); break; case DISCARD_REASON_LINE_BUSY: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.BUSY)); break; case DISCARD_REASON_MISSED: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.CANCELED : DisconnectCause.MISSED)); break; default: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.REMOTE)); break; } systemCallConnection.destroy(); systemCallConnection=null; } } }; if(delay>0) AndroidUtilities.runOnUIThread(r, delay); else r.run(); } }
Example #10
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onDisconnect(){ if(BuildVars.LOGS_ENABLED) FileLog.d("ConnectionService onDisconnect"); setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); destroy(); systemCallConnection=null; hangUp(); }
Example #11
Source File: VoiceConnection.java From react-native-callkeep with ISC License | 5 votes |
@Override public void onReject() { super.onReject(); setDisconnected(new DisconnectCause(DisconnectCause.REJECTED)); sendCallRequestToActivity(ACTION_END_CALL, handle); Log.d(TAG, "onReject executed"); try { ((VoiceConnectionService) context).deinitConnection(handle.get(EXTRA_CALL_UUID)); } catch(Throwable exception) { Log.e(TAG, "Handle map error", exception); } destroy(); }
Example #12
Source File: VoiceConnection.java From react-native-callkeep with ISC License | 5 votes |
@Override public void onAbort() { super.onAbort(); setDisconnected(new DisconnectCause(DisconnectCause.REJECTED)); sendCallRequestToActivity(ACTION_END_CALL, handle); Log.d(TAG, "onAbort executed"); try { ((VoiceConnectionService) context).deinitConnection(handle.get(EXTRA_CALL_UUID)); } catch(Throwable exception) { Log.e(TAG, "Handle map error", exception); } destroy(); }
Example #13
Source File: VoiceConnection.java From react-native-callkeep with ISC License | 5 votes |
@Override public void onDisconnect() { super.onDisconnect(); setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); sendCallRequestToActivity(ACTION_END_CALL, handle); Log.d(TAG, "onDisconnect executed"); try { ((VoiceConnectionService) context).deinitConnection(handle.get(EXTRA_CALL_UUID)); } catch(Throwable exception) { Log.e(TAG, "Handle map error", exception); } destroy(); }
Example #14
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onDisconnect(){ if(BuildVars.LOGS_ENABLED) FileLog.d("ConnectionService onDisconnect"); setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); destroy(); systemCallConnection=null; hangUp(); }
Example #15
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
protected void callEnded() { if (BuildVars.LOGS_ENABLED) { FileLog.d("Call " + getCallID() + " ended"); } dispatchStateChanged(STATE_ENDED); if (needPlayEndSound) { playingSound = true; soundPool.play(spEndId, 1, 1, 0, 0, 1); AndroidUtilities.runOnUIThread(afterSoundRunnable, 700); } if(timeoutRunnable!=null){ AndroidUtilities.cancelRunOnUIThread(timeoutRunnable); timeoutRunnable=null; } if(USE_CONNECTION_SERVICE){ Runnable r=new Runnable(){ @Override public void run(){ if(systemCallConnection!=null){ switch(callDiscardReason){ case DISCARD_REASON_HANGUP: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.LOCAL : DisconnectCause.REJECTED)); break; case DISCARD_REASON_DISCONNECT: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); break; case DISCARD_REASON_LINE_BUSY: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.BUSY)); break; case DISCARD_REASON_MISSED: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.CANCELED : DisconnectCause.MISSED)); break; default: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.REMOTE)); break; } systemCallConnection.destroy(); systemCallConnection=null; } } }; if(needPlayEndSound) AndroidUtilities.runOnUIThread(r, 700); else r.run(); } stopSelf(); }
Example #16
Source File: VoiceConnectionService.java From react-native-callkeep with ISC License | 4 votes |
private Connection makeOutgoingCall(ConnectionRequest request, String uuid, Boolean forceWakeUp) { Bundle extras = request.getExtras(); Connection outgoingCallConnection = null; String number = request.getAddress().getSchemeSpecificPart(); String extrasNumber = extras.getString(EXTRA_CALL_NUMBER); String displayName = extras.getString(EXTRA_CALLER_NAME); Boolean isForeground = VoiceConnectionService.isRunning(this.getApplicationContext()); Log.d(TAG, "makeOutgoingCall:" + uuid + ", number: " + number + ", displayName:" + displayName); // Wakeup application if needed if (!isForeground || forceWakeUp) { Log.d(TAG, "onCreateOutgoingConnection: Waking up application"); this.wakeUpApplication(uuid, number, displayName); } else if (!this.canMakeOutgoingCall() && isReachable) { Log.d(TAG, "onCreateOutgoingConnection: not available"); return Connection.createFailedConnection(new DisconnectCause(DisconnectCause.LOCAL)); } // TODO: Hold all other calls if (extrasNumber == null || !extrasNumber.equals(number)) { extras.putString(EXTRA_CALL_UUID, uuid); extras.putString(EXTRA_CALLER_NAME, displayName); extras.putString(EXTRA_CALL_NUMBER, number); } outgoingCallConnection = createConnection(request); outgoingCallConnection.setDialing(); outgoingCallConnection.setAudioModeIsVoip(true); outgoingCallConnection.setCallerDisplayName(displayName, TelecomManager.PRESENTATION_ALLOWED); // ️Weirdly on some Samsung phones (A50, S9...) using `setInitialized` will not display the native UI ... // when making a call from the native Phone application. The call will still be displayed correctly without it. if (!Build.MANUFACTURER.equalsIgnoreCase("Samsung")) { outgoingCallConnection.setInitialized(); } HashMap<String, String> extrasMap = this.bundleToMap(extras); sendCallRequestToActivity(ACTION_ONGOING_CALL, extrasMap); sendCallRequestToActivity(ACTION_AUDIO_SESSION, extrasMap); Log.d(TAG, "onCreateOutgoingConnection: calling"); return outgoingCallConnection; }
Example #17
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
protected void callEnded() { if (BuildVars.LOGS_ENABLED) { FileLog.d("Call " + getCallID() + " ended"); } dispatchStateChanged(STATE_ENDED); if (needPlayEndSound) { playingSound = true; soundPool.play(spEndId, 1, 1, 0, 0, 1); AndroidUtilities.runOnUIThread(afterSoundRunnable, 700); } if(timeoutRunnable!=null){ AndroidUtilities.cancelRunOnUIThread(timeoutRunnable); timeoutRunnable=null; } if(USE_CONNECTION_SERVICE){ Runnable r=new Runnable(){ @Override public void run(){ if(systemCallConnection!=null){ switch(callDiscardReason){ case DISCARD_REASON_HANGUP: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.LOCAL : DisconnectCause.REJECTED)); break; case DISCARD_REASON_DISCONNECT: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); break; case DISCARD_REASON_LINE_BUSY: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.BUSY)); break; case DISCARD_REASON_MISSED: systemCallConnection.setDisconnected(new DisconnectCause(isOutgoing ? DisconnectCause.CANCELED : DisconnectCause.MISSED)); break; default: systemCallConnection.setDisconnected(new DisconnectCause(DisconnectCause.REMOTE)); break; } systemCallConnection.destroy(); systemCallConnection=null; } } }; if(needPlayEndSound) AndroidUtilities.runOnUIThread(r, 700); else r.run(); } stopSelf(); }