1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-27 04:34:42 +01:00
This commit is contained in:
Grishka 2019-01-08 06:28:25 +03:00
parent 12e76ed3db
commit 0c732e2ce4

View File

@ -342,7 +342,7 @@ void VoIPController::Stop(){
} }
bool VoIPController::NeedRate(){ bool VoIPController::NeedRate(){
return needRate; return needRate && ServerConfig::GetSharedInstance()->GetBoolean("bad_call_rating", false);
} }
void VoIPController::SetRemoteEndpoints(vector<Endpoint> endpoints, bool allowP2p, int32_t connectionMaxLayer){ void VoIPController::SetRemoteEndpoints(vector<Endpoint> endpoints, bool allowP2p, int32_t connectionMaxLayer){
@ -426,19 +426,19 @@ void VoIPController::SetNetworkType(int type){
UpdateAudioBitrateLimit(); UpdateAudioBitrateLimit();
myIPv6=IPv6Address(); myIPv6=IPv6Address();
string itfName=udpSocket->GetLocalInterfaceInfo(NULL, &myIPv6); string itfName=udpSocket->GetLocalInterfaceInfo(NULL, &myIPv6);
LOGI("set network type: %s, active interface %s", NetworkTypeToString(type).c_str(), activeNetItfName.c_str()); LOGI("set network type: %s, active interface %s", NetworkTypeToString(type).c_str(), itfName.c_str());
LOGI("Local IPv6 address: %s", myIPv6.ToString().c_str()); LOGI("Local IPv6 address: %s", myIPv6.ToString().c_str());
if(itfName!=activeNetItfName){
udpSocket->OnActiveInterfaceChanged();
LOGI("Active network interface changed: %s -> %s", activeNetItfName.c_str(), itfName.c_str());
bool isFirstChange=activeNetItfName.length()==0 && state!=STATE_ESTABLISHED && state!=STATE_RECONNECTING;
activeNetItfName=itfName;
if(IS_MOBILE_NETWORK(networkType)){ if(IS_MOBILE_NETWORK(networkType)){
CellularCarrierInfo carrier=GetCarrierInfo(); CellularCarrierInfo carrier=GetCarrierInfo();
if(!carrier.name.empty()){ if(!carrier.name.empty()){
LOGI("Carrier: %s [%s; mcc=%s, mnc=%s]", carrier.name.c_str(), carrier.countryCode.c_str(), carrier.mcc.c_str(), carrier.mnc.c_str()); LOGI("Carrier: %s [%s; mcc=%s, mnc=%s]", carrier.name.c_str(), carrier.countryCode.c_str(), carrier.mcc.c_str(), carrier.mnc.c_str());
} }
} }
if(itfName!=activeNetItfName){
udpSocket->OnActiveInterfaceChanged();
LOGI("Active network interface changed: %s -> %s", activeNetItfName.c_str(), itfName.c_str());
bool isFirstChange=activeNetItfName.length()==0 && state!=STATE_ESTABLISHED && state!=STATE_RECONNECTING;
activeNetItfName=itfName;
if(isFirstChange) if(isFirstChange)
return; return;
if(currentEndpoint){ if(currentEndpoint){