info.phoneNumber = number;
connection.setUserData(info);
}
<<<<<<< HEAD
setAudioMode();
=======
} catch (CallStateException ex) {
Log.w(LOG_TAG, "Exception from phone.dial()", ex);
status = CALL_STATUS_FAILED;
}
return status;
}
/**
* Dial the number using a 3rd party provider gateway. Should
* *NOT* be called if the number is either:
* . An emergency one
* . A GSM MMI code
* . A CDMA feature code
* None of the above is checked in this method, it's the caller's
* responsability to make sure the number is 'valid'.
*
* If the connection is establised, this method issues a sync call
* that may block to query the caller info.
* TODO: Change the logic to use the async query.
*
* @param phone the Phone object.
* @param context To perform the CallerInfo query.
* @param number to be dialed as requested by the user. This is
* NOT the phone number to connect to. It is used only to build the
* call card and to update the call log. See above for restrictions.
* @param contactRef that triggered the call. Typically a 'tel:'
* uri but can also be a 'content://contacts' one.
* @param gatewayUri Is the address used to setup the connection.
* @return either CALL_STATUS_DIALED or CALL_STATUS_FAILED
*/
static int placeCallVia(Context context, Phone phone,
String number, Uri contactRef, Uri gatewayUri) {
if (DBG) log("placeCallVia: '" + number + "' GW:'" + gatewayUri + "'");
// TODO: 'tel' should be a contant defined in framework base
// somewhere (it is in webkit.)
if (null == gatewayUri || !"tel".equals(gatewayUri.getScheme())) {
Log.e(LOG_TAG, "Unsupported URL:" + gatewayUri);
return CALL_STATUS_FAILED;
}
// We can use getSchemeSpecificPart because we don't allow #
// in the gateway numbers (treated a fragment delim.) However
// if we allow more complex gateway numbers sequence (with
// passwords or whatnot) that use #, this may break.
// TODO: Need to support MMI codes.
String gatewayNumber = gatewayUri.getSchemeSpecificPart();
Connection connection;
try {
connection = PhoneApp.getInstance().mCM.dial(phone, gatewayNumber);
} catch (CallStateException ex) {
Log.e(LOG_TAG, "Exception dialing gateway", ex);
connection = null;
}
if (null == connection) {
Log.e(LOG_TAG, "Got null connection.");
return CALL_STATUS_FAILED;
}
>>>>>>> e7c3616d1ad0e9f1cf6b349e37d8dc88b4fc938d
if (DBG) log("about to activate speaker");
// Check is phone in any dock, and turn on speaker accordingly |