Commit 0d62fc07 authored by Emmanuel Milou's avatar Emmanuel Milou

[#1910] Remove warnings compilation in src

parent 2c8e0c74
...@@ -23,7 +23,10 @@ ...@@ -23,7 +23,10 @@
#include "manager.h" #include "manager.h"
Account::Account (const AccountID& accountID, std::string type) : Account::Account (const AccountID& accountID, std::string type) :
_accountID (accountID), _link (NULL), _enabled (false), _type (type) _accountID (accountID)
, _link (NULL)
, _enabled (false)
, _type (type)
{ {
setRegistrationState (Unregistered); setRegistrationState (Unregistered);
} }
......
...@@ -178,12 +178,6 @@ class Account{ ...@@ -178,12 +178,6 @@ class Account{
*/ */
std::string _alias; std::string _alias;
/*
* The account type
* IAX2 or SIP
*/
std::string _type;
/** /**
* Voice over IP Link contains a listener thread and calls * Voice over IP Link contains a listener thread and calls
*/ */
...@@ -196,6 +190,12 @@ class Account{ ...@@ -196,6 +190,12 @@ class Account{
*/ */
bool _enabled; bool _enabled;
/*
* The account type
* IAX2 or SIP
*/
std::string _type;
/* /*
* The registration state of the account * The registration state of the account
*/ */
......
...@@ -88,6 +88,8 @@ AudioStream::drainStream(void) { ...@@ -88,6 +88,8 @@ AudioStream::drainStream(void) {
pa_threaded_mainloop_unlock(_mainloop); pa_threaded_mainloop_unlock(_mainloop);
} }
return true;
} }
bool bool
......
...@@ -32,9 +32,7 @@ int UrlHook::addAction (std::string field_value, std::string command) ...@@ -32,9 +32,7 @@ int UrlHook::addAction (std::string field_value, std::string command)
/* Execute the command in the background to not block the application */ /* Execute the command in the background to not block the application */
command_bg = command + " " + field_value + "&" ; command_bg = command + " " + field_value + "&" ;
/* Execute a system call */ /* Execute a system call */
RUN_COMMAND (command_bg.c_str()); return RUN_COMMAND (command_bg.c_str());
return 0;
} }
......
...@@ -920,7 +920,6 @@ void ...@@ -920,7 +920,6 @@ void
IAXVoIPLink::iaxHandleRegReply (iax_event* event) IAXVoIPLink::iaxHandleRegReply (iax_event* event)
{ {
int new_voicemails;
std::string account_id; std::string account_id;
IAXAccount *account; IAXAccount *account;
......
...@@ -86,24 +86,29 @@ main (int argc, char **argv) ...@@ -86,24 +86,29 @@ main (int argc, char **argv)
} }
} else { } else {
// PID file exists. Check the former process still alive or not. If alive, give user a hint. // PID file exists. Check the former process still alive or not. If alive, give user a hint.
fgets (cOldPid, 64, fp); char *res;
fclose (fp); res = fgets (cOldPid, 64, fp);
if (res == NULL) perror ("Error getting string from stream");
if (kill (atoi (cOldPid), 0) == SUCCESS) {
fprintf (stderr, "There is already a sflphoned daemon running in the system. Starting Failed.\n"); else
exit (-1); {
} else { fclose (fp);
if ( (fp = fopen (homepid,"w")) == NULL) {
fprintf (stderr, "Writing to PID file %s failed. Exited.\n", homepid); if (kill (atoi (cOldPid), 0) == SUCCESS) {
exit (-1); fprintf (stderr, "There is already a sflphoned daemon running in the system. Starting Failed.\n");
} else { exit (-1);
fputs (cPid , fp); } else {
fclose (fp); if ( (fp = fopen (homepid,"w")) == NULL) {
} fprintf (stderr, "Writing to PID file %s failed. Exited.\n", homepid);
exit (-1);
} } else {
} fputs (cPid , fp);
fclose (fp);
}
}
}
}
int sessionPort = 0; int sessionPort = 0;
if (argc == 2) { if (argc == 2) {
......
...@@ -286,7 +286,6 @@ ManagerImpl::answerCall (const CallID& id) ...@@ -286,7 +286,6 @@ ManagerImpl::answerCall (const CallID& id)
AccountID currentaccountid = getAccountFromCall (id); AccountID currentaccountid = getAccountFromCall (id);
Call* currentcall = getAccountLink (currentaccountid)->getCall (getCurrentCallId()); Call* currentcall = getAccountLink (currentaccountid)->getCall (getCurrentCallId());
_debug ("ManagerImpl::answerCall :: current call->getState %i \n",currentcall->getState());
if (currentcall->getState() == 1) if (currentcall->getState() == 1)
isActive = true; isActive = true;
...@@ -1050,19 +1049,12 @@ bool ManagerImpl::playATone (Tone::TONEID toneId) ...@@ -1050,19 +1049,12 @@ bool ManagerImpl::playATone (Tone::TONEID toneId)
void ManagerImpl::stopTone (bool stopAudio=true) void ManagerImpl::stopTone (bool stopAudio=true)
{ {
int hasToPlayTone; int hasToPlayTone;
AudioLayer *audiolayer;
hasToPlayTone = getConfigInt (SIGNALISATION, PLAY_TONES); hasToPlayTone = getConfigInt (SIGNALISATION, PLAY_TONES);
if (!hasToPlayTone) if (!hasToPlayTone)
return; return;
// if (stopAudio) {
// audiolayer = getAudioDriver();
// if (audiolayer) audiolayer->stopStream();
// }
_toneMutex.enterMutex(); _toneMutex.enterMutex();
if (_telephoneTone != 0) { if (_telephoneTone != 0) {
...@@ -1628,10 +1620,14 @@ ManagerImpl::getAudioOutputDeviceList (void) ...@@ -1628,10 +1620,14 @@ ManagerImpl::getAudioOutputDeviceList (void)
{ {
_debug ("Get audio output device list\n"); _debug ("Get audio output device list\n");
AlsaLayer *layer; AlsaLayer *layer;
std::vector <std::string> devices;
layer = dynamic_cast<AlsaLayer*> (getAudioDriver ()); layer = dynamic_cast<AlsaLayer*> (getAudioDriver ());
if (layer) return layer -> getSoundCardsInfo (SFL_PCM_PLAYBACK); if (layer)
devices = layer -> getSoundCardsInfo (SFL_PCM_PLAYBACK);
return devices;
} }
/** /**
...@@ -1664,12 +1660,15 @@ ManagerImpl::setAudioOutputDevice (const int index) ...@@ -1664,12 +1660,15 @@ ManagerImpl::setAudioOutputDevice (const int index)
std::vector<std::string> std::vector<std::string>
ManagerImpl::getAudioInputDeviceList (void) ManagerImpl::getAudioInputDeviceList (void)
{ {
_debug ("Get audio input device list\n");
AlsaLayer *audiolayer; AlsaLayer *audiolayer;
std::vector <std::string> devices;
audiolayer = dynamic_cast<AlsaLayer *> (getAudioDriver()); audiolayer = dynamic_cast<AlsaLayer *> (getAudioDriver());
if (audiolayer) return audiolayer->getSoundCardsInfo (SFL_PCM_CAPTURE); if (audiolayer)
devices = audiolayer->getSoundCardsInfo (SFL_PCM_CAPTURE);
return devices;
} }
/** /**
...@@ -1932,7 +1931,7 @@ ManagerImpl::setPulseAppVolumeControl (void) ...@@ -1932,7 +1931,7 @@ ManagerImpl::setPulseAppVolumeControl (void)
void ManagerImpl::setAudioManager (const int32_t& api) void ManagerImpl::setAudioManager (const int32_t& api)
{ {
int type, samplerate, framesize, numCardIn, numCardOut; int type;
std::string alsaPlugin; std::string alsaPlugin;
_debug ("Setting audio manager \n"); _debug ("Setting audio manager \n");
...@@ -1984,7 +1983,10 @@ ManagerImpl::getAudioDeviceIndex (const std::string name) ...@@ -1984,7 +1983,10 @@ ManagerImpl::getAudioDeviceIndex (const std::string name)
alsalayer = dynamic_cast<AlsaLayer *> (getAudioDriver()); alsalayer = dynamic_cast<AlsaLayer *> (getAudioDriver());
if (alsalayer) return alsalayer -> soundCardGetIndex (name); if (alsalayer)
return alsalayer -> soundCardGetIndex (name);
else
return 0;
} }
std::string std::string
...@@ -2390,7 +2392,7 @@ ManagerImpl::getAccountList() ...@@ -2390,7 +2392,7 @@ ManagerImpl::getAccountList()
{ {
std::vector< std::string > v; std::vector< std::string > v;
std::vector< std::string > account_order; std::vector< std::string > account_order;
int i; unsigned int i;
account_order = loadAccountOrder (); account_order = loadAccountOrder ();
AccountMap::iterator iter; AccountMap::iterator iter;
...@@ -2476,7 +2478,6 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma ...@@ -2476,7 +2478,6 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
std::string accountType; std::string accountType;
Account *acc; Account *acc;
VoIPLink *link;
accountType = (*details.find (CONFIG_ACCOUNT_TYPE)).second; accountType = (*details.find (CONFIG_ACCOUNT_TYPE)).second;
...@@ -2681,7 +2682,7 @@ ManagerImpl::loadAccountMap() ...@@ -2681,7 +2682,7 @@ ManagerImpl::loadAccountMap()
short nbAccount = 0; short nbAccount = 0;
TokenList sections = _config.getSections(); TokenList sections = _config.getSections();
std::string accountType; std::string accountType;
Account* tmpAccount; Account *tmpAccount = 0;
std::vector <std::string> account_order; std::vector <std::string> account_order;
TokenList::iterator iter = sections.begin(); TokenList::iterator iter = sections.begin();
...@@ -2811,25 +2812,6 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s ...@@ -2811,25 +2812,6 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s
return AccountNULL; return AccountNULL;
} }
AccountMap ManagerImpl::getSipAccountMap (void)
{
AccountMap::iterator iter;
AccountMap sipaccounts;
AccountID id;
Account *account;
for (iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) {
if (iter->second->getType() == "sip") {
//id = iter->first;
//account = iter->second;
//sipaccounts.insert( std::pair<id, account> );
}
}
return sipaccounts;
}
void ManagerImpl::restartPJSIP (void) void ManagerImpl::restartPJSIP (void)
{ {
SIPVoIPLink *siplink; SIPVoIPLink *siplink;
...@@ -3133,7 +3115,6 @@ std::vector< std::string > ...@@ -3133,7 +3115,6 @@ std::vector< std::string >
ManagerImpl::getCallList (void) ManagerImpl::getCallList (void)
{ {
std::vector< std::string > v; std::vector< std::string > v;
int i;
CallAccountMap::iterator iter = _callAccountMap.begin (); CallAccountMap::iterator iter = _callAccountMap.begin ();
......
...@@ -893,11 +893,6 @@ class ManagerImpl { ...@@ -893,11 +893,6 @@ class ManagerImpl {
void registerCurSIPAccounts(VoIPLink *link); void registerCurSIPAccounts(VoIPLink *link);
/**
* Returns a map with only the existing SIP accounts
*/
AccountMap getSipAccountMap( void );
/* /*
* Initialize audiodriver * Initialize audiodriver
*/ */
......
...@@ -207,6 +207,9 @@ bool AudioRecord::setRecording() ...@@ -207,6 +207,9 @@ bool AudioRecord::setRecording()
recordingEnabled_ = true; // once opend file, start recording recordingEnabled_ = true; // once opend file, start recording
} }
// WARNING: Unused return value
return true;
} }
void AudioRecord::stopRecording() void AudioRecord::stopRecording()
...@@ -344,6 +347,8 @@ bool AudioRecord::openExistingRawFile() ...@@ -344,6 +347,8 @@ bool AudioRecord::openExistingRawFile()
_debug ("AudioRecord::openExistingRawFile() : could not create RAW file!\n"); _debug ("AudioRecord::openExistingRawFile() : could not create RAW file!\n");
return false; return false;
} }
return true;
} }
...@@ -386,6 +391,8 @@ bool AudioRecord::openExistingWavFile() ...@@ -386,6 +391,8 @@ bool AudioRecord::openExistingWavFile()
if (fseek (fp, 4 , SEEK_END) != 0) if (fseek (fp, 4 , SEEK_END) != 0)
_debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file \n"); _debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file \n");
return true;
} }
......
...@@ -35,7 +35,14 @@ static const pj_str_t STR_RTPMAP = { (char*) "rtpmap", 6 }; ...@@ -35,7 +35,14 @@ static const pj_str_t STR_RTPMAP = { (char*) "rtpmap", 6 };
Sdp::Sdp (pj_pool_t *pool) Sdp::Sdp (pj_pool_t *pool)
: _local_media_cap(), _session_media (0), _ip_addr (""), _local_offer (NULL), _negociated_offer (NULL), _negociator (NULL), _pool (NULL), _local_extern_audio_port (0) : _local_media_cap()
, _session_media (0)
, _negociator (NULL)
, _ip_addr ("")
, _local_offer (NULL)
, _negociated_offer (NULL)
, _pool (NULL)
, _local_extern_audio_port (0)
{ {
_pool = pool; _pool = pool;
} }
...@@ -206,8 +213,8 @@ int Sdp::receiving_initial_offer (pjmedia_sdp_session* remote) ...@@ -206,8 +213,8 @@ int Sdp::receiving_initial_offer (pjmedia_sdp_session* remote)
pj_status_t Sdp::check_sdp_answer(pjsip_inv_session *inv, pjsip_rx_data *rdata) pj_status_t Sdp::check_sdp_answer(pjsip_inv_session *inv, pjsip_rx_data *rdata)
{ {
static const pj_str_t str_application = { "application", 11 }; static const pj_str_t str_application = { (char*) "application", 11 };
static const pj_str_t str_sdp = { "sdp", 3 }; static const pj_str_t str_sdp = { (char*) "sdp", 3 };
pj_status_t status; pj_status_t status;
pjsip_msg * message = NULL; pjsip_msg * message = NULL;
pjmedia_sdp_session * remote_sdp = NULL; pjmedia_sdp_session * remote_sdp = NULL;
...@@ -469,7 +476,7 @@ void Sdp::set_local_media_capabilities () ...@@ -469,7 +476,7 @@ void Sdp::set_local_media_capabilities ()
{ {
CodecOrder selected_codecs; CodecOrder selected_codecs;
int i; unsigned int i;
sdpMedia *audio; sdpMedia *audio;
CodecsMap codecs_list; CodecsMap codecs_list;
CodecsMap::iterator iter; CodecsMap::iterator iter;
......
...@@ -220,15 +220,15 @@ class Sdp { ...@@ -220,15 +220,15 @@ class Sdp {
// negociation, with the compatible media from each part // negociation, with the compatible media from each part
pjmedia_sdp_session *_negociated_offer; pjmedia_sdp_session *_negociated_offer;
// The pool to allocate memory
pj_pool_t *_pool;
/** Local audio port */ /** Local audio port */
int _local_extern_audio_port; int _local_extern_audio_port;
/** Remote's audio port */ /** Remote's audio port */
unsigned int _remote_audio_port; unsigned int _remote_audio_port;
// The pool to allocate memory
pj_pool_t *_pool;
Sdp(const Sdp&); //No Copy Constructor Sdp(const Sdp&); //No Copy Constructor
Sdp& operator=(const Sdp&); //No Assignment Operator Sdp& operator=(const Sdp&); //No Assignment Operator
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
SIPAccount::SIPAccount (const AccountID& accountID) SIPAccount::SIPAccount (const AccountID& accountID)
: Account (accountID, "sip") : Account (accountID, "sip")
, _cred (NULL) , _cred (NULL)
, _regc()
, _bRegister (false) , _bRegister (false)
, _contact ("") , _contact ("")
, _resolveOnce (false) , _resolveOnce (false)
, _regc()
{ {
/* SIPVoIPlink is used as a singleton, because we want to have only one link for all the SIP accounts created */ /* 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 */ /* So instead of creating a new instance, we just fetch the static instance, or create one if it is not yet */
......
...@@ -97,8 +97,6 @@ class SIPCall : public Call ...@@ -97,8 +97,6 @@ class SIPCall : public Call
private: private:
Sdp *_local_sdp;
int _cid; int _cid;
int _did; int _did;
int _tid; int _tid;
...@@ -111,7 +109,11 @@ class SIPCall : public Call ...@@ -111,7 +109,11 @@ class SIPCall : public Call
pjsip_evsub *_xferSub; pjsip_evsub *_xferSub;
pjsip_inv_session *_invSession;
pjsip_inv_session *_invSession;
Sdp *_local_sdp;
}; };
#endif #endif
...@@ -33,25 +33,25 @@ ...@@ -33,25 +33,25 @@
#define CAN_REINVITE 1 #define CAN_REINVITE 1
static char * invitationStateMap[] = { static char * invitationStateMap[] = {
"PJSIP_INV_STATE_NULL", (char*) "PJSIP_INV_STATE_NULL",
"PJSIP_INV_STATE_CALLING", (char*) "PJSIP_INV_STATE_CALLING",
"PJSIP_INV_STATE_INCOMING", (char*) "PJSIP_INV_STATE_INCOMING",
"PJSIP_INV_STATE_EARLY", (char*) "PJSIP_INV_STATE_EARLY",
"PJSIP_INV_STATE_CONNECTING", (char*) "PJSIP_INV_STATE_CONNECTING",
"PJSIP_INV_STATE_CONFIRMED", (char*) "PJSIP_INV_STATE_CONFIRMED",
"PJSIP_INV_STATE_DISCONNECTED" (char*) "PJSIP_INV_STATE_DISCONNECTED"
}; };
static char * transactionStateMap[] = { static char * transactionStateMap[] = {
"PJSIP_TSX_STATE_NULL" , (char*) "PJSIP_TSX_STATE_NULL" ,
"PJSIP_TSX_STATE_CALLING", (char*) "PJSIP_TSX_STATE_CALLING",
"PJSIP_TSX_STATE_TRYING", (char*) "PJSIP_TSX_STATE_TRYING",
"PJSIP_TSX_STATE_PROCEEDING", (char*) "PJSIP_TSX_STATE_PROCEEDING",
"PJSIP_TSX_STATE_COMPLETED", (char*) "PJSIP_TSX_STATE_COMPLETED",
"PJSIP_TSX_STATE_CONFIRMED", (char*) "PJSIP_TSX_STATE_CONFIRMED",
"PJSIP_TSX_STATE_TERMINATED", (char*) "PJSIP_TSX_STATE_TERMINATED",
"PJSIP_TSX_STATE_DESTROYED", (char*) "PJSIP_TSX_STATE_DESTROYED",
"PJSIP_TSX_STATE_MAX" (char*) "PJSIP_TSX_STATE_MAX"
}; };
struct result struct result
...@@ -1882,6 +1882,7 @@ bool SIPVoIPLink::pjsip_shutdown (void) ...@@ -1882,6 +1882,7 @@ bool SIPVoIPLink::pjsip_shutdown (void)
pj_shutdown(); pj_shutdown();
/* Done. */ /* Done. */
return true;
} }
int getModId() int getModId()
...@@ -1902,7 +1903,7 @@ static void dns_cb(pj_status_t status, void *token, const struct pjsip_server_ad ...@@ -1902,7 +1903,7 @@ static void dns_cb(pj_status_t status, void *token, const struct pjsip_server_ad
void set_voicemail_info (AccountID account, pjsip_msg_body *body) void set_voicemail_info (AccountID account, pjsip_msg_body *body)
{ {
int voicemail, pos_begin, pos_end; int voicemail = 0, pos_begin, pos_end;
std::string voice_str = "Voice-Message: "; std::string voice_str = "Voice-Message: ";
std::string delimiter = "/"; std::string delimiter = "/";
std::string msg_body, voicemail_str; std::string msg_body, voicemail_str;
...@@ -2655,7 +2656,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata) ...@@ -2655,7 +2656,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
return; return;
} }
SIPCall* newCall; SIPCall* newCall = 0;
SIPVoIPLink *link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink (accId)); SIPVoIPLink *link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink (accId));
...@@ -2791,7 +2792,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event) ...@@ -2791,7 +2792,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
if (event->body.rx_msg.rdata->msg_info.msg_buf != NULL) { if (event->body.rx_msg.rdata->msg_info.msg_buf != NULL) {
request = event->body.rx_msg.rdata->msg_info.msg_buf; request = event->body.rx_msg.rdata->msg_info.msg_buf;
if (request.find (noresource) != -1) { if ((int) request.find (noresource) != -1) {
_debug ("UserAgent: NORESOURCE for transfer!\n"); _debug ("UserAgent: NORESOURCE for transfer!\n");
link->transferStep2(); link->transferStep2();
pjsip_evsub_terminate (sub, PJ_TRUE); pjsip_evsub_terminate (sub, PJ_TRUE);
...@@ -2800,7 +2801,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event) ...@@ -2800,7 +2801,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
return; return;
} }
if (request.find (ringing) != -1) { if ((int) request.find (ringing) != -1) {
_debug ("UserAgent: transfered call RINGING!\n"); _debug ("UserAgent: transfered call RINGING!\n");
link->transferStep2(); link->transferStep2();
pjsip_evsub_terminate (sub, PJ_TRUE); pjsip_evsub_terminate (sub, PJ_TRUE);
......
...@@ -351,9 +351,6 @@ class SIPVoIPLink : public VoIPLink ...@@ -351,9 +351,6 @@ class SIPVoIPLink : public VoIPLink
*/ */
bool pjsip_shutdown(void); bool pjsip_shutdown(void);
/** Do we use stun? */
bool _useStun;
pj_status_t stunServerResolve(); pj_status_t stunServerResolve();
/** Create SIP UDP Listener */ /** Create SIP UDP Listener */
...@@ -363,12 +360,6 @@ class SIPVoIPLink : public VoIPLink ...@@ -363,12 +360,6 @@ class SIPVoIPLink : public VoIPLink
std::string getLocalIP() {return _localExternAddress;} std::string getLocalIP() {return _localExternAddress;}
/** Starting sound */
AudioRtp* _audiortp;
/** For registration use only */
int _regPort;
/* Flag to check if the STUN server is valid or not */ /* Flag to check if the STUN server is valid or not */
bool validStunServer; bool validStunServer;
...@@ -381,6 +372,15 @@ class SIPVoIPLink : public VoIPLink ...@@ -381,6 +372,15 @@ class SIPVoIPLink : public VoIPLink
/** Local Extern Port is the port seen by peers for SIP listener */ /** Local Extern Port is the port seen by peers for SIP listener */
unsigned int _localExternPort; unsigned int _localExternPort;
/** Starting sound */
AudioRtp* _audiortp;
/** For registration use only */
int _regPort;
/** Do we use stun? */
bool _useStun;
/** Threading object */ /** Threading object */
EventThread* _evThread; EventThread* _evThread;
ost::Mutex _mutexSIP; ost::Mutex _mutexSIP;
......
...@@ -87,7 +87,6 @@ bool VoIPLink::clearCallMap() ...@@ -87,7 +87,6 @@ bool VoIPLink::clearCallMap()
Account* VoIPLink::getAccountPtr (void) Account* VoIPLink::getAccountPtr (void)
{ {
Account* account;
AccountID id; AccountID id;
id = getAccountID(); id = getAccountID();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment