我正在使用 Pjsip 库进行呼叫,并且因为我正在从我的代码更改编解码器并且它随着新的优先级而发生变化,但它没有在 FreeSWITCH 呼叫日志中更新,因为它向我显示了旧的编解码器。不使用新的优先编解码器进行更新。假设我已将编解码器优先级从 PCMU 8 kHz 更改为 G729 8 kHz。但它只向我显示了 PCMU 的日志,而不是 G729 的日志。
我使用了以下 PJSIP 内置方法来更改 CodecPriority,因为它在设备内部发生了变化,但没有反映到 FreeSWITCH 日志。
public short getCodecPriority(String codecName, String type, String defaultValue) {
String key = SipConfigManager.getCodecKey(codecName, type);
if (key != null) {
String val = getPreferenceStringValue(key, defaultValue);
if (!TextUtils.isEmpty(val)) {
try {
return (short) Integer.parseInt(val);
} catch (NumberFormatException e) {
Log.e(THIS_FILE, "Impossible to parse " + val);
}
}
}
return (short) Integer.parseInt(defaultValue);
}
/**
* Set the priority for the codec for a given bandwidth type
*
* @param codecName the name of the codec as announced by codec
* @param type bandwidth type <br/>
* For now, valid constants are :
* {@link SipConfigManager#CODEC_NB} and
* {@link SipConfigManager#CODEC_WB}
* @param newValue Short value for preference as a string.
*/
public void setCodecPriority(String codecName, String type, String newValue) {
String key = SipConfigManager.getCodecKey(codecName, type);
if (key != null) {
setPreferenceStringValue(key, newValue);
}
// TODO : else raise error
}
我使用了来自 CSipSimple GitHub 代码的参考代码。
如果有人对在 FreeSWITCH 通话记录中更改编解码器优先级有任何想法,请分享您的答案。
谢谢。