private void dialInternal(ImsPhoneConnection conn, int clirMode, int videoState) { if (conn == null) { return; } if (conn.getAddress() == null || conn.getAddress().length() == 0 || conn.getAddress().indexOf(PhoneNumberUtils.WILD) >= 0) { // Phone number is invalid conn.setDisconnectCause(DisconnectCause.INVALID_NUMBER); sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO); return; } // Always unmute when initiating a new call setMute(false); int serviceType = PhoneNumberUtils.isEmergencyNumber(conn.getAddress()) ? ImsCallProfile.SERVICE_TYPE_EMERGENCY : ImsCallProfile.SERVICE_TYPE_NORMAL; int callType = ImsCallProfile.getCallTypeFromVideoState(videoState); // TODO(vt): Is this sufficient? At what point do we know the video state of the call? conn.setVideoState(videoState); try { String[] callees = new String[] {conn.getAddress()}; ImsCallProfile profile = mImsManager.createCallProfile(mServiceId, serviceType, callType); profile.setCallExtraInt(ImsCallProfile.EXTRA_OIR, clirMode); ImsCall imsCall = mImsManager.makeCall(mServiceId, profile, callees, mImsCallListener); conn.setImsCall(imsCall); IImsVideoCallProvider imsVideoCallProvider = imsCall.getCallSession().getVideoCallProvider(); if (imsVideoCallProvider != null) { ImsVideoCallProviderWrapper imsVideoCallProviderWrapper = new ImsVideoCallProviderWrapper(imsVideoCallProvider); conn.setVideoProvider(imsVideoCallProviderWrapper); } } catch (ImsException e) { loge("dialInternal : " + e); conn.setDisconnectCause(DisconnectCause.ERROR_UNSPECIFIED); sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO); } catch (RemoteException e) { } }