试图异常时,调用(SIP) [英] Exception when trying to call(SIP)
问题描述
我的深化发展SIP应用程序,当我想打电话给某人(与配置服务器的标识符),我有一个NullPointerException异常=>错误试图关闭管理器时。 这里是code:
公共无效initiateCall(){
updateStatus(sipAddress);
尝试 {
SipAudioCall.Listener监听器=新SipAudioCall.Listener(){
@覆盖
公共无效onCallEstablished(SipAudioCall调用){
call.startAudio();
call.setSpeakerMode(真正的);
call.toggleMute();
updateStatus(电话);
}
@覆盖
公共无效onCallEnded(SipAudioCall调用){
updateStatus(准备好了。);
}
};
调用= manager.makeAudioCall(me.getUriString(),sipAddress,监听器,30);
}
赶上(例外五){
Log.i(试图关闭经理时出现错误。WalkieTalkieActivity / InitiateCall,E);
如果(我!= NULL){
尝试 {
manager.close(me.getUriString());
}赶上(例外EE){
Log.i(WalkieTalkieActivity / InitiateCall
错误当试图关闭经理,EE);
ee.printStackTrace();
}
}
如果(呼!= NULL){
call.close();
}
}
}
感谢您的帮助。
解决方案在VOIP / SIP libary是默认不支持的Android模拟器
经理== NULL
- 这就是为什么你所得到的NullPointerException异常
幸运的是,有一个工作一个圆。下载此链接并将其复制到 ... \。安卓\ AVD \ .avd 文件夹。
启动模拟器以及
布尔voipSupported = SipManager.isVoipSupported(本);
布尔apiSupported = SipManager.isApiSupported(本);
现在应该返回true。
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.
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/
这篇关于试图异常时,调用(SIP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!