android.net.sip.SipException:不支持VOIP API

时间:2015-09-02 06:30:17

标签: android device sip voip notsupportedexception

我构建包含SIP / VOIP call的应用程序.i在三星,Redmi,One plus One中运行应用程序工作正常但是当我在Micromax中运行相同的应用程序时,Moto G设备在我呼叫SIP / VOIP时崩溃Function.Its在Logcat中显示错误。

错误:

Error when trying to close manager. android.net.sip.SipException: VOIP API is not supported

我的功能是

public void initiateCall() {

        EditText Concode;
        Concode=(EditText)findViewById(R.id.ConfCode);
        String sipadd="sip address";

        if(sipadd!= null && !sipadd.isEmpty()){

     //   updateStatus(sipAddress);

        try {
            SipAudioCall.Listener listener = new SipAudioCall.Listener() {
                // Much of the client's interaction with the SIP Stack will
                // happen via listeners.  Even making an outgoing call, don't
                // forget to set up a listener to set things up once the call is established.
                @Override
                public void onCallEstablished(SipAudioCall call) {
                    call.startAudio();
                    call.setSpeakerMode(false);
                 //   call.toggleMute();
                    //updateStatus(call);
                }

                @Override
                public void onCallEnded(SipAudioCall call) {

                    //updateStatus("Ready.");
                }
            };

            call = manager.makeAudioCall(me.getUriString(), sipadd, listener, 30);


        }
        catch (Exception e) {
            Log.i("JoinConfWithoutLogin/InitiateCall", "Error when trying to close manager.", e);
            if (me != null) {
                try {
                    manager.close(me.getUriString());
                } catch (Exception ee) {
                    Log.i("MainActivity/InitiateCall",
                            "Error when trying to close manager.", ee);
                    ee.printStackTrace();
                }
            }
            if (call != null) {
                call.close();
            }
        }}
        else {
            new AlertDialog.Builder(this)
                    .setTitle("Error")
                    .setMessage("Enter Conferance Code")

                    .setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            // do nothing
                        }
                    })
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .show();
        }
    }

这背后的问题是什么? 帮我解决这个问题 提前谢谢。

1 个答案:

答案 0 :(得分:0)

并非所有的Android设备都支持使用SIP进行VOIP呼叫。您应该始终调用isVoipSupported()来验证设备是否支持VOIP调用,并始终调用isApiSupported()来验证设备支持SIP API。您的应用程序还必须请求Manifest.permission.INTERNET和Manifest.permission.USE_SIP权限。