diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index 57074b7..568d7c6 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -19,6 +19,7 @@
 import android.net.Uri;
 import android.telecomm.CallInfo;
 import android.telecomm.CallState;
+import android.telecomm.GatewayInfo;
 
 import com.google.android.collect.Sets;
 import com.google.common.base.Preconditions;
@@ -57,6 +58,12 @@
     /** The handle with which to establish this call. */
     private Uri mHandle;
 
+    /** The gateway information associated with this call. This stores the original call handle
+     * that the user is attempting to connect to via the gateway, the actual handle to dial in
+     * order to connect the call via the gateway, as well as the package name of the gateway
+     * service. */
+    private final GatewayInfo mGatewayInfo;
+
     /**
      * The call service which is attempted or already connecting this call.
      */
@@ -67,9 +74,6 @@
      */
     private CallServiceSelectorWrapper mCallServiceSelector;
 
-    /** Read-only and parcelable version of this call. */
-    private CallInfo mCallInfo;
-
     /**
      * The set of call services that were attempted in the process of placing/switching this call
      * but turned out unsuitable.  Only used in the context of call switching.
@@ -82,7 +86,7 @@
      * @param isIncoming True if this is an incoming call.
      */
     Call(boolean isIncoming) {
-        this(null, null, isIncoming);
+        this(null, null, null, isIncoming);
     }
 
     /**
@@ -90,13 +94,15 @@
      *
      * @param handle The handle to dial.
      * @param contactInfo Information about the entity being called.
+     * @param gatewayInfo Gateway information to use for the call.
      * @param isIncoming True if this is an incoming call.
      */
-    Call(Uri handle, ContactInfo contactInfo, boolean isIncoming) {
+    Call(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo, boolean isIncoming) {
         mId = UUID.randomUUID().toString();  // UUIDs should provide sufficient uniqueness.
         mState = CallState.NEW;
         mHandle = handle;
         mContactInfo = contactInfo;
+        mGatewayInfo = gatewayInfo;
         mIsIncoming = isIncoming;
         mCreationTime = new Date();
     }
@@ -126,7 +132,6 @@
         if (mState != newState) {
             Log.v(this, "setState %s -> %s", mState, newState);
             mState = newState;
-            clearCallInfo();
         }
     }
 
@@ -138,6 +143,21 @@
         mHandle = handle;
     }
 
+    /**
+     * @return The original handle this call is associated with. In-call services should use this
+     * handle when indicating in their UI the handle that is being called.
+     */
+    public Uri getOriginalHandle() {
+        if (mGatewayInfo != null && !mGatewayInfo.isEmpty()) {
+            return mGatewayInfo.getOriginalHandle();
+        }
+        return getHandle();
+    }
+
+    GatewayInfo getGatewayInfo() {
+        return mGatewayInfo;
+    }
+
     ContactInfo getContactInfo() {
         return mContactInfo;
     }
@@ -309,10 +329,7 @@
      * @return An object containing read-only information about this call.
      */
     CallInfo toCallInfo() {
-        if (mCallInfo == null) {
-            mCallInfo = new CallInfo(mId, mState, mHandle);
-        }
-        return mCallInfo;
+        return new CallInfo(mId, mState, mHandle, mGatewayInfo);
     }
 
     /**
@@ -327,13 +344,6 @@
         return false;
     }
 
-    /**
-     * Resets the cached read-only version of this call.
-     */
-    private void clearCallInfo() {
-        mCallInfo = null;
-    }
-
     @SuppressWarnings("rawtypes")
     private void decrementAssociatedCallCount(ServiceBinder binder) {
         if (binder != null) {
diff --git a/src/com/android/telecomm/CallActivity.java b/src/com/android/telecomm/CallActivity.java
index 06d4267..43c4cf3 100644
--- a/src/com/android/telecomm/CallActivity.java
+++ b/src/com/android/telecomm/CallActivity.java
@@ -90,7 +90,9 @@
      */
     private void processOutgoingCallIntent(Intent intent) {
         ContactInfo contactInfo = null;
-        mCallsManager.processOutgoingCallIntent(intent.getData(), contactInfo);
+        NewOutgoingCallIntentBroadcaster broadcaster =
+                new NewOutgoingCallIntentBroadcaster(mCallsManager, contactInfo, intent);
+        broadcaster.processIntent();
     }
 
     /**
diff --git a/src/com/android/telecomm/CallLogManager.java b/src/com/android/telecomm/CallLogManager.java
index 7862afd..99eb845 100644
--- a/src/com/android/telecomm/CallLogManager.java
+++ b/src/com/android/telecomm/CallLogManager.java
@@ -101,15 +101,13 @@
      *     {@link android.provider.CallLog.Calls#MISSED_TYPE}
      */
     private void logCall(Call call, int callLogType) {
-        Uri number = call.getHandle();
         final long creationTime = call.getCreationTimeInMilliseconds();
         final long age = call.getAgeInMilliseconds();
 
         final ContactInfo contactInfo = call.getContactInfo();  // May be null.
         final String logNumber = getLogNumber(call);
 
-        Log.d(TAG, "logNumber set to:" + Log.pii(logNumber) + ", number set to: "
-                + Log.pii(number));
+        Log.d(TAG, "logNumber set to: %s", Log.pii(logNumber));
 
         final int presentation = getPresentation(call, contactInfo);
 
@@ -164,7 +162,7 @@
      * @return the phone number to be logged.
      */
     private String getLogNumber(Call call) {
-        Uri handle = call.getHandle();
+        Uri handle = call.getOriginalHandle();
 
         if (handle == null) {
             return null;
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 36fbf77..22d9ce6 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -16,14 +16,13 @@
 
 package com.android.telecomm;
 
-import android.content.Context;
 import android.net.Uri;
 import android.os.Bundle;
 import android.telecomm.CallInfo;
 import android.telecomm.CallServiceDescriptor;
 import android.telecomm.CallState;
+import android.telecomm.GatewayInfo;
 
-import com.android.internal.telecomm.ICallService;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableCollection;
@@ -161,15 +160,14 @@
     }
 
     /**
-     * Attempts to issue/connect the specified call.  From an (arbitrary) application standpoint,
-     * all that is required to initiate this flow is to fire either of the CALL, CALL_PRIVILEGED,
-     * and CALL_EMERGENCY intents. These are listened to by CallActivity.java which then invokes
-     * this method.
+     * Attempts to issue/connect the specified call.
      *
-     * @param handle The handle to dial.
+     * @param handle Handle to connect the call with.
      * @param contactInfo Information about the entity being called.
+     * @param gatewayInfo Optional gateway information that can be used to route the call to the
+     *     actual dialed handle via a gateway provider. May be null.
      */
-    void processOutgoingCallIntent(Uri handle, ContactInfo contactInfo) {
+    void placeOutgoingCall(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo) {
         for (OutgoingCallValidator validator : mOutgoingCallValidators) {
             if (!validator.isValid(handle, contactInfo)) {
                 // TODO(gilad): Display an error message.
@@ -178,8 +176,15 @@
             }
         }
 
-        // No objection to issue the call, proceed with trying to put it through.
-        Call call = new Call(handle, contactInfo, false /* isIncoming */);
+        final Uri uriHandle = (gatewayInfo == null) ? handle : gatewayInfo.getGatewayHandle();
+
+        if (gatewayInfo == null) {
+            Log.i(this, "Creating a new outgoing call with handle: %s", Log.pii(uriHandle));
+        } else {
+            Log.i(this, "Creating a new outgoing call with gateway handle: %s, original handle: %s",
+                    Log.pii(uriHandle), Log.pii(handle));
+        }
+        Call call = new Call(uriHandle, contactInfo, gatewayInfo, false /*isIncoming*/);
         setCallState(call, CallState.DIALING);
         addCall(call);
         mSwitchboard.placeOutgoingCall(call);
diff --git a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
new file mode 100644
index 0000000..369a1fd
--- /dev/null
+++ b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
@@ -0,0 +1,370 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.telecomm;
+
+import android.app.Activity;
+import android.app.ActivityManagerNative;
+import android.app.AlertDialog;
+import android.app.AppOpsManager;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Binder;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.RemoteException;
+import android.os.SystemProperties;
+import android.os.UserHandle;
+import android.provider.ContactsContract;
+import android.telecomm.GatewayInfo;
+import android.telecomm.TelecommConstants;
+import android.telephony.PhoneNumberUtils;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ProgressBar;
+
+/**
+ * OutgoingCallIntentBroadcaster receives CALL and CALL_PRIVILEGED Intents, and broadcasts the
+ * ACTION_NEW_OUTGOING_CALL intent. ACTION_NEW_OUTGOING_CALL is an ordered broadcast intent which
+ * contains the phone number being dialed. Applications can use this intent to (1) see which numbers
+ * are being dialed, (2) redirect a call (change the number being dialed), or (3) prevent a call
+ * from being placed.
+ *
+ * After the other applications have had a chance to see the ACTION_NEW_OUTGOING_CALL intent, it
+ * finally reaches the {@link NewOutgoingCallBroadcastIntentReceiver}.
+ *
+ * Calls where no number is present (like for a CDMA "empty flash" or a nonexistent voicemail
+ * number) are exempt from being broadcast.
+ *
+ * Calls to emergency numbers are still broadcast for informative purposes. The call is placed
+ * prior to sending ACTION_NEW_OUTGOING_CALL and cannot be redirected nor prevented.
+ */
+class NewOutgoingCallIntentBroadcaster {
+    /** Required permission for any app that wants to consume ACTION_NEW_OUTGOING_CALL. */
+    private static final String PERMISSION = android.Manifest.permission.PROCESS_OUTGOING_CALLS;
+
+    private static final String EXTRA_ACTUAL_NUMBER_TO_DIAL =
+            "android.telecomm.extra.ACTUAL_NUMBER_TO_DIAL";
+
+    /**
+     * Legacy string constants used to retrieve gateway provider extras from intents. These still
+     * need to be copied from the source call intent to the destination intent in order to
+     * support third party gateway providers that are still using old string constants in
+     * Telephony.
+     */
+    public static final String EXTRA_GATEWAY_PROVIDER_PACKAGE =
+            "com.android.phone.extra.GATEWAY_PROVIDER_PACKAGE";
+    public static final String EXTRA_GATEWAY_URI = "com.android.phone.extra.GATEWAY_URI";
+
+    private final CallsManager mCallsManager;
+    private final ContactInfo mContactInfo;
+    private final Intent mIntent;
+
+    NewOutgoingCallIntentBroadcaster(CallsManager callsManager, ContactInfo contactInfo,
+            Intent intent) {
+        mCallsManager = callsManager;
+        mContactInfo = contactInfo;
+        mIntent = intent;
+    }
+
+    /**
+     * Processes the result of the outgoing call broadcast intent, and performs callbacks to
+     * the OutgoingCallIntentBroadcasterListener as necessary.
+     */
+    private class NewOutgoingCallBroadcastIntentReceiver extends BroadcastReceiver {
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            Log.v(this, "doReceive: %s");
+
+            // Once the NEW_OUTGOING_CALL broadcast is finished, the resultData is used as the
+            // actual number to call. (If null, no call will be placed.)
+            String resultHandle = getResultData();
+            Log.v(this, "- got number from resultData: %s", Log.pii(resultHandle));
+
+            if (resultHandle == null) {
+                Log.v(this, "Call cancelled (null number), returning...");
+                return;
+            } else if (PhoneNumberUtils.isPotentialLocalEmergencyNumber(resultHandle, context)) {
+                Log.w(this, "Cannot modify outgoing call to emergency number %s.", resultHandle);
+                return;
+            }
+
+            Uri resultHandleUri = Uri.parse(resultHandle);
+
+            Uri originalUri = mIntent.getData();
+
+            if (originalUri.getSchemeSpecificPart().equals(resultHandle)) {
+                Log.v(this, "Call handle unmodified after new outgoing call intent broadcast.");
+            } else {
+                Log.v(this, "Retrieved modified handle after outgoing call intent broadcast: "
+                        + "Original: %s, Modified: %s",
+                        Log.pii(originalUri),
+                        Log.pii(resultHandleUri));
+            }
+
+            GatewayInfo gatewayInfo = getGateWayInfoFromIntent(intent, resultHandleUri);
+            mCallsManager.placeOutgoingCall(resultHandleUri, mContactInfo, gatewayInfo);
+        }
+    }
+
+    /**
+     * Processes the supplied intent and starts the outgoing call broadcast process relevant to the
+     * intent.
+     *
+     * This method will handle three kinds of actions:
+     *
+     * - CALL (intent launched by all third party dialers)
+     * - CALL_PRIVILEGED (intent launched by system apps e.g. system Dialer, voice Dialer)
+     * - CALL_EMERGENCY (intent launched by lock screen emergency dialer)
+     */
+    void processIntent() {
+        Log.v(this, "Processing call intent in OutgoingCallIntentBroadcaster.");
+
+        final Context context = TelecommApp.getInstance();
+        Intent intent = mIntent;
+
+        String handle = PhoneNumberUtils.getNumberFromIntent(intent, context);
+
+        if (TextUtils.isEmpty(handle)) {
+            Log.w(this, "Empty handle obtained from the call intent.");
+            return;
+        }
+
+        if (!PhoneNumberUtils.isUriNumber(handle)) {
+            handle = PhoneNumberUtils.convertKeypadLettersToDigits(handle);
+            handle = PhoneNumberUtils.stripSeparators(handle);
+        }
+
+        final boolean isPotentialEmergencyNumber = isPotentialEmergencyNumber(context, handle);
+        Log.v(this, "isPotentialEmergencyNumber = %s", isPotentialEmergencyNumber);
+
+        rewriteCallIntentAction(intent, isPotentialEmergencyNumber);
+        // True for certain types of numbers that are not intended to be intercepted or modified
+        // by third parties (e.g. emergency numbers).
+        boolean callImmediately = false;
+
+        String action = intent.getAction();
+        if (Intent.ACTION_CALL.equals(action)) {
+            if (isPotentialEmergencyNumber) {
+                Log.w(this, "Cannot call potential emergency number %s with CALL Intent %s.",
+                        handle, intent);
+                launchSystemDialer(context, intent.getData());
+            }
+            callImmediately = false;
+        } else if (Intent.ACTION_CALL_EMERGENCY.equals(action)) {
+            if (!isPotentialEmergencyNumber) {
+                Log.w(this, "Cannot call non-potential-emergency number %s with EMERGENCY_CALL "
+                        + "Intent %s.", handle, intent);
+                return;
+            }
+            callImmediately = true;
+        } else {
+            Log.w(this, "Unhandled Intent %s. Ignoring and not placing call.", intent);
+            return;
+        }
+
+        if (callImmediately) {
+            Log.i(this, "Placing call immediately instead of waiting for "
+                    + " OutgoingCallBroadcastReceiver: %s", intent);
+            mCallsManager.placeOutgoingCall(Uri.parse(handle), mContactInfo, null);
+
+            // Don't return but instead continue and send the ACTION_NEW_OUTGOING_CALL broadcast
+            // so that third parties can still inspect (but not intercept) the outgoing call. When
+            // the broadcast finally reaches the OutgoingCallBroadcastReceiver, we'll know not to
+            // initiate the call again because of the presence of the EXTRA_ALREADY_CALLED extra.
+        }
+
+        broadcastIntent(intent, handle, context, !callImmediately);
+    }
+
+    /**
+     * Sends a new outgoing call ordered broadcast so that third party apps can cancel the
+     * placement of the call or redirect it to a different number.
+     *
+     * @param originalCallIntent The original call intent.
+     * @param handle Call handle that was stored in the original call intent.
+     * @param context Valid context to send the ordered broadcast using.
+     * @param receiverRequired Whether or not the result from the ordered broadcast should be
+     *     processed using a {@link NewOutgoingCallIntentBroadcaster}.
+     */
+    private void broadcastIntent(
+            Intent originalCallIntent,
+            String handle,
+            Context context,
+            boolean receiverRequired) {
+        Intent broadcastIntent = new Intent(Intent.ACTION_NEW_OUTGOING_CALL);
+        if (handle != null) {
+            broadcastIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, handle);
+        }
+
+        // Force receivers of this broadcast intent to run at foreground priority because we
+        // want to finish processing the broadcast intent as soon as possible.
+        broadcastIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+        Log.v(this, "Broadcasting intent: %s.", broadcastIntent);
+
+        checkAndCopyGatewayProviderExtras(originalCallIntent, broadcastIntent);
+
+        context.sendOrderedBroadcastAsUser(
+                broadcastIntent,
+                UserHandle.OWNER,
+                PERMISSION,
+                receiverRequired ? new NewOutgoingCallBroadcastIntentReceiver() : null,
+                null,  // scheduler
+                Activity.RESULT_OK,  // initialCode
+                handle,  // initialData: initial value for the result data (number to be modified)
+                null);  // initialExtras
+    }
+
+    /**
+     * Copy all the expected extras set when a 3rd party gateway provider is to be used, from the
+     * source intent to the destination one.
+     *
+     * @param src Intent which may contain the provider's extras.
+     * @param dst Intent where a copy of the extras will be added if applicable.
+     */
+    public void checkAndCopyGatewayProviderExtras(Intent src, Intent dst) {
+        if (hasGatewayProviderExtras(src)) {
+            dst.putExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE,
+                    src.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE));
+            dst.putExtra(EXTRA_GATEWAY_URI,
+                    src.getStringExtra(EXTRA_GATEWAY_URI));
+            Log.d(this, "Found and copied gateway provider extras to broadcast intent.");
+            return;
+        }
+
+        Log.d(this, "No gateway provider extras found in call intent.");
+    }
+
+    /**
+     * Check if valid gateway provider information is stored as extras in the intent
+     *
+     * @param intent to check for
+     * @return true if the intent has all the gateway information extras needed.
+     */
+    private boolean hasGatewayProviderExtras(Intent intent) {
+        if (intent == null) {
+            return false;
+        }
+        final String name = intent.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE);
+        final String uriString = intent.getStringExtra(EXTRA_GATEWAY_URI);
+
+        return !TextUtils.isEmpty(name) && !TextUtils.isEmpty(uriString);
+    }
+
+    private static Uri getGatewayUriFromString(String gatewayUriString) {
+        return TextUtils.isEmpty(gatewayUriString) ? null : Uri.parse(gatewayUriString);
+    }
+
+    /**
+     * Extracts gateway provider information from a provided intent..
+     *
+     * @param intent to extract gateway provider information from.
+     * @param trueHandle The actual call handle that the user is trying to dial
+     * @return GatewayInfo object containing extracted gateway provider information as well as
+     *     the actual handle the user is trying to dial.
+     */
+    public static GatewayInfo getGateWayInfoFromIntent(Intent intent, Uri trueHandle) {
+        if (intent == null) {
+            return null;
+        }
+
+        // Check if gateway extras are present.
+        String gatewayPackageName = intent.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE);
+        Uri gatewayUri = getGatewayUriFromString(intent.getStringExtra(EXTRA_GATEWAY_URI));
+        if (!TextUtils.isEmpty(gatewayPackageName) && gatewayUri != null) {
+            return new GatewayInfo(gatewayPackageName, gatewayUri, trueHandle);
+        }
+
+        return null;
+    }
+
+    private void launchSystemDialer(Context context, Uri handle) {
+        Intent systemDialerIntent = new Intent();
+        final Resources resources = context.getResources();
+        systemDialerIntent.setClassName(
+                resources.getString(R.string.ui_default_package),
+                resources.getString(R.string.dialer_default_class));
+        systemDialerIntent.setAction(Intent.ACTION_DIAL);
+        systemDialerIntent.setData(handle);
+        systemDialerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        Log.v(this, "calling startActivity for default dialer: %s", systemDialerIntent);
+        context.startActivity(systemDialerIntent);
+    }
+
+    /**
+     * Check whether or not this is an emergency number, in order to enforce the restriction
+     * that only the CALL_PRIVILEGED and CALL_EMERGENCY intents are allowed to make emergency
+     * calls.
+     *
+     * To prevent malicious 3rd party apps from making emergency calls by passing in an
+     * "invalid" number like "9111234" (that isn't technically an emergency number but might
+     * still result in an emergency call with some networks), we use
+     * isPotentialLocalEmergencyNumber instead of isLocalEmergencyNumber.
+     *
+     * @param context Valid context
+     * @param handle Handle to inspect in order to determine whether or not an emergency number
+     * is potentially being dialed
+     * @return True if the handle is potentially an emergency number.
+     */
+    private boolean isPotentialEmergencyNumber(Context context, String handle) {
+        Log.v(this, "Checking restrictions for number : %s", Log.pii(handle));
+        return (handle != null) && PhoneNumberUtils.isPotentialLocalEmergencyNumber(handle,context);
+    }
+
+    /**
+     * Given a call intent and whether or not the number to dial is an emergency number, rewrite
+     * the call intent action to an appropriate one.
+     *
+     * @param intent Intent to rewrite the action for
+     * @param isPotentialEmergencyNumber Whether or not the handle is potentially an emergency
+     * number.
+     */
+    private void rewriteCallIntentAction(Intent intent, boolean isPotentialEmergencyNumber) {
+        if (CallActivity.class.getName().equals(intent.getComponent().getClassName())) {
+            // If we were launched directly from the CallActivity, not one of its more privileged
+            // aliases, then make sure that only the non-privileged actions are allowed.
+            if (!Intent.ACTION_CALL.equals(intent.getAction())) {
+                Log.w(this, "Attempt to deliver non-CALL action; forcing to CALL");
+                intent.setAction(Intent.ACTION_CALL);
+            }
+        }
+
+        String action = intent.getAction();
+
+        /* Change CALL_PRIVILEGED into CALL or CALL_EMERGENCY as needed. */
+        if (Intent.ACTION_CALL_PRIVILEGED.equals(action)) {
+            if (isPotentialEmergencyNumber) {
+                Log.i(this, "ACTION_CALL_PRIVILEGED is used while the number is a potential"
+                        + " emergency number. Using ACTION_CALL_EMERGENCY as an action instead.");
+                action = Intent.ACTION_CALL_EMERGENCY;
+            } else {
+                action = Intent.ACTION_CALL;
+            }
+            Log.v(this, " - updating action from CALL_PRIVILEGED to %s", action);
+            intent.setAction(action);
+        }
+    }
+}
