@Override public void onCallEstablished(SipAudioCall call) { Log.d(TAG, "onCallEstablished: called."); call.startAudio(); if (call.isMuted()) { call.toggleMute(); } PhonyConnection.this.setActive(); }
/** * Updates the status box with the SIP address of the current mSipAudioCall. * * @param call The current, active mSipAudioCall. */ public void updateStatus(SipAudioCall call) { String useName = call.getPeerProfile().getDisplayName(); if (useName == null) { useName = call.getPeerProfile().getUserName(); } updateStatus(useName + "@" + call.getPeerProfile().getSipDomain()); }
@Override public void onCallEnded(SipAudioCall call) { Log.d(TAG, "onCallEnded: called."); PhonyConnection.this.setDisconnected(new DisconnectCause(DisconnectCause.REMOTE)); PhonyConnection.this.destroy(); }
public PhonyConnection(SipAudioCall sipCall) throws SipException { Log.d(TAG, "PhonyConnection: called."); setInitializing(); setAudioModeIsVoip(true); setConnectionCapabilities(CAPABILITY_MUTE); mSipCall = sipCall; mSipCall.setListener(mSipListener); }
@Override public Connection onCreateIncomingConnection(PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request) { Log.d(TAG, "onCreateIncomingConnection: called."); if (request.getExtras() == null) { return Connection.createFailedConnection(new DisconnectCause(DisconnectCause.ERROR, "No extras on request.")); } Intent sipIntent = request.getExtras().getParcelable(EXTRA_INCOMING_CALL_INTENT); if (sipIntent == null) { return Connection.createFailedConnection(new DisconnectCause(DisconnectCause.ERROR, "No SIP intent.")); } try { SipAudioCall audioCall = PhonySipUtil.getSipManager(this).takeAudioCall(sipIntent, null); PhonyConnection connection = new PhonyConnection(audioCall); connection.setAddress(Uri.parse(audioCall.getPeerProfile().getUriString()), TelecomManager.PRESENTATION_ALLOWED); connection.setInitialized(); return connection; } catch (SipException e) { e.printStackTrace(); return Connection.createFailedConnection(new DisconnectCause(DisconnectCause.ERROR, "SipExecption", "Check the stack trace for more information.", e.getLocalizedMessage())); } }
@Override public Connection onCreateOutgoingConnection(PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request) { Log.d(TAG, "onCreateOutgoingConnection: called."); try { SipAudioCall audioCall = PhonySipUtil.getSipManager(this).makeAudioCall(connectionManagerPhoneAccount.getId(), Uri.decode(request.getAddress().toString()), null, PhonySipUtil.EXPIRY_TIME); PhonyConnection connection = new PhonyConnection(audioCall); connection.setAddress(request.getAddress(), TelecomManager.PRESENTATION_ALLOWED); connection.setInitialized(); return connection; } catch (SipException e) { e.printStackTrace(); return Connection.createFailedConnection(new DisconnectCause(DisconnectCause.ERROR, "SipExecption", "Check the stack trace for more information.", e.getLocalizedMessage())); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { try { SipAudioCall call = new SipAudioCall(this, null); call.startAudio(); } catch (Exception e) { Log.w(TAG, e); } return true; } return super.onOptionsItemSelected(item); }
public void updateStatus(SipAudioCall call) { String useName = call.getPeerProfile().getDisplayName(); if (useName == null) { useName = call.getPeerProfile().getUserName(); } updateStatus(useName + "@" + call.getPeerProfile().getSipDomain()); }
CallInfo(SipAudioCall call) { this(call.getPeerProfile().getUriString()); }
@Hook("android.net.sip.SipAudioCall->startAudio") public static void SipAudioCall_startAudio(SipAudioCall call) { Log.d(TAG, "SipAudioCall_startAudio"); OriginalMethod.by(new $() {}).invoke(call); }
@Override public void onCallEstablished(SipAudioCall call) { call.startAudio(); call.setSpeakerMode(true); call.toggleMute(); }
@Override public void onCallEnded(SipAudioCall call) { super.onCallEnded(call); updateStatus(STATE_CONNECTED); }
@Override public void onCalling(SipAudioCall call) { if (!call.isMuted()) call.toggleMute(); updateStatus(STATE_CALLING + " " + call.getPeerProfile().getUserName()); }