diff --git a/sflphone_kde/CMakeLists.txt b/sflphone_kde/CMakeLists.txt
index 1b9cfbc2c53c1385e201c6f5b5c4ccf99c3bf5c6..fc127f03a61cc50de9fd06125e667658fcf6420e 100644
--- a/sflphone_kde/CMakeLists.txt
+++ b/sflphone_kde/CMakeLists.txt
@@ -13,8 +13,7 @@ SET(
 	main.cpp
 	sflphone_const.cpp
 	Account.cpp
-	AccountList.cpp	
-	Automate.cpp
+	AccountList.cpp
 	Call.cpp
 	CallList.cpp
 	configurationmanager_interface.cpp
diff --git a/sflphone_kde/Call.cpp b/sflphone_kde/Call.cpp
index f9edbac64780ba379995ea37dc4faac574bb4881..5ef9f7fe046bf9d6a2dc6c9d8cc32ff49468de0c 100644
--- a/sflphone_kde/Call.cpp
+++ b/sflphone_kde/Call.cpp
@@ -1,25 +1,63 @@
 #include "Call.h"
 
+#include "callmanager_interface_p.h"
+#include "callmanager_interface_singleton.h"
+#include "SFLPhone.h"
 
-Call::Call(call_state startState, QString callId)
+
+const call_state Call::stateMap [11][5] = 
 {
-	this->automate = new Automate(startState);
-	this->id = callId;
+//                      ACCEPT                  REFUSE             TRANSFER                   HOLD                           RECORD
+/*INCOMING       */  {CALL_STATE_CURRENT  , CALL_STATE_OVER  , CALL_STATE_OVER           , CALL_STATE_HOLD           ,  CALL_STATE_INCOMING       },
+/*RINGING        */  {CALL_STATE_ERROR    , CALL_STATE_OVER  , CALL_STATE_ERROR          , CALL_STATE_ERROR          ,  CALL_STATE_RINGING        },
+/*CURRENT        */  {CALL_STATE_ERROR    , CALL_STATE_OVER  , CALL_STATE_TRANSFER       , CALL_STATE_HOLD           ,  CALL_STATE_CURRENT        },
+/*DIALING        */  {CALL_STATE_RINGING  , CALL_STATE_OVER  , CALL_STATE_ERROR          , CALL_STATE_ERROR          ,  CALL_STATE_DIALING        },
+/*HOLD           */  {CALL_STATE_ERROR    , CALL_STATE_OVER  , CALL_STATE_TRANSFER_HOLD  , CALL_STATE_CURRENT        ,  CALL_STATE_HOLD           },
+/*FAILURE        */  {CALL_STATE_ERROR    , CALL_STATE_OVER  , CALL_STATE_ERROR          , CALL_STATE_ERROR          ,  CALL_STATE_ERROR          },
+/*BUSY           */  {CALL_STATE_ERROR    , CALL_STATE_OVER  , CALL_STATE_ERROR          , CALL_STATE_ERROR          ,  CALL_STATE_ERROR          },
+/*TRANSFER       */  {CALL_STATE_OVER     , CALL_STATE_OVER  , CALL_STATE_CURRENT        , CALL_STATE_TRANSFER_HOLD  ,  CALL_STATE_TRANSFER       },
+/*TRANSFER_HOLD  */  {CALL_STATE_OVER     , CALL_STATE_OVER  , CALL_STATE_HOLD           , CALL_STATE_TRANSFER       ,  CALL_STATE_TRANSFER_HOLD  },
+/*OVER           */  {CALL_STATE_ERROR    , CALL_STATE_ERROR , CALL_STATE_ERROR          , CALL_STATE_ERROR          ,  CALL_STATE_ERROR          },
+/*ERROR          */  {CALL_STATE_ERROR    , CALL_STATE_ERROR , CALL_STATE_ERROR          , CALL_STATE_ERROR          ,  CALL_STATE_ERROR          }
+};
+
+const function Call::functionMap[11][5] = 
+{ 
+//                      ACCEPT               REFUSE            TRANSFER                 HOLD                  RECORD
+/*INCOMING       */  {&Call::accept     , &Call::refuse   , &Call::acceptTransf   , &Call::acceptHold  ,  &Call::switchRecord  },
+/*RINGING        */  {&Call::nothing    , &Call::hangUp   , &Call::nothing        , &Call::nothing     ,  &Call::switchRecord  },
+/*CURRENT        */  {&Call::nothing    , &Call::hangUp   , &Call::nothing        , &Call::hold        ,  &Call::setRecord     },
+/*DIALING        */  {&Call::call       , &Call::nothing  , &Call::nothing        , &Call::nothing     ,  &Call::switchRecord  },
+/*HOLD           */  {&Call::nothing    , &Call::hangUp   , &Call::nothing        , &Call::unhold      ,  &Call::setRecord     },
+/*FAILURE        */  {&Call::nothing    , &Call::hangUp   , &Call::nothing        , &Call::nothing     ,  &Call::nothing       },
+/*BUSY           */  {&Call::nothing    , &Call::hangUp   , &Call::nothing        , &Call::nothing     ,  &Call::nothing       },
+/*TRANSFERT      */  {&Call::transfer   , &Call::hangUp   , &Call::nothing        , &Call::hold        ,  &Call::setRecord     },
+/*TRANSFERT_HOLD */  {&Call::transfer   , &Call::hangUp   , &Call::nothing        , &Call::unhold      ,  &Call::setRecord     },
+/*OVER           */  {&Call::nothing    , &Call::nothing  , &Call::nothing        , &Call::nothing     ,  &Call::nothing       },
+/*ERROR          */  {&Call::nothing    , &Call::nothing  , &Call::nothing        , &Call::nothing     ,  &Call::nothing       }
+};
+
+
+Call::Call(call_state startState, QString callId)
+{	
+	this->callId = callId;
 	this->item = new QListWidgetItem("");
+	this->recording = false;
+	this->currentState = startState;
 }
 
 Call::Call(call_state startState, QString callId, QString from, Account & account)
 {
-	this->automate = new Automate(startState);
-	this->id = callId;
+	this->callId = callId;
 	this->item = new QListWidgetItem(from);
 	this->account = & account;
+	this->recording = false;
+	this->currentState = startState;
 }
 
 Call::~Call()
 {
 	delete item;
-	delete automate;
 }
 	
 Call * Call::buildDialingCall(QString callId)
@@ -41,15 +79,124 @@ QListWidgetItem * Call::getItem()
 
 call_state Call::getState() const
 {
-	return automate->getCurrentState();
+	return currentState;
 }
 
 call_state Call::action(call_action action, QString number)
 {
-	return automate->action(action, id, number);
+	call_state previousState = currentState;
+	//execute the action associated with this transition
+	(this->*(functionMap[currentState][action]))(number);
+	//update the state
+	currentState = stateMap[currentState][action];
+	qDebug() << "Calling action " << action << " on call with state " << previousState << ". Become " << currentState;
+	//return the new state
+	return currentState;
 }
 
 QString Call::getCallId()
 {
-	return id;
+	return callId;
+}
+
+call_state Call::getCurrentState() const
+{
+	return currentState;
+}
+
+
+
+
+
+
+
+
+/*************************************************
+*************   Automate functions   *************
+*************************************************/
+
+
+void Call::nothing(QString number)
+{
 }
+
+void Call::accept(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Accepting call. callId : " << callId;
+	callManager.accept(callId);
+}
+
+void Call::refuse(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Refusing call. callId : " << callId;
+	callManager.refuse(callId);
+}
+
+void Call::acceptTransf(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Accepting call and transfering it to number : " << number << ". callId : " << callId;
+	callManager.accept(callId);
+	callManager.transfert(callId, number);
+}
+
+void Call::acceptHold(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Accepting call and holding it. callId : " << callId;
+	callManager.accept(callId);
+	callManager.hold(callId);
+}
+
+void Call::hangUp(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Hanging up call. callId : " << callId;
+	callManager.hangUp(callId);
+}
+
+void Call::hold(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Holding call. callId : " << callId;
+	callManager.hold(callId);
+}
+
+void Call::call(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	QString account = SFLPhone::firstAccount();
+	qDebug() << "Calling " << number << " with account " << account << ". callId : " << callId;
+	callManager.placeCall(account, callId, number);
+}
+
+void Call::transfer(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	QString account = SFLPhone::firstAccount();
+	qDebug() << "Transfering call to number : " << number << ". callId : " << callId;
+	callManager.transfert(callId, number);
+}
+
+void Call::unhold(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Unholding call. callId : " << callId;
+	callManager.unhold(callId);
+}
+
+void Call::switchRecord(QString number)
+{
+	qDebug() << "Switching record state for call automate. callId : " << callId;
+	recording = !recording;
+}
+
+void Call::setRecord(QString number)
+{
+	CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
+	qDebug() << "Setting record for call. callId : " << callId;
+	callManager.unhold(callId);
+}
+
diff --git a/sflphone_kde/Call.h b/sflphone_kde/Call.h
index 2a8a25ef62b947f0f6b4cd7e61ac8c266dfc48f9..cdbb3d066710882a9336dc7740abbc11c24cb8d2 100644
--- a/sflphone_kde/Call.h
+++ b/sflphone_kde/Call.h
@@ -1,26 +1,96 @@
 #ifndef CALL_H
 #define CALL_H
+#include <QtGui>
+#include "Account.h"
 
-#include "Automate.h"
-//#include "Account.h"
-//typedef call_state;
+/** @enum call_state_t 
+  * This enum have all the states a call can take.
+  */
+typedef enum
+{ 
+   /** Ringing incoming call */
+   CALL_STATE_INCOMING,
+   /** Ringing outgoing call */
+   CALL_STATE_RINGING,
+   /** Call to which the user can speak and hear */
+   CALL_STATE_CURRENT,
+   /** Call which numbers are being added by the user */
+   CALL_STATE_DIALING,
+   /** Call is on hold */
+   CALL_STATE_HOLD,      
+   /** Call has failed */
+   CALL_STATE_FAILURE,      
+   /** Call is busy */
+   CALL_STATE_BUSY,        
+   /** Call is being transfered.  During this state, the user can enter the new number. */
+   CALL_STATE_TRANSFER,
+   /** Call is on hold for transfer */
+   CALL_STATE_TRANSFER_HOLD,
+   /** Call is over and should not be used */
+   CALL_STATE_OVER,
+   /** This state should never be reached */
+   CALL_STATE_ERROR
+} call_state;
 
-//class Automate;
+/** @enum call_action
+  * This enum have all the actions you can make on a call.
+  */
+typedef enum
+{ 
+   /** Green button, accept or new call or place call or place transfer */
+   CALL_ACTION_ACCEPT,
+   /** Red button, refuse or hang up */
+   CALL_ACTION_REFUSE,
+   /** Blue button, put into or out of transfer mode where you can type transfer number */
+   CALL_ACTION_TRANSFER,
+   /** Blue-green button, hold or unhold the call */
+   CALL_ACTION_HOLD,
+   /** Record button, enable or disable recording */
+   CALL_ACTION_RECORD
+} call_action;
+
+
+class Call;
+
+typedef  void (Call::*function)(QString number);
 
 class Call
 {
 private:
+
+	//Call attributes
 	Account * account;
-	QString id;
+	QString callId;
 	QString from;
 	QString to;
 //	HistoryState * historyState;
 	QTime start;
 	QTime stop;
 	QListWidgetItem * item;
-	Automate * automate;
+	//Automate * automate;
+	
+	//Automate attributes
+	static const call_state stateMap [11][5];
+	static const function functionMap[11][5];
+	call_state currentState;
+	bool recording;
 
 	Call(call_state startState, QString callId);
+	Call(call_state startState, QString callId, QString from, Account & account);
+	
+	//Automate functions
+	void nothing(QString number);
+	void accept(QString number);
+	void refuse(QString number);
+	void acceptTransf(QString number);
+	void acceptHold(QString number);
+	void hangUp(QString number);
+	void hold(QString number);
+	void call(QString number);
+	void transfer(QString number);
+	void unhold(QString number);
+	void switchRecord(QString number);
+	void setRecord(QString number);
 
 public:
 	
@@ -31,6 +101,7 @@ public:
 	call_state getState() const;
 	QString getCallId();
 	call_state action(call_action action, QString number = NULL);
+	call_state getCurrentState() const;
 
 };