3

我正在开发 SIP 应用程序。我使用了 SipDemo 中的 SipDemo 示例,出了点问题。我有 NullPointerException =>“尝试关闭管理器时出错。” 在这个地方(例外'e'):

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

另外我检查了这个SipManager.isApiSupported()并且 SipManager.isVoipSupported()都返回了false。我正在使用 4.0.3 操作系统的 Tab 上对此进行测试。我想知道故障是否在于不支持本机 sip,但我可以轻松地使用 SipDroid 或市场上的其他应用程序拨打电话。

编辑 Logcat 堆栈跟踪:

05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247): Error when trying to close manager.
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247): java.lang.NullPointerException
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at com.example.android.sip.WalkieTalkieActivity.initiateCall(WalkieTalkieActivity.java:212)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at com.example.android.sip.WalkieTalkieActivity$4.onClick(WalkieTalkieActivity.java:324)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:165)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at android.os.Looper.loop(Looper.java:130)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at android.app.ActivityThread.main(ActivityThread.java:3691)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at java.lang.reflect.Method.invokeNative(Native Method)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at java.lang.reflect.Method.invoke(Method.java:507)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
05-15 22:29:11.255: INFO/WalkieTalkieActivity/InitiateCall(4247):     at dalvik.system.NativeStart.main(Native Method)
4

1 回答 1

2

我想我有一些解决办法。并非每个版本的 android 都支持 sip。因此,您应该寻找第 3 部分库。例如,您可以查看SipdroidCSipSimple的源代码并根据自己的需要进行转换。

于 2012-09-27T07:46:07.517 回答