[Sofaswitch-svn] [commit] r396 - in sofaswitch/trunk: am console mcu server sofa/src sound voip
Author: derek Date: Thu Mar 27 18:33:08 2008 New Revision: 396 Modified: sofaswitch/trunk/am/audio.cxx sofaswitch/trunk/am/comms.cxx sofaswitch/trunk/am/main.cxx sofaswitch/trunk/am/manager.cxx sofaswitch/trunk/console/main.cxx sofaswitch/trunk/mcu/audio.cxx sofaswitch/trunk/mcu/comms.cxx sofaswitch/trunk/mcu/main.cxx sofaswitch/trunk/mcu/manager.cxx sofaswitch/trunk/mcu/member.cxx sofaswitch/trunk/mcu/participant.cxx sofaswitch/trunk/server/main.cxx sofaswitch/trunk/sofa/src/messages.cxx sofaswitch/trunk/sofa/src/messlist.cxx sofaswitch/trunk/sound/audio.cxx sofaswitch/trunk/sound/comms.cxx sofaswitch/trunk/sound/main.cxx sofaswitch/trunk/voip/comms.cxx sofaswitch/trunk/voip/jocall.cxx sofaswitch/trunk/voip/jocall.h sofaswitch/trunk/voip/main.cxx sofaswitch/trunk/voip/mymanager.cxx sofaswitch/trunk/voip/udpconnection.cxx sofaswitch/trunk/voip/udpep.cxx sofaswitch/trunk/voip/udpsound.cxx Log: Move to the new ptlib/opal layout, with bool, and not BOOL, and true, (but not TRUE) and false (but not FALSE). Modified: sofaswitch/trunk/am/audio.cxx ============================================================================== --- sofaswitch/trunk/am/audio.cxx (original) +++ sofaswitch/trunk/am/audio.cxx Thu Mar 27 18:33:08 2008 @@ -43,7 +43,7 @@ AudioRead::AudioRead() :AudioBase("%X Audio reader") { - sentEndOfFile = FALSE; + sentEndOfFile = false; PTRACE(3, "Reader\tConstruct thread for reading " ); } @@ -51,7 +51,7 @@ PUDPSocket *_socket, PString _fileName) { - AudioBase::Initialise(_comms, _socket, _fileName, TRUE); + AudioBase::Initialise(_comms, _socket, _fileName, true); PTRACE(3, "Reader\tInitialise thread for reading " ); } @@ -61,7 +61,7 @@ data.SetSize(480); while (socket->IsOpen()) { - BOOL doThisRead = TRUE; + bool doThisRead = true; PINDEX delayTime = 30; //Default, delay 30ms. PINDEX lastReadCount = 0; @@ -70,16 +70,16 @@ EnactFileChange(); if (!audioFile.IsOpen()) { - doThisRead = FALSE; + doThisRead = false; } if (doThisRead) { if (audioFile.GetPosition() > (audioFile.GetDataLength() - 480)) { - doThisRead = FALSE; + doThisRead = false; if (!sentEndOfFile) { PTRACE(1, "Send end of file as we hav read the end of this file." << fileName); comms->SendEndOfFile(); - sentEndOfFile = TRUE; + sentEndOfFile = true; PTRACE(4, "End of this file, currently at " << audioFile.GetPosition() << " index, of a total of " <<audioFile.GetDataLength() << " bytes"); } @@ -89,11 +89,11 @@ if (doThisRead) { audioFile.Read(data.GetPointer(), data.GetSize()); if (audioFile.GetErrorCode() != PChannel::NoError) { - doThisRead = FALSE; + doThisRead = false; if (!sentEndOfFile) { PTRACE(1, "Send end of file as we had an error in read, " << audioFile.GetErrorText()); comms->SendEndOfFile(); - sentEndOfFile = TRUE; + sentEndOfFile = true; PTRACE(3, "AudioRead\t failed with error text " << audioFile.GetErrorText()); } } @@ -118,12 +118,12 @@ PTRACE(3, "End audio read thread"); } -BOOL AudioRead::EnactFileChange() +bool AudioRead::EnactFileChange() { - BOOL changedFile = AudioBase::EnactFileChange(); + bool changedFile = AudioBase::EnactFileChange(); if (changedFile) - sentEndOfFile = FALSE; + sentEndOfFile = false; return changedFile; } @@ -140,7 +140,7 @@ PUDPSocket * _socket, PString _fileName) { - AudioBase::Initialise(_comms, _socket, _fileName, FALSE); + AudioBase::Initialise(_comms, _socket, _fileName, false); PTRACE(3, "Writer\tInitialise thread for writing " ); } @@ -210,7 +210,7 @@ void AudioBase::Initialise(Comms * _comms, PUDPSocket *_socket, PString _fileName, - BOOL _isReadDir) + bool _isReadDir) { comms = _comms; socket = _socket; @@ -234,7 +234,7 @@ socket->Close(); //Not really required, but it will get it closed for sure. } -BOOL AudioBase::OpenWavFile(PString & newName) +bool AudioBase::OpenWavFile(PString & newName) { PWaitAndSignal m(audioFileLock); @@ -267,13 +267,13 @@ if (!audioFile.Open(newFile, openMode, openOptions)) { PTRACE(1, "Audio\tFAILED to open the file \"" << newFile << "\" for access"); - return FALSE; + return false; } if (!isReadDir) audioFile.SetFormat(PWAVFile::PCM_WavFile); - return TRUE; + return true; } void AudioBase::ProcessFile(const PString & _audioFile) @@ -284,12 +284,12 @@ incomingFile = _audioFile; } -BOOL AudioBase::EnactFileChange() +bool AudioBase::EnactFileChange() { PTRACE(6, "EnactFileChange. New=\"" << incomingFile << "\" and current =\"" << fileName << "\""); if (incomingFile.IsEmpty()) - return FALSE; + return false; PTRACE(1, "EnactFileChange. New=\"" << incomingFile << "\" Current =\"" << fileName << "\""); @@ -300,7 +300,7 @@ incomingFile = PString::Empty(); audioFile.SetPosition(0); - return TRUE; + return true; } PTRACE(1, "Change of file name, Close \"" << fileName << "\". Use\"" << incomingFile << "\""); @@ -321,14 +321,14 @@ /**At this point, comms has been initialised */ comms->SendEndOfFile(); - return TRUE; + return true; } PTRACE(3, "Success in open the file \"" << fileName << "\" to " << dirString); delay.Restart(); - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// Modified: sofaswitch/trunk/am/comms.cxx ============================================================================== --- sofaswitch/trunk/am/comms.cxx (original) +++ sofaswitch/trunk/am/comms.cxx Thu Mar 27 18:33:08 2008 @@ -46,7 +46,7 @@ { PTRACE(3, "Construct a Comms structrue " << GetOurId()); remoteController = PString(); - mediaStreamsStarted = FALSE; + mediaStreamsStarted = false; IncCountComms(); } @@ -77,7 +77,7 @@ PTRACE(3, "Comms::ProcessTransferUdp " << cmds); if (!mediaStreamsStarted) { - mediaStreamsStarted = TRUE; + mediaStreamsStarted = true; StartMediaStreams(); manager.CreateCall(sender, GetOurId()); } @@ -225,10 +225,10 @@ PTRACE(3, "We answer this call automatically, so thankyou"); } -BOOL Comms::SendDtmf(const PString & dtmfVals) +bool Comms::SendDtmf(const PString & dtmfVals) { PTRACE(1, "SEND DTMF not implemented, so " << dtmfVals << " not sent"); - return FALSE; + return false; } void Comms::SetReadFile(const PString & newReadFile) @@ -248,7 +248,7 @@ } -PString Comms::GetAudioFile(BOOL isReadFile) +PString Comms::GetAudioFile(bool isReadFile) { if (isReadFile) return audioReadFile; Modified: sofaswitch/trunk/am/main.cxx ============================================================================== --- sofaswitch/trunk/am/main.cxx (original) +++ sofaswitch/trunk/am/main.cxx Thu Mar 27 18:33:08 2008 @@ -86,7 +86,7 @@ if (args.HasOption('v')) { cout << GetName() - << " Version " << GetVersion(TRUE) + << " Version " << GetVersion(true) << " by " << GetManufacturer() << " on " << GetOSClass() << ' ' << GetOSName() << " (" << GetOSVersion() << '-' << GetOSHardware() << ")\n\n"; Modified: sofaswitch/trunk/am/manager.cxx ============================================================================== --- sofaswitch/trunk/am/manager.cxx (original) +++ sofaswitch/trunk/am/manager.cxx Thu Mar 27 18:33:08 2008 @@ -111,7 +111,7 @@ return NULL; } -BOOL Manager::WaitUntilSupervisorOk() +bool Manager::WaitUntilSupervisorOk() { return supervisor.WaitUntilInitialised(); } Modified: sofaswitch/trunk/console/main.cxx ============================================================================== --- sofaswitch/trunk/console/main.cxx (original) +++ sofaswitch/trunk/console/main.cxx Thu Mar 27 18:33:08 2008 @@ -24,7 +24,7 @@ : PThread(1000, NoAutoDeleteThread), lid(_lid) { comms = NULL; - keepGoing = TRUE; + keepGoing = true; } CommsLauncher::~CommsLauncher() @@ -35,7 +35,7 @@ void CommsLauncher::Terminate() { - keepGoing = FALSE; + keepGoing = false; delay.Signal(); } @@ -142,7 +142,7 @@ void UserInterface::EndNow() { - endNow = TRUE; + endNow = true; } @@ -201,7 +201,7 @@ #ifdef PMEMORY_CHECK "-setallocationbreakpoint:" #endif - , FALSE); + , false); #if PMEMORY_CHECK if (args.HasOption("setallocationbreakpoint")) @@ -241,7 +241,7 @@ cout << endl << "Product Name: " << (const char *)GetName() << endl << "Manufacturer: " << (const char *)GetManufacturer() << endl - << "Version : " << (const char *)GetVersion(TRUE) << endl + << "Version : " << (const char *)GetVersion(true) << endl << "System : " << (const char *)GetOSName() << " - " << (const char *)GetOSHardware() << " - " << (const char *)GetOSVersion() << endl Modified: sofaswitch/trunk/mcu/audio.cxx ============================================================================== --- sofaswitch/trunk/mcu/audio.cxx (original) +++ sofaswitch/trunk/mcu/audio.cxx Thu Mar 27 18:33:08 2008 @@ -51,7 +51,7 @@ AudioRead::AudioRead() - :AudioBase(TRUE) + :AudioBase(true) { PTRACE(3, "Reader\tConstruct thread for reading " ); } @@ -72,13 +72,13 @@ member->ReadAudio(data.GetPointer(), readSize); if (!socket->IsOpen()) { - keepGoing = FALSE; + keepGoing = false; break; } socket->Write(data.GetPointer(), readSize); if (socket->GetErrorCode() != PChannel::NoError) { - keepGoing = FALSE; + keepGoing = false; PTRACE(3, "AudioRead\tWrite to socket failed with error text " << socket->GetErrorText()); } else { PTRACE(3, "AudioRead\tWritten ok " << readSize << " bytes to socket"); @@ -101,7 +101,7 @@ ////////////////////////////////////////////////////////////////////// AudioWrite::AudioWrite() - : AudioBase(FALSE) + : AudioBase(false) { PTRACE(3, "Writer\tConstruct thread for writing " ); } @@ -121,14 +121,14 @@ while(keepGoing) { if (!socket->IsOpen()) { - keepGoing = FALSE; + keepGoing = false; break; } if (keepGoing){ socket->Read(data.GetPointer(), maxSize); if (socket->GetErrorCode() != PChannel::NoError) { - keepGoing = FALSE; + keepGoing = false; PTRACE(3, "AudioWrite\t failed with error text " << socket->GetErrorText()); } else { readSize = socket->GetLastReadCount(); @@ -151,13 +151,13 @@ ////////////////////////////////////////////////////////////// -AudioBase::AudioBase(BOOL _isReadDir) +AudioBase::AudioBase(bool _isReadDir) : PThread(1000, NoAutoDeleteThread) { countPackets = 0; isReadDir = _isReadDir; dirString = (isReadDir ? "reading" : "writing"); - keepGoing = TRUE; + keepGoing = true; manager = NULL; socket = NULL; } @@ -169,7 +169,7 @@ memberId = _memberId; } -BOOL AudioBase::IsInitialised() +bool AudioBase::IsInitialised() { return manager != NULL; } @@ -182,7 +182,7 @@ void AudioBase::Terminate() { - keepGoing = FALSE; + keepGoing = false; if (socket != NULL) socket->Close(); } Modified: sofaswitch/trunk/mcu/comms.cxx ============================================================================== --- sofaswitch/trunk/mcu/comms.cxx (original) +++ sofaswitch/trunk/mcu/comms.cxx Thu Mar 27 18:33:08 2008 @@ -46,7 +46,7 @@ : MessageFrame(_lid, 62000), manager(_manager) { PTRACE(3, "Construct a Comms structrue "); - mediaStreamsStarted = FALSE; + mediaStreamsStarted = false; IncCountComms(); } @@ -74,7 +74,7 @@ PTRACE(3, "Possible START the media Streams "); if (!mediaStreamsStarted) { - mediaStreamsStarted = TRUE; + mediaStreamsStarted = true; PTRACE(3, "START the media Streams "); manager.CreateCall(sender, GetOurId()); StartMediaStreams(); @@ -211,10 +211,10 @@ PTRACE(3, "We answer this call automatically, so thankyou"); } -BOOL Comms::SendDtmf(const PString & dtmfVals) +bool Comms::SendDtmf(const PString & dtmfVals) { PTRACE(1, "SEND DTMF not implemented, so " << dtmfVals << " not sent"); - return FALSE; + return false; } //////////////////////////////////////////////////////////////////////////////// Modified: sofaswitch/trunk/mcu/main.cxx ============================================================================== --- sofaswitch/trunk/mcu/main.cxx (original) +++ sofaswitch/trunk/mcu/main.cxx Thu Mar 27 18:33:08 2008 @@ -89,7 +89,7 @@ if (args.HasOption('v')) { cout << GetName() - << " Version " << GetVersion(TRUE) + << " Version " << GetVersion(true) << " by " << GetManufacturer() << " on " << GetOSClass() << ' ' << GetOSName() << " (" << GetOSVersion() << '-' << GetOSHardware() << ")\n\n"; Modified: sofaswitch/trunk/mcu/manager.cxx ============================================================================== --- sofaswitch/trunk/mcu/manager.cxx (original) +++ sofaswitch/trunk/mcu/manager.cxx Thu Mar 27 18:33:08 2008 @@ -154,7 +154,7 @@ PTRACE(3, "Manager\tFinish CollectGarbage"); } -BOOL Manager::WaitUntilSupervisorOk() +bool Manager::WaitUntilSupervisorOk() { return supervisor.WaitUntilInitialised(); } Modified: sofaswitch/trunk/mcu/member.cxx ============================================================================== --- sofaswitch/trunk/mcu/member.cxx (original) +++ sofaswitch/trunk/mcu/member.cxx Thu Mar 27 18:33:08 2008 @@ -78,14 +78,14 @@ IncCountMembers(); PTRACE(3, "Member\tConstructor " << *this); - keepGoing = TRUE; + keepGoing = true; bufferSize = PCM_BUFFER_SIZE; buffer = new BYTE[bufferSize]; memset(buffer, 0, bufferSize); currentWriteIndex = 0; - isClearing = FALSE; + isClearing = false; } Member::~Member() @@ -198,10 +198,10 @@ participants.ReadAndMixAudio(dataPtr, readSize); } -BOOL Member::ReadAndMixAudio(BYTE * data, PINDEX readSize, PINDEX ¤tReadIndex) +bool Member::ReadAndMixAudio(BYTE * data, PINDEX readSize, PINDEX ¤tReadIndex) { if (!keepGoing) - return FALSE; + return false; if (readSize == 0) { PTRACE(3, "Mixer\tNo data to read"); @@ -274,7 +274,7 @@ PWaitAndSignal m(clearMutex); if (isClearing) return; - isClearing = TRUE; + isClearing = true; } PTRACE(3, *this << " is now doing a CLEAR for sure."); Modified: sofaswitch/trunk/mcu/participant.cxx ============================================================================== --- sofaswitch/trunk/mcu/participant.cxx (original) +++ sofaswitch/trunk/mcu/participant.cxx Thu Mar 27 18:33:08 2008 @@ -49,7 +49,7 @@ { SetKey (srcMemberId + PString("-->") + dstMemberId); SetMatchingKey(dstMemberId + PString("-->") + srcMemberId); - isClearing = FALSE; + isClearing = false; srcMemberPtr = manager.activeMembers.FindWithLock(srcMemberId, PSafeReadOnly); srcMemberPtr->SafeReference(); @@ -79,7 +79,7 @@ strm << "(" << GetKey() << ")"; } -BOOL Participant::ReadAndMixAudio(BYTE * data, PINDEX amount) +bool Participant::ReadAndMixAudio(BYTE * data, PINDEX amount) { return dstMemberPtr->ReadAndMixAudio(data, amount, currentReadIndex); } @@ -102,7 +102,7 @@ PWaitAndSignal m(clearMutex); if (isClearing) return; - isClearing = TRUE; + isClearing = true; } PTRACE(3, *this << " commence CLEAR now"); @@ -146,7 +146,7 @@ countEntries.SetValue(0); SetAutoDeleteObjects(); - shuttingDown = FALSE; + shuttingDown = false; PString name = psprintf("garbage %x", this); PThread::Create(PCREATE_NOTIFIER(GarbageMain), 0, PThread::AutoDeleteThread, @@ -186,7 +186,7 @@ loops++; PThread::Sleep(300); if ((loops % 6) == 0) - EmptyParticipantDict(TRUE); + EmptyParticipantDict(true); } } @@ -210,7 +210,7 @@ void ParticipantDict::ReadAndMixAudio(BYTE *data, PINDEX amount) { for (PSafePtr<Participant> participant(*this, PSafeReadOnly); participant != NULL; ++participant) { - BOOL readStatus = participant->ReadAndMixAudio(data, amount); + bool readStatus = participant->ReadAndMixAudio(data, amount); if (!readStatus) participant->Clear(); } @@ -235,13 +235,13 @@ } } -void ParticipantDict::EmptyParticipantDict(BOOL doForce) +void ParticipantDict::EmptyParticipantDict(bool doForce) { { PWaitAndSignal m(addNewParticipantMutex); if (shuttingDown && (!doForce)) return; - shuttingDown = TRUE; + shuttingDown = true; } PTRACE(3, "Empty participantDict for Dictionary of \"" << *this << "\""); Modified: sofaswitch/trunk/server/main.cxx ============================================================================== --- sofaswitch/trunk/server/main.cxx (original) +++ sofaswitch/trunk/server/main.cxx Thu Mar 27 18:33:08 2008 @@ -95,7 +95,7 @@ cout << endl << "Product Name: " << (const char *)GetName() << endl << "Manufacturer: " << (const char *)GetManufacturer() << endl - << "Version : " << (const char *)GetVersion(TRUE) << endl + << "Version : " << (const char *)GetVersion(true) << endl << "System : " << (const char *)GetOSName() << '-' << (const char *)GetOSHardware() << ' ' << (const char *)GetOSVersion() << endl @@ -130,9 +130,9 @@ { connectionCount.SetValue(0); bogusCount.SetValue(0); - keepRunning = TRUE; + keepRunning = true; connectionsActive.SetAutoDeleteObjects(); - isQuitting = FALSE; + isQuitting = false; } Manager::~Manager() @@ -211,7 +211,7 @@ return; } PTRACE(3, "Stop all incoming connection requests "); - keepRunning = FALSE; + keepRunning = false; PTRACE(3, "KeepRunning flag turned OFF"); listener.Close(); PTRACE(3, "listener closed"); @@ -223,7 +223,7 @@ if (isQuitting) return; PTRACE(3, "START of QuitNow process"); - isQuitting = TRUE; + isQuitting = true; PThread::Create(PCREATE_NOTIFIER(DoQuitNow), 30000, PThread::AutoDeleteThread, @@ -340,7 +340,7 @@ globalUniqueId = GetTcpConnectionName(); // globalUniqueId = PString(PRandom::Number()); - isClearing = FALSE; + isClearing = false; incomingMessages = NULL; reportReadMessages = ServerProcess::Current().ReportReadMessages(); @@ -433,7 +433,7 @@ PWaitAndSignal m(clearMutex); if (isClearing) return; - isClearing = TRUE; + isClearing = true; } // Add a reference for the thread we are about to start SafeReference(); @@ -484,11 +484,11 @@ PTRACE(3, "This connection " << *this << " stopped"); } -BOOL TcpConnection::IsRunning() +bool TcpConnection::IsRunning() { PWaitAndSignal m(incomingLock); if (incomingMessages == NULL) - return FALSE; + return false; return !incomingMessages->IsTerminated(); } @@ -737,13 +737,13 @@ return; } -BOOL TcpConnection::ProcessedAsServerCommand(const PString & txt) +bool TcpConnection::ProcessedAsServerCommand(const PString & txt) { if (txt *= PString("quitnow")) { PTRACE(3, "QUIT now as have read in the command \"" << txt << "\""); messagesSocket.Close(); manager.QuitNow(); - return TRUE; + return true; } if (txt.Left(6) *= PString("WhoAmI")){ @@ -752,13 +752,13 @@ memcpy(answer.GetPointer(), sourceId.GetPointer(), sourceId.GetLength()); answer[sourceId.GetLength()] = 0; SendThisMessage(answer); - return TRUE; + return true; } if (txt.Left(19) *= PString("AdviseOnTermination")) { PStringArray msg = txt.Tokenise(" "); adviseOnTermination = msg[1]; - return TRUE; + return true; } if (txt.Left(6) *= PString("status")) { @@ -776,7 +776,7 @@ memcpy(answer.GetPointer(), msg.GetPointer(), msg.GetLength()); answer[msg.GetLength()] = 0; SendThisMessage(answer); - return TRUE; + return true; } #ifdef PMEMORY_CHECK @@ -791,7 +791,7 @@ PFile::Create + PFile::Truncate)) { PTRACE(3, "Failed to open the specified file " << fileName << " to dump memory to"); - return TRUE; + return true; } PMemoryHeap::DumpStatistics(); @@ -800,7 +800,7 @@ PMemoryHeap::DumpObjectsSince(0, result); outputFile.WriteLine(result); outputFile.Close(); - return TRUE; + return true; } #endif @@ -816,10 +816,10 @@ memcpy(answer.GetPointer(), msg.GetPointer(), msg.GetLength()); answer[msg.GetLength()] = 0; SendThisMessage(answer); - return TRUE; + return true; } - return FALSE; + return false; } void TcpConnection::SendThisMessage(PBYTEArray & message) @@ -847,7 +847,7 @@ { DisallowDeleteObjects(); - endNow = FALSE; + endNow = false; createNewTcpConnections = PThread::Create(PCREATE_NOTIFIER(FillListWithTcpConnections), 0, @@ -867,7 +867,7 @@ void TcpConnectionList::CloseDown() { PTRACE(3, "TcpConnectionList::CloseDown is starting"); - endNow = TRUE; + endNow = true; checkListContents.Signal(); { PWaitAndSignal m(mutexNewTcpConnections); Modified: sofaswitch/trunk/sofa/src/messages.cxx ============================================================================== --- sofaswitch/trunk/sofa/src/messages.cxx (original) +++ sofaswitch/trunk/sofa/src/messages.cxx Thu Mar 27 18:33:08 2008 @@ -89,7 +89,7 @@ remoteServer = lid.GetServer(); PTRACE(5, "Constructor for MessageFrame " << ourId); - keepGoing = TRUE; + keepGoing = true; availableCommands += PString(/* 0 */ "HANGUP"); availableCommands += PString(/* 1 */ "CALLNODE"); @@ -153,14 +153,14 @@ messagesSocket.Close(); } -BOOL MessageFrame::WaitUntilInitialised() +bool MessageFrame::WaitUntilInitialised() { PTRACE(3, "WaitForInitialised start"); threadRunning.Wait(); if (!keepGoing) { PTRACE(3, "Thread " << GetOurId() << " failed as thread never started"); PTRACE(3, "Thread " << GetOurId() << " has terminated."); - return FALSE; + return false; } PTRACE(5, "WaitForInitialised start wait for connection"); @@ -168,7 +168,7 @@ if (!keepGoing) { PTRACE(3, "Thread " << GetOurId() << " failed as we could not connect"); PTRACE(3, "Thread " << GetOurId() << " has terminated."); - return FALSE; + return false; } PTRACE(5, "WaitForInitialised start wait for source id"); @@ -176,17 +176,17 @@ if (!keepGoing) { PTRACE(3, "Thread " << GetOurId() << " failed as no source id received"); PTRACE(3, "Thread " << GetOurId() << " has terminated."); - return FALSE; + return false; } PTRACE(5, "WaitForInitialised start all done ok."); PTRACE(4, "Thread " << GetOurId() << " is initialised ok"); - return TRUE; + return true; } void MessageFrame::Terminate() { - keepGoing = FALSE; + keepGoing = false; audioSocket.Close(); CloseMessagesSocket(); threadRunning.Signal(); @@ -227,7 +227,7 @@ if (messagesSocket.GetErrorCode() != PChannel::NoError) { PTRACE(3, "error fail warning GIVE UP on this link. After 5 tries, could not get in." ); PTRACE(3, "multiple efforts to connect aborted " ); - keepGoing = FALSE; + keepGoing = false; goodConnection.Signal(); return; } @@ -295,7 +295,7 @@ PTRACE(3, "Error on sending " << ourId << " to server"); PTRACE(3, "Wrote " << writeSize << " bytes"); PTRACE(3, "Error text is " << messagesSocket.GetErrorText()); - keepGoing = FALSE; + keepGoing = false; writeSize = 1; } writeMessageLock.Signal(); @@ -343,7 +343,7 @@ SilentlyEndAll(); CloseMessagesSocket(); - keepGoing = FALSE; + keepGoing = false; continue; } @@ -351,7 +351,7 @@ PTRACE(3, "Failed in read from comms socket, code is " << messagesSocket.GetErrorText()); PTRACE(3, "End Process Incoming Messages as we had a read error."); - keepGoing = FALSE; + keepGoing = false; continue; } else { ProcessIncomingMessages(data, size); @@ -444,7 +444,7 @@ binary[binary.GetSize() - 1] = 0; writeMessageLock.Wait(); - if (messagesSocket.Write(binary.GetPointer(), binary.GetSize()) == FALSE) { + if (messagesSocket.Write(binary.GetPointer(), binary.GetSize()) == false) { PTRACE(3, "Failed to send message " << _message << " to " << dest << ". error was " << messagesSocket.GetErrorText()); } writeMessageLock.Signal(); @@ -452,12 +452,12 @@ void MessageFrame::ProcessMessage(PString message, PString sender) { - PStringArray cmds = message.Tokenise(" ", FALSE); + PStringArray cmds = message.Tokenise(" ", false); if (cmds[0] *= availableCommands[0]) { PTRACE(4, "ProcessHangup " << cmds[0]); if (OkToHangup()) { - keepGoing = FALSE; + keepGoing = false; ProcessHangup(cmds, sender); CloseMessagesSocket(); } else { @@ -524,7 +524,7 @@ if (cmds[0] *= availableCommands[10]) { PTRACE(4, "ProcessQuitNow " << cmds[0]); if (OkToQuitNow()) { - keepGoing = FALSE; + keepGoing = false; ProcessQuitNow(cmds, sender); CloseMessagesSocket(); } else { @@ -702,8 +702,7 @@ PString transfer = cmds[0] + PString(" ") + cmds[1] + PString(" "); transfer += addr.AsString() + PString(":") + PString(portNo); if (cmds.GetSize() == 3) { - PTRACE(3, "have received a transfer command from " << sender); - PTRACE(3, "Now we send the concluding message to " << sender); + PTRACE(7, "have received a transfer command from " << sender); destination = sender; transfer += " done"; } @@ -712,7 +711,7 @@ if (cmds.GetSize() == 2) { /**We have receive a command, "transferudp destination" */ - PTRACE(3, "finished " << cmds[0]); + PTRACE(7, "finished " << cmds[0]); return; } @@ -739,7 +738,7 @@ if (!SetSendToAddress(addr, port)) { PTRACE(3, cmds[0] << PString(" FAILED to specify a valid destination address ") << cmds[2] << PString("==not avail")); } - PTRACE(3, "Set send to address of " << addr << " : " << port); + PTRACE(8, "Set send to address of " << addr << " : " << port); } @@ -756,26 +755,26 @@ SendThisMessageTo(reply, sender); } -BOOL MessageFrame::GetLocalAddress(PIPSocket::Address &address, PINDEX &portNo) +bool MessageFrame::GetLocalAddress(PIPSocket::Address &address, PINDEX &portNo) { PIPSocket::InterfaceTable table; PIPSocket::Address addr; if (PIPSocket::GetInterfaceTable (table) ) for (PINDEX i = 0; i < table.GetSize(); i++) { addr = table[i].GetAddress(); - PTRACE(6, "Possible Local address is " << addr); + PTRACE(8, "Possible Local address is " << addr); if (addr.IsLoopback()) continue; - PTRACE(3, "Select Local address of " << addr); + PTRACE(8, "Select Local address of " << addr); address = addr; portNo = audioSocket.GetPort(); - PTRACE(3, "Select local port of " << portNo); - return TRUE; + PTRACE(8, "Select local port of " << portNo); + return true; } PTRACE(3, "Failed to do :GetLocalAddress"); - return FALSE; + return false; } void MessageFrame::ProcessSendDtmf(PStringArray &cmds, PString & sender) @@ -848,39 +847,39 @@ } #endif -BOOL MessageFrame::SendDtmf(const PString & dtmfVals) +bool MessageFrame::SendDtmf(const PString & dtmfVals) { PTRACE(1, "Send DTMF of " << dtmfVals << " is not implemented - and it should be"); - return FALSE; + return false; } -BOOL MessageFrame::QueryLocalAddress(PIPSocket::Address & addr, PINDEX & portNo) +bool MessageFrame::QueryLocalAddress(PIPSocket::Address & addr, PINDEX & portNo) { PTRACE(3, "Query local address " << GetOurId()); return GetLocalAddress(addr, portNo); } -BOOL MessageFrame::QuerySendToAddress(PIPSocket::Address & addr, PINDEX & portNo) +bool MessageFrame::QuerySendToAddress(PIPSocket::Address & addr, PINDEX & portNo) { PTRACE(3, "Query sendto address " << GetOurId()); return GetSendToAddress(addr, portNo); } -BOOL MessageFrame::SetSendToAddress(PIPSocket::Address & addr, PINDEX & portNo) +bool MessageFrame::SetSendToAddress(PIPSocket::Address & addr, PINDEX & portNo) { - PTRACE(3, "Set sendto address " << addr << ":" << PString(portNo)); + PTRACE(8, "Set sendto address " << addr << ":" << PString(portNo)); audioSocket.SetSendAddress(addr, portNo); - return TRUE; + return true; } -BOOL MessageFrame::GetSendToAddress(PIPSocket::Address & addr, PINDEX & portNo) +bool MessageFrame::GetSendToAddress(PIPSocket::Address & addr, PINDEX & portNo) { WORD remotePort; audioSocket.GetSendAddress(addr, remotePort); portNo = remotePort; - return TRUE; + return true; } void MessageFrame::SetWriteFile(const PString & newWriteFile) Modified: sofaswitch/trunk/sofa/src/messlist.cxx ============================================================================== --- sofaswitch/trunk/sofa/src/messlist.cxx (original) +++ sofaswitch/trunk/sofa/src/messlist.cxx Thu Mar 27 18:33:08 2008 @@ -157,7 +157,7 @@ : lid(_lid) { SetPreAllocatedSize(10); - keepGoing = TRUE; + keepGoing = true; MessageFrameList::Initialise(); makeNewMessageFrame = PThread::Create(PCREATE_NOTIFIER(MakeNewMessageFrames), 0, @@ -208,7 +208,7 @@ void MessageFrameListProvider::Terminate() { - keepGoing = FALSE; + keepGoing = false; makeAnother.Signal(); } @@ -365,16 +365,16 @@ data.AppendString(newString); } -BOOL NodeRequest::GetRequest(PString & nextString) +bool NodeRequest::GetRequest(PString & nextString) { PWaitAndSignal m(accessMutex); if (data.IsEmpty()) { PTRACE(3, "No pending requests for a node. "); - return FALSE; + return false; } nextString = data[0]; data.RemoveAt(0); PTRACE(3, "Request from " << nextString << " for a node"); - return TRUE; + return true; } Modified: sofaswitch/trunk/sound/audio.cxx ============================================================================== --- sofaswitch/trunk/sound/audio.cxx (original) +++ sofaswitch/trunk/sound/audio.cxx Thu Mar 27 18:33:08 2008 @@ -48,7 +48,7 @@ countPackets++; } else { PTRACE(3, "Detected the closure of our udp socket, so end"); - keepGoing = FALSE; + keepGoing = false; } if (!keepGoing) { @@ -98,7 +98,7 @@ << readSize << " bytes"); if (!socket.IsOpen()) { PTRACE(3, "Detected the closure of our udp socket, so end"); - keepGoing = FALSE; + keepGoing = false; continue; } @@ -169,7 +169,7 @@ sound(_sound) { countPackets = 0; - keepGoing = TRUE; + keepGoing = true; currentVolume = 90; } @@ -182,7 +182,7 @@ void TestAudio::Terminate() { PTRACE(5, "Terminate of TestAudio class now"); - keepGoing = FALSE; + keepGoing = false; socket.Close(); } Modified: sofaswitch/trunk/sound/comms.cxx ============================================================================== --- sofaswitch/trunk/sound/comms.cxx (original) +++ sofaswitch/trunk/sound/comms.cxx Thu Mar 27 18:33:08 2008 @@ -43,8 +43,8 @@ tar(* new TestAudioRead(audioSocket, _soundRecorder)), taw(* new TestAudioWrite(audioSocket, _soundPlayer)) { - stopByExit = FALSE; - stopByHangup = TRUE; + stopByExit = false; + stopByHangup = true; } Comms::~Comms() @@ -74,7 +74,7 @@ void Comms::WaitForTermination() { - BOOL keepGoing = TRUE; + bool keepGoing = true; while (keepGoing) { { PTRACE(6, "Comms\tWaitForTermination"); @@ -87,7 +87,7 @@ MessageFrame::WaitForTermination(); } -PString Comms::AlterVolume(PSoundChannel::Directions dir, BOOL doRaise) +PString Comms::AlterVolume(PSoundChannel::Directions dir, bool doRaise) { PString newVolume; @@ -111,10 +111,10 @@ } -BOOL Comms::SendDtmf(const PString & dtmfVals) +bool Comms::SendDtmf(const PString & dtmfVals) { cerr << "At " << PTime() << " received DTMF from the controller of ---->>>|||" << dtmfVals << endl; - return TRUE; + return true; } @@ -128,7 +128,7 @@ void Comms::ProcessHangup(PStringArray &cmds, PString & sender) { - stopByExit = TRUE; + stopByExit = true; SetRemoteController(sender); Terminate(); } @@ -189,7 +189,7 @@ void Comms::ProcessQuitNow(PStringArray &cmds, PString & sender) { - stopByExit = TRUE; + stopByExit = true; SetRemoteController(sender); Terminate(); } Modified: sofaswitch/trunk/sound/main.cxx ============================================================================== --- sofaswitch/trunk/sound/main.cxx (original) +++ sofaswitch/trunk/sound/main.cxx Thu Mar 27 18:33:08 2008 @@ -32,7 +32,7 @@ player(_player), recorder(_recorder) { - endNow = FALSE; + endNow = false; Resume(); } @@ -99,7 +99,7 @@ break; case 'x' : case 'q' : { - endNow = TRUE; + endNow = true; PTRACE(3, "End this program now "); } break; @@ -124,7 +124,7 @@ void UserInterface::Terminate() { - endNow = TRUE; + endNow = true; } ///////////////////////////////////////////////////////////////////////////// @@ -179,7 +179,7 @@ cout << endl << "Product Name: " << (const char *)GetName() << endl << "Manufacturer: " << (const char *)GetManufacturer() << endl - << "Version : " << (const char *)GetVersion(TRUE) << endl + << "Version : " << (const char *)GetVersion(true) << endl << "System : " << (const char *)GetOSName() << '-' << (const char *)GetOSHardware() << ' ' << (const char *)GetOSVersion() << endl @@ -314,7 +314,7 @@ } -BOOL Audio::OpenSoundDevice(PSoundChannel & sound, PSoundChannel::Directions dir) +bool Audio::OpenSoundDevice(PSoundChannel & sound, PSoundChannel::Directions dir) { PString name = (dir == PSoundChannel::Recorder ? "recorder" : "player"); @@ -328,12 +328,12 @@ cerr << "TestAudio:: Failed to open sound Playing/Recording device. Exit" << endl; PTRACE(3, "TestAudio\tFailed to open device for " << name << " and device name of " << devName); - return FALSE; + return false; } #if 0 if (!sound.IsOpen()) { PTRACE(3, "just opened the device, but it is not open "); - return FALSE; + return false; } #endif PINDEX currentVolume = 90; @@ -343,13 +343,13 @@ #if 0 if (sound.IsOpen()) { PTRACE(3, "End of OpenAudio, sound device is opened just fine"); - return TRUE; + return true; } else { PTRACE(3, "End of OpenAudio, but the sound device is closed"); - return FALSE; + return false; } #endif - return TRUE; + return true; } //////////////////////////////////////////////////////////////////////////////// Modified: sofaswitch/trunk/voip/comms.cxx ============================================================================== --- sofaswitch/trunk/voip/comms.cxx (original) +++ sofaswitch/trunk/voip/comms.cxx Thu Mar 27 18:33:08 2008 @@ -185,28 +185,28 @@ } remoteController = sender; - BOOL doAnswer = FALSE; - BOOL doAnswerDefined= FALSE; + bool doAnswer = false; + bool doAnswerDefined= false; if (cmds.GetSize() > 1) { if ((cmds[1] *= "true") || (cmds[1] *= "yes") || (cmds[1] *= "accept")) { - doAnswer = TRUE; - doAnswerDefined = TRUE; + doAnswer = true; + doAnswerDefined = true; } if ((cmds[1] *= "false") || (cmds[1] *= "no") || (cmds[1] *= "reject")) { - doAnswer = FALSE; - doAnswerDefined = TRUE; + doAnswer = false; + doAnswerDefined = true; } } if (cmds.GetSize() == 1) { - doAnswer = TRUE; - doAnswerDefined = TRUE; + doAnswer = true; + doAnswerDefined = true; } if (!doAnswerDefined) { PTRACE(0, "Answer command did not correctly specify what to do "); PTRACE(0, "The command \"" << cmds[1] << "\" was not understood -- sorry"); - doAnswer = FALSE; + doAnswer = false; } PString thisToken; @@ -218,7 +218,7 @@ if(!doAnswer) { PTRACE(3, "Reject this call"); - manager.AcceptThisCall(thisToken, FALSE); + manager.AcceptThisCall(thisToken, false); PWaitAndSignal m(opalCallLock); if (myOpalCall != NULL) myOpalCall->Clear(); @@ -229,16 +229,16 @@ manager.AcceptThisCall(thisToken); } -BOOL Comms::SendDtmf(const PString & dtmfValue) +bool Comms::SendDtmf(const PString & dtmfValue) { PWaitAndSignal m(opalCallLock); if (myOpalCall == NULL) { PTRACE(3, "WE are not in a call, cannot send dtmf " << dtmfValue); - return FALSE; + return false; } myOpalCall->SendThisDtmf(dtmfValue); - return TRUE; + return true; } PUDPSocket & Comms::GetAudioSocket() Modified: sofaswitch/trunk/voip/jocall.cxx ============================================================================== --- sofaswitch/trunk/voip/jocall.cxx (original) +++ sofaswitch/trunk/voip/jocall.cxx Thu Mar 27 18:33:08 2008 @@ -65,7 +65,7 @@ IncMyOpalCall(); PTRACE(3, "MyOpalCall\tCreated a new MyOpalCall. The opal call token is " << myToken); - sentEstablishedMessage = FALSE; + sentEstablishedMessage = false; } #ifdef _MSC_VER @@ -87,15 +87,15 @@ DecMyOpalCall(); } -BOOL MyOpalCall::OnSetUp(OpalConnection & connection) +bool MyOpalCall::OnSetUp(OpalConnection & connection) { PTRACE(3, "Call\tOnSetUp " << connection); - BOOL ok = FALSE; + bool ok = false; if (!LockReadWrite()) { PTRACE(3, "failed to lock the read write"); - return FALSE; + return false; } partyA = connection.GetRemotePartyName(); @@ -116,27 +116,27 @@ PTRACE(3, "Now do a setup"); if (conn->SetUpConnection()) { PTRACE(3, "set up the connection ok "); - ok = TRUE; + ok = true; } } } PTRACE(2, "finished onsetup of connection/call and it gave " << 1); - return TRUE; + return true; } -BOOL MyOpalCall::OnAlerting(OpalConnection & connection) +bool MyOpalCall::OnAlerting(OpalConnection & connection) { PTRACE(2, "On alerting of connection. " << connection.GetToken()); return OpalCall::OnAlerting(connection); } -BOOL MyOpalCall::OnConnected(OpalConnection & connection) +bool MyOpalCall::OnConnected(OpalConnection & connection) { PTRACE(2, "On Connected of connection. " << connection.GetToken()); return OpalCall::OnConnected(connection); } -BOOL MyOpalCall::OnEstablished(OpalConnection & connection) +bool MyOpalCall::OnEstablished(OpalConnection & connection) { PTRACE(2, "On Established of connection. " << connection.GetToken()); @@ -145,7 +145,7 @@ if (PIsDescendant(&connection, OpalUdpSsConnection)) { comms.AdviseCallCreation(); - sentEstablishedMessage = TRUE; + sentEstablishedMessage = true; PTRACE(3, "We have just advised that the call was created "); } @@ -192,20 +192,30 @@ SendThisMessageTo(message, remoteController); } -void MyOpalCall::AcceptThisCall(BOOL doAccept) +void MyOpalCall::AcceptThisCall(bool doAccept) { - PTRACE(3, "Process request to accept this call"); + SafeReference(); + acceptingThisCall = doAccept; + PStringStream threadName; + threadName << "Answer call " << *this; + PThread::Create(PCREATE_NOTIFIER(AcceptThisCallMain), 20000, PThread::AutoDeleteThread, PThread::NormalPriority, threadName); +} + +void MyOpalCall::AcceptThisCallMain(PThread &, INT) +{ + PTRACE(3, "Process request to accept this call " << *this); for (PSafePtr<OpalConnection> conn(connectionsActive, PSafeReadOnly); conn != NULL; ++conn) { PSafePtr<OpalUdpSsConnection> connection; connection = PSafePtrCast<OpalConnection, OpalUdpSsConnection>(conn); if (connection == NULL) { - if (doAccept) + if (acceptingThisCall) conn->AnsweringCall(OpalConnection::AnswerCallNow); else conn->AnsweringCall(OpalConnection::AnswerCallDenied); PTRACE(3, "Finished Answering the call for " << conn->GetToken()); } } + SafeDereference(); } void MyOpalCall::CloseThisId() Modified: sofaswitch/trunk/voip/jocall.h ============================================================================== --- sofaswitch/trunk/voip/jocall.h (original) +++ sofaswitch/trunk/voip/jocall.h Thu Mar 27 18:33:08 2008 @@ -170,6 +170,18 @@ for permission to answer it */ void QueryAcceptIncomingCall(const PString & remoteController, const PString &remoteParty); + + +#ifdef DOC_PLUS_PLUS + /**A short lived thread which handles the answering of this call. This + thread is required to do this - otherwise the message handling thread of + the comms interface does the work of answering the call. For voip + protocols like iax2, this is to much work for the comms thread to do. */ + virtual void AcceptThisCallMain(PThread &, INT); +#else + PDECLARE_NOTIFIER(PThread, MyOpalCall, AcceptThisCallMain); +#endif + protected: /**Link to our controll manager */ @@ -187,6 +199,10 @@ established. In other words, only tell the remote controller once that we have been established.*/ BOOL sentEstablishedMessage; + + /**Simple short lived flag which is used so the thread (which answers the + call) can correctly answer yes/no */ + BOOL acceptingThisCall; }; Modified: sofaswitch/trunk/voip/main.cxx ============================================================================== --- sofaswitch/trunk/voip/main.cxx (original) +++ sofaswitch/trunk/voip/main.cxx Thu Mar 27 18:33:08 2008 @@ -80,7 +80,7 @@ void VoipProcess::Main() { cout << GetName() - << " Version " << GetVersion(TRUE) + << " Version " << GetVersion(true) << " by " << GetManufacturer() << " on " << GetOSClass() << ' ' << GetOSName() << " (" << GetOSVersion() << '-' << GetOSHardware() << ")\n\n"; @@ -145,7 +145,7 @@ #if OPAL_IAX2 "X-no-iax2." #endif - , FALSE); + , false); if (args.HasOption('h')) { Modified: sofaswitch/trunk/voip/mymanager.cxx ============================================================================== --- sofaswitch/trunk/voip/mymanager.cxx (original) +++ sofaswitch/trunk/voip/mymanager.cxx Thu Mar 27 18:33:08 2008 @@ -123,11 +123,11 @@ DecMyManager(); } -BOOL MyManager::Initialise(PArgList & args) +bool MyManager::Initialise(PArgList & args) { if (!supervisor.WaitUntilInitialised()) { cerr << "The supervisor could not connect to the remote server. Sorry." << endl; - return FALSE; + return false; } @@ -209,7 +209,7 @@ msg << "IP Type Of Service bits must be 0 to 255." << tos << " is invalid"; cerr << msg << endl; PTRACE(1, msg); - return FALSE; + return false; } SetRtpIpTypeofService(tos); } @@ -253,7 +253,7 @@ unsigned initialBandwidth = args.GetOptionString('b').AsUnsigned()*100; if (initialBandwidth == 0) { cerr << "Illegal bandwidth specified." << endl; - return FALSE; + return false; } h323EP->SetInitialBandwidth(initialBandwidth); } @@ -271,7 +271,7 @@ if (!h323EP->StartListeners(listeners)) { cerr << "Could not open any H.323 listener from " << setfill(',') << listeners << endl; - return FALSE; + return false; } cout << "H.323 listeners: " << setfill(',') << h323EP->GetListeners() << setfill(' ') << endl; @@ -316,7 +316,7 @@ } cerr << '.' << endl; if (args.HasOption("require-gatekeeper")) - return FALSE; + return false; } } } @@ -370,7 +370,7 @@ if (!sipEP->StartListeners(listeners)) { cerr << "Could not open any SIP listener from " << setfill(',') << listeners << endl; - return FALSE; + return false; } if (args.HasOption('r')) { @@ -393,7 +393,7 @@ if (args.HasOption('d')) { if (!SetRouteTable(args.GetOptionString('d').Lines())) { cerr << "No legal entries in dial peer!" << endl; - return FALSE; + return false; } } @@ -431,11 +431,11 @@ #endif - return TRUE; + return true; } -BOOL MyManager::OnIncomingConnection( +bool MyManager::OnIncomingConnection( OpalConnection & connection, unsigned options, OpalConnection::StringOptions * stringOptions @@ -458,17 +458,17 @@ return OpalManager::OnIncomingConnection(connection, options, stringOptions); } -void MyManager::AcceptThisCall(const PString & uniqueCallId, BOOL doAccept) +void MyManager::AcceptThisCall(const PString & uniqueCallId, bool doAccept) { PTRACE(3, "Accept this call if we can find it " << uniqueCallId); - OpalCall *oCall = FindCallWithLock(uniqueCallId); + PSafePtr<OpalCall> oCall = FindCallWithLock(uniqueCallId); if (oCall == NULL) { PTRACE(3, "Failed to accept call with a token of " << uniqueCallId); return; } - MyOpalCall *call; - call = PSafePtrCast<OpalCall, MyOpalCall>(oCall); + + PSafePtr<MyOpalCall> call = PSafePtrCast<OpalCall, MyOpalCall>(oCall); PTRACE(3, "Accept/Reject this call as we have found it " << uniqueCallId); call->AcceptThisCall(doAccept); } @@ -604,20 +604,20 @@ supervisor.SendThisMessageTo(PString("REQUESTNEWID ") + c->GetOurId(), requester); } -BOOL MyManager::SendThisDtmf(const PString & token, const PString & thisDtmf) +bool MyManager::SendThisDtmf(const PString & token, const PString & thisDtmf) { PTRACE(3, "MyManager\tSend this dtmf " << thisDtmf << " to call " << token); OpalCall *oCall = FindCallWithLock(token); if (oCall == NULL) { PTRACE(3, "MyManager\tSend this dtmf " << thisDtmf << " to call " << token << " FAILED - call not found"); - return FALSE; + return false; } MyOpalCall *call; call = PSafePtrCast<OpalCall, MyOpalCall>(oCall); call->SendThisDtmf(thisDtmf); PTRACE(3, "MyManager\tSend this dtmf " << thisDtmf << " to call " << token << " sent ok"); - return TRUE; + return true; } @@ -785,12 +785,12 @@ } -BOOL MyManager::OnOpenMediaStream(OpalConnection & connection, +bool MyManager::OnOpenMediaStream(OpalConnection & connection, OpalMediaStream & stream) { if (!OpalManager::OnOpenMediaStream(connection, stream)) { PTRACE(1, "Failed to open a media stream"); - return FALSE; + return false; } #if 0 cout << "Started media stream "; @@ -805,7 +805,7 @@ cout << endl; #endif - return TRUE; + return true; } Modified: sofaswitch/trunk/voip/udpconnection.cxx ============================================================================== --- sofaswitch/trunk/voip/udpconnection.cxx (original) +++ sofaswitch/trunk/voip/udpconnection.cxx Thu Mar 27 18:33:08 2008 @@ -89,29 +89,29 @@ } -BOOL OpalUdpSsConnection::SetUpConnection() +bool OpalUdpSsConnection::SetUpConnection() { // Check if we are A-Party in thsi call, so need to do things differently if (ownerCall.GetConnection(0) == this) { phase = SetUpPhase; if (!OnIncomingConnection(0, NULL)) { Release(EndedByCallerAbort); - return FALSE; + return false; } PTRACE(3, "PCSS\tOutgoing call routed to " << ownerCall.GetPartyB() << " for " << *this); if (!ownerCall.OnSetUp(*this)) { Release(EndedByNoAccept); - return FALSE; + return false; } - return TRUE; + return true; } { PSafePtr<OpalConnection> otherConn = ownerCall.GetOtherPartyConnection(*this); if (otherConn == NULL) - return FALSE; + return false; remotePartyName = otherConn->GetRemotePartyName(); remotePartyAddress = otherConn->GetRemotePartyAddress(); @@ -126,7 +126,7 @@ } -BOOL OpalUdpSsConnection::SetAlerting(const PString & calleeName, BOOL) +bool OpalUdpSsConnection::SetAlerting(const PString & calleeName, bool) { PTRACE(3, "UdpSs\tSetAlerting(" << calleeName << ')'); phase = AlertingPhase; @@ -135,7 +135,7 @@ } -BOOL OpalUdpSsConnection::SetConnected() +bool OpalUdpSsConnection::SetConnected() { PTRACE(3, "UdpSs\tSetConnected()"); @@ -147,7 +147,7 @@ OnEstablished(); } - return TRUE; + return true; } void OpalUdpSsConnection::OnEstablished() @@ -180,7 +180,7 @@ OpalMediaStream * OpalUdpSsConnection::CreateMediaStream( const OpalMediaFormat & mediaFormat, unsigned sessionID, - BOOL isSource) + bool isSource) { if (sessionID != OpalMediaFormat::DefaultAudioSessionID) return OpalConnection::CreateMediaStream(mediaFormat, sessionID, isSource); @@ -198,11 +198,11 @@ OpalConnection::CloseMediaStreams(); } -BOOL OpalUdpSsConnection::OnOpenMediaStream(OpalMediaStream & mediaStream) +bool OpalUdpSsConnection::OnOpenMediaStream(OpalMediaStream & mediaStream) { PTRACE(3, "OnOpenMediaStream for " << mediaStream); if (!OpalConnection::OnOpenMediaStream(mediaStream)) - return FALSE; + return false; if (mediaStream.IsSource()) { OpalMediaPatch * patch = mediaStream.GetPatch(); @@ -213,7 +213,7 @@ } } - return TRUE; + return true; } void OpalUdpSsConnection::Release(CallEndReason reason) @@ -240,7 +240,7 @@ ((MyOpalCall &)GetCall()).SendThisMessageTo(message, destination); } -PSoundChannel * OpalUdpSsConnection::CreateSoundChannel(BOOL isSource) +PSoundChannel * OpalUdpSsConnection::CreateSoundChannel(bool isSource) { PTRACE(1, "Create UDP Sound Channel "); @@ -265,10 +265,10 @@ } -BOOL OpalUdpSsConnection::SendUserInputString(const PString & value) +bool OpalUdpSsConnection::SendUserInputString(const PString & value) { PTRACE(5, "UdpSs\tSendUserInputString(" << value << ") drives nowhere"); - return TRUE; + return true; } Modified: sofaswitch/trunk/voip/udpep.cxx ============================================================================== --- sofaswitch/trunk/voip/udpep.cxx (original) +++ sofaswitch/trunk/voip/udpep.cxx Thu Mar 27 18:33:08 2008 @@ -76,7 +76,7 @@ DecOpalUdpSsEndPoint(); } -BOOL OpalUdpSsEndPoint::MakeConnection(OpalCall & call, +bool OpalUdpSsEndPoint::MakeConnection(OpalCall & call, const PString & remoteParty, void * userData, unsigned int /*options*/, @@ -92,12 +92,12 @@ PSafePtr<OpalUdpSsConnection> connection = CreateConnection(call, userData, conToken); if (connection == NULL) { PTRACE(1, "Failed to create a connection on " << conToken); - return FALSE; + return false; } connectionsActive.SetAt(conToken, connection); - return TRUE; + return true; } @@ -143,22 +143,22 @@ } -BOOL OpalUdpSsEndPoint::AcceptIncomingConnection(const PString & token) +bool OpalUdpSsEndPoint::AcceptIncomingConnection(const PString & token) { PSafePtr<OpalUdpSsConnection> connection = GetUdpSsConnectionWithLock(token, PSafeReadOnly); if (connection == NULL) { PTRACE(2, "OpalSsEp\tAcceptIncoming connection on " << token << "return false as connection not found"); - return FALSE; + return false; } connection->AcceptIncoming(); - return TRUE; + return true; } -BOOL OpalUdpSsEndPoint::OnShowUserInput(const OpalUdpSsConnection &, const PString &) +bool OpalUdpSsEndPoint::OnShowUserInput(const OpalUdpSsConnection &, const PString &) { - return TRUE; + return true; } @@ -169,19 +169,19 @@ return PSafePtrCast<OpalConnection, OpalUdpSsConnection>(GetConnectionWithLock(token, mode)); } -BOOL OpalUdpSsEndPoint::OnShowIncoming(const OpalUdpSsConnection & connection) +bool OpalUdpSsEndPoint::OnShowIncoming(const OpalUdpSsConnection & connection) { PTRACE(3, "INCOMING CALL from remote node " << connection.GetToken()); - return TRUE; + return true; } -BOOL OpalUdpSsEndPoint::OnShowOutgoing(const OpalUdpSsConnection & connection) +bool OpalUdpSsEndPoint::OnShowOutgoing(const OpalUdpSsConnection & connection) { //PTime now; //cout << connection.GetRemotePartyName() << " is ringing on " // << now.AsString("w h:mma") << " ..." << endl; - return TRUE; + return true; } Modified: sofaswitch/trunk/voip/udpsound.cxx ============================================================================== --- sofaswitch/trunk/voip/udpsound.cxx (original) +++ sofaswitch/trunk/voip/udpsound.cxx Thu Mar 27 18:33:08 2008 @@ -45,7 +45,7 @@ -PString GetSSLabel(BOOL isSource) +PString GetSSLabel(bool isSource) { if (isSource) return PString ("-Source- "); @@ -54,7 +54,7 @@ } -UdpSoundChannel::UdpSoundChannel(MyOpalCall & _myOpalCall, BOOL _isSource) +UdpSoundChannel::UdpSoundChannel(MyOpalCall & _myOpalCall, bool _isSource) : myOpalCall(_myOpalCall), audioSocket(_myOpalCall.GetAudioSocket()), isSource(_isSource) { @@ -73,13 +73,13 @@ } -BOOL UdpSoundChannel::Open(const PString & device, Directions dir, +bool UdpSoundChannel::Open(const PString & device, Directions dir, unsigned /* numChannels*/, unsigned /*sampleRate */, unsigned /*bitsPerSample*/) { if (device != PString("udpsound")) { PTRACE(2, "OPEN failed for this udpsound channel"); - return FALSE; + return false; } PTRACE(3, "MEDIASound\t open for a direction of " << dir << " and for " << GetSSLabel(isSource)); @@ -90,7 +90,7 @@ readBuffer.SetSize(480); //The absolute largest possible size readQueue.Open(960); - return TRUE; + return true; } void UdpSoundChannel::CreateSilence(void * buffer, PINDEX amount) @@ -99,7 +99,7 @@ lastReadCount = amount; } -BOOL UdpSoundChannel::Write(const void * buffer, PINDEX amount) +bool UdpSoundChannel::Write(const void * buffer, PINDEX amount) { { WORD dPort; @@ -112,11 +112,11 @@ if (!IsOpen()) { PTRACE(3, "MEDIA\tWrite failed as this sound channel is closed"); - return FALSE; + return false; } - BOOL res = audioSocket.Write(buffer, amount); - if (res == FALSE) { + bool res = audioSocket.Write(buffer, amount); + if (res == false) { WORD dPort; PIPSocket::Address destination; @@ -134,14 +134,14 @@ } -BOOL UdpSoundChannel::Read(void * buffer, PINDEX amount) +bool UdpSoundChannel::Read(void * buffer, PINDEX amount) { if (!IsOpen()) { PTRACE(3, "MEDIA\tRead failed as this sound channel is closed"); - return FALSE; + return false; } - BOOL readOk = TRUE; + bool readOk = true; PTRACE(7, "MEDIA\tNow do a read of " << amount << " bytes for " << GetSSLabel(isSource)); PTRACE(7, "MEDIA\tThe read queue has a buffered bytes size of " << readQueue.GetLength()); @@ -151,7 +151,7 @@ if (!readOk) { PTRACE(3, "MEDIA\tThe read of a packet from a socket failed for " << GetSSLabel(isSource)); - return FALSE; + return false; } PTRACE(7, "The socket provided us with " << audioSocket.GetLastReadCount() << " bytes"); @@ -161,7 +161,7 @@ << readQueue.GetLength() << " bytes"); if (!readOk) { PTRACE(3, "Failed to write incoming packet to the memory queue"); - return FALSE; + return false; } } @@ -172,30 +172,30 @@ } -BOOL UdpSoundChannel::Close() +bool UdpSoundChannel::Close() { PTRACE(3, "Close audio channel now for " << GetSSLabel(isSource)); PTRACE(6, "os_handle or fd = " << os_handle); audioSocket.Close(); os_handle = -1; - return TRUE; + return true; } -BOOL UdpSoundChannel::IsOpen() const +bool UdpSoundChannel::IsOpen() const { if (os_handle < 0) { PTRACE(6, "udp sound channel is closed"); - return FALSE; + return false; } if (audioSocket.IsOpen()) { PTRACE(6, "udpsound channel is open"); - return TRUE; + return true; } PTRACE(6, "udp sound channel is closed"); - return FALSE; + return false; } void UdpSoundChannel::PrintOn( ostream & strm ) const @@ -230,7 +230,7 @@ AudioDelay::AudioDelay() { - firstTime = TRUE; + firstTime = true; error = 0; } @@ -240,15 +240,15 @@ void AudioDelay::Restart() { - firstTime = TRUE; + firstTime = true; } -BOOL AudioDelay::Delay(int frameTime) +bool AudioDelay::Delay(int frameTime) { if (firstTime) { - firstTime = FALSE; + firstTime = false; previousTime = PTime(); - return TRUE; + return true; } error += frameTime;
participants (1)
-
SofaSWITCH SVN