From dfe7e9a4bbf76868eb736fbb81d9547b22a25f8d Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.comemmanuel.milou@savoirfairelinux.com> Date: Thu, 17 Jan 2008 09:51:14 -0500 Subject: [PATCH] Bug fix --- sflphone-gtk/src/actions.c | 1 + sflphone-gtk/src/configwindow.c | 4 ++-- src/audio/audiortp.cpp | 13 ++++++------- src/managerimpl.cpp | 19 +++++++++++++------ src/sipaccount.cpp | 5 ++--- src/sipvoiplink.cpp | 2 ++ src/user_cfg.h | 4 ++-- 7 files changed, 28 insertions(+), 20 deletions(-) diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index bcb1e78d37..7487782bcc 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -207,6 +207,7 @@ sflphone_pick_up() printf("accountID=%s\n",selectedCall->accountID); break; case CALL_STATE_INCOMING: + printf("CALL ID = %s\n", selectedCall->callID); dbus_accept (selectedCall); break; case CALL_STATE_HOLD: diff --git a/sflphone-gtk/src/configwindow.c b/sflphone-gtk/src/configwindow.c index acb2334afe..d88329e182 100644 --- a/sflphone-gtk/src/configwindow.c +++ b/sflphone-gtk/src/configwindow.c @@ -199,8 +199,8 @@ select_codec( GtkComboBox* wid) guint item = gtk_combo_box_get_active(wid); /* now we want this selected codec to be used as the preferred codec */ /* ie first in the list in the user config */ - codec_set_prefered_order(item); - dbus_set_prefered_codec(codec_list_get_nth(0)->name); + //codec_set_prefered_order(item); + //dbus_set_prefered_codec(codec_list_get_nth(0)->name); } void diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp index 53efa0962d..c3b7aa0c8d 100644 --- a/src/audio/audiortp.cpp +++ b/src/audio/audiortp.cpp @@ -66,7 +66,7 @@ AudioRtp::createNewSession (SIPCall *ca) { // Start RTP Send/Receive threads _symmetric = Manager::instance().getConfigInt(SIGNALISATION,SYMMETRIC) ? true : false; _RTXThread = new AudioRtpRTX (ca, _symmetric); - + printf("_sym=%i\n\n", _symmetric); try { if (_RTXThread->start() != 0) { _debug("! ARTP Failure: unable to start RTX Thread\n"); @@ -111,7 +111,6 @@ AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym) // TODO: this should be the local ip not the external (router) IP std::string localipConfig = _ca->getLocalIp(); // _ca->getLocalIp(); ost::InetHostAddress local_ip(localipConfig.c_str()); - if (!_sym) { _sessionRecv = new ost::RTPSession(local_ip, _ca->getLocalAudioPort()); _sessionSend = new ost::RTPSession(local_ip, _ca->getLocalAudioPort()); @@ -182,7 +181,7 @@ AudioRtpRTX::initAudioRtpSession (void) try { if (_ca == 0) { return; } - //_debug("Init audio RTP session\n"); + _debug("Init audio RTP session\n"); ost::InetHostAddress remote_ip(_ca->getRemoteIp().c_str()); if (!remote_ip) { _debug("! ARTP Thread Error: Target IP address [%s] is not correct!\n", _ca->getRemoteIp().data()); @@ -224,7 +223,7 @@ AudioRtpRTX::initAudioRtpSession (void) _sessionSend->setMark(true); } else { - //_debug("AudioRTP Thread: Added session destination %s:%d\n", remote_ip.getHostname(), (unsigned short) _ca->getRemoteSdpAudioPort()); + //_debug("AudioRTP Thread: Added session destination %s\n", remote_ip.getHostname() ); if (!_session->addDestination (remote_ip, (unsigned short) _ca->getRemoteAudioPort())) { return; @@ -330,13 +329,14 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime) adu = _session->getData(_session->getFirstTimestamp()); } if (adu == NULL) { + //_debug("No RTP audio stream\n"); return; } int payload = adu->getType(); // codec type unsigned char* data = (unsigned char*)adu->getData(); // data in char unsigned int size = adu->getSize(); // size in char - + // Decode data with relevant codec AudioCodec* audiocodec = _ca->getCodecMap().getCodec((CodecType)payload); @@ -359,7 +359,7 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime) _debug("We have decoded an RTP packet larger than expected: %s VS %s. Cropping.\n", nbInt16, max); nbInt16=max; } - + SFLDataFormat* toAudioLayer; int nbSample = nbInt16; @@ -501,7 +501,6 @@ AudioRtpRTX::run () { // Recv session //////////////////////////// receiveSessionForSpkr(countTime); - // Let's wait for the next transmit cycle Thread::sleep(TimerPort::getTimer()); TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 858e0233a0..b16891dc9b 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -166,6 +166,7 @@ ManagerImpl::isCurrentCall(const CallID& callId) { bool ManagerImpl::hasCurrentCall() { ost::MutexLock m(_currentCallMutex); + _debug("Current call ID = %s\n", _currentCallId2.c_str()); if ( _currentCallId2 != "") { return true; } @@ -220,10 +221,10 @@ bool ManagerImpl::answerCall(const CallID& id) { stopTone(false); - if (hasCurrentCall()) + /*if (hasCurrentCall()) { onHoldCall(getCurrentCallId()); - } + }*/ AccountID accountid = getAccountFromCall( id ); if (accountid == AccountNULL) { _debug("Answering Call: Call doesn't exists\n"); @@ -611,6 +612,7 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId) associateCallToAccount(call->getCallId(), accountId); if ( !hasCurrentCall() ) { + _debug("INCOMING CALL!!!!!!\n"); call->setConnectionState(Call::Ringing); ringtone(); switchCall(call->getCallId()); @@ -990,7 +992,7 @@ ManagerImpl::behindNat(const std::string& svr, int port) { StunAddress4 stunSvrAddr; stunSvrAddr.addr = 0; - + // Convert char* to StunAddress4 structure bool ret = stunParseServerName ((char*)svr.data(), stunSvrAddr); if (!ret) { @@ -1085,9 +1087,12 @@ void ManagerImpl::initAudioCodec (void) { _debugInit("Active Codecs"); - _codecDescriptorMap.setActive(getConfigString("Audio", "Codecs.codec1")); + //_codecDescriptorMap.setActive(getConfigString("Audio", "Codecs.codec1")); //_codecDescriptorMap.setActive(getConfigString("Audio", "Codec.codec2")); //_codecDescriptorMap.setActive(getConfigString("Audio", "Codec.codec3")); + _codecDescriptorMap.setActive("G711a"); + _codecDescriptorMap.setActive("G711u"); + _codecDescriptorMap.setActive("GSM"); } void @@ -1102,8 +1107,10 @@ ManagerImpl::setPreferedCodec(const ::DBus::String& codec_name) list[0] = list[i]; list[i] = tmp; _codecDescriptorMap.setActive(list[0]); - _codecDescriptorMap.setInactive(list[1]); - _codecDescriptorMap.setInactive(list[2]); + //_codecDescriptorMap.setInactive(list[1]); + //_codecDescriptorMap.setInactive(list[2]); + _codecDescriptorMap.setActive(list[1]); + _codecDescriptorMap.setActive(list[2]); setConfig("Audio", "Codecs.codec1", list[0]); setConfig("Audio", "Codecs.codec2", list[1]); setConfig("Audio", "Codecs.codec3", list[2]); diff --git a/src/sipaccount.cpp b/src/sipaccount.cpp index d2d2def825..a00184ee3a 100644 --- a/src/sipaccount.cpp +++ b/src/sipaccount.cpp @@ -20,7 +20,7 @@ #include "sipaccount.h" #include "sipvoiplink.h" #include "manager.h" - +#include "user_cfg.h" SIPAccount::SIPAccount(const AccountID& accountID) : Account(accountID) @@ -43,8 +43,7 @@ SIPAccount::registerVoIPLink() int useStun = Manager::instance().getConfigInt(_accountID,SIP_USE_STUN); SIPVoIPLink* thislink = dynamic_cast<SIPVoIPLink*> (_link); - - thislink->setStunServer(Manager::instance().getConfigString(_accountID,SIP_STUN_SERVER)); + thislink->setStunServer(Manager::instance().getConfigString(_accountID,DFT_STUN_SERVER)); thislink->setUseStun( useStun!=0 ? true : false); _link->init(); diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 3288cb8886..168a2d0e8b 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -951,7 +951,9 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject) CodecMap::iterator iter = map.begin(); while(iter != map.end()) { + printf("codec = %s\n",iter->second->getCodecName().data()); if (iter->second!=0 && iter->second->isActive()) { + printf("codec = %s\n",iter->second->getCodecName().data()); payload = iter->first; // add each payload in the list of payload media_audio << payload << " "; diff --git a/src/user_cfg.h b/src/user_cfg.h index 497674b914..ad205cb6a6 100644 --- a/src/user_cfg.h +++ b/src/user_cfg.h @@ -56,8 +56,8 @@ #define PLAY_TONES "DTMF.playTones" #define PULSE_LENGTH "DTMF.pulseLength" #define SEND_DTMF_AS "DTMF.sendDTMFas" -//#define STUN_SERVER "STUN.STUNserver" -//#define USE_STUN "STUN.useStun" +#define STUN_SERVER "STUN.STUNserver" +#define USE_STUN "STUN.useStun" #define DRIVER_NAME "Drivers.driverName" #define DRIVER_NAME_IN "Drivers.driverNameIn" #define DRIVER_NAME_OUT "Drivers.driverNameOut" -- GitLab