diff --git a/sflphone-common/src/sip/im/InstantMessaging.cpp b/sflphone-common/src/sip/im/InstantMessaging.cpp
index 2c7b3d360b3a9a113d6840f0c6d84d68bcff7669..9cc585864d7489b468afe0fbf9f390921f02c060 100644
--- a/sflphone-common/src/sip/im/InstantMessaging.cpp
+++ b/sflphone-common/src/sip/im/InstantMessaging.cpp
@@ -4,7 +4,8 @@ namespace sfl
 {
 
 InstantMessaging::InstantMessaging()
-        : imFiles () {}
+        : imFiles ()
+	, messageMaxSize(MAXIMUM_MESSAGE_LENGTH) {}
 
 
 InstantMessaging::~InstantMessaging() {}
@@ -40,7 +41,7 @@ bool InstantMessaging::saveMessage (const std::string& message, const std::strin
     // We will use the Call ID
 
     std::ofstream File;
-    std::string filename = "sip:";
+    std::string filename = "im:";
 
     filename.append (id);
     File.open (filename.c_str (), (std::_Ios_Openmode) mode);
@@ -127,7 +128,7 @@ pj_status_t InstantMessaging::send_message (pjsip_inv_session *session, CallID&
 {
 
     /* Check the length of the message */
-    if (message.length() < MAXIMUM_MESSAGE_LENGTH) {
+    if (message.length() < getMessageMaximumSize()) {
         /* No problem here */
         send (session, id, message);
     }
@@ -155,17 +156,17 @@ std::vector<std::string> InstantMessaging::split_message (const std::string& tex
     std::string text_to_split = text;
 
     /* Iterate over the message length */
-    while (text_to_split.length() > MAXIMUM_MESSAGE_LENGTH) {
+    while (text_to_split.length() > getMessageMaximumSize()) {
         /* The remaining string is still too long */
 
         /* Compute the substring */
-        std::string split_message = text_to_split.substr (0, (size_t) MAXIMUM_MESSAGE_LENGTH);
+        std::string split_message = text_to_split.substr (0, (size_t) getMessageMaximumSize());
         /* Append our split character \n\n */
         split_message.append (DELIMITER_CHAR);
         /* Append in the vector */
         messages.push_back (split_message);
         /* Use the remaining string to not loop forever */
-        text_to_split = text_to_split.substr ( (size_t) MAXIMUM_MESSAGE_LENGTH);
+        text_to_split = text_to_split.substr ( (size_t) getMessageMaximumSize());
     }
 
     /* Push the last message */
diff --git a/sflphone-common/src/sip/im/InstantMessaging.h b/sflphone-common/src/sip/im/InstantMessaging.h
index 46ed20e2b877723c9f65ba78442d787768599971..4277b354562d732bc11d9b059d32d0eb69a6dd2a 100644
--- a/sflphone-common/src/sip/im/InstantMessaging.h
+++ b/sflphone-common/src/sip/im/InstantMessaging.h
@@ -37,6 +37,17 @@ namespace sfl  {
 			 */
 			~InstantMessaging();
 
+			/**
+	 		 * Set maximum size fo this module.
+			 */
+			void setMessageMaximumSize(unsigned int max) { messageMaxSize = max; }
+
+			/**
+			 * Return the maximum number if character for a single SIP MESSAGE.
+			 * Longer messages should be splitted in several smaller messages using split_message
+			 */ 
+			unsigned int getMessageMaximumSize(void) { return messageMaxSize; }
+
 			/*
 			 * Register and initialize instant messaging support
 			 */
@@ -126,6 +137,11 @@ namespace sfl  {
 
 			InstantMessaging(const InstantMessaging&); //No Copy Constructor
 			InstantMessaging& operator=(const InstantMessaging&); //No Assignment Operator
+
+			/**
+			 * Store the maximum number of character for a SIP MESSAGE
+			 */
+			unsigned int messageMaxSize;
 	};
 }
 #endif // _INSTANT_MESSAGING_H
diff --git a/sflphone-common/test/instantmessagingtest.cpp b/sflphone-common/test/instantmessagingtest.cpp
index 75a74ce5b20afba021c49f77c2a0924693049623..99f49970786253f9b076c9bdc0310415e5864ab5 100644
--- a/sflphone-common/test/instantmessagingtest.cpp
+++ b/sflphone-common/test/instantmessagingtest.cpp
@@ -52,12 +52,14 @@ void InstantMessagingTest::testSaveSingleMessage ()
 
     std::string input, tmp;
     std::string callID = "testfile1.txt";
+    std::string filename = "im:";
 
     // Open a file stream and try to write in it
     CPPUNIT_ASSERT (_im->saveMessage ("Bonjour, c'est un test d'archivage de message", "Manu", callID, std::ios::out)  == true);
 
+    filename.append(callID);
     // Read it to check it has been successfully written
-    std::ifstream testfile (callID.c_str (), std::ios::in);
+    std::ifstream testfile (filename.c_str (), std::ios::in);
     CPPUNIT_ASSERT (testfile.is_open () == true);
 
     while (!testfile.eof ()) {
@@ -75,13 +77,15 @@ void InstantMessagingTest::testSaveMultipleMessage ()
 
     std::string input, tmp;
     std::string callID = "testfile2.txt";
+    std::string filename = "im:";
 
     // Open a file stream and try to write in it
     CPPUNIT_ASSERT (_im->saveMessage ("Bonjour, c'est un test d'archivage de message", "Manu", callID, std::ios::out)  == true);
     CPPUNIT_ASSERT (_im->saveMessage ("Cool", "Alex", callID, std::ios::out || std::ios::app)  == true);
 
+    filename.append(callID);
     // Read it to check it has been successfully written
-    std::ifstream testfile (callID.c_str (), std::ios::in);
+    std::ifstream testfile (filename.c_str (), std::ios::in);
     CPPUNIT_ASSERT (testfile.is_open () == true);
 
     while (!testfile.eof ()) {
@@ -97,10 +101,13 @@ void InstantMessagingTest::testSaveMultipleMessage ()
 void InstantMessagingTest::testSplitMessage ()
 {
 
+    _im->setMessageMaximumSize(10);
+    unsigned int maxSize = _im->getMessageMaximumSize();
+
     /* A message that does not need to be split */
     std::string short_message = "Salut";
     std::vector<std::string> messages = _im->split_message (short_message);
-    CPPUNIT_ASSERT (messages.size() == short_message.length() /MAXIMUM_SIZE + 1);
+    CPPUNIT_ASSERT (messages.size() == short_message.length() / maxSize + 1);
     CPPUNIT_ASSERT (messages[0] == short_message);
 
     /* A message that needs to be split into two messages */
@@ -108,15 +115,15 @@ void InstantMessagingTest::testSplitMessage ()
     messages = _im->split_message (long_message);
     int size = messages.size ();
     int i = 0;
-    CPPUNIT_ASSERT (size == (int) long_message.length() /MAXIMUM_SIZE + 1);
+    CPPUNIT_ASSERT (size == (int) (long_message.length() / maxSize + 1));
 
     /* If only one element, do not enter the loop */
     for (i = 0; i < size - 1; i++) {
-        CPPUNIT_ASSERT (messages[i] == long_message.substr ( (MAXIMUM_SIZE * i), MAXIMUM_SIZE) + DELIMITER_CHAR);
-    }
+        CPPUNIT_ASSERT (messages[i] == long_message.substr ( (maxSize * i), maxSize) + DELIMITER_CHAR);
+    } 
 
     /* Works for the last element, or for the only element */
-    CPPUNIT_ASSERT (messages[size- 1] == long_message.substr (MAXIMUM_SIZE * (size-1)));
+    CPPUNIT_ASSERT (messages[size- 1] == long_message.substr (maxSize * (size-1)));
 
     /* A message that needs to be split into four messages */
     std::string very_long_message = "A message that needs to be split into many messages";
@@ -125,11 +132,11 @@ void InstantMessagingTest::testSplitMessage ()
 
     /* If only one element, do not enter the loop */
     for (i = 0; i < size - 1; i++) {
-        CPPUNIT_ASSERT (messages[i] ==very_long_message.substr ( (MAXIMUM_SIZE * i), MAXIMUM_SIZE) + DELIMITER_CHAR);
+        CPPUNIT_ASSERT (messages[i] ==very_long_message.substr ( (maxSize * i), maxSize) + DELIMITER_CHAR);
     }
 
     /* Works for the last element, or for the only element */
-    CPPUNIT_ASSERT (messages[size- 1] == very_long_message.substr (MAXIMUM_SIZE * (size-1)));
+    CPPUNIT_ASSERT (messages[size- 1] == very_long_message.substr (maxSize * (size-1)));
 }
 
 void InstantMessagingTest::tearDown()