尝试呼叫时出现异常(SIP) [英] Exception when trying to call(SIP)

查看:245
本文介绍了尝试呼叫时出现异常(SIP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个SIP应用程序,当我想呼叫某人(在服务器中配置了其标识符)时,我有一个NullPointerException =>尝试关闭管理器时出错。
这里是代码:

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

感谢您的帮助。

推荐答案

默认情况下,Android模拟器不支持VOIP / SIP libary。问题是,
manager == null - 这就是为什么你得到NullPointerException。

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.

幸运的是,有一个工作一轮。下载此链接并将其复制到 ... \.android\avd\\ \\.avd 文件夹。

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

启动你的模拟器和

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

现在应该返回true。

should now return true.

http://xilard.hu/

这篇关于尝试呼叫时出现异常(SIP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆