Exception when trying to call(SIP)
Asked Answered
T

3

7

I'm developping a SIP application, and when i want to call someone(with its identifier configured in the server) i have a NullPointerException => "Error when trying to close manager." Here is the code:

public void initiateCall() {

        updateStatus(sipAddress);

        try {
            SipAudioCall.Listener listener = new SipAudioCall.Listener() {

                @Override
                public void onCallEstablished(SipAudioCall call) {
                    call.startAudio();
                    call.setSpeakerMode(true);
                    call.toggleMute();
                    updateStatus(call);
                }

                @Override
                public void onCallEnded(SipAudioCall call) {
                    updateStatus("Ready.");
                }
            };

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

        }
        catch (Exception e) {
            Log.i("WalkieTalkieActivity/InitiateCall", "Error when trying to close manager.", e);
            if (me != null) {
                try {
                    manager.close(me.getUriString());
                } catch (Exception ee) {
                    Log.i("WalkieTalkieActivity/InitiateCall",
                            "Error when trying to close manager.", ee);
                    ee.printStackTrace();
                }
            }
            if (call != null) {
                call.close();
            }
        }
    }

Thank you for your help.

Togs answered 24/4, 2011 at 14:59 Comment(1)
In what line is the exception thrown?Pendleton
P
8

The VOIP/SIP libary is not supported by default on Android emulator. The problem is that the
manager == null - thats why you are getting the NullPointerException.

Luckily, there is a work-a-round. Download this link and copy it into ...\.android\avd\.avd folder.

Start your emulator and

 Boolean voipSupported = SipManager.isVoipSupported(this);
 Boolean apiSupported = SipManager.isApiSupported(this);

should now return true.

Source: http://xilard.hu/

Plaything answered 17/6, 2011 at 7:27 Comment(0)
T
0

Android.net.sip (Sip API) only works on G711 over Android 2.3+. Also the phones supplied by carriers may have the SIP stack (android.net.sip) blocked or cripple. SipManager.isVoipSupported(this) && SipManager.isApiSupported(this) will return false for most of the devices is your ie. your SipManager object will always be null in such case.You should use third party library to implement SIP.

There are different open source sip stack libraries as well as projects are available on internet. You can download the source code of that projects. Here is the List of some popular open source sip stack libraries which allows to voice call over internet.

1.Jain sip (I think the best option):

2.Pjsip

3.Mjsip

4.Doubango

There are different open source projects which have used these libraries in their projects.

1.Jain sip: Not used in a "famous" app. 2. Sipdroid uses MjSip 3. Csipsimple uses PjSip 4. Imsdroid uses doubango.

Tiu answered 31/7, 2014 at 13:57 Comment(0)
U
-3

Check the bridge connection in Android and the SIP server in your application to obtain the SIP key of your application.

Undersized answered 31/7, 2014 at 12:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.