我试图在Android 4.4.4上的Eclipse Android应用程序中使用Liblinphone Java代码,通过我的WLAN拨打运行Ubuntu 16.04,Linphone和Asterisk的计算机。当我尝试从Android Linphone而不是我的应用程序进行这样的调用时,它运行正常,所以我猜计算机上的Asterisk和Linphone都配置正确,但是当我尝试运行我的应用程序时,当我调用LinphoneCore.iterate时它会崩溃( )。 Wireshark没有显示来自手机的来电通讯的迹象。 在崩溃之前,我在LogCat中收到警告:
dalvikvm Invalid indirect reference 0x41fcb6c8 in decodeIndirectRef
警告后面是错误:
dalvikvm VM aborting
libc Fatal signal 6 (SIGABRT) at 0x00001f15 (code=-6), thread 8256 (LinphoneMini sc)
我的代码:
public class LinphoneMiniManager implements LinphoneCoreListener {
private static LinphoneMiniManager mInstance;
private Context mContext;
private LinphoneCore mLinphoneCore;
private Timer mTimer;
public LinphoneMiniManager(Context c) {
mContext = c;
LinphoneCoreFactory inst = null;
inst = LinphoneCoreFactory.instance();
inst.setDebugMode(true, "Linphone Mini");
File basePathFile = Context.getFilesDir();//.getAbsolutePath();
String basePath = basePathFile.getAbsolutePath();
copyAssetsFromPackage(basePath);
mLinphoneCore =
LinphoneCoreFactory.instance().createLinphoneCore(this,
basePath + "/.linphonerc", basePath + "/linphonerc", null,
mContext);
initLinphoneCoreValues(basePath);
setUserAgent();
setFrontCamAsDefault();
startIterate();
mInstance = this;
boolean b = mLinphoneCore.isNetworkReachable();
mLinphoneCore.setNetworkReachable(true); // Let's assume it's true
} catch (LinphoneCoreException e) {
Log.d("exception " + e);
} catch (IOException e) {
}
}
private void startIterate() {
TimerTask lTask = new TimerTask() {
@Override
public void run() {
mLinphoneCore.iterate();
Log.d("called iterate");
}
};
/*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/
mTimer = new Timer("LinphoneMini scheduler");
mTimer.schedule(lTask, 0, 20);
}
我的linphonerc:
[net]
download_bw=380
upload_bw=380
firewall_policy=1
nat_address=10.0.0.138
[sip]
sip_port=5060
guess_hostname=1
contact="John Doe" <sip:6002@10.0.0.1:5060>
inc_timeout=15
use_info=0
use_rfc2833=0
use_ipv6=0
register_only_when_network_is_up=0
default_proxy=0
media_encryption=none
[auth_info_0]
username=6002
userid=6002
passwd=1234
realm="asterisk"
[video]
size=qvga
[app]
sharing_server=https://www.linphone.org:444/upload.php
tunnel=disabled
[tunnel]
host=
port=443
[misc]
[proxy_0]
reg_proxy=<sip:6002@10.0.0.1>
reg_identity=sip:6002@10.0.0.1
reg_expires=3600
reg_sendregister=1
publish=1
dial_escape_plus=0
注意:
这是我关于SO的第一个问题。我希望我能正确遵守规则。
对mLinphoneCore.isNetworkReachable()的调用返回false。
我的应用具有必要的权限。
我无法查看Linphone Android应用使用的linphonerc,因为我没有root权限。
谢谢