|
@@ -23,8 +23,10 @@
|
|
#include "base/json_object.h"
|
|
#include "base/json_object.h"
|
|
#include "edge/ip_table.h"
|
|
#include "edge/ip_table.h"
|
|
#include "core/jhws.h"
|
|
#include "core/jhws.h"
|
|
|
|
+#include "manager/ConfigManager.h"
|
|
#include "security/SecurityManager.h"
|
|
#include "security/SecurityManager.h"
|
|
#include "zkaudio.h"
|
|
#include "zkaudio.h"
|
|
|
|
+#include "voip/telephone_audio_initializer.h"
|
|
|
|
|
|
/**
|
|
/**
|
|
* 仅用于测试,默认不发送视频
|
|
* 仅用于测试,默认不发送视频
|
|
@@ -80,16 +82,18 @@ voip::Telephone* GetTelephone() {
|
|
// conf.headers["CID"] = "jhylf14988-com.jhws";
|
|
// conf.headers["CID"] = "jhylf14988-com.jhws";
|
|
// conf.headers["JWT"] = StoragePreferences::getString(SIP_JHWS_TOKEN, "");
|
|
// conf.headers["JWT"] = StoragePreferences::getString(SIP_JHWS_TOKEN, "");
|
|
// LOGD("deviceuid: %s", GetDeviceUid().c_str());
|
|
// LOGD("deviceuid: %s", GetDeviceUid().c_str());
|
|
- LOGD("id_url: %s", conf.id_uri.c_str());
|
|
|
|
- LOGD("server_url: %s", conf.server_uri.c_str());
|
|
|
|
- LOGD("user_name: %s", conf.user_name.c_str());
|
|
|
|
- LOGD("password: %s", conf.password.c_str());
|
|
|
|
- LOGD("user_agent: %s", conf.user_agent.c_str());
|
|
|
|
|
|
+// LOGD("id_url: %s", conf.id_uri.c_str());
|
|
|
|
+// LOGD("server_url: %s", conf.server_uri.c_str());
|
|
|
|
+// LOGD("user_name: %s", conf.user_name.c_str());
|
|
|
|
+// LOGD("password: %s", conf.password.c_str());
|
|
|
|
+// LOGD("user_agent: %s", conf.user_agent.c_str());
|
|
#endif
|
|
#endif
|
|
bool enable_video = StoragePreferences::getBool(SIP_ENABLE_VIDEO, true);
|
|
bool enable_video = StoragePreferences::getBool(SIP_ENABLE_VIDEO, true);
|
|
conf.auto_transmit_video_to_remote = enable_video;
|
|
conf.auto_transmit_video_to_remote = enable_video;
|
|
|
|
+ //单实例
|
|
telephone = new voip::Telephone(conf);
|
|
telephone = new voip::Telephone(conf);
|
|
|
|
|
|
|
|
+#if 0
|
|
//设置消回音、增益等参数
|
|
//设置消回音、增益等参数
|
|
base::AcousticEchoCancellater::Configuration aec_conf;
|
|
base::AcousticEchoCancellater::Configuration aec_conf;
|
|
aec_conf.sample_rate = 8000; //固定8K
|
|
aec_conf.sample_rate = 8000; //固定8K
|
|
@@ -111,6 +115,36 @@ voip::Telephone* GetTelephone() {
|
|
zk_audio_input_set_volume_native(1, 12);
|
|
zk_audio_input_set_volume_native(1, 12);
|
|
zk_audio_output_set_volume_native(15);
|
|
zk_audio_output_set_volume_native(15);
|
|
// telephone->SetInputAecApcConfig(aec_conf, apc_conf);
|
|
// telephone->SetInputAecApcConfig(aec_conf, apc_conf);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if 1
|
|
|
|
+ const int kSampleRate = 8000;//固定8K
|
|
|
|
+ //设置消回音等参数
|
|
|
|
+ base::AcousticEchoCancellater::Configuration aec_conf;
|
|
|
|
+ aec_conf.sample_rate = kSampleRate; //固定8K
|
|
|
|
+ aec_conf.nearend_channel = 1;
|
|
|
|
+ aec_conf.farend_channel = 1;
|
|
|
|
+
|
|
|
|
+ //进一步处理录音数据
|
|
|
|
+ base::AudioProcessChain::Configuration apc_conf;
|
|
|
|
+ apc_conf.number_of_channels = 1;
|
|
|
|
+ apc_conf.sample_rate = kSampleRate;
|
|
|
|
+ apc_conf.anr.enable = 1; //降低噪音
|
|
|
|
+ for (int i = 0; i < array_length(apc_conf.anr.intensity); ++i) {
|
|
|
|
+ //调整降噪强度
|
|
|
|
+ apc_conf.anr.intensity[i] = 5;
|
|
|
|
+ }
|
|
|
|
+ telephone->SetInputAecApcConfig(aec_conf, apc_conf);
|
|
|
|
+ zk_audio_input_set_volume_native(0, 0);//回采通道,建议固定0增益
|
|
|
|
+ zk_audio_input_set_volume_native(1, 10); //录音音量,可按需求调整增益
|
|
|
|
+ zk_audio_output_set_volume_native(15); //扬声器的增益,可按需求调整
|
|
|
|
+#else
|
|
|
|
+ //也可以从配置文件中设置 Aec、 Apc、 输入输出音量
|
|
|
|
+ const std::string filename =
|
|
|
|
+ CONFIGMANAGER->getResFilePath("telephone_audio_config.json");
|
|
|
|
+ TelephoneAudioInitializer::Setup(telephone, filename);
|
|
|
|
+#endif
|
|
|
|
+
|
|
return telephone;
|
|
return telephone;
|
|
}
|
|
}
|
|
|
|
|