0

i Build the app which contain SIP/VOIP call.i Run the app in samsung,Redmi,One plus One it Work fine But When i run the same app in Micromax,Moto G devices it crash when i Call SIP/VOIP Function.Its Showing the error in Logcat.

Error:

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

and my function is

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();
        }
    }

Whats the problem behind this? Help Me to solve this issue Thanks in advance.

RushDroid
  • 1,570
  • 3
  • 21
  • 46

1 Answers1

1

Not all Android-powered devices support VOIP calls using SIP. You should always call isVoipSupported() to verify that the device supports VOIP calling and isApiSupported() to verify that the device supports the SIP APIs. Your application must also request the Manifest.permission.INTERNET and Manifest.permission.USE_SIP permissions.

Tim
  • 367
  • 1
  • 12
  • thank you for the answer. But there are a couple of libraries which support VoIP/sip call for all platform devices. like pjSip – RushDroid Jul 02 '19 at 06:46