但是這個(gè)linphone它不能接收電話,根據(jù)跟蹤排查,原因是因?yàn)樗木幋a沒(méi)有設(shè)置全,所以在存在的庫(kù)中找不到改編碼被(通話)遺棄了
下面我們?cè)谶@塊改動(dòng)它的編碼削茁,使它的編碼,比較完全
該版本為簡(jiǎn)化版本掉房,只保留了核心功能
在VoipService中的onCreate中
改動(dòng)前
@Override
public void onCreate() {
//設(shè)置日志
isDebug = VoipHelper.getInstance().isDebug();
LinphoneCoreFactory.instance().setDebugMode(isDebug, "dds_voip");
LinphoneCoreFactory.instance().setLogCollectionPath(Environment.getExternalStorageDirectory().getAbsolutePath() + "/trustmobi_voip");
mWindowManager = (WindowManager) getApplicationContext()
.getSystemService(WINDOW_SERVICE);
//開(kāi)啟基本配置
LinphoneManager.createAndStart(this);
instance = this;
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
initListener();
initReceiver();
setCallBack(new VoipCallBackDefault(getApplication()));
if (isDebug) {
displayCustomToast("open success");
}
}
改動(dòng)后
@Override
public void onCreate() {
//設(shè)置日志
isDebug = VoipHelper.getInstance().isDebug();
LinphoneCoreFactory.instance().setDebugMode(isDebug, "dds_voip");
LinphoneCoreFactory.instance().setLogCollectionPath(Environment.getExternalStorageDirectory().getAbsolutePath() + "/trustmobi_voip");
mWindowManager = (WindowManager) getApplicationContext()
.getSystemService(WINDOW_SERVICE);
//開(kāi)啟基本配置
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, "音頻設(shè)置失敗!", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
//設(shè)置音頻
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");
}
}