diff --git a/ChangeLog b/ChangeLog
index 162951436f03857e8f9fa11e65eb68bc558a697c..c6ae864867ca4bc27ee80e929ae55f5812ead3cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Laurielle LEA (11 July 2005) version 0.4
+- Check functions return.
+- Remove unused mute functions
+
 Laurielle LEA (8 July 2005) version 0.4
 - Stop program when error opening skin file
 - Divide toggle() of qtguimainwindow.cpp in small functions
diff --git a/sflphone.spec.in b/sflphone.spec.in
index 62a838684d778d6519211113c6ad6b1c9a8d67f3..a97d217b282a885046014a7a2b3e0b1a886bd2dd 100644
--- a/sflphone.spec.in
+++ b/sflphone.spec.in
@@ -1,6 +1,6 @@
 %define name sflphone
-%define version 0.1
-%define release 1
+%define version 0.4
+%define release 4
 %define prefix /usr
 Autoreq: 0
 
@@ -12,7 +12,7 @@ Copyright:	GPL
 Group:		Networking/Utilities
 URL:		http://www.sflphone.org
 Packager:	Cyrille Béraud <cyrille.beraud@savoirfairelinux.com>
-Source:		http://www.sflphone.org/sflphone-0.1.tar.gz
+Source:		http://www.sflphone.org/sflphone-0.4.tar.gz
 BuildRoot:	/tmp/sflphone-%{version}-%{release}
 
 %description
diff --git a/src/call.cpp b/src/call.cpp
index db19d5a97b9165ee1fc9731e1ea8edb5ac8b7634..415d8172d1ffde9c60bb1fb180cd253c14d645bb 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -306,18 +306,6 @@ Call::transfer  (const string& to)
 	return i;
 }
 
-int 
-Call::muteOn (void)
-{
-	return 1;
-}
-
-int 
-Call::muteOff (void)
-{
-	return 1;
-}
-
 int 
 Call::refuse  (void)
 {
diff --git a/src/call.h b/src/call.h
index a3e21218dd03ff824ca3bea0ca00b0e1b62d045a..78076145d250b8323cb4ce672686a6eb255898ff 100644
--- a/src/call.h
+++ b/src/call.h
@@ -106,8 +106,6 @@ public:
 	int onHold  (void);
 	int offHold  (void);
 	int transfer  (const string& to);
-	int muteOn (void);
-	int muteOff (void);
 	int refuse  (void);
 
 private:
diff --git a/src/gui/guiframework.cpp b/src/gui/guiframework.cpp
index d7e6e01ec947a45956670d4d2b9e0945287739eb..c4e5cd6982fea85a26919f672cc1fc05cadfb9ce 100644
--- a/src/gui/guiframework.cpp
+++ b/src/gui/guiframework.cpp
@@ -39,7 +39,7 @@ GuiFramework::outgoingCall (const string& to)
 int 
 GuiFramework::hangupCall (short id)
 {
-	if (_manager->hangupCall(id)) {
+	if (_manager->hangupCall(id) == 0) {
 		return 1;
 	} else {
 		return 0;
@@ -49,7 +49,7 @@ GuiFramework::hangupCall (short id)
 int 
 GuiFramework::cancelCall (short id)
 {
-	if (_manager->cancelCall(id)) {
+	if (_manager->cancelCall(id) == 0) {
 		return 1;
 	} else {
 		return 0;
@@ -59,7 +59,7 @@ GuiFramework::cancelCall (short id)
 int 
 GuiFramework::answerCall (short id)
 {
-	if (_manager->answerCall(id)) {
+	if (_manager->answerCall(id) == 0) {
 		return 1;
 	} else {
 		return 0;
@@ -69,7 +69,7 @@ GuiFramework::answerCall (short id)
 int 
 GuiFramework::onHoldCall (short id)
 {
-	if (_manager->onHoldCall(id)) {
+	if (_manager->onHoldCall(id) == 0) {
 		return 1;
 	} else {
 		return 0;
@@ -79,7 +79,7 @@ GuiFramework::onHoldCall (short id)
 int 
 GuiFramework::offHoldCall (short id)
 {
-	if (_manager->offHoldCall(id)) {
+	if (_manager->offHoldCall(id) == 0) {
 		return 1;
 	} else {
 		return 0;
@@ -89,37 +89,29 @@ GuiFramework::offHoldCall (short id)
 int 
 GuiFramework::transferCall (short id, const string& to)
 {
-	if (_manager->transferCall(id, to)) {
+	if (_manager->transferCall(id, to) == 1) {
 		return 1;
 	} else {
 		return 0;
 	}
 }
 
-int 
+void
 GuiFramework::muteOn (short id)
 {
-	if (_manager->muteOn(id)) {
-		return 1;
-	} else {
-		return 0;
-	}
+	_manager->muteOn(id);
 }
 
-int 
+void
 GuiFramework::muteOff (short id)
 {
-	if (_manager->muteOff(id)) {
-		return 1;
-	} else {
-		return 0;
-	}
+	_manager->muteOff(id);
 }
 
 int 
 GuiFramework::refuseCall (short id)
 {
-	if (_manager->refuseCall(id)) {
+	if (_manager->refuseCall(id) == 0) {
 		return 1;
 	} else {
 		return 0;
diff --git a/src/gui/guiframework.h b/src/gui/guiframework.h
index 3a22171cc24b16cb9b34210af219f4b8a9c3ac18..25d68106d3a3c82113c3417b6dae704fd3e08b4f 100644
--- a/src/gui/guiframework.h
+++ b/src/gui/guiframework.h
@@ -34,7 +34,7 @@ public:
 
 	/* Parent class to child class */
 	virtual int incomingCall (short id) = 0;
-	virtual int peerAnsweredCall (short id) = 0;
+	virtual void peerAnsweredCall (short id) = 0;
 	virtual int peerRingingCall (short id) = 0;
 	virtual int peerHungupCall (short id) = 0;
 	virtual void displayTextMessage (short id, const string& message) = 0;
@@ -55,8 +55,8 @@ public:
 	int onHoldCall (short id);
 	int offHoldCall (short id);
 	int transferCall (short id, const string& to);
-	int muteOn (short id);
-	int muteOff (short id);
+	void muteOn (short id);
+	void muteOff (short id);
 	int refuseCall (short id);
 
 	int saveConfig (void);
diff --git a/src/gui/qt/qtGUImainwindow.cpp b/src/gui/qt/qtGUImainwindow.cpp
index 67ab6ff1f58d7517af5c0ab92884d77fd4da051e..64bb99449dcdacba1d8dd1217c35fdce726ea340 100644
--- a/src/gui/qt/qtGUImainwindow.cpp
+++ b/src/gui/qt/qtGUImainwindow.cpp
@@ -650,18 +650,11 @@ QtGUIMainWindow::callIsRinging(int id, int line, int busyLine)
 void
 QtGUIMainWindow::callIsProgressing (int id, int line, int busyLine)
 {
-	changeLineStatePixmap(line, BUSY);
-	putOnHoldBusyLine(busyLine);
-	displayContext(id);
-	if (getChooseLine()) {
-		// If a free line is off-hook, set this line to free state
-		setChooseLine(false);
-		changeLineStatePixmap(getChosenLine(), FREE);
-		dialtone(false);
-	}
+	// Same function of callIsRinging
+	callIsRinging(id, line, busyLine);
 }
 
-void
+int
 QtGUIMainWindow::callIsBusy (Call* call, int id, int line, int busyLine)
 {
 	if(call->isAnswered() and getPrevLine() != line) {
@@ -681,11 +674,15 @@ QtGUIMainWindow::callIsBusy (Call* call, int id, int line, int busyLine)
 		_debug("CASE 4 Put Call %d on-hold\n", id);
 		changeLineStatePixmap(line, ONHOLD);
 		displayStatus(ONHOLD_STATUS);
-		qt_onHoldCall(id);
+		if (qt_onHoldCall(id) != 1) {
+			_callmanager->displayErrorText("On-hold call failed !\n");
+			return -1;
+		}
 	}
+	return 1;
 }
 
-void
+int
 QtGUIMainWindow::callIsOnHold(int id, int line, int busyLine)
 {
 	changeLineStatePixmap(line, BUSY);
@@ -697,16 +694,24 @@ QtGUIMainWindow::callIsOnHold(int id, int line, int busyLine)
 		dialtone(false);
 	}		
 	_lcd->setInFunction(true);
-	qt_offHoldCall(id);
+	if (qt_offHoldCall(id) != 1) {
+		_callmanager->displayErrorText("Off-hold call failed !\n");
+		return -1;
+	}
 	displayContext(id);
+	return 1;
 }
 
-void
+int
 QtGUIMainWindow::callIsIncoming (int id, int line, int busyLine)
 {
 	changeLineStatePixmap(line, BUSY);
 	putOnHoldBusyLine(busyLine);
-	qt_answerCall(id);
+	if (qt_answerCall(id) != 1) {
+		_callmanager->displayErrorText("Answered call failed !\n");
+		return -1;
+	}
+	return 1;
 }
 
 void
@@ -834,7 +839,7 @@ QtGUIMainWindow::incomingCall (short id)
 	return i;
 }
 	
-int 
+void 
 QtGUIMainWindow::peerAnsweredCall (short id)
 {
 	dialtone(false);
@@ -843,8 +848,6 @@ QtGUIMainWindow::peerAnsweredCall (short id)
 	startCallTimer(id);
 	_callmanager->displayStatus(CONNECTED_STATUS);
 	setChooseLine(false);
-	
-	return 1;
 }
 
 int 
@@ -970,6 +973,8 @@ QtGUIMainWindow::qt_outgoingCall (void)
 		displayStatus(TRYING_STATUS);
 		_callmanager->getCall(id)->setCallerIdNumber(to);
 		changeLineStatePixmap(line, BUSY);
+	} else {
+		_callmanager->displayErrorText("Outgoing call failed !\n");
 	}
 	
 	return line;
@@ -1041,8 +1046,7 @@ QtGUIMainWindow::qt_transferCall (short id)
 void 
 QtGUIMainWindow::qt_muteOn (short id)
 {
-	int i;
-	i = muteOn(id);
+	muteOn(id);
 	getPhoneLine(id)->setStatus(QString(getCall(id)->getStatus()));	
 	displayStatus(MUTE_ON_STATUS);
 }	
@@ -1050,8 +1054,7 @@ QtGUIMainWindow::qt_muteOn (short id)
 void 
 QtGUIMainWindow::qt_muteOff (short id)
 {
-	int i;
-	i = muteOff(id);
+	muteOff(id);
 	getPhoneLine(id)->setStatus(QString(getCall(id)->getStatus()));
 	displayStatus(CONNECTED_STATUS);
 }	
@@ -1087,6 +1090,7 @@ QtGUIMainWindow::toggleLine (int line)
 {
 	int id;
 	int busyLine;
+	int ret = 1;
 	
 	Call* call;
 
@@ -1113,18 +1117,18 @@ QtGUIMainWindow::toggleLine (int line)
 			_debug("CASE 2: Call %d is progressing\n", id);
 			callIsProgressing (id, line, busyLine);
 		} else if (call->isBusy()) {
-			callIsBusy (call, id, line, busyLine);
+			ret = callIsBusy (call, id, line, busyLine);
 		} else if (call->isOnHold()) {
 			// If call is on hold, put this call on busy state
 			_debug("CASE 5: Put Call %d off-hold\n", id);
-			callIsOnHold(id, line, busyLine);
+			ret = callIsOnHold(id, line, busyLine);
 		} else if (call->isIncomingType()) {
 		// If incoming call occurs
 			_debug("CASE 6: Answer call %d\n", id);
-			callIsIncoming (id, line, busyLine);
+			ret = callIsIncoming (id, line, busyLine);
 		} else {
 			_debug("Others cases to handle\n");
-			return -1;
+			ret = -1;
 		}	
 		setPrevLine(line);
 	} else {
@@ -1132,7 +1136,7 @@ QtGUIMainWindow::toggleLine (int line)
 		_debug("CASE 7: New line off-hook\n");
 		clickOnFreeLine(line, busyLine);
 	}
-	return 1;
+	return ret;
 }
 
 /**
@@ -1145,24 +1149,32 @@ QtGUIMainWindow::dial (void)
 	short i;
 	int line = -1;
 	
-	try {
-		if ((i = isThereIncomingCall()) > 0) {
-			// If new incoming call 
-			line = id2line(i);
+	if ((i = isThereIncomingCall()) > 0) {
+		// If new incoming call 
+		line = id2line(i);
+		if (line != -1) {
 			_TabIncomingCalls[line] = -1;
 			toggleLine(line);
-		} else if (getTransfer()){
-			// If call transfer
-			qt_transferCall (line2id(getCurrentLine()));
+			//setPrevLine(line);
 		} else {
-			// If new outgoing call  
-				if (getCurrentLine() < 0 or getChooseLine()) {
-					line = qt_outgoingCall();
-				}
-		}		
-	} catch (const exception &e) {
-		_callmanager->displayErrorText(e.what());
-	}
+			return;
+		}
+	} else if (getTransfer()){
+		// If call transfer
+		if(qt_transferCall (line2id(getCurrentLine()) != 1)) {
+			_callmanager->displayErrorText("Transfer failed !\n");
+		}
+	} else {
+		// If new outgoing call  
+		if (getCurrentLine() < 0 or getChooseLine()) {
+			line = qt_outgoingCall();
+			if (line == -1) {
+				return;
+			} else {
+				setPrevLine(line);
+			}
+		}
+	}		
 }
 
 /**
@@ -1175,41 +1187,49 @@ QtGUIMainWindow::hangupLine (void)
 	int line = getCurrentLine();
 	int id = phLines[line]->getCallId();
 
-	try {
-		if (_callmanager->getbCongestion()) {
-			// If congestion tone
+	if (_callmanager->getbCongestion()) {
+		// If congestion tone
+		if (qt_hangupCall(id)) {
 			changeLineStatePixmap(line, FREE);
 			_lcd->clear(QString(ENTER_NUMBER_STATUS));
-			qt_hangupCall(id);
 			_callmanager->congestion(false);
 			phLines[line]->setCallId(0);
-		} else if (line >= 0 and id > 0 and getCall(id)->isProgressing()) {
-			// If I want to cancel a call before ringing.
-			qt_cancelCall(id);
+		} else {
+			_callmanager->displayErrorText("Hangup call failed !\n");
+		}
+	} else if (line >= 0 and id > 0 and getCall(id)->isProgressing()) {
+		// If I want to cancel a call before ringing.
+		if (qt_cancelCall(id)) {
 			changeLineStatePixmap(line, FREE);
 			phLines[line]->setCallId(0);
 			setChooseLine(false);
-		} else if (line >= 0 and id > 0) {
-			// If hangup current line normally
-			_debug("Hangup line %d\n", line);
-			qt_hangupCall(id);
+		} else {
+			_callmanager->displayErrorText("Cancelled call failed !\n");
+		}
+	} else if (line >= 0 and id > 0) {
+		// If hangup current line normally
+		_debug("Hangup line %d\n", line);
+		if (qt_hangupCall(id)) {
 			changeLineStatePixmap(line, FREE);
 			phLines[line]->setCallId(0);
 			setChooseLine(false);
-		} else if ((i = isThereIncomingCall()) > 0){
-			// To refuse new incoming call 
-			_debug("Refuse call %d\n", id);
-			qt_refuseCall(i);
+		} else {
+			_callmanager->displayErrorText("Hangup call failed !\n");
+		}
+	} else if ((i = isThereIncomingCall()) > 0){
+		// To refuse new incoming call 
+		_debug("Refuse call %d\n", id);
+		if (qt_refuseCall(i)) {
 			changeLineStatePixmap(id2line(i), FREE);
-		} else if (line >= 0) {
-			_debug("Just load free pixmap for the line %d\n", line);
-			changeLineStatePixmap(line, FREE);
-			dialtone(false);
-			setChooseLine(false);
-			setCurrentLine(-1);
+		} else {
+			_callmanager->displayErrorText("Refused call failed !\n");
 		}
-	} catch (const exception &e) {
-		_callmanager->displayErrorText(e.what());
+	} else if (line >= 0) {
+		_debug("Just load free pixmap for the line %d\n", line);
+		changeLineStatePixmap(line, FREE);
+		dialtone(false);
+		setChooseLine(false);
+		setCurrentLine(-1);
 	}
 }
 
@@ -1299,7 +1319,9 @@ void
 QtGUIMainWindow::button_msg (void) {
      stopTimerMessage();
      _lcd->appendText(get_config_fields_str(PREFERENCES, VOICEMAIL_NUM));
-	 qt_outgoingCall();
+	 if (qt_outgoingCall() == -1) {
+		 return;
+	 }
 }
 
 // Allow to enter a phone number to transfer the current call.
diff --git a/src/gui/qt/qtGUImainwindow.h b/src/gui/qt/qtGUImainwindow.h
index 66a899bb27dc8f86c81bf4dfddd817a9484d00c8..be10e39519c1eea04954db2d208fa8c00682c25c 100644
--- a/src/gui/qt/qtGUImainwindow.h
+++ b/src/gui/qt/qtGUImainwindow.h
@@ -84,7 +84,7 @@ public:
 	
 	// Reimplementation of virtual functions
 	virtual int incomingCall (short id);
-	virtual int peerAnsweredCall (short id);
+	virtual void peerAnsweredCall (short id);
 	virtual int peerRingingCall (short id);
 	virtual int peerHungupCall (short id);
 	virtual void displayTextMessage (short id, const string& message);
@@ -366,13 +366,13 @@ private:
 	void dialtone (bool var);
 
 	/* 
-	 * Functions of toggle function
+	 * Functions used in toggle function
 	 */
 	void callIsRinging(int id, int line, int busyLine);
 	void callIsProgressing (int id, int line, int busyLine);
-	void callIsBusy (Call* call, int id, int line, int busyLine);
-	void callIsOnHold(int id, int line, int busyLine);
-	void callIsIncoming (int id, int line, int busyLine);
+	int callIsBusy (Call* call, int id, int line, int busyLine);
+	int callIsOnHold(int id, int line, int busyLine);
+	int callIsIncoming (int id, int line, int busyLine);
 	void clickOnFreeLine(int line, int busyLine);
 
 };
diff --git a/src/manager.cpp b/src/manager.cpp
index 8e7dd09e749a6311a0045b3637ef709126e6fe1d..ec86065f15d8850000c2233e0fec756def3f33c8 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -269,6 +269,8 @@ Manager::outgoingCall (const string& to)
 	
 	_debug("Outgoing Call with identifiant %d\n", id);
 	call = getCall(id);
+	if (call == NULL)
+		return 0;
 	
 	call->setStatus(string(TRYING_STATUS));
 	call->setState(Progressing);
@@ -285,9 +287,10 @@ Manager::hangupCall (short id)
 	Call* call;
 
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setStatus(string(HUNGUP_STATUS));
 	call->setState(Hungup);
-	call->hangup();
 	_mutex.enterMutex();
 	_nCalls -= 1;
 	_mutex.leaveMutex();
@@ -295,7 +298,7 @@ Manager::hangupCall (short id)
 	if (getbRingback()) {
 		ringback(false);
 	}
-	return 1;
+	return call->hangup();
 }
 
 int
@@ -304,9 +307,10 @@ Manager::cancelCall (short id)
 	Call* call;
 
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setStatus(string(HUNGUP_STATUS));
 	call->setState(Hungup);
-	call->cancel();
 	_mutex.enterMutex();
 	_nCalls -= 1;
 	_mutex.leaveMutex();
@@ -314,7 +318,7 @@ Manager::cancelCall (short id)
 	if (getbRingback()) {
 		ringback(false);
 	}
-	return 1;
+	return call->cancel();
 }
 
 int 
@@ -323,11 +327,12 @@ Manager::answerCall (short id)
 	Call* call;
 
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setStatus(string(CONNECTED_STATUS));
 	call->setState(Answered);
-	call->answer();
 	ringtone(false);
-	return 1;
+	return call->answer();
 }
 
 int 
@@ -335,10 +340,11 @@ Manager::onHoldCall (short id)
 {
 	Call* call;
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setStatus(string(ONHOLD_STATUS));
 	call->setState(OnHold);
-	call->onHold();
-	return 1;
+	return call->onHold();
 }
 
 int 
@@ -346,10 +352,11 @@ Manager::offHoldCall (short id)
 {
 	Call* call;
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setStatus(string(CONNECTED_STATUS));
 	call->setState(OffHold);
-	call->offHold();	
-	return 1;
+	return call->offHold();	
 }
 
 int 
@@ -357,32 +364,37 @@ Manager::transferCall (short id, const string& to)
 {
 	Call* call;
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setStatus(string(TRANSFER_STATUS));
 	call->setState(Transfered);
-	call->transfer(to);
-	return 1;
+	if (call->transfer(to) != 0) {
+		return -1;
+	} else {
+		return 1;
+	}
 }
 
-int 
+void 
 Manager::muteOn (short id)
 {
 	Call* call;
 	call = getCall(id);
+	if (call == NULL)
+		return;
 	call->setStatus(string(MUTE_ON_STATUS));
 	call->setState(MuteOn);
-	call->muteOn();
-	return 1;
 }
 
-int 
+void 
 Manager::muteOff (short id)
 {
 	Call* call;
 	call = getCall(id);
+	if (call == NULL)
+		return;
 	call->setStatus(string(CONNECTED_STATUS));
 	call->setState(MuteOff);
-	call->muteOff();
-	return 1;
 }
 
 int 
@@ -390,12 +402,13 @@ Manager::refuseCall (short id)
 {
 	Call *call;
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setStatus(string(HUNGUP_STATUS));
 	call->setState(Refused);	
-	call->refuse();
 	ringtone(false);
 	delete call;
-	return 1;
+	return call->refuse();
 }
 
 int
@@ -476,17 +489,18 @@ Manager::incomingCall (short id)
 {
 	Call* call;
 	call = getCall(id);
+	if (call == NULL)
+		return -1;
 	call->setType(Incoming);
 	call->setStatus(string(RINGING_STATUS));
 	call->setState(Progressing);
 	ringtone(true);
-	_gui->incomingCall(id);
 	displayStatus(RINGING_STATUS);
-	return 1;
+	return _gui->incomingCall(id);
 }
 
 // L'autre personne a repondu
-int 
+void 
 Manager::peerAnsweredCall (short id)
 {
 	Call* call;
@@ -501,7 +515,6 @@ Manager::peerAnsweredCall (short id)
 	if (isCurrentId(id)) {
 		_gui->peerAnsweredCall(id);
 	}
-	return 1;
 }
 
 int 
diff --git a/src/manager.h b/src/manager.h
index d3b10c36c29761a327c6327d87d54514a5dff511..8ab71ca3319d748cdcc23e5652e6459b3d6371f3 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -125,6 +125,9 @@ public:
 	 */
 	void deleteCall	(short id);
 	
+	/*
+	 * Functions which occur with a user's action
+	 */
 	int outgoingCall (const string& to);
 	int hangupCall (short id);
 	int cancelCall (short id);
@@ -132,8 +135,8 @@ public:
 	int onHoldCall (short id);
 	int offHoldCall (short id);
 	int transferCall (short id, const string& to);
-	int muteOn (short id);
-	int muteOff (short id);
+	void muteOn (short id);
+	void muteOff (short id);
 	int refuseCall (short id);
 
 	int saveConfig (void);
@@ -152,7 +155,7 @@ public:
 	
 
 	int incomingCall (short id);
-	int peerAnsweredCall (short id);
+	void peerAnsweredCall (short id);
 	int peerRingingCall (short id);
 	int peerHungupCall (short id);
 	void displayTextMessage (short id, const string& message);
@@ -168,7 +171,11 @@ public:
 	 */
 	void ringback (bool var);
 
+	/*
+	 * Handle played music when an incoming call occurs
+	 */
 	void ringtone (bool var);
+
 	void congestion (bool var);
 
 	/*
@@ -199,6 +206,9 @@ public:
 	inline bool isDriverLoaded (void) { return _loaded; }
 	inline void loaded (bool l) { _loaded = l; }
 
+	/* 
+	 * Functions about audio device
+	 */
 	static device_t deviceList (int);
 	static int deviceCount (void);
 	static bool defaultDevice (int);
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index 86928116713437fce10765d356d16ce15c838071..977c7a7d26cbfa9eec1f0af698f307b1bca4ad4f 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -391,13 +391,15 @@ SipVoIPLink::getEvent (void)
 		case EXOSIP_CALL_NEW: //
 			// Set local random port for incoming call
 			if (!_manager->useStun()) {
+			// If no firewall
 				setLocalPort(RANDOM_LOCAL_PORT);
 			} else {
+			// If there is a firewall
 				if (behindNat() != 0) {
 					setLocalPort(_manager->getFirewallPort());
 				} else {
-					_debug("behindNat function returns 0\n");
-				}
+					return -1;
+				}	
 			}
 			
 			id = _manager->generateNewCallId();
@@ -412,12 +414,19 @@ SipVoIPLink::getEvent (void)
   			osip_from_parse(from, event->remote_uri);
 			name = osip_from_get_displayname(from);
 			_manager->displayTextMessage(id, name);
-			_manager->getCall(id)->setCallerIdName(name);
+			if (_manager->getCall(id) != NULL) {
+				_manager->getCall(id)->setCallerIdName(name);
+			} else {
+				return -1;
+			}
 			_debug("From: %s\n", name);
 			osip_from_free(from);
 			
 			getSipCall(id)->newIncomingCall(event);
-			_manager->incomingCall(id);
+			if (_manager->incomingCall(id) < 0) {
+				_manager->displayErrorText("Incoming call failed");
+				return -1;
+			}
 
 			// Associate an audio port with a call
 			getSipCall(id)->setLocalAudioPort(_localPort);
@@ -437,14 +446,15 @@ SipVoIPLink::getEvent (void)
 			if (id > 0 and !_manager->getCall(id)->isOnHold()
 					   and !_manager->getCall(id)->isOffHold()) {
 				getSipCall(id)->setStandBy(false);
-				getSipCall(id)->answeredCall(event);
-				_manager->peerAnsweredCall(id);
-
-				// Outgoing call is answered, start the sound channel.
-				if (_audiortp->createNewSession (getSipCall(id)) < 0) {
-					_debug("FATAL: Unable to start sound (%s:%d)\n", 
-							__FILE__, __LINE__);
-					exit(1);
+				if (getSipCall(id)->answeredCall(event) != -1) {
+					_manager->peerAnsweredCall(id);
+
+					// Outgoing call is answered, start the sound channel.
+					if (_audiortp->createNewSession (getSipCall(id)) < 0) {
+						_debug("FATAL: Unable to start sound (%s:%d)\n", 
+								__FILE__, __LINE__);
+						exit(1);
+					}
 				}
 			}
 			break;
@@ -458,7 +468,9 @@ SipVoIPLink::getEvent (void)
 			if (id > 0) {
 				getSipCall(id)->ringingCall(event);
 				_manager->peerRingingCall(id);
-			} 
+			} else {
+				return -1;
+			}
 			break;
 
 		case EXOSIP_CALL_REDIRECTED:
@@ -476,6 +488,8 @@ SipVoIPLink::getEvent (void)
 				}
 				_manager->peerHungupCall(id);
 				deleteSipCall(id);
+			} else {
+				return -1;
 			}	
 			break;
 
@@ -483,13 +497,17 @@ SipVoIPLink::getEvent (void)
 			id = findCallId(event);
 			if (id > 0) {
 				getSipCall(id)->onholdCall(event);
-			}
+			} else {
+			   return -1;
+			}	   
 			break;
 
 		case EXOSIP_CALL_OFFHOLD:
 			id = findCallId(event);
 			if (id > 0) {
 				getSipCall(id)->offholdCall(event);
+			} else {
+				return -1;
 			}
 			break;
 			
@@ -697,7 +715,11 @@ SipVoIPLink::getSipCall (short callid)
 AudioCodec*
 SipVoIPLink::getAudioCodec (short callid)
 {
-	return getSipCall(callid)->getAudioCodec();
+	if (getSipCall(callid)) {
+		return getSipCall(callid)->getAudioCodec();
+	} else {
+		return NULL;
+	}
 }
 ///////////////////////////////////////////////////////////////////////////////
 // Private functions
@@ -837,7 +859,12 @@ SipVoIPLink::startCall (short id, const string& from, const string& to,
 		}
 	}
 	
-	getSipCall(id)->setLocalAudioPort(_localPort);
+	if (getSipCall(id) != NULL) {
+		getSipCall(id)->setLocalAudioPort(_localPort);
+	} else {
+		return -1;
+	}
+	
 	bzero (port, 64);
 	snprintf (port, 63, "%d", getLocalPort());