但是这个linphone它不能接收电话,根据跟踪排查,原因是因为它的编码没有设置全,所以在存在的库中找不到改编码被(通话)遗弃了
下面我们在这块改动它的编码,使它的编码,比较完全
该版本为简化版本,只保留了核心功能
在VoipService中的onCreate中
改动前
@Override
public void onCreate() {
//设置日志
isDebug = VoipHelper.getInstance().isDebug();
LinphoneCoreFactory.instance().setDebugMode(isDebug, "dds_voip");
LinphoneCoreFactory.instance().setLogCollectionPath(Environment.getExternalStorageDirectory().getAbsolutePath() + "/trustmobi_voip");
mWindowManager = (WindowManager) getApplicationContext()
.getSystemService(WINDOW_SERVICE);
//开启基本配置
LinphoneManager.createAndStart(this);
instance = this;
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
initListener();
initReceiver();
setCallBack(new VoipCallBackDefault(getApplication()));
if (isDebug) {
displayCustomToast("open success");
}
}
改动后
@Override
public void onCreate() {
//设置日志
isDebug = VoipHelper.getInstance().isDebug();
LinphoneCoreFactory.instance().setDebugMode(isDebug, "dds_voip");
LinphoneCoreFactory.instance().setLogCollectionPath(Environment.getExternalStorageDirectory().getAbsolutePath() + "/trustmobi_voip");
mWindowManager = (WindowManager) getApplicationContext()
.getSystemService(WINDOW_SERVICE);
//开启基本配置
LinphoneManager.createAndStart(this);
instance = this;
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
initListener();
initReceiver();
setCallBack(new VoipCallBackDefault(getApplication()));
if (isDebug) {
displayCustomToast("open success");
}
try {
initAudioSettings();
} catch (LinphoneCoreException e) {
Toast.makeText(this, "音频设置失败!", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
//设置音频
public void initAudioSettings() throws LinphoneCoreException {
LinphoneCore lcIfManagerNotDestroyedOrNull = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
PayloadType[] audioCodecs = lcIfManagerNotDestroyedOrNull.getAudioCodecs();
for (int i = 0; i < audioCodecs.length; i++) {
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(audioCodecs[i], true);
Log.e("XINHAO_HAN", "initAudioSettings: " + audioCodecs[i].getMime() + " : " + audioCodecs[i].getRate() + "HZ");
}
}
网友评论