diff --git a/src/Network/fgcom.cxx b/src/Network/fgcom.cxx index 162ee92..ec17466 100644 --- a/src/Network/fgcom.cxx +++ b/src/Network/fgcom.cxx @@ -470,8 +470,8 @@ void FGCom::connectToCommFrequency() { // ensure that the current comm is still in range //zhongjin - SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency()"); - SG_LOG(SG_SOUND, SG_INFO, "FGCom: _currentCallFrequency=" << _currentCallFrequency); + //SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency()"); + //SG_LOG(SG_SOUND, SG_INFO, "FGCom: _currentCallFrequency=" << _currentCallFrequency); if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) { @@ -479,9 +479,11 @@ void FGCom::connectToCommFrequency() { _currentCallFrequency = 0.0; } + // don't connected (and disconnect if already connected) when tuned freq is 0 if (_currentCommFrequency < 1.0) { if (_currentCallIdent != -1) { + iaxc_dump_call_number(_currentCallIdent); SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent); _currentCallIdent = -1; @@ -490,6 +492,7 @@ void FGCom::connectToCommFrequency() { } if (_currentCallFrequency != _currentCommFrequency || _currentCallIdent == -1) { + if (_currentCallIdent != -1) { iaxc_dump_call_number(_currentCallIdent); SG_LOG(SG_SOUND, SG_INFO, "FGCom: dump_call_number " << _currentCallIdent); @@ -501,6 +504,7 @@ void FGCom::connectToCommFrequency() { std::string num = computePhoneNumber(_currentCommFrequency, getAirportCode(_currentCommFrequency)); _processingTimer.stamp(); + if (!isInRange(_currentCommFrequency)) { if (_currentCallIdent != -1) { SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect call as not in range " << _currentCallIdent); @@ -511,11 +515,14 @@ void FGCom::connectToCommFrequency() { } return; } - else - SG_LOG(SG_SOUND, SG_WARN, "FGCom: frequency"); + + SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency num=" << num); if (!num.empty()) { _currentCallIdent = iaxc_call(num.c_str()); + + SG_LOG(SG_SOUND, SG_INFO, "FGCom: iaxc_call(" << num << ") _currentCallIdent=" << _currentCallIdent); + if (_currentCallIdent == -1) SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: cannot call " << num.c_str()); else {