diff --git a/sflphone-common/src/Makefile.am b/sflphone-common/src/Makefile.am index b0fdb972aa33695c20810a087eb8faf4185824d6..faf3560fa0ba95a74db3b27735edf5283ed8f5a3 100644 --- a/sflphone-common/src/Makefile.am +++ b/sflphone-common/src/Makefile.am @@ -84,3 +84,10 @@ libsflphone_la_LIBADD = \ ./history/libhistory.la libsflphone_la_SOURCES = + +indent: + @echo "Indenting code:" + if [ -f $(ASTYLERC) ] ; then \ + $(indent) --options=$(ASTYLERC) --recursive *.cpp *.h; \ + fi + diff --git a/sflphone-common/src/audio/audiolayer.h b/sflphone-common/src/audio/audiolayer.h index 35b7abd073cbdaaa14cb90498e3f7b2d90126350..ab70ddfd0701caadbb55cd6d15343403199cf0bf 100644 --- a/sflphone-common/src/audio/audiolayer.h +++ b/sflphone-common/src/audio/audiolayer.h @@ -206,12 +206,12 @@ class AudioLayer { /** * Set the audio recorder */ - void setRecorderInstance(Recordable* rec) {_recorder = NULL; _recorder = rec;} + inline void setRecorderInstance (Recordable* rec) {_recorder = NULL; _recorder = rec;} /** * Get the audio recorder */ - Recordable* getRecorderInstance(Recordable* rec) {return _recorder;} + inline Recordable* getRecorderInstance (void) {return _recorder;} protected: diff --git a/sflphone-common/src/audio/codecs/g722.cpp b/sflphone-common/src/audio/codecs/g722.cpp index 5280fa1f337869b0a9e4ab49b74fe660d4bcd236..8118b5757e7b330b9271252bcfac53abebab0e6a 100644 --- a/sflphone-common/src/audio/codecs/g722.cpp +++ b/sflphone-common/src/audio/codecs/g722.cpp @@ -49,8 +49,8 @@ class G722 : public AudioCodec decode_s = new g722_decode_state_t; encode_s = new g722_encode_state_t; - g722_decode_init (64000, 0); - g722_encode_init (64000, 0); + g722_decode_init (); + g722_encode_init (); } @@ -76,7 +76,7 @@ class G722 : public AudioCodec } - void g722_encode_init (int rate, int options) { + void g722_encode_init (void) { encode_s->itu_test_mode = FALSE; @@ -92,7 +92,7 @@ class G722 : public AudioCodec encode_s->band[1].det = 8; } - void g722_decode_init (int rate, int options) { + void g722_decode_init (void) { decode_s->itu_test_mode = FALSE; diff --git a/sflphone-common/src/audio/codecs/g722.h b/sflphone-common/src/audio/codecs/g722.h index 565bcf2e3c9e2a159d6e7d0900981480360171ef..4df3334c65b2a8a2d522758faaade819f1933056 100644 --- a/sflphone-common/src/audio/codecs/g722.h +++ b/sflphone-common/src/audio/codecs/g722.h @@ -130,11 +130,11 @@ typedef struct extern "C" { #endif -void g722_encode_init(int rate, int options); +void g722_encode_init (void); int g722_encode_release(); int g722_encode(uint8_t g722_data[], const int16_t amp[], int len); -void g722_decode_init(int rate, int options); +void g722_decode_init (void); int g722_decode_release(); int g722_decode(int16_t amp[], const uint8_t g722_data[], int len); diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp index 38608fbf2bb7a21ad59dfea3b9a13c4e41da6251..f63390969bc6b6f421ab5c779f67f394b1cfd26e 100644 --- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp +++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp @@ -106,11 +106,11 @@ AudioStream::disconnectStream (void) if (_audiostream) { pa_stream_disconnect (_audiostream); - // make sure we don't get any further callback - pa_stream_set_state_callback(_audiostream, NULL, NULL); - pa_stream_set_write_callback (_audiostream, NULL, NULL); - pa_stream_set_underflow_callback (_audiostream, NULL, NULL); - pa_stream_set_overflow_callback (_audiostream, NULL, NULL); + // make sure we don't get any further callback + pa_stream_set_state_callback (_audiostream, NULL, NULL); + pa_stream_set_write_callback (_audiostream, NULL, NULL); + pa_stream_set_underflow_callback (_audiostream, NULL, NULL); + pa_stream_set_overflow_callback (_audiostream, NULL, NULL); pa_stream_unref (_audiostream); _audiostream = NULL; diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp index b57968d698c24761351eb5d7627a275b832e9c27..7cb135ff384cfddcdd268426d4bd23aae1ab21bc 100644 --- a/sflphone-common/src/dbus/callmanager.cpp +++ b/sflphone-common/src/dbus/callmanager.cpp @@ -258,7 +258,7 @@ CallManager::startTone (const int32_t& start , const int32_t& type) else Manager::instance().playToneWithMessage(); } else - Manager::instance().stopTone (true); + Manager::instance().stopTone (); } // TODO: this will have to be adapted diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index beca00b58e818ac08ced9e849832b838a16652d7..8b36efbca5fb58833aa10c7e6ad31aeb1f9b84d8 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -95,11 +95,13 @@ ConfigurationManager::setIp2IpDetails (const std::map< std::string, std::string std::map<std::string, std::string>::iterator it; it = map_cpy.find (LOCAL_ADDRESS); + if (it != details.end()) { Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_ADDRESS, it->second); } - it = map_cpy.find(LOCAL_PORT); + it = map_cpy.find (LOCAL_PORT); + if (it != details.end()) { Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_PORT, it->second); } @@ -724,7 +726,7 @@ void ConfigurationManager::setSipAddress (const std::string& address) { _debug ("Manager received setSipAddress: %s\n", address.c_str()); - Manager::instance().setLocalIp2IpInfo(address); + Manager::instance().setLocalIp2IpInfo (address); } std::map<std::string, int32_t> ConfigurationManager::getAddressbookSettings (void) diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp index fd486a14fe6f61801732d57916205c5ab612a71b..7ca2fb9ff102b573240c14cf00489482e705e83e 100644 --- a/sflphone-common/src/iax/iaxvoiplink.cpp +++ b/sflphone-common/src/iax/iaxvoiplink.cpp @@ -304,7 +304,7 @@ IAXVoIPLink::sendAudioFromMic (void) if (currentCall) { - bool sessionIsConnected = (currentCall->getConnectionState() == Call::Connected); + // bool sessionIsConnected = (currentCall->getConnectionState() == Call::Connected); bool callIsActive = (currentCall->getState() == Call::Active); // if (sessionIsConnected || callIsActive) { diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 8826eab1c766374a2859cf8b6f8826d61de94af1..464c079ba679ef0cbb61d1a17be5ceecf38a424d 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -335,7 +335,7 @@ ManagerImpl::answerCall (const CallID& call_id) _debug ("ManagerImpl::answerCall(%s)\n", call_id.c_str()); - stopTone (true); + stopTone (); // store the current call id CallID current_call_id = getCurrentCallId(); @@ -418,8 +418,7 @@ ManagerImpl::hangupCall (const CallID& call_id) // store the current call id CallID current_call_id = getCurrentCallId(); - stopTone (false); - // switchCall (call_id); + stopTone (); /* Broadcast a signal over DBus */ _debug (" hangupCall: Send DBUS call state change (HUNGUP) for id %s\n", call_id.c_str()); @@ -524,7 +523,7 @@ ManagerImpl::cancelCall (const CallID& id) AccountID accountid; bool returnValue; - stopTone (true); + stopTone (); /* Direct IP to IP call */ @@ -563,7 +562,7 @@ ManagerImpl::onHoldCall (const CallID& call_id) _debug ("ManagerImpl::onHoldCall(%s)\n", call_id.c_str()); - stopTone (true); + stopTone (); CallID current_call_id = getCurrentCallId(); @@ -614,7 +613,7 @@ ManagerImpl::offHoldCall (const CallID& call_id) _debug ("ManagerImpl::offHoldCall(%s)\n", call_id.c_str()); - stopTone (false); + stopTone (); CallID current_call_id = getCurrentCallId(); @@ -696,7 +695,7 @@ ManagerImpl::transferCall (const CallID& call_id, const std::string& to) AccountID accountid; bool returnValue; - stopTone (true); + stopTone (); CallID current_call_id = getCurrentCallId(); @@ -764,7 +763,7 @@ ManagerImpl::refuseCall (const CallID& id) CallID current_call_id = getCurrentCallId(); - stopTone (false); + stopTone (); int nbCalls = getCallList().size(); @@ -1257,8 +1256,6 @@ ManagerImpl::detachParticipant (const CallID& call_id, const CallID& current_id) CallID current_call_id = current_id; - if (current_call_id.compare ("") == 0); - current_call_id = getCurrentCallId(); if (call_id != default_id) { @@ -1567,7 +1564,7 @@ ManagerImpl::sendDtmf (const CallID& id, char code) AccountID accountid = getAccountFromCall (id); if (accountid == AccountNULL) { - playDtmf (code, false); + playDtmf (code); return false; } @@ -1578,7 +1575,7 @@ ManagerImpl::sendDtmf (const CallID& id, char code) switch (sendType) { case 0: // SIP INFO - playDtmf (code , true); + playDtmf (code); returnValue = getAccountLink (accountid)->carryingDTMFdigits (id, code); break; @@ -1597,7 +1594,7 @@ ManagerImpl::sendDtmf (const CallID& id, char code) //THREAD=Main | VoIPLink bool -ManagerImpl::playDtmf (char code, bool isTalking) +ManagerImpl::playDtmf (char code) { int pulselen, layer, size; bool ret = false; @@ -1606,7 +1603,7 @@ ManagerImpl::playDtmf (char code, bool isTalking) _debug ("ManagerImpl::playDtmf\n"); - stopTone (false); + stopTone (); bool hasToPlayTone = getConfigBool (SIGNALISATION, PLAY_DTMF); @@ -1722,7 +1719,7 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId) PulseLayer *pulselayer; std::string from, number, display_name, display; - stopTone (false); + stopTone (); _debug ("Incoming call %s for account %s\n", call->getCallId().data(), accountId.c_str()); @@ -1830,7 +1827,7 @@ ManagerImpl::peerAnsweredCall (const CallID& id) { // The if statement is usefull only if we sent two calls at the same time. if (isCurrentCall (id)) { - stopTone (false); + stopTone (); } if (_dbus) _dbus->getCallManager()->callStateChanged (id, "CURRENT"); @@ -1883,7 +1880,7 @@ ManagerImpl::peerHungupCall (const CallID& call_id) } } else { if (isCurrentCall (call_id)) { - stopTone (true); + stopTone (); switchCall (""); } @@ -1962,11 +1959,11 @@ ManagerImpl::callFailure (const CallID& call_id) if (participToConference (call_id)) { - _debug("Call %s participating to a conference failed\n", call_id.c_str()); + _debug ("Call %s participating to a conference failed\n", call_id.c_str()); - Conference *conf = getConferenceFromCallID (call_id); + Conference *conf = getConferenceFromCallID (call_id); - if (conf != NULL) { + if (conf != NULL) { // remove this participant removeParticipant (call_id); @@ -2044,7 +2041,7 @@ bool ManagerImpl::playATone (Tone::TONEID toneId) /** * Multi Thread */ -void ManagerImpl::stopTone (bool stopAudio=true) +void ManagerImpl::stopTone () { bool hasToPlayTone; @@ -2122,8 +2119,6 @@ ManagerImpl::ringtone() int layer, samplerate; bool loadFile; - // stopTone(true); - if (isRingtoneEnabled()) { _debug (" Tone is enabled\n"); @@ -2827,14 +2822,15 @@ ManagerImpl::getDialpad (void) void ManagerImpl::setDialpad (bool display) { - std::string set; + std::string set; - display ? set = TRUE_STR : set = FALSE_STR; - // If the value we received is different from the one saved in the config file, save the new value - // Else do nothing - if ((display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != TRUE_STR)) || - (!display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != FALSE_STR))) - setConfig (PREFERENCES, CONFIG_DIALPAD, set); + display ? set = TRUE_STR : set = FALSE_STR; + // If the value we received is different from the one saved in the config file, save the new value + // Else do nothing + + if ( (display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != TRUE_STR)) || + (!display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != FALSE_STR))) + setConfig (PREFERENCES, CONFIG_DIALPAD, set); } int @@ -2849,14 +2845,15 @@ ManagerImpl::getVolumeControls (void) void ManagerImpl::setVolumeControls (bool display) { - std::string set; + std::string set; + + display ? set = TRUE_STR : set = FALSE_STR; + // If the value we received is different from the one saved in the config file, save the new value + // Else do nothing - display ? set = TRUE_STR : set = FALSE_STR; - // If the value we received is different from the one saved in the config file, save the new value - // Else do nothing - if ((display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != TRUE_STR)) || - (!display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != FALSE_STR))) - setConfig (PREFERENCES, CONFIG_VOLUME, set); + if ( (display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != TRUE_STR)) || + (!display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != FALSE_STR))) + setConfig (PREFERENCES, CONFIG_VOLUME, set); } void @@ -3159,7 +3156,7 @@ void ManagerImpl::switchAudioManager (void) framesize = getConfigInt (AUDIO , ALSA_FRAME_SIZE); - _debug("samplerate: %i, framesize %i\n", samplerate, framesize); + _debug ("samplerate: %i, framesize %i\n", samplerate, framesize); alsaPlugin = getConfigString (AUDIO , ALSA_PLUGIN); @@ -3256,39 +3253,40 @@ void ManagerImpl::setMicVolume (unsigned short mic_vol) -void ManagerImpl::setLocalIp2IpInfo(const std::string& address) +void ManagerImpl::setLocalIp2IpInfo (const std::string& address) { - std::string ip_address = std::string(address); + std::string ip_address = std::string (address); - int index = ip_address.find_first_of(":"); + int index = ip_address.find_first_of (":"); - std::string local_address = ip_address.substr(0,index); - std::string local_port = ip_address.substr(index+1); - int newPort = atoi(local_port.c_str()); + std::string local_address = ip_address.substr (0,index); + std::string local_port = ip_address.substr (index+1); + int newPort = atoi (local_port.c_str()); _debug ("Setting new address %s and port %s for default account (ip to ip calls)\n", local_address.c_str(), local_port.c_str()); int prevPort = getConfigInt (IP2IP_PROFILE, LOCAL_PORT); - std::string prevAddress = getConfigString(IP2IP_PROFILE, LOCAL_ADDRESS); + std::string prevAddress = getConfigString (IP2IP_PROFILE, LOCAL_ADDRESS); - if ((prevPort != newPort) || (prevAddress.compare(local_address) != 0)) { + if ( (prevPort != newPort) || (prevAddress.compare (local_address) != 0)) { - - if(_directIpAccount) { - SIPAccount* account = dynamic_cast<SIPAccount*>(_directIpAccount); + if (_directIpAccount) { - account->setLocalPort(newPort); - account->setLocalAddress(local_address); - } + SIPAccount* account = dynamic_cast<SIPAccount*> (_directIpAccount); + + account->setLocalPort (newPort); + account->setLocalAddress (local_address); + } setConfig (IP2IP_PROFILE, LOCAL_ADDRESS, local_address); + setConfig (IP2IP_PROFILE, LOCAL_PORT, newPort); - SIPVoIPLink* siplink = SIPVoIPLink::instance (""); - // if(siplink) - siplink->updateAccountInfo(_directIpAccount->getAccountID()); + SIPVoIPLink* siplink = SIPVoIPLink::instance (""); + // if(siplink) + siplink->updateAccountInfo (_directIpAccount->getAccountID()); // this->restartPJSIP (); } } @@ -3298,7 +3296,7 @@ int ManagerImpl::getLocalIp2IpPort (void) { /* The SIP port used for default account (IP to IP) calls */ - _debug("Default account port %i\n", getConfigInt (IP2IP_PROFILE, LOCAL_PORT)); + _debug ("Default account port %i\n", getConfigInt (IP2IP_PROFILE, LOCAL_PORT)); return getConfigInt (IP2IP_PROFILE, LOCAL_PORT); @@ -3542,7 +3540,7 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou Account * account = _accountMap[accountID]; if (account == NULL) { - _debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.\n", accountID.c_str()); + _debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.\n", accountID.c_str()); } a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getConfigString (accountID, CONFIG_ACCOUNT_ALIAS))); @@ -4003,7 +4001,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma acc->loadConfig(); if (acc->isEnabled()) { - // acc->unregisterVoIPLink(); // do not need to send an unregister + // acc->unregisterVoIPLink(); // do not need to send an unregister acc->registerVoIPLink(); } else { acc->unregisterVoIPLink(); @@ -4213,7 +4211,7 @@ short ManagerImpl::loadAccountMap() { - _debug("ManagerImpl::loadAccountMap\n"); + _debug ("ManagerImpl::loadAccountMap\n"); short nbAccount = 0; TokenList sections = _config.getSections(); @@ -4238,7 +4236,7 @@ ManagerImpl::loadAccountMap() // No registration in the sense of // the REGISTER method is performed. _debug ("Succeed to create direct ip calls \"account\"\n"); - _accountMap[IP2IP_PROFILE] = _directIpAccount; + _accountMap[IP2IP_PROFILE] = _directIpAccount; _directIpAccount->registerVoIPLink(); } @@ -4271,6 +4269,7 @@ ManagerImpl::loadAccountMap() iter++; } + /* if (_directIpAccount == NULL) { _debug ("Failed to create direct ip calls \"account\"\n"); @@ -4280,7 +4279,7 @@ ManagerImpl::loadAccountMap() // the REGISTER method is performed. _debug ("Succeed to create direct ip calls \"account\"\n"); _directIpAccount->registerVoIPLink(); - _accountMap[IP2IP_PROFILE] = _directIpAccount; + _accountMap[IP2IP_PROFILE] = _directIpAccount; } */ _debug ("nbAccount loaded %i \n", nbAccount); @@ -4324,7 +4323,7 @@ ManagerImpl::getAccount (const AccountID& accountID) // In our definition, // this is the "direct ip calls account" if (accountID == AccountNULL) { - _debug ("Returns the direct IP account\n"); + _debug ("Returns the direct IP account\n"); return _directIpAccount; } @@ -4387,29 +4386,31 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s void ManagerImpl::restartPJSIP (void) { - _debug("ManagerImpl::restartPJSIP\n"); - VoIPLink *link = getSIPAccountLink(); + _debug ("ManagerImpl::restartPJSIP\n"); + VoIPLink *link = getSIPAccountLink(); SIPVoIPLink *siplink = NULL; - if(link) { + if (link) { siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ()); } - _debug("ManagerImpl::unregister sip account\n"); + _debug ("ManagerImpl::unregister sip account\n"); + this->unregisterCurSIPAccounts(); /* Terminate and initialize the PJSIP library */ if (siplink) { - _debug("ManagerImpl::Terminate sip\n"); + _debug ("ManagerImpl::Terminate sip\n"); siplink->terminate (); siplink = SIPVoIPLink::instance (""); - _debug("ManagerImpl::Init new sip\n"); + _debug ("ManagerImpl::Init new sip\n"); siplink->init (); } - _debug("ManagerImpl::register sip account\n"); + _debug ("ManagerImpl::register sip account\n"); + /* Then register all enabled SIP accounts */ - this->registerCurSIPAccounts (siplink); + this->registerCurSIPAccounts (); } VoIPLink* ManagerImpl::getAccountLink (const AccountID& accountID) @@ -4431,8 +4432,8 @@ VoIPLink* ManagerImpl::getSIPAccountLink() /* We are looking for the first SIP account we met because all the SIP accounts have the same voiplink */ Account *account; AccountMap::iterator iter = _accountMap.begin(); - - while(iter != _accountMap.end()) { + + while (iter != _accountMap.end()) { account = iter->second; @@ -4440,7 +4441,7 @@ VoIPLink* ManagerImpl::getSIPAccountLink() return account->getVoIPLink(); } - ++iter; + ++iter; } return NULL; @@ -4449,8 +4450,7 @@ VoIPLink* ManagerImpl::getSIPAccountLink() -pjsip_regc -*getSipRegcFromID (const AccountID& id UNUSED) +pjsip_regc *getSipRegcFromID (const AccountID& id UNUSED) { /*SIPAccount *tmp = dynamic_cast<SIPAccount *>getAccount(id); if(tmp != NULL) @@ -4478,7 +4478,7 @@ void ManagerImpl::unregisterCurSIPAccounts() } } -void ManagerImpl::registerCurSIPAccounts (VoIPLink *link) +void ManagerImpl::registerCurSIPAccounts (void) { Account *current; diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index 032e5169dea69f3c3763256095c2e889b95adace..627170e88f5ea80012b414b881f395fc70253e7b 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -332,9 +332,8 @@ class ManagerImpl { /** * Play the dtmf-associated sound * @param code The pressed key - * @param isTalking In conversation or not. Useful to know whether or not the sound streams are started */ - bool playDtmf(char code, bool isTalking); + bool playDtmf (char code); /** * Play a ringtone @@ -352,9 +351,8 @@ class ManagerImpl { /** * Acts on the audio streams and audio files - * @param stopAudio Tells whether or not to stop the streams */ - void stopTone(bool stopAudio); + void stopTone (void); /** * When receiving a new incoming call, add it to the callaccount map @@ -1036,9 +1034,9 @@ class ManagerImpl { */ void restartPJSIP( ); - void unregisterCurSIPAccounts(); + void unregisterCurSIPAccounts (void); - void registerCurSIPAccounts(VoIPLink *link); + void registerCurSIPAccounts (void); /* * Initialize audiodriver diff --git a/sflphone-common/src/plug-in/librarymanager.cpp b/sflphone-common/src/plug-in/librarymanager.cpp index 3938a6b83c185ca26b3229008c5861ff938662d3..24b8396469149d224db7999b28d923cb132ea103 100644 --- a/sflphone-common/src/plug-in/librarymanager.cpp +++ b/sflphone-common/src/plug-in/librarymanager.cpp @@ -92,7 +92,7 @@ int LibraryManager::resolveSymbol (const std::string &symbol, SymbolHandle *symb /************************************************************************************************/ LibraryManagerException::LibraryManagerException (const std::string &libraryName, const std::string &details, Reason reason) : - std::runtime_error (""), _reason (reason), _details ("") + std::runtime_error (""), _reason (reason), _details ("") { if (_reason == loadingFailed) diff --git a/sflphone-common/src/sip/sdp.cpp b/sflphone-common/src/sip/sdp.cpp index e269ecd8313dc0dedb31e53269d2ed1ceac17932..942da7db35588c36871dc10e1133bb42bcd3c35e 100644 --- a/sflphone-common/src/sip/sdp.cpp +++ b/sflphone-common/src/sip/sdp.cpp @@ -375,7 +375,7 @@ void Sdp::sdp_add_zrtp_attribute (pjmedia_sdp_media* media, std::string hash) "%.*s %.*s", 4, ZRTP_VERSION, - (int)hash.size(), + (int) hash.size(), hash.c_str()); attribute->value.slen = len; @@ -440,8 +440,9 @@ void Sdp::set_negotiated_sdp (const pjmedia_sdp_session *sdp) for (j=0 ; j<nb_codecs ; j++) { attribute = pjmedia_sdp_media_find_attr (current, &STR_RTPMAP, NULL); // pj_strtoul(attribute->pt) - if (!attribute) - return; + + if (!attribute) + return; pjmedia_sdp_attr_to_rtpmap (_pool, attribute, &rtpmap); diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 07853ad4017aa602c4cc99cc01b1748f68f2019b..fe36571c986ff556d92fe9c158a3fa4b81807b1f 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -25,24 +25,24 @@ #include <pwd.h> SIPAccount::SIPAccount (const AccountID& accountID) - : Account (accountID, "sip") - , _regc (NULL) - , _bRegister (false) - , _registrationExpire ("") - , _publishedSameasLocal(true) - , _localIpAddress ("") - , _publishedIpAddress ("") - , _localPort (atoi (DEFAULT_SIP_PORT)) - , _publishedPort (atoi (DEFAULT_SIP_PORT)) - , _transportType (PJSIP_TRANSPORT_UNSPECIFIED) - , _transport(NULL) - , _resolveOnce (false) - , _credentialCount (0) - , _cred (NULL) - , _realm (DEFAULT_REALM) - , _authenticationUsername ("") - , _tlsSetting (NULL) - , _displayName ("") + : Account (accountID, "sip") + , _regc (NULL) + , _bRegister (false) + , _registrationExpire ("") + , _publishedSameasLocal (true) + , _localIpAddress ("") + , _publishedIpAddress ("") + , _localPort (atoi (DEFAULT_SIP_PORT)) + , _publishedPort (atoi (DEFAULT_SIP_PORT)) + , _transportType (PJSIP_TRANSPORT_UNSPECIFIED) + , _transport (NULL) + , _resolveOnce (false) + , _credentialCount (0) + , _cred (NULL) + , _realm (DEFAULT_REALM) + , _authenticationUsername ("") + , _tlsSetting (NULL) + , _displayName ("") { /* SIPVoIPlink is used as a singleton, because we want to have only one link for all the SIP accounts created */ /* So instead of creating a new instance, we just fetch the static instance, or create one if it is not yet */ @@ -330,15 +330,20 @@ void SIPAccount::loadConfig() } // Load network settings - // Local parameters + // Local parameters std::string localPort = Manager::instance().getConfigString (_accountID, LOCAL_PORT); + setLocalPort (atoi (localPort.c_str())); + setLocalAddress (Manager::instance().getConfigString (_accountID, LOCAL_ADDRESS)); - // Published parameters - setPublishedSameasLocal (Manager::instance().getConfigString (_accountID, PUBLISHED_SAMEAS_LOCAL) == TRUE_STR ? true : false); + // Published parameters + setPublishedSameasLocal (Manager::instance().getConfigString (_accountID, PUBLISHED_SAMEAS_LOCAL) == TRUE_STR ? true : false); + std::string publishedPort = Manager::instance().getConfigString (_accountID, PUBLISHED_PORT); + setPublishedPort (atoi (publishedPort.c_str())); + setPublishedAddress (Manager::instance().getConfigString (_accountID, PUBLISHED_ADDRESS)); // Init TLS settings if the user wants to use TLS diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 2c4cc0abab0d1ec208f029a3d61a0c436fa10fe6..21f12a44f41052db14873419d69cd8faec4191d6 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -246,7 +246,7 @@ SIPVoIPLink* SIPVoIPLink::instance (const AccountID& id) { if (!_instance) { - _debug ("Create new SIPVoIPLink instance\n"); + _debug ("Create new SIPVoIPLink instance\n"); _instance = new SIPVoIPLink (id); } @@ -268,8 +268,8 @@ bool SIPVoIPLink::init() if (initDone()) return false; - // TODO This port should be the one configured for the IP profile - // and not the global one + // TODO This port should be the one configured for the IP profile + // and not the global one _regPort = Manager::instance().getLocalIp2IpPort(); /* Instanciate the C++ thread */ @@ -286,12 +286,12 @@ bool SIPVoIPLink::init() void SIPVoIPLink::terminate() { - _debug("SIPVoIPLink::terminate"); + _debug ("SIPVoIPLink::terminate"); if (_evThread) { - _debug("SIPVoIPLink:: delete eventThread"); + _debug ("SIPVoIPLink:: delete eventThread"); delete _evThread; _evThread = NULL; } @@ -300,7 +300,7 @@ SIPVoIPLink::terminate() /* Clean shutdown of pjsip library */ if (initDone()) { - _debug("pjsip_shutdown\n"); + _debug ("pjsip_shutdown\n"); pjsip_shutdown(); } @@ -682,7 +682,7 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl) call->setPeerNumber (toUri); - // TODO May use the published address as well + // TODO May use the published address as well localAddr = account->getLocalAddress (); setCallAudioLocal (call, localAddr); @@ -1322,7 +1322,9 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED) // Set the appropriate transport pjsip_tpselector *tp; + init_transport_selector (account->getAccountTransport (), &tp); + status = pjsip_dlg_set_transport (dialog, tp); status = pjsip_inv_send_msg (inv, tdata); @@ -1434,7 +1436,7 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to) pjsip_dialog *dialog; pjsip_inv_session *inv; pjsip_tx_data *tdata; - std::string localAddress; + std::string localAddress; /* Create the call */ call = new SIPCall (id, Call::Outgoing, _pool); @@ -1452,15 +1454,18 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to) _debug ("Account is null. Returning\n"); return !PJ_SUCCESS; } - - // Set SDP parameters - localAddress = account->getLocalAddress (); - _debug("new_ip_to_ip_call localAddress: %s\n", localAddress.c_str()); - if (localAddress == "0.0.0.0"){ - _debug ("Here is the local address: %s\n", localAddress.c_str ()); - loadSIPLocalIP (&localAddress); - } - setCallAudioLocal (call, localAddress); + + // Set SDP parameters + localAddress = account->getLocalAddress (); + + _debug ("new_ip_to_ip_call localAddress: %s\n", localAddress.c_str()); + + if (localAddress == "0.0.0.0") { + _debug ("Here is the local address: %s\n", localAddress.c_str ()); + loadSIPLocalIP (&localAddress); + } + + setCallAudioLocal (call, localAddress); _debug ("toUri received in new_ip_to_ip call %s\n", to.c_str()); @@ -1477,14 +1482,15 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to) _debug ("! SIP Failure: Unable to create RTP Session in SIPVoIPLink::new_ip_to_ip_call (%s:%d)\n", __FILE__, __LINE__); } - // If no account already set, use the default one created at pjsip initialization - if(account->getAccountTransport() == NULL) { - _debug("No transport for this account, using the default one\n"); - account->setAccountTransport(_localUDPTransport); - } + // If no account already set, use the default one created at pjsip initialization + if (account->getAccountTransport() == NULL) { + _debug ("No transport for this account, using the default one\n"); + account->setAccountTransport (_localUDPTransport); + } + + _debug ("IptoIP local port %i\n", account->getLocalPort()); - _debug("IptoIP local port %i\n", account->getLocalPort()); - _debug("IptoIP local address %s\n", account->getLocalAddress().c_str()); + _debug ("IptoIP local address %s\n", account->getLocalAddress().c_str()); // Create URI std::string fromUri; @@ -1671,11 +1677,11 @@ bool SIPVoIPLink::pjsip_init() pj_str_t accepted; std::string name_mod; pj_dns_resolver *p_resv; - std::string addr; + std::string addr; name_mod = "sflphone"; - _debug("pjsip_init\n"); + _debug ("pjsip_init\n"); // Init PJLIB: must be called before any call to the pjsip library status = pj_init(); @@ -1718,15 +1724,17 @@ bool SIPVoIPLink::pjsip_init() // This corresponds to the accountID set to // AccountNULL SIPAccount * account = NULL; + bool directIpCallsTlsEnabled = false; + account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (AccountNULL)); if (account == NULL) { _debug ("Account is null in pjsip init\n"); - port = _regPort; + port = _regPort; } else { directIpCallsTlsEnabled = account->isTlsEnabled(); - port = account->getLocalPort (); + port = account->getLocalPort (); } // Create a UDP listener meant for all accounts @@ -1927,27 +1935,31 @@ int SIPVoIPLink::createUDPServer (AccountID id) int listeningPort = _regPort; /* Use my local address as default value */ + if (!loadSIPLocalIP (&listeningAddress)) return !PJ_SUCCESS; - _debug("SIPVoIPLink::createUDPServer\n"); + _debug ("SIPVoIPLink::createUDPServer\n"); + /* * Retrieve the account information */ SIPAccount * account = NULL; + account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id)); // Set information to the local address and port if (account == NULL) { _debug ("Account with id \"%s\" is null in createUDPServer.\n", id.c_str()); - // account = Manager::instance()->getAccount(IP2IP_PROFILE); + // account = Manager::instance()->getAccount(IP2IP_PROFILE); } else { // We are trying to initialize a UDP transport available for all local accounts and direct IP calls - if (account->getLocalAddress () != "0.0.0.0"){ - listeningAddress = account->getLocalAddress (); - } - listeningPort = account->getLocalPort (); + if (account->getLocalAddress () != "0.0.0.0") { + listeningAddress = account->getLocalAddress (); + } + + listeningPort = account->getLocalPort (); } // Init bound address to ANY @@ -1962,20 +1974,21 @@ int SIPVoIPLink::createUDPServer (AccountID id) pj_bzero (bound_addr.sin_zero, sizeof (bound_addr.sin_zero)); // Create UDP-Server (default port: 5060) - // Use here either the local information or the published address - if (account != NULL && !account->getPublishedSameasLocal ()) - { - // Set the listening address to the published address - listeningAddress = account->getPublishedAddress (); - // Set the listening port to the published port - listeningPort = account->getPublishedPort (); - _debug (" ******************************** Use the published address %s:%i\n", listeningAddress.c_str (), listeningPort ); - } + // Use here either the local information or the published address + if (account != NULL && !account->getPublishedSameasLocal ()) { + // Set the listening address to the published address + listeningAddress = account->getPublishedAddress (); + // Set the listening port to the published port + listeningPort = account->getPublishedPort (); + _debug (" ******************************** Use the published address %s:%i\n", listeningAddress.c_str (), listeningPort); + } //strcpy (tmpIP, listeningAddress.data()); - /* Init published name */ + /* Init published name */ pj_bzero (&a_name, sizeof (pjsip_host_port)); + pj_cstr (&a_name.host, listeningAddress.c_str()); + a_name.port = listeningPort; @@ -2006,7 +2019,7 @@ int SIPVoIPLink::createUDPServer (AccountID id) if (account == NULL) _localUDPTransport = transport; else - account->setAccountTransport (transport); + account->setAccountTransport (transport); } _debug ("Transport initialized successfully on %s:%i\n", listeningAddress.c_str (), listeningPort); @@ -2091,7 +2104,8 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_ return machineName; } - _debug ("Local address discovered from attached transport: %s\n", localAddress.ptr); + _debug ("Local address discovered from attached transport: %s\n", localAddress.ptr); + return std::string (localAddress.ptr, localAddress.slen); } @@ -2187,7 +2201,8 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport * _debug ("Failed to find local address from transport\n"); } - _debug ("Local port discovered from attached transport: %i\n", port); + _debug ("Local port discovered from attached transport: %i\n", port); + return port; } @@ -2240,8 +2255,8 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id) pj_uint16_t stunPort; pj_sockaddr_in pub_addr; pj_sock_t sock; - std::string listeningAddress = ""; - int listeningPort; + std::string listeningAddress = ""; + int listeningPort; /* * Retrieve the account information @@ -2315,10 +2330,11 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id) if (status != PJ_SUCCESS) { _debug ("Error creating alternate SIP UDP listener (%d)\n", status); - return status; + return status; } - _debug ("UDP Transport successfully created on %s:%i\n", listeningAddress.c_str (), listeningPort); + _debug ("UDP Transport successfully created on %s:%i\n", listeningAddress.c_str (), listeningPort); + account->setAccountTransport (transport); return PJ_SUCCESS; @@ -2401,10 +2417,10 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id) } -void SIPVoIPLink::updateAccountInfo(const AccountID& accountID) +void SIPVoIPLink::updateAccountInfo (const AccountID& accountID) { - createUDPServer(accountID); + createUDPServer (accountID); } @@ -2413,11 +2429,11 @@ bool SIPVoIPLink::loadSIPLocalIP (std::string *addr) { bool returnValue = true; - std::string localAddress = "127.0.0.1"; + std::string localAddress = "127.0.0.1"; pj_sockaddr ip_addr; if (pj_gethostip (pj_AF_INET(), &ip_addr) != PJ_SUCCESS) { - // Update the registration state if no network capabilities found + // Update the registration state if no network capabilities found _debug ("UserAgent: Get host ip failed!\n"); returnValue = false; } else { @@ -2425,7 +2441,8 @@ bool SIPVoIPLink::loadSIPLocalIP (std::string *addr) _debug ("UserAgent: Checking network, setting local IP address to: %s\n", localAddress.data()); } - *addr = localAddress; + *addr = localAddress; + return returnValue; } @@ -2670,7 +2687,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) //pjsip_transaction * tsx pjsip_transaction * tsx = NULL; tsx = e->body.tsx_state.tsx; - int statusCode; + int statusCode = 404; if (tsx != NULL) { statusCode = tsx->status_code; @@ -2737,7 +2754,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) case PJSIP_SC_UNAUTHORIZED: - case PJSIP_SC_FORBIDDEN: + case PJSIP_SC_FORBIDDEN: case PJSIP_SC_REQUEST_PENDING: accId = Manager::instance().getAccountFromCall (call->getCallId()); @@ -2849,8 +2866,8 @@ void regc_cb (struct pjsip_regc_cbparam *param) if (param->code && description) { - //std::string descriptionprint(description->ptr, description->slen); - //_debug("Received client registration callback wiht code: %i, %s\n", param->code, descriptionprint.c_str()); + //std::string descriptionprint(description->ptr, description->slen); + //_debug("Received client registration callback wiht code: %i, %s\n", param->code, descriptionprint.c_str()); DBusManager::instance().getCallManager()->registrationStateChanged (account->getAccountID(), std::string (description->ptr, description->slen), param->code); std::pair<int, std::string> details (param->code, std::string (description->ptr, description->slen)); account->setRegistrationStateDetailed (details); @@ -3082,18 +3099,17 @@ mod_on_rx_request (pjsip_rx_data *rdata) account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (account_id)); if (account != NULL) { - // TODO May use the published address as well - addrToUse = account->getLocalAddress (); + // TODO May use the published address as well + addrToUse = account->getLocalAddress (); } - if (addrToUse == "0.0.0.0") - { - link->loadSIPLocalIP (&addrToUse); - } + if (addrToUse == "0.0.0.0") { + link->loadSIPLocalIP (&addrToUse); + } - // Have to do some stuff with the SDP - // Set the codec map, IP, peer number and so on... for the SIPCall object - setCallAudioLocal (call, addrToUse); + // Have to do some stuff with the SDP + // Set the codec map, IP, peer number and so on... for the SIPCall object + setCallAudioLocal (call, addrToUse); // We retrieve the remote sdp offer in the rdata struct to begin the negociation call->getLocalSDP()->set_ip_address (addrToUse); diff --git a/sflphone-common/src/sip/sipvoiplink.h b/sflphone-common/src/sip/sipvoiplink.h index 7b28b1761b1acb4a1869d8d8c02586faefe2e4b2..69d79d8b7c7e370d94ddcc8979e342c75d20b46c 100644 --- a/sflphone-common/src/sip/sipvoiplink.h +++ b/sflphone-common/src/sip/sipvoiplink.h @@ -43,7 +43,7 @@ class SIPCall; #define RANDOM_SIP_PORT rand() % 64000 + 1024 // To set the verbosity. From 0 (min) to 6 (max) -#define PJ_LOG_LEVEL 1 +#define PJ_LOG_LEVEL 6 /** * @file sipvoiplink.h diff --git a/sflphone-common/test/audiolayerTest.cpp b/sflphone-common/test/audiolayerTest.cpp index 4791f073de178be7eb794ecd0062971a4c7bf4b2..cf0552f4833f2bc862707dc04942ca3c0f6826b7 100644 --- a/sflphone-common/test/audiolayerTest.cpp +++ b/sflphone-common/test/audiolayerTest.cpp @@ -65,14 +65,15 @@ void AudioLayerTest::testAudioLayerConfig() { int sampling_rate = Manager::instance().getConfigInt (AUDIO, ALSA_SAMPLE_RATE); int frame_size = Manager::instance().getConfigInt (AUDIO, ALSA_FRAME_SIZE); - frame_size = 0; // frame size in config not used anymore + frame_size = 0; // frame size in config not used anymore int layer = Manager::instance().getAudioDriver()->getLayerType(); - if(layer != ALSA) + if (layer != ALSA) Manager::instance().switchAudioManager(); CPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getSampleRate() == sampling_rate); + CPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getFrameSize() == frame_size); } @@ -111,7 +112,7 @@ void AudioLayerTest::testPulseConnect() manager = &Manager::instance(); // _pulselayer = new PulseLayer (manager); - _pulselayer = (PulseLayer*)Manager::instance().getAudioDriver(); + _pulselayer = (PulseLayer*) Manager::instance().getAudioDriver(); CPPUNIT_ASSERT (_pulselayer->getLayerType() == PULSEAUDIO); @@ -146,22 +147,22 @@ void AudioLayerTest::testPulseConnect() // Must return Access failure "PA_ERR_ACCESS" == 2 // CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->getStreamState() == 2); // CPPUNIT_ASSERT (_pulselayer->getRecordStream()->getStreamState() == 2); - _debug("-------------------------- \n"); + _debug ("-------------------------- \n"); _pulselayer->startStream (); // usleep(1000000); - + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); // Must return No error "PA_OK" == 1 CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->getStreamState() == 1); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->getStreamState() == 1); - + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->disconnectStream() == true); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->disconnectStream() == true); - + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->connectStream() == true); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->connectStream() == true); @@ -176,7 +177,7 @@ void AudioLayerTest::testPulseConnect() // usleep(1000000); CPPUNIT_ASSERT (_pulselayer->disconnectAudioStream() == true); - + } diff --git a/sflphone-common/test/mainbufferTest.cpp b/sflphone-common/test/mainbufferTest.cpp index 7169fc1cf80c90dc5ee0030ba50c2a58c5901757..9551715a29eed00a3ec89de9fc9e27123fbdd309 100644 --- a/sflphone-common/test/mainbufferTest.cpp +++ b/sflphone-common/test/mainbufferTest.cpp @@ -554,7 +554,7 @@ void MainBufferTest::testBindUnbindBuffer() // unbind test_id1 with default_id _mainbuffer.unBindCallID (test_id1); - _debug ("%i\n", (int)(_mainbuffer._ringBufferMap.size())); + _debug ("%i\n", (int) (_mainbuffer._ringBufferMap.size())); CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0); CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0); @@ -1383,7 +1383,7 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); - //putdata test ring buffers + //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int)); @@ -1500,10 +1500,10 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); - // test mainbuffer availforget + // test mainbuffer availforget CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); @@ -1522,8 +1522,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget - CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); @@ -1641,8 +1641,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); @@ -1661,8 +1661,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget - CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); diff --git a/sflphone-common/test/rtpTest.cpp b/sflphone-common/test/rtpTest.cpp index d641b2fc07447ec30eafbead6bb1f93c9b239ec5..48f8ef5e4cbcfb6739f8e56bf29a9052a57a410e 100644 --- a/sflphone-common/test/rtpTest.cpp +++ b/sflphone-common/test/rtpTest.cpp @@ -81,7 +81,7 @@ bool RtpTest::pjsipInit() void RtpTest::testRtpInitClose() { - audiortp = new AudioSymmetricRtpSession(Manager::instance(), sipcall); + audiortp = new AudioSymmetricRtpSession (Manager::instance(), sipcall); _debug ("------ void RtpTest::testRtpInit() ------\n");