diff --git a/sflphone-common/src/call.cpp b/sflphone-common/src/call.cpp index 0e7ee9f795fd50b67d7bebcc12f278949206144c..b10dcaebda1f4c64f190d8296d6a666f87be6e5b 100644 --- a/sflphone-common/src/call.cpp +++ b/sflphone-common/src/call.cpp @@ -39,16 +39,12 @@ Call::Call (const CallID& id, Call::CallType type) SOUND_FORMAT soundFormat = INT16; recAudio.setRecordingOption (fileType,soundFormat,44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH),id); - // _debug("CALL::Constructor for this clss is called \n"); } Call::~Call() { - // _debug("CALL::~Call(): Destructor for this clss is called \n"); - if (recAudio.isOpenFile()) { - // _debug("CALL::~Call(): A recording file is open, close it \n"); recAudio.closeFile(); } } diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 2f5a2b720a6e11ac706379717f446c8126e419b7..fb57815c6b7b7643c362f169c8291e8fa21f6c37 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -350,7 +350,7 @@ ManagerImpl::hangupCall (const CallID& id) int nbCalls = getCallList().size(); - _debug ("nbCalls %i \n", nbCalls); + _debug ("hangupCall: callList is of size %i call(s)\n", nbCalls); // stop stream if (! (nbCalls > 1)) @@ -1422,7 +1422,7 @@ ManagerImpl::setActiveCodecList (const std::vector< std::string >& list) _codecDescriptorMap.saveActiveCodecs (list); // setConfig std::string s = serialize (list); - printf ("%s\n", s.c_str()); + _debug ("Setting codec with payload number %s to the active list\n", s.c_str()); setConfig ("Audio", "ActiveCodecs", s); } @@ -1467,7 +1467,7 @@ ManagerImpl::serialize (std::vector<std::string> v) std::vector <std::string> ManagerImpl::getActiveCodecList (void) { - _debug ("Get Active codecs list\n"); + _debug ("ManagerImpl::getActiveCodecList\n"); std::vector< std::string > v; CodecOrder active = _codecDescriptorMap.getActiveCodecs(); unsigned int i=0; @@ -1477,7 +1477,7 @@ ManagerImpl::getActiveCodecList (void) std::stringstream ss; ss << active[i]; v.push_back ( (ss.str()).data()); - _debug ("%s\n", ss.str().data()); + _debug ("Codec with payload number %s is active\n", ss.str().data()); i++; } @@ -2709,7 +2709,7 @@ ManagerImpl::loadAccountMap() } if (tmpAccount != NULL) { - _debug (" %s \n", iter->c_str()); + _debug ("Loading account %s \n", iter->c_str()); _accountMap[iter->c_str() ] = tmpAccount; nbAccount++; } @@ -2775,7 +2775,6 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s for (iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) { _debug ("for : account = %s\n", iter->first.c_str()); account = dynamic_cast<SIPAccount *> (iter->second); - _debug ("account != NULL = %i\n", (account != NULL)); if (account != NULL) { if (account->fullMatch (userName, server)) { diff --git a/sflphone-common/src/sdp.cpp b/sflphone-common/src/sdp.cpp index 8c79cb36dd98489ccf568fc3bf27e12335a36aff..3b5a0a347761838435e4cfb9da2d77c8300ad3e3 100644 --- a/sflphone-common/src/sdp.cpp +++ b/sflphone-common/src/sdp.cpp @@ -477,7 +477,7 @@ void Sdp::set_local_media_capabilities () // Clean it first _local_media_cap.clear(); - _debug ("Fetch local media capabilities .......... %i\n" , get_local_extern_audio_port()); + _debug ("Fetch local media capabilities. Local extern audio port: %i\n" , get_local_extern_audio_port()); /* Only one audio media used right now */ audio = new sdpMedia (MIME_TYPE_AUDIO); diff --git a/sflphone-common/src/sipcall.cpp b/sflphone-common/src/sipcall.cpp index 8f1017ce0a314b6051234a6830ef4965f9c1e95b..0a87a613045804fcc64dee45106e8da96fd85204 100644 --- a/sflphone-common/src/sipcall.cpp +++ b/sflphone-common/src/sipcall.cpp @@ -33,7 +33,7 @@ SIPCall::SIPCall (const CallID& id, Call::CallType type, pj_pool_t *pool) : Call , _local_sdp (0) { _local_sdp = new Sdp (pool); - _debug ("SIPCALL::Constructor for this clss is called \n"); + _debug ("SIPCALL::Constructor for this class is called \n"); } SIPCall::~SIPCall() @@ -41,7 +41,7 @@ SIPCall::~SIPCall() delete _local_sdp; _local_sdp = 0; - _debug ("SIPCALL::Destructor for this clss is called \n"); + _debug ("SIPCALL::Destructor for this class is called \n"); } diff --git a/sflphone-common/src/sipvoiplink.cpp b/sflphone-common/src/sipvoiplink.cpp index fadfc65986a00c64043d33df49d420331881ee79..b3a93b22a222a04d38a8dde14ea5258cefec2c06 100644 --- a/sflphone-common/src/sipvoiplink.cpp +++ b/sflphone-common/src/sipvoiplink.cpp @@ -32,6 +32,28 @@ #define CAN_REINVITE 1 +static char * invitationStateMap[] = { +"PJSIP_INV_STATE_NULL", +"PJSIP_INV_STATE_CALLING", +"PJSIP_INV_STATE_INCOMING", +"PJSIP_INV_STATE_EARLY", +"PJSIP_INV_STATE_CONNECTING", +"PJSIP_INV_STATE_CONFIRMED", +"PJSIP_INV_STATE_DISCONNECTED" +}; + +static char * transactionStateMap[] = { +"PJSIP_TSX_STATE_NULL" , +"PJSIP_TSX_STATE_CALLING", +"PJSIP_TSX_STATE_TRYING", +"PJSIP_TSX_STATE_PROCEEDING", +"PJSIP_TSX_STATE_COMPLETED", +"PJSIP_TSX_STATE_CONFIRMED", +"PJSIP_TSX_STATE_TERMINATED", +"PJSIP_TSX_STATE_DESTROYED", +"PJSIP_TSX_STATE_MAX" +}; + struct result { pj_status_t status; @@ -574,7 +596,7 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl) setCallAudioLocal (call, getLocalIPAddress(), useStun(), getStunServer()); try { - _debug ("CREATE NEW RTP SESSION FROM NEWOUTGOINGCALL\n"); + _debug ("Creating new rtp session in newOutgoingCall\n"); _audiortp->createNewSession (call); } catch (...) { _debug ("Failed to create rtp thread from newOutGoingCall\n"); @@ -1154,12 +1176,10 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED) strTo = getSipTo (call->getPeerNumber(), account->getHostname()); - _debug (" To: %s\n", strTo.data()); - // Generate the from URI strFrom = "sip:" + account->getUsername() + "@" + account->getHostname(); - _debug (" From: %s\n", strFrom.c_str()); + _debug ("Placing new call: \nTo: %s\nFrom: %s\n", strTo.data(), strFrom.c_str()); // pjsip need the from and to information in pj_str_t format pj_strdup2 (_pool, &from, strFrom.data()); @@ -1929,7 +1949,7 @@ void SIPVoIPLink::handle_reinvite (SIPCall *call) // This callback is called when the invite session state has changed void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) { - _debug ("--------------------- call_on_state_changed --------------------- %i\n", inv->state); + _debug ("call_on_state_changed to state %s\n", invitationStateMap[inv->state]); SIPCall *call; AccountID accId; @@ -2039,7 +2059,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) link->SIPCallAnswered (call, rdata); } else if (inv->state == PJSIP_INV_STATE_DISCONNECTED) { - _debug ("------------------- Call disconnected ---------------------\n"); + _debug ("Invitation falled in state \"disconnected\".\n"); _debug ("State: %i, Disconnection cause: %i\n", inv->state, inv->cause); switch (inv->cause) { @@ -2082,7 +2102,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) // This callback is called after SDP offer/answer session has completed. void call_on_media_update (pjsip_inv_session *inv, pj_status_t status) { - _debug ("--------------------- call_on_media_update --------------------- \n"); + _debug ("call_on_media_update\n"); const pjmedia_sdp_session *local_sdp; const pjmedia_sdp_session *remote_sdp; @@ -2140,8 +2160,7 @@ void call_on_forked (pjsip_inv_session *inv, pjsip_event *e) void call_on_tsx_changed (pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e) { - - _debug ("--------------------- call_on_tsx_changed --------------------- %i\n", tsx->state); + _debug ("call_on_tsx_changed to state %s\n", transactionStateMap[tsx->state]); if (tsx->role==PJSIP_ROLE_UAS && tsx->state==PJSIP_TSX_STATE_TRYING && pjsip_method_cmp (&tsx->method, &pjsip_refer_method) ==0) { @@ -2244,7 +2263,7 @@ mod_on_rx_request (pjsip_rx_data *rdata) userName = std::string (sip_uri->user.ptr, sip_uri->user.slen); server = std::string (sip_uri->host.ptr, sip_uri->host.slen); - std::cout << userName << " ------------------ " << server << std::endl; + _debug("mod_on_rx_request: %s@%s\n", userName.c_str(), server.c_str()); // Get the account id of callee from username and server account_id = Manager::instance().getAccountIdFromNameAndServer (userName, server); @@ -2433,7 +2452,7 @@ mod_on_rx_request (pjsip_rx_data *rdata) pj_bool_t mod_on_rx_response (pjsip_rx_data *rdata UNUSED) { - + _debug("Mod on rx response"); return PJ_SUCCESS; }