diff --git a/sflphone-common/src/sip/im/InstantMessaging.cpp b/sflphone-common/src/sip/im/InstantMessaging.cpp
index 1a5a0a723e257a6ac7d0f5855e7eff359575f00f..b42f5ae8aa0ca3c939cdd043b34680905df3cf21 100644
--- a/sflphone-common/src/sip/im/InstantMessaging.cpp
+++ b/sflphone-common/src/sip/im/InstantMessaging.cpp
@@ -3,36 +3,16 @@
 namespace sfl {
 
 	InstantMessaging::InstantMessaging()
-		: _current_dlg( NULL ), _message(EMPTY_MESSAGE), _response(EMPTY_MESSAGE){}
+		 {}
 
 
 	InstantMessaging::~InstantMessaging(){
-		delete _current_dlg; _current_dlg = 0;
 	}
 
 	pj_status_t InstantMessaging::init () {
-
-		
-	
-	}
-
-
-	void InstantMessaging::set_text( std::string message ){
-		_message = pj_str((char*)message.c_str());
-	}
-
-	void InstantMessaging::set_response( std::string resp ){
-		_response = pj_str((char*)resp.c_str());
-	}
-
-	std::string InstantMessaging::get_text_message( void ){
-		std::string text;
-
-		text = _response.ptr;
-		return text;
+		return PJ_SUCCESS;
 	}
 
-
 	pj_status_t InstantMessaging::receive (std::string message, CallID& id) {
 
 		// We just receive a TEXT message. Before sent it to the recipient, we must assure that the message is complete.
@@ -41,41 +21,43 @@ namespace sfl {
 	}
 
 
-	pj_status_t InstantMessaging::send (CallID& id, std::string message) {
+	pj_status_t InstantMessaging::send (pjsip_inv_session *session, const std::string& text) {
+
+
+		pjsip_method msg_method;
+		const pj_str_t type =  STR_TEXT;
+		const pj_str_t subtype = STR_PLAIN;
+		pjsip_tx_data *tdata;
+		pj_status_t status;
+		pjsip_dialog* dialog;
+		pj_str_t message;
 
-		/*
-		   pjsip_method msg_method;
-		   const pj_str_t type =  STR_TEXT;
-		   const pj_str_t subtype = STR_PLAIN;
-		   pjsip_tx_data *tdata;
-		   pj_status_t status;
+		msg_method.id = PJSIP_OTHER_METHOD;
+		msg_method.name = METHOD_NAME ;
 
-		   msg_method.id = PJSIP_OTHER_METHOD;
-		   msg_method.name = METHOD_NAME ;
+		// Get the dialog associated to the call
+		dialog = session->dlg;
+		// Convert the text into a format readable by pjsip
+		message = pj_str ((char*) text.c_str ());
 
 		// Must lock dialog
-		pjsip_dlg_inc_lock( _current_dlg );
+		pjsip_dlg_inc_lock( dialog );
 
 		// Create the message request
-		status = pjsip_dlg_create_request( _current_dlg, &msg_method, -1, &tdata );
+		status = pjsip_dlg_create_request( dialog, &msg_method, -1, &tdata );
 		PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 );
 
 		// Attach "text/plain" body 
-		tdata->msg->body = pjsip_msg_body_create( tdata->pool, &type, &subtype, &_message );
+		tdata->msg->body = pjsip_msg_body_create( tdata->pool, &type, &subtype, &message );
 
 		// Send the request
-		status = pjsip_dlg_send_request( _current_dlg, tdata, -1, NULL);
+		status = pjsip_dlg_send_request( dialog, tdata, -1, NULL);
 		PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 );
 
 		// Done
-		pjsip_dlg_dec_lock( _current_dlg );
-		 */
-		return PJ_SUCCESS;
-	}
+		pjsip_dlg_dec_lock( dialog );
 
-
-	void InstantMessaging::display (void){
-		std::cout << "<IM> " << _response.ptr << std::endl;
+		return PJ_SUCCESS;
 	}
 
 }
diff --git a/sflphone-common/src/sip/im/InstantMessaging.h b/sflphone-common/src/sip/im/InstantMessaging.h
index e4df00bdc76d54bf5f2ea72e2bdeb7e4d36c6a60..78749c742399cb6cff238412b6dd62d4df0110d1 100644
--- a/sflphone-common/src/sip/im/InstantMessaging.h
+++ b/sflphone-common/src/sip/im/InstantMessaging.h
@@ -10,6 +10,7 @@
 #include <pjlib-util.h>
 
 #include "call.h"
+#include "sip/sipcall.h"
 
 #define EMPTY_MESSAGE   pj_str((char*)"")
 #define STR_TEXT        pj_str((char*)"text")
@@ -36,23 +37,6 @@ namespace sfl  {
 			 */
 			pj_status_t init ();
 
-			/*
-			 * Attach the instant messaging module to an existing SIP dialog
-			 *
-			 * @param dlg   A pointer on the current pjsip_dialog structure
-			 */
-			void set_dialog (pjsip_dialog *dlg) { _current_dlg = dlg; }
-
-			/*
-			 * Prepare a string to be sent. This method have to be called
-			 * before sending each message
-			 *
-			 * @param message   The text message
-			 */
-			void set_text( std::string message );
-
-			std::string get_text_message(void) ; 
-
 			/*
   			 * Receive a string SIP message, for a specific call
 			 *
@@ -70,7 +54,7 @@ namespace sfl  {
 			 * @return pj_status_t  0 on success
 			 *                      1 otherwise
 			 */
-			pj_status_t send (CallID& id, const std::string message);
+			pj_status_t send (pjsip_inv_session*, const std::string&);
 
 			/**
  			 * Notify the clients, through D-Bus, that a new message has arrived
@@ -79,40 +63,13 @@ namespace sfl  {
 			 */
 			pj_status_t notify (CallID& id);
 
-			/*
-			 * Set the response.
-			 *
-			 * @param resp    The last string message received
-			 */ 
-			void set_response( std::string resp );
-
-			/*
-			 * Display the response
-			 */
-			void display (void);
-
 		private:
 
-			/*
-			 * The pjsip_dialog instance through which the instant messaging module exists
-			 */
-			pjsip_dialog *_current_dlg;
-
-			/*
-			 * The message to be sent
-			 */
-			pj_str_t _message;
-
 			/**
 			 * A queue to handle messages
 			 */
 			std::queue<std::string> queuedMessages;
 
-			/*
-			 * The last response
-			 */
-			pj_str_t _response;
-
 			InstantMessaging(const InstantMessaging&); //No Copy Constructor
 			InstantMessaging& operator=(const InstantMessaging&); //No Assignment Operator
 	};
diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index 7a0cf23dbe21a73f53685311746406902cd058c6..afdfdde80fdd81f9e2f1f9774d475cd50b561234 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -277,6 +277,8 @@ SIPVoIPLink::SIPVoIPLink (const AccountID& accountID)
     srand (time (NULL));
 
     urlhook = new UrlHook ();
+
+	// Load the chat module
 	imModule = new InstantMessaging ();
 
     /* Start pjsip initialization step */
@@ -1098,6 +1100,9 @@ int SIPVoIPLink::inv_session_reinvite (SIPCall *call, std::string direction)
     // Send it
     status = pjsip_inv_send_msg (call->getInvSession(), tdata);
 
+	// Test IM message
+	imModule->send (call->getInvSession (), "Salut! Click <a href='http://sflphone.org'>here</a>");
+
     if (status != PJ_SUCCESS)
         return 1;   // !PJ_SUCCESS
 
@@ -2021,7 +2026,7 @@ bool SIPVoIPLink::pjsip_init()
     pjsip_endpt_add_capability (_endpt, &_mod_ua, PJSIP_H_ACCEPT, NULL, 1, &STR_MIME_TEXT_PLAIN);
 
 	// Registering and initializing IM module
-	// imModule->init ();
+	imModule->init ();
 
     // Register "application/sdp" in ACCEPT header
     pjsip_endpt_add_capability (_endpt, &_mod_ua, PJSIP_H_ACCEPT, NULL, 1, &accepted);
diff --git a/sflphone-common/test/Makefile.am b/sflphone-common/test/Makefile.am
index b2ae6aae0c29f2449ac90c8c11c6ee023a3707f8..ddb4294c4746c6587543c28663aa355415ef774c 100644
--- a/sflphone-common/test/Makefile.am
+++ b/sflphone-common/test/Makefile.am
@@ -28,7 +28,8 @@ test_SOURCES = \
 	sdesnegotiatortest.h \
 	sdesnegotiatortest.cpp \
 	delaydetectiontest.h \
-	delaydetectiontest.cpp
+	delaydetectiontest.cpp \
+	instantmessagingtest.cpp
 
 
 
diff --git a/sflphone-common/test/instantmessagingtest.cpp b/sflphone-common/test/instantmessagingtest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4557f06fd81d92c51a86b27259dd576a6872e18c
--- /dev/null
+++ b/sflphone-common/test/instantmessagingtest.cpp
@@ -0,0 +1,58 @@
+/*
+ *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
+ *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#include <stdio.h>
+#include <sstream>
+#include <dlfcn.h>
+
+#include "instantmessagingtest.h"
+
+using std::cout;
+using std::endl;
+using namespace sfl;
+
+void InstantMessagingTest::setUp()
+{
+    _im = new InstantMessaging ();
+	_im->init ();
+}
+
+void InstantMessagingTest::testFunction()
+{
+	_debug ("-------------------- InstantMessagingTest::testFunction --------------------\n");
+
+    CPPUNIT_ASSERT (1 == 1);
+}
+
+void InstantMessagingTest::tearDown()
+{
+    delete _im;
+    _im = 0;
+}
diff --git a/sflphone-common/test/instantmessagingtest.h b/sflphone-common/test/instantmessagingtest.h
new file mode 100644
index 0000000000000000000000000000000000000000..40629374f316624a96f4eb5b1efea3b71656bcb1
--- /dev/null
+++ b/sflphone-common/test/instantmessagingtest.h
@@ -0,0 +1,84 @@
+/*
+ *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
+ *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+// Cppunit import
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCaller.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/TestSuite.h>
+
+#include <assert.h>
+
+// Application import
+#include "sip/im/InstantMessaging.h"
+
+/*
+ * @file instantmessagingtest.h 
+ * @brief       Regroups unitary tests related to the instant messagin module
+ */
+
+#ifndef _INSTANTMANAGER_TEST_
+#define _INSTANTMANAGER_TEST_
+
+class InstantMessagingTest : public CppUnit::TestCase {
+
+   /**
+     * Use cppunit library macros to add unit test the factory
+     */
+    CPPUNIT_TEST_SUITE( InstantMessagingTest );
+        CPPUNIT_TEST( testFunction  );
+    CPPUNIT_TEST_SUITE_END();
+
+    public:
+        InstantMessagingTest() : CppUnit::TestCase("Instant messaging module Tests") {}
+        
+        /*
+         * Code factoring - Common resources can be initialized here.
+         * This method is called by unitcpp before each test
+         */
+        void setUp();
+
+        /*
+         * Code factoring - Common resources can be released here.
+         * This method is called by unitcpp after each test
+         */
+        inline void tearDown ();
+
+        void testFunction ();
+        
+    private:
+		sfl::InstantMessaging *_im;
+};
+
+/* Register our test module */
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(InstantMessagingTest, "InstantMessagingTest");
+CPPUNIT_TEST_SUITE_REGISTRATION( InstantMessagingTest );
+
+#endif