diff --git a/configure.ac b/configure.ac index b3a168ba65b780caf6fd54ac4cf5a24484e34dbe..988fc35e537e21c1680ba68c5e02b282227e57d0 100644 --- a/configure.ac +++ b/configure.ac @@ -188,11 +188,18 @@ PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1 >= ${LIBDBUSCPP_MIN_VERSION}) AC_SUBST(DBUSCPP_LIBS) AC_SUBST(DBUSCPP_CFLAGS) +LIBOPENSSL_MIN_VERSION=0.9.8 +PKG_CHECK_MODULES(LIBOPENSSL, libssl >= ${LIBOPENSSL_MIN_VERSION}) +AC_SUBST(LIBOPENSSL_LIBS) +AC_SUBST(LIBOPENSSL_CFLAGS) + dnl Check for libcppunit-dev CPPUNIT_MIN_VERSION=1.12 PKG_CHECK_MODULES(CPPUNIT, cppunit >= ${CPPUNIT_MIN_VERSION}) AC_SUBST(CPPUNIT_LIBS) +LIBSSL_MIN_VERSION=0.9.8 + # check for libgsm1 (doesn't use pkg-config) dnl Check for libgsm AC_ARG_WITH([gsm], diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c index 591f276ca0a91642aaf6cc3b18536017da73983f..7359a34bb1e6dde63b06c4e80bf607b236a5e4aa 100644 --- a/sflphone-gtk/src/calltree.c +++ b/sflphone-gtk/src/calltree.c @@ -378,6 +378,7 @@ void row_activated(GtkTreeView *tree_view UNUSED, { case CALL_STATE_INCOMING: dbus_accept(selectedCall); + stop_notification(); break; case CALL_STATE_HOLD: dbus_unhold(selectedCall); diff --git a/src/audio/alsalayer.cpp b/src/audio/alsalayer.cpp index b1b0dd69a6eef9e913d7b7d9fd7cdee912230a9d..2d2811b363722e41d4a2d774182eec2ef21681e4 100644 --- a/src/audio/alsalayer.cpp +++ b/src/audio/alsalayer.cpp @@ -194,9 +194,9 @@ void AlsaLayer::stopCaptureStream (void) if(_CaptureHandle){ err = snd_pcm_drop (_CaptureHandle); - _debug("AlsaLayer::stopCaptureStream snd_pcm_drop returned vaue : %i\n",err); + stop_capture (); - _debug("Wroking here !!!!!!!!!!!!!!!\n"); + } } diff --git a/src/audio/audiostream.cpp b/src/audio/audiostream.cpp index 778192643d5ee2ad3b2e2ba8540e2266a8cb370f..c031b4ac0d4a5119a7444736eb26a417d21d869f 100644 --- a/src/audio/audiostream.cpp +++ b/src/audio/audiostream.cpp @@ -66,6 +66,7 @@ AudioStream::stream_state_callback( pa_stream* s, void* user_data UNUSED ) case PA_STREAM_READY: _debug("Stream successfully created, connected to %s\n", pa_stream_get_device_name( s )); + pa_stream_cork( s, 0, NULL, NULL); break; case PA_STREAM_UNCONNECTED: _debug("Stream unconnected\n"); diff --git a/src/audio/pulselayer.cpp b/src/audio/pulselayer.cpp index 40de7e886fa86a6282b40e5870c402d3af0b4a18..8101e5e23839497707a618fe7f7afd1c08c533a2 100644 --- a/src/audio/pulselayer.cpp +++ b/src/audio/pulselayer.cpp @@ -140,12 +140,12 @@ void PulseLayer::createStreams( pa_context* c ) playback = new AudioStream(c, PLAYBACK_STREAM, PLAYBACK_STREAM_NAME, _manager->getSpkrVolume()); pa_stream_set_write_callback( playback->pulseStream(), audioCallback, this); - //pa_stream_set_overflow_callback( playback->pulseStream() , overflow , this); + // pa_stream_set_overflow_callback( playback->pulseStream() , overflow , this); // pa_stream_set_suspended_callback( playback->pulseStream(), stream_suspended_callback, this); record = new AudioStream(c, CAPTURE_STREAM, CAPTURE_STREAM_NAME , _manager->getMicVolume()); pa_stream_set_read_callback( record->pulseStream() , audioCallback, this); - //pa_stream_set_underflow_callback( record->pulseStream() , underflow , this); + // pa_stream_set_underflow_callback( record->pulseStream() , underflow , this); // pa_stream_set_suspended_callback(record->pulseStream(), stream_suspended_callback, this); @@ -173,6 +173,8 @@ bool PulseLayer::openDevice(int indexIn UNUSED, int indexOut UNUSED, int sampleR assert(context); connectPulseAudioServer(); + + startStream(); _debug("Connection Done!! \n"); return true; @@ -254,8 +256,6 @@ void PulseLayer::stream_suspended_callback(pa_stream *s, void *userdata UNUSED ) void PulseLayer::processData( void ) { - _debug("PulseLayer::processData() \n"); - // Handle the mic // We check if the stream is ready if( (record->pulseStream()) && (pa_stream_get_state( record->pulseStream()) == PA_STREAM_READY)) diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp index 231e024d4619433cbc8ad291411a1155a1183150..79466dc5028ab6093d3c3565d0d2ed8818162977 100644 --- a/src/iaxvoiplink.cpp +++ b/src/iaxvoiplink.cpp @@ -74,6 +74,8 @@ IAXVoIPLink::~IAXVoIPLink() audiolayer = NULL; + delete converter; + delete [] micData; micData = NULL; delete [] micDataConverted; micDataConverted = NULL; delete [] micDataEncoded; micDataEncoded = NULL; diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index c24affc647efee0a88119fc1d99cf61bd7dd42db..4ad23121b347059f92cc050def291349b38f7c52 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -124,7 +124,7 @@ ManagerImpl::init() AudioLayer *audiolayer = getAudioDriver(); - if (audiolayer!=0) { + if (audiolayer != 0) { unsigned int sampleRate = audiolayer->getSampleRate(); _debugInit("Load Telephone Tone"); @@ -134,6 +134,9 @@ ManagerImpl::init() _debugInit("Loading DTMF key"); _dtmfKey = new DTMF(sampleRate); } + + if (audiolayer == 0) + audiolayer->stopStream(); } void ManagerImpl::terminate() @@ -190,6 +193,9 @@ ManagerImpl::outgoingCall(const std::string& accountid, const CallID& id, const { _debug("ManagerImpl::outgoingCall() method \n"); + stopTone(false); + playTone(); + if (!accountExists(accountid)) { _debug("! Manager Error: Outgoing Call: account doesn't exist\n"); return false; @@ -221,6 +227,14 @@ ManagerImpl::outgoingCall(const std::string& accountid, const CallID& id, const bool ManagerImpl::answerCall(const CallID& id) { + bool isActive = false; + + AccountID currentaccountid = getAccountFromCall( id ); + Call* currentcall = getAccountLink(currentaccountid)->getCall(getCurrentCallId()); + _debug("ManagerImpl::answerCall :: current call->getState %i \n",currentcall->getState()); + + if (currentcall->getState() == 1) + isActive = true; stopTone(false); _debug("Try to answer call: %s\n", id.data()); @@ -230,10 +244,27 @@ ManagerImpl::answerCall(const CallID& id) return false; } - if (id != getCurrentCallId()) { + /* + _debug("_nbIncomingWaitingCall =======>>>>>>>> %i \n",_nbIncomingWaitingCall); + + CallIDSet::iterator iter = _waitingCall.begin(); + while (iter != _waitingCall.end()) { + CallID ident = *iter; + AccountID acc = getAccountFromCall( ident ); + Call* call = getAccountLink(acc)->getCall(ident); + _debug("ManagerImpl::answerCall :: incoming call ident: %s \n",ident.c_str()); + _debug("ManagerImpl::answerCall :: incoming call state: %i \n",call->getState()); + ++iter; + } + */ + + // if (id != getCurrentCallId()) { + if (isActive) { _debug("* Manager Info: there is currently a call, try to hold it\n"); + onHoldCall(getCurrentCallId()); } + if (!getAccountLink(accountid)->answer(id)) { // error when receiving... @@ -313,11 +344,11 @@ ManagerImpl::cancelCall (const CallID& id) bool ManagerImpl::onHoldCall(const CallID& id) { - _debug("*************** ON HOLD ***********************************\n"); + stopTone(true); AccountID accountid = getAccountFromCall( id ); if (accountid == AccountNULL) { - _debug("5 Manager On Hold Call: Account ID %s or callid %s desn't exists\n", accountid.c_str(), id.c_str()); + _debug("5 Manager On Hold Call: Account ID %s or callid %s doesn't exists\n", accountid.c_str(), id.c_str()); return false; } @@ -336,7 +367,7 @@ ManagerImpl::onHoldCall(const CallID& id) bool ManagerImpl::offHoldCall(const CallID& id) { - _debug("*************** OFF HOLD ***********************************\n"); + stopTone(false); AccountID accountid = getAccountFromCall( id ); if (accountid == AccountNULL) { @@ -598,13 +629,21 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId) associateCallToAccount(call->getCallId(), accountId); + _debug("ManagerImpl::incomingCall :: hasCurrentCall() %i \n",hasCurrentCall()); + if ( !hasCurrentCall() ) { call->setConnectionState(Call::Ringing); ringtone(); switchCall(call->getCallId()); - } else { + + } + /* + else { addWaitingCall(call->getCallId()); } + */ + + addWaitingCall(call->getCallId()); from = call->getPeerName(); number = call->getPeerNumber(); @@ -618,6 +657,15 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId) from.append(number); from.append(">"); } + + /* + CallIDSet::iterator iter = _waitingCall.begin(); + while (iter != _waitingCall.end()) { + CallID ident = *iter; + _debug("ManagerImpl::incomingCall :: CALL iteration: %s \n",ident.c_str()); + ++iter; + } + */ /* Broadcast a signal over DBus */ _dbus->getCallManager()->incomingCall(accountId, call->getCallId(), from); @@ -1592,6 +1640,8 @@ void ManagerImpl::setAudioManager( const int32_t& api ) { int manager; + _debug(" ManagerImpl::setAudioManager :: %i \n",api); + manager = api; if( manager == PULSEAUDIO ) { @@ -1705,8 +1755,8 @@ ManagerImpl::initAudioDriver(void) if (error == -1) { _debug("Init audio driver: %i\n", error); } - } - + } + } /** @@ -1756,6 +1806,7 @@ ManagerImpl::selectAudioDriver (void) /* Notify the error if there is one */ if( _audiodriver -> getErrorMessage() != -1 ) notifyErrClient( _audiodriver -> getErrorMessage()); + } void ManagerImpl::switchAudioManager (void) @@ -1796,6 +1847,16 @@ void ManagerImpl::switchAudioManager (void) _audiodriver->openDevice( numCardIn , numCardOut, samplerate, framesize, SFL_PCM_BOTH, alsaPlugin ); if( _audiodriver -> getErrorMessage() != -1 ) notifyErrClient( _audiodriver -> getErrorMessage()); + + _debug("Current device: %i \n", type); + _debug("has current call: %i \n", hasCurrentCall()); + + // need to stop audio streams if there is currently no call + if( (type != PULSEAUDIO) && (!hasCurrentCall())) { + _debug("There is currently a call!!\n"); + _audiodriver->stopStream(); + + } } /** diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 33e738f345a47cb7145525ed6a6a0fba92ea60ab..a1fec949673df9f2ae270c6031a46a987574ee7f 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -267,6 +267,7 @@ SIPVoIPLink::getEvent() int SIPVoIPLink::sendRegister( AccountID id ) { + _debug("sendRegister called!!!!!!!!!!!!!!!!!!!!!!! \n"); pj_status_t status; int expire_value; char contactTmp[256]; @@ -1348,36 +1349,34 @@ void SIPVoIPLink::setStunServer( const std::string &server ) pj_sockaddr_in bound_addr; pjsip_host_port a_name; char tmpIP[32]; - pj_sock_t sock; + pj_sock_t sock; // Init bound address to ANY pj_memset(&bound_addr, 0, sizeof (bound_addr)); - bound_addr.sin_addr.s_addr = PJ_INADDR_ANY; + + + bound_addr.sin_addr.s_addr = pj_htonl(PJ_INADDR_ANY); + bound_addr.sin_port = pj_htons((pj_uint16_t) _localPort); + bound_addr.sin_family = PJ_AF_INET; + pj_bzero(bound_addr.sin_zero, sizeof(bound_addr.sin_zero)); - // Create UDP server socket - status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &sock); - if (status != PJ_SUCCESS) { - _debug("UserAgent: (%d) UDP socket() error\n", status); - return status; - } - status = pj_sock_bind_in(sock, pj_ntohl(bound_addr.sin_addr.s_addr), (pj_uint16_t) _localPort); - if (status != PJ_SUCCESS) { - _debug("UserAgent: (%d) UDP bind() error\n", status); - pj_sock_close(sock); - return status; - } - _debug("UserAgent: Use IP: %s\n", _localExternAddress.data()); + _debug("bound_addr.sin_port %i \n", bound_addr.sin_port); + + _debug("UserAgent: Use IP: %s\n", _localExternAddress.data()); + + // Create UDP-Server (default port: 5060) strcpy(tmpIP, _localExternAddress.data()); pj_strdup2(_pool, &a_name.host, tmpIP); a_name.port = (pj_uint16_t) _localExternPort; - _debug("a_name: host: %s - port : %i\n", a_name.host.ptr, a_name.port); - status = pjsip_udp_transport_attach(_endpt, sock, &a_name, 1, NULL); + // status = pjsip_tls_transport_start(_endpt, NULL, &bound_addr, &a_name, 1, NULL); + status = pjsip_udp_transport_start(_endpt, &bound_addr, &a_name, 1, NULL); + if (status != PJ_SUCCESS) { _debug("UserAgent: (%d) Unable to start UDP transport!\n", status); return -1;