Skip to content
Snippets Groups Projects
Commit 9967379d authored by yanmorin's avatar yanmorin
Browse files

Remove iterator corruption
Put sflphoned to libexec
parent 8b6cf3cd
No related branches found
No related tags found
No related merge requests found
...@@ -148,6 +148,7 @@ sflphone.spec \ ...@@ -148,6 +148,7 @@ sflphone.spec \
sflphoned-fedora.spec \ sflphoned-fedora.spec \
Makefile \ Makefile \
src/Makefile \ src/Makefile \
src/sflphone \
src/audio/Makefile \ src/audio/Makefile \
src/audio/gsm/Makefile \ src/audio/gsm/Makefile \
src/audio/pacpp/Makefile \ src/audio/pacpp/Makefile \
......
bin_PROGRAMS = sflphoned libexec_PROGRAMS = sflphoned
bin_SCRIPTS = sflphone
if USE_ZEROCONF if USE_ZEROCONF
ZEROCONFDIR = zeroconf ZEROCONFDIR = zeroconf
......
...@@ -44,10 +44,11 @@ typedef short int16; ...@@ -44,10 +44,11 @@ typedef short int16;
#define SFLPHONED_VERSION "0.5" #define SFLPHONED_VERSION "0.5"
#define SFLPHONED_VERSIONNUM 0x000500 #define SFLPHONED_VERSIONNUM 0x000500
#define PROGNAME "sflphoned" #define PROGNAME "sflphoned"
#define PROGDIR "sflphone" #define PROGNAME_GLOBAL "sflphone"
#define RINGDIR "ringtones" #define PROGDIR "sflphone"
#define CODECDIR "codecs" #define RINGDIR "ringtones"
#define CODECDIR "codecs"
#define MONO 1 #define MONO 1
#define CHANNELS 2 #define CHANNELS 2
......
...@@ -71,8 +71,8 @@ public: ...@@ -71,8 +71,8 @@ public:
iter = _argList.begin(); iter = _argList.begin();
if (iter != _argList.end() && iter->length() != 0) { if (iter != _argList.end() && iter->length() != 0) {
_callId = *iter; _callId = *iter;
iter++;
// last arg is the destination // last arg is the destination
iter++;
if (iter != _argList.end()) { if (iter != _argList.end()) {
_destination = *iter; _destination = *iter;
argsAreValid = true; argsAreValid = true;
......
...@@ -95,7 +95,7 @@ RequestConfigGet::RequestConfigGet(const std::string &sequenceId, const TokenLis ...@@ -95,7 +95,7 @@ RequestConfigGet::RequestConfigGet(const std::string &sequenceId, const TokenLis
if (iter != _argList.end()) { if (iter != _argList.end()) {
_section = *iter; _section = *iter;
_argList.pop_front(); _argList.pop_front();
iter++; iter = _argList.begin();
if (iter != _argList.end()) { if (iter != _argList.end()) {
_name = *iter; _name = *iter;
_argList.pop_front(); _argList.pop_front();
...@@ -128,11 +128,11 @@ RequestConfigSet::RequestConfigSet(const std::string &sequenceId, const TokenLis ...@@ -128,11 +128,11 @@ RequestConfigSet::RequestConfigSet(const std::string &sequenceId, const TokenLis
if (iter != _argList.end()) { if (iter != _argList.end()) {
_section = *iter; _section = *iter;
_argList.pop_front(); _argList.pop_front();
iter++; iter = _argList.begin();
if (iter != _argList.end()) { if (iter != _argList.end()) {
_name = *iter; _name = *iter;
_argList.pop_front(); _argList.pop_front();
iter++; iter = _argList.begin();
if (iter != _argList.end()) { if (iter != _argList.end()) {
_value = *iter; _value = *iter;
_argList.pop_front(); _argList.pop_front();
......
...@@ -816,6 +816,46 @@ ManagerImpl::peerHungupCall (CALLID id) ...@@ -816,6 +816,46 @@ ManagerImpl::peerHungupCall (CALLID id)
return 1; return 1;
} }
/**
* Multi Thread
*/
void
ManagerImpl::callBusy(CALLID id) {
_debug("%10d: Call is busy\n", id);
playATone(Tone::TONE_BUSY);
ost::MutexLock m(_mutex);
Call* call = getCall(id);
if (call != 0) {
call->setState(Call::Busy);
}
deleteCall(id);
call->setState(Call::Hungup);
removeCallFromCurrent(id);
}
/**
* Multi Thread
*/
void
ManagerImpl::callFailure(CALLID id) {
_debug("%10d: Call failed\n", id);
playATone(Tone::TONE_BUSY);
_mutex.enterMutex();
Call* call = getCall(id);
if (call != 0) {
call->setState(Call::Error);
}
_mutex.leaveMutex();
if (_gui) {
_gui->callFailure(id);
}
deleteCall(id);
call->setState(Call::Hungup);
removeCallFromCurrent(id);
}
/** /**
* SipEvent Thread * SipEvent Thread
* for outgoing call, send by SipEvent * for outgoing call, send by SipEvent
...@@ -996,38 +1036,6 @@ ManagerImpl::ringtone() ...@@ -996,38 +1036,6 @@ ManagerImpl::ringtone()
} }
} }
/**
* Multi Thread
*/
void
ManagerImpl::callBusy(CALLID id) {
_debug("%10d: Call is busy\n", id);
playATone(Tone::TONE_BUSY);
ost::MutexLock m(_mutex);
Call* call = getCall(id);
if (call != 0) {
call->setState(Call::Busy);
}
}
/**
* Multi Thread
*/
void
ManagerImpl::callFailure(CALLID id) {
_debug("%10d: Call failed\n", id);
playATone(Tone::TONE_BUSY);
_mutex.enterMutex();
Call* call = getCall(id);
if (call != 0) {
call->setState(Call::Error);
}
_mutex.leaveMutex();
if (_gui) {
_gui->callFailure(id);
}
}
AudioLoop* AudioLoop*
ManagerImpl::getTelephoneTone() ManagerImpl::getTelephoneTone()
{ {
......
...@@ -97,7 +97,7 @@ SipVoIPLink::init(void) ...@@ -97,7 +97,7 @@ SipVoIPLink::init(void)
_debug("VoIP Link listen on port %d\n", DEFAULT_SIP_PORT); _debug("VoIP Link listen on port %d\n", DEFAULT_SIP_PORT);
} }
// Set user agent // Set user agent
std::string tmp = std::string(PROGNAME) + "/" + std::string(SFLPHONED_VERSION); std::string tmp = std::string(PROGNAME_GLOBAL) + "/" + std::string(SFLPHONED_VERSION);
eXosip_set_user_agent(tmp.data()); eXosip_set_user_agent(tmp.data());
// If use STUN server, firewall address setup // If use STUN server, firewall address setup
...@@ -806,6 +806,14 @@ SipVoIPLink::getEvent (void) ...@@ -806,6 +806,14 @@ SipVoIPLink::getEvent (void)
case EXOSIP_CALL_RELEASED: case EXOSIP_CALL_RELEASED:
if (event) { if (event) {
_debug("SIP call released: [cid = %d, did = %d]\n", event->cid, event->did); _debug("SIP call released: [cid = %d, did = %d]\n", event->cid, event->did);
id = findCallId(event);
if (id!=0) {
// not supposed to be execute on a current call...
_debug("send a call failure...");
Manager::instance().callFailure(id);
deleteSipCall(id);
}
} }
//id = findCallId(event); //id = findCallId(event);
//if (id!=0) { //if (id!=0) {
...@@ -843,10 +851,12 @@ SipVoIPLink::getEvent (void) ...@@ -843,10 +851,12 @@ SipVoIPLink::getEvent (void)
//Manager::instance().displayError(event->response->reason_phrase); //Manager::instance().displayError(event->response->reason_phrase);
Manager::instance().displayErrorText(id, event->response->reason_phrase); Manager::instance().displayErrorText(id, event->response->reason_phrase);
Manager::instance().callFailure(id); Manager::instance().callFailure(id);
deleteSipCall(id);
break; break;
case BUSY_HERE: case BUSY_HERE:
Manager::instance().displayErrorText(id, event->response->reason_phrase); Manager::instance().displayErrorText(id, event->response->reason_phrase);
Manager::instance().callBusy(id); Manager::instance().callBusy(id);
deleteSipCall(id);
break; break;
case REQ_TERMINATED: case REQ_TERMINATED:
break; break;
......
pkginclude_HEADERS = \ #pkginclude_HEADERS = \
Binder.hpp Binder.inl \ # Binder.hpp Binder.inl \
FunctorHandler.hpp \ # FunctorHandler.hpp \
Functor.hpp \ # Functor.hpp \
FunctorImpl.hpp \ # FunctorImpl.hpp \
Functor.inl \ # Functor.inl \
MemFunHandler.hpp # MemFunHandler.hpp
pkgincludedir=$(includedir)/utilspp/functor #pkgincludedir=$(includedir)/utilspp/functor
...@@ -10,14 +10,14 @@ libsingleton_la_SOURCES = \ ...@@ -10,14 +10,14 @@ libsingleton_la_SOURCES = \
SingletonHolder.hpp SingletonHolder.inl SingletonHolder.hpp SingletonHolder.inl
pkginclude_HEADERS = \ #pkginclude_HEADERS = \
CreationStatic.hpp CreationStatic.inl \ # CreationStatic.hpp CreationStatic.inl \
CreationUsingNew.hpp CreationUsingNew.inl \ # CreationUsingNew.hpp CreationUsingNew.inl \
LifetimeDefault.hpp LifetimeDefault.inl \ # LifetimeDefault.hpp LifetimeDefault.inl \
LifetimeLibrary.hpp LifetimeLibrary.inl \ # LifetimeLibrary.hpp LifetimeLibrary.inl \
LifetimeWithLongevity.hpp LifetimeWithLongevity.inl \ # LifetimeWithLongevity.hpp LifetimeWithLongevity.inl \
PrivateMembers.hpp PrivateMembers.inl \ # PrivateMembers.hpp PrivateMembers.inl \
SingletonHolder.hpp SingletonHolder.inl # SingletonHolder.hpp SingletonHolder.inl
pkgincludedir=$(includedir)/utilspp/singleton #pkgincludedir=$(includedir)/utilspp/singleton
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment