需要帮助在第三方VOIP应用程序中使用本机IN-CALL屏幕

时间:2012-07-24 05:40:03

标签: android android-intent sip voip

我正在开发一个VoIP应用程序。

My app registers to a SIP based back-end server using a User-ID and password.
Once the registration is successful, the user can make sip calls through this app.
If the user uses the native phone dialer to dial out a number, My app intercepts the call and places the call through SIP.
Once the call is intercepted, the native phone dialer goes to background and my app's 'call status' screen is displayed(my app comes to foreground).

我的要求如下:

一旦呼叫被截获,我们需要显示原生拨号器(默认电话拨号器)“呼叫状态”/“呼叫进度”屏幕(如三星手机的三星Touchwiz,HTC Sense for HTC)电话等),但电话应该通过我的应用程序(SIP)。我们的应用程序应该控制本机拨号程序“呼叫状态”屏幕的所有功能。

例如:如果用户点击本机拨号器的“呼叫状态”屏幕上的“呼叫结束”按钮,我的应用应结束通话。同样,本机拨号器“呼叫状态”屏幕上的所有控件都应将控制权移交给我的应用程序以采取必要的措施。

请告诉我是否可以完成此操作以及如何实施。

*public void onReceive(final Context context, Intent intent) {
    final String intentAction = intent.getAction();
    if (intentAction.equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
        SharedPreferences getPrefs = PreferenceManager
                .getDefaultSharedPreferences(context);
        boolean bool_CustomFlag = getPrefs.getBoolean(
                "use_custom_dialer_preference", true);
        if (bool_CustomFlag == true) {
 setResultData(null);
    final String strPhoneNum = intent*
            .getStringExtra(Intent.EXTRA_PHONE_NUMBER);
    (new Thread() {
        public void run() {
            try {
Intent intent = new Intent(Intent.ACTION_CALL,Uri.fromParts("my_data_scheme",    
    Uri.decode(strPhoneNum),null));                                               
 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }).start();

} } *

我已经为我的拨出呼叫活动创建了自己的数据方案,以便brodcastreciver可以在通过本地拨号程序进行呼叫时收听Action_outgoing_call并启动我的拨出呼叫活动。

*<activity
        android:name=".OutgoingCallActivity"
        android:screenOrientation="portrait">
        <intent-filter >
            <action android:name="android.intent.action.CALL" />
            <category android:name= "android.intent.category.DEFAULT" />
            <data android:scheme = "sip" />
            <data android:scheme="my_data_scheme" />
        </intent-filter>
    </activity>*`

1 个答案:

答案 0 :(得分:0)

很抱歉,Android没有任何API可以执行您想要对内置的incall状态屏幕执行的操作。

唯一记录的方法是调出自己的incall状态屏幕。许多SIP应用程序模拟内置的android incall状态屏幕,所以无论如何它看起来都一样。