diff --git a/configure.ac b/configure.ac
index 70317736ea516d075bcc27e1549ab36ec0bbb540..ec2c87cdc2fe7e21de971e55232fb682d2229bf8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,9 +126,7 @@ AC_CHECK_FUNCS([bzero floor gethostbyname gethrtime gettimeofday \
   inet_ntoa memset mkdir pathconf pow regcomp select setlocale socket \
   strchr strdup strerror strrchr strstr strtol utime])
 
-dnl Check for exosip2
-LP_CHECK_EXOSIP2
-SFLPHONE_LIBS="$SFLPHONE_LIBS $EXOSIP_LIBS"
+SFLPHONE_LIBS="$SFLPHONE_LIBS"
 
 dnl Check for GNU ccRTP
 PKG_PROG_PKG_CONFIG
@@ -139,12 +137,6 @@ if test "x${have_libpj}" = "xfalse" ; then
     AC_MSG_ERROR([PJSIP not found. http://www.pjsip.org/download.htm])
 fi
 
-LIBOSIP2_OSIPLISTNOPOINTER_MIN_VERSION=3.0.0
-PKG_CHECK_MODULES([libosip2], [libosip2 >= ${LIBOSIP2_OSIPLISTNOPOINTER_MIN_VERSION}],
-	[LIBOSIP2_CFLAGS=""], [LIBOSIP2_CFLAGS="-DLIBOSIP2_WITHPOINTER"])
-SIP_CFLAGS="$SIP_CFLAGS $LIBOSIP2_CFLAGS";
-AC_SUBST(SIP_CFLAGS)
-
 LIBASOUND2_MIN_VERSION=1.0
 PKG_CHECK_MODULES(alsa, alsa >= ${LIBASOUND2_MIN_VERSION})
 SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libasound2_CFLAGS"
@@ -349,26 +341,6 @@ DBUS_SERVICES_DIR="$datadir/dbus-1/services"
 AC_SUBST(DBUS_SERVICES_DIR)
 AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for DBUS is])
 
-
-dnl QT interface
-AC_MSG_CHECKING([whether to enable sflphoneqt])
-AC_ARG_ENABLE(sflphoneqt,
-   AS_HELP_STRING(
-     [--enable-sflphoneqt],
-     [enable sflphone-qt compilation @<:@default=no@:>@]
-   ),
-   [with_sflphoneqt=$enableval],
-   [with_sflphoneqt=no]
-)
-AM_CONDITIONAL(WITH_QT, test "x$with_sflphoneqt" = "xyes")
-AM_CONDITIONAL(include_x11, test x$with_sflphoneqt = "xyes")
-if test "x$with_sflphoneqt" = "xno"; then
-  AC_MSG_RESULT(no)
-else
-  AC_MSG_RESULT(yes)
-  gw_CHECK_QT
-fi
-
 # Go!
 AC_SUBST(SFLPHONE_CFLAGS)
 AC_SUBST(SFLPHONE_LIBS)
diff --git a/src/Makefile.am b/src/Makefile.am
index 96bdd373a5244f6338fb4034a95e5110bb155193..8f178a13f104814ce45a124e3be53074cee7fb62 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -54,7 +54,7 @@ sflphoned_SOURCES = \
 sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(ZEROCONFFLAGS) $(IAX_FLAGS) $(SFLPHONE_CFLAGS) $(SIP_CFLAGS)
 
 #sflphoned_LDFLAGS = -static
-sflphoned_LDADD =  ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS) $(ALSAFLAG) $(PULSEAUDIO_LIBS) $(PJSIP_LIBS)
+sflphoned_LDADD =  ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(ALSAFLAG) $(PULSEAUDIO_LIBS) $(PJSIP_LIBS)
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES) $(libdbuscpp_CFLAGS) \
 	      -DCODECS_DIR=\""$(sflcodecdir)"\" 
 	      -DENABLE_TRACE
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
old mode 100755
new mode 100644
index ee874334bec661fcc020e14ac27d7f11d7f89d1a..1e69b0010fad954b4ea812664d78e0d4e3143ee4
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -698,7 +698,6 @@ ManagerImpl::callFailure(const CallID& id)
   void
 ManagerImpl::startVoiceMessageNotification(const AccountID& accountId, int nb_msg)
 {
-    _debug("cccccccccccccccccc\n");
   if (_dbus) _dbus->getCallManager()->voiceMailNotify(accountId, nb_msg) ;
 }
 
diff --git a/src/managerimpl.h b/src/managerimpl.h
old mode 100755
new mode 100644
diff --git a/src/sipcall.cpp b/src/sipcall.cpp
old mode 100755
new mode 100644
index ee6a51978fd21ce1946c4eacf270581ec9687421..451283960392d816897890a0951af3dfd62f26f1
--- a/src/sipcall.cpp
+++ b/src/sipcall.cpp
@@ -60,7 +60,7 @@ SIPCall::SIPCallInvite(pjsip_rx_data *rdata, pj_pool_t *pool)
   
   _localSDP->origin.version = 0;
   sdpAddOrigin();
-  _localSDP->name = pj_str("sflphone");
+  _localSDP->name = pj_str((char*)"sflphone");
   sdpAddConnectionInfo();
   _localSDP->time.start = _localSDP->time.stop = 0;
   sdpAddMediaDescription(pool);
@@ -101,145 +101,6 @@ SIPCall::SIPCallInvite(pjsip_rx_data *rdata, pj_pool_t *pool)
   return true;
 }
 
-bool 
-SIPCall::SIPCallReinvite(eXosip_event_t *event)
-{
-  if (event->cid < 1 && event->did < 1) {
-    _debug("SIP Failure: Invalid cid and did\n");
-    return false;
-  }
-
-  if (event->request == NULL) {
-    _debug("SIP Failure: No request into the event\n");
-    return false;
-  }
-
-  setCid(event->cid);
-  setDid(event->did);
-  setTid(event->tid);
-
-  setPeerInfoFromRequest(event);
-
-  sdp_message_t* remote_sdp = getRemoteSDPFromRequest(event);
-  if (remote_sdp == 0) {
-    return false;
-  }
-
-  sdp_media_t* remote_med = getRemoteMedia(event->tid, remote_sdp);
-  if (remote_med == 0) {
-    sdp_message_free (remote_sdp);
-    return false;
-  }
-
-  /*if (!setRemoteAudioFromSDP(remote_med, remote_sdp)) {
-    _debug("SIP Failure: unable to set IP address and port from SDP\n");
-    sdp_message_free (remote_sdp);
-    return false;
-  }
-
-  if (!setAudioCodecFromSDP(remote_med, event->tid)) {
-    sdp_message_free (remote_sdp);
-    return false;
-  }*/
-
-  osip_message_t *answer = 0;
-  eXosip_lock();
-  _debug("< Building Answer 200\n");
-  if (0 == eXosip_call_build_answer (event->tid, 200, &answer)) {
-    if ( 0 != sdp_complete_message(remote_sdp, answer)) {
-      osip_message_free(answer);
-      // Send 415 Unsupported media type
-      eXosip_call_send_answer (event->tid, 415, NULL);
-      _debug("< Sending Answer 415\n");
-    } else {
-
-      sdp_message_t *local_sdp = eXosip_get_sdp_info(answer);
-      sdp_media_t *local_med = NULL;
-      if (local_sdp != NULL) {
-         local_med = eXosip_get_audio_media(local_sdp);
-      }
-      if (local_sdp != NULL && local_med != NULL) {
-        /* search if stream is sendonly or recvonly */
-        int _remote_sendrecv = sdp_analyse_attribute (remote_sdp, remote_med);
-        int _local_sendrecv =  sdp_analyse_attribute (local_sdp, local_med);
-        _debug("            Remote SendRecv: %d\n", _remote_sendrecv);
-        _debug("            Local  SendRecv: %d\n", _local_sendrecv);
-        if (_local_sendrecv == _SENDRECV) {
-          if (_remote_sendrecv == _SENDONLY)      { _local_sendrecv = _RECVONLY; }
-          else if (_remote_sendrecv == _RECVONLY) { _local_sendrecv = _SENDONLY; }
-        }
-        _debug("            Final Local SendRecv: %d\n", _local_sendrecv);
-        sdp_message_free (local_sdp);
-      }
-      _debug("< Sending answer 200\n");
-      if (0 != eXosip_call_send_answer (event->tid, 200, answer)) {
-        _debug("SipCall::newIncomingCall: cannot send 200 OK?\n");
-      }
-    }
-  }
-  eXosip_unlock ();
-  sdp_message_free (remote_sdp);
-  return true;
-}
-
-bool 
-SIPCall::SIPCallAnswered(eXosip_event_t *event)
-{
-  if (event->cid < 1 && event->did < 1) {
-    _debug("SIP Failure: Invalid cid and did\n");
-    return false;
-  }
-
-  if (event->request == NULL) {
-    _debug("SIP Failure: No request into the event\n");
-    return false;
-  }
-
-  setCid(event->cid);
-  setDid(event->did);
-
-  //setPeerInfoFromResponse()
-
-  eXosip_lock ();
-  {
-    osip_message_t *ack = NULL;
-    int i;
-    i = eXosip_call_build_ack (event->did, &ack);
-    if (i != 0) {
-      _debug("SipCall::answeredCall: Cannot build ACK for call!\n");
-    } else {
-      sdp_message_t *local_sdp = NULL;
-      sdp_message_t *remote_sdp = NULL;
-
-      if (event->request != NULL && event->response != NULL) {
-        local_sdp = eXosip_get_sdp_info (event->request);
-        remote_sdp = eXosip_get_sdp_info (event->response);
-      }
-      if (local_sdp == NULL && remote_sdp != NULL) {
-        /* sdp in ACK */
-        i = sdp_complete_message (remote_sdp, ack);
-        if (i != 0) {
-            _debug("SipCall::answeredCall: Cannot complete ACK with sdp body?!\n");
-        }
-      }
-      sdp_message_free (local_sdp);
-      sdp_message_free (remote_sdp);
-
-      _debug("< Send ACK\n");
-      eXosip_call_send_ack (event->did, ack);
-    }
-  }
-  eXosip_unlock ();
-  return true;  
-}
-
-
-bool 
-SIPCall::SIPCallAnsweredWithoutHold(eXosip_event_t* event)
-{
-    return true;
-}
-
 bool
 SIPCall::SIPCallAnsweredWithoutHold(pjsip_rx_data *rdata)
 {
@@ -270,193 +131,6 @@ SIPCall::SIPCallAnsweredWithoutHold(pjsip_rx_data *rdata)
 }
 
 
-int 
-SIPCall::sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg)
-{
-  // Format port to a char*
-  if (remote_sdp == NULL) {
-    _debug("SipCall::sdp_complete_message: No remote SDP body found for call\n");
-    return -1;
-  }
-  if (msg == NULL) {
-    _debug("SipCall::sdp_complete_message: No message to complete\n");
-    return -1;
-  }
-
-  std::ostringstream media;
-
-  // for each medias
-  int iMedia = 0;
-  char *tmp = NULL;
-  #ifdef LIBOSIP2_WITHPOINTER 
-  const osip_list_t* remote_sdp_m_medias = remote_sdp->m_medias; // old abi
-  #else
-  const osip_list_t* remote_sdp_m_medias = &(remote_sdp->m_medias);
-  #endif
-  osip_list_t* remote_med_m_payloads = 0;
-
-  while (!osip_list_eol(remote_sdp_m_medias, iMedia)) {
-    sdp_media_t *remote_med = (sdp_media_t *)osip_list_get(remote_sdp_m_medias, iMedia);
-    if (remote_med == 0) { continue; }
-
-    if (0 != osip_strcasecmp (remote_med->m_media, "audio")) {
-      // if this is not an "audio" media, we set it to 0
-      media << "m=" << remote_med->m_media << " 0 " << remote_med->m_proto << " \r\n";
-    } else {
-      std::ostringstream listCodec;
-      std::ostringstream listRtpMap;
-
-      // search for compatible codec: foreach payload
-      int iPayload = 0;
-      #ifdef LIBOSIP2_WITHPOINTER 
-      remote_med_m_payloads = remote_med->m_payloads; // old abi
-      #else
-      remote_med_m_payloads = &(remote_med->m_payloads);
-      #endif
-
-      //while (!osip_list_eol(remote_med_m_payloads, iPayload) && iPayload < 2) {
-      while (!osip_list_eol(remote_med_m_payloads, iPayload)) {
-        tmp = (char *)osip_list_get(remote_med_m_payloads, iPayload);
-        if (tmp!=NULL) {
-          int payload = atoi(tmp);
-	  _debug("remote payload = %s\n", tmp);
-          AudioCodecType audiocodec = (AudioCodecType)payload;
-          if (audiocodec != (AudioCodecType)-1 && _codecMap.isActive(audiocodec))  { 
-            listCodec << payload << " ";
-            //listRtpMap << "a=rtpmap:" << payload << " " << audiocodec->getCodecName() << "/" << audiocodec->getClockRate();
-            listRtpMap << "a=rtpmap:" << payload << " " << _codecMap.getCodecName(audiocodec) << "/" << _codecMap.getSampleRate(audiocodec);
-	    if (_codecMap.getChannel(audiocodec) != 1) {
-              listRtpMap << "/" << _codecMap.getChannel(audiocodec);
-            }
-            listRtpMap << "\r\n";
-          }
-        }
-        iPayload++;
-      }
-      if (listCodec.str().empty()) {
-        media << "m=" << remote_med->m_media << " 0 " << remote_med->m_proto << " \r\n";
-      } else {
-        // we add the media line + a=rtpmap list
-        media << "m=" << remote_med->m_media << " " << getLocalExternAudioPort() << " RTP/AVP " << listCodec.str() << "\r\n";
-        media << listRtpMap.str();
-      }
-    }
-    iMedia++;
-  }
-  char buf[4096];
-  snprintf (buf, 4096,
-    "v=0\r\n"
-    "o=user 0 0 IN IP4 %s\r\n"
-    "s=session\r\n"
-    "c=IN IP4 %s\r\n"
-    "t=0 0\r\n"
-    "%s\n", getLocalIp().c_str(), getLocalIp().c_str(), media.str().c_str());
-
-  osip_message_set_body (msg, buf, strlen (buf));
-  osip_message_set_content_type (msg, "application/sdp");
-  _debug("          sdp: %s", buf);
-  return 0;
-}
-
-
-
-int 
-SIPCall::sdp_analyse_attribute (sdp_message_t * sdp, sdp_media_t * med)
-{
-  int pos;
-  int pos_media;
-
-  /* test media attributes */
-  pos = 0;
-  #ifdef LIBOSIP2_WITHPOINTER 
-  const osip_list_t* med_a_attributes = med->a_attributes; // old abi
-  #else
-  const osip_list_t* med_a_attributes = &(med->a_attributes);
-  #endif
-  while (!osip_list_eol (med_a_attributes, pos)) {
-      sdp_attribute_t *at;
-
-      at = (sdp_attribute_t *) osip_list_get (med_a_attributes, pos);
-      if (at->a_att_field != NULL && 
-      0 == strcmp (at->a_att_field, "sendonly")) {
-      return _SENDONLY;
-      } else if (at->a_att_field != NULL &&
-                0 == strcmp (at->a_att_field, "recvonly")) {
-          return _RECVONLY;
-      } else if (at->a_att_field != NULL &&
-                0 == strcmp (at->a_att_field, "sendrecv")) {
-          return _SENDRECV;
-      }
-      pos++;
-  }
-
-  /* test global attributes */
-  pos_media = -1;
-  pos = 0;
-  #ifdef LIBOSIP2_WITHPOINTER 
-  const osip_list_t* sdp_a_attributes = sdp->a_attributes; // old abi
-  #else
-  const osip_list_t* sdp_a_attributes = &(sdp->a_attributes);
-  #endif
-  while (!osip_list_eol (sdp_a_attributes, pos)) {
-      sdp_attribute_t *at;
-
-      at = (sdp_attribute_t *) osip_list_get (sdp_a_attributes, pos);
-      if (at->a_att_field != NULL && 
-      0 == strcmp (at->a_att_field, "sendonly")) {
-          return _SENDONLY;
-      } else if (at->a_att_field != NULL &&
-                0 == strcmp (at->a_att_field, "recvonly")) {
-          return _RECVONLY;
-      } else if (at->a_att_field != NULL &&
-                0 == strcmp (at->a_att_field, "sendrecv")) {
-          return _SENDRECV;
-      }
-      pos++;
-  }
-
-  return _SENDRECV;
-}
-
-bool 
-SIPCall::setPeerInfoFromRequest(eXosip_event_t *event)
-{
-  // event->request should not be NULL!
-  char remote_uri[256] = "";
-  std::string name("");
-  std::string number("");
-
-  char *tmp = NULL;
-  osip_from_to_str(event->request->from, &tmp);
-  if (tmp != NULL) {
-    snprintf (remote_uri, 255, "%s", tmp);
-    remote_uri[255] = '\0';
-    osip_free (tmp);
-
-    // Get the name/number
-    osip_from_t *from;
-    osip_from_init(&from);
-    osip_from_parse(from, remote_uri);
-    char *tmpname = osip_from_get_displayname(from);
-    if ( tmpname != NULL ) {
-      name = tmpname;
-    }
-    osip_uri_t* url = osip_from_get_url(from); 
-    if ( url != NULL && url->username != NULL) {
-      number = url->username;
-    }
-    osip_from_free(from);
-  }
-
-  _debug("            Name: %s\n", name.c_str());
-  _debug("            Number: %s\n", number.c_str());
-  _debug("            Remote URI: %s\n", remote_uri);
-
-  setPeerName(name);
-  setPeerNumber(number);  
-  return true;
-}
-
 pjmedia_sdp_session* 
 SIPCall::getRemoteSDPFromRequest(pjsip_rx_data *rdata)
 {
@@ -472,27 +146,6 @@ SIPCall::getRemoteSDPFromRequest(pjsip_rx_data *rdata)
     return sdp;
 }
 
-sdp_media_t* 
-SIPCall::getRemoteMedia(int tid, sdp_message_t* remote_sdp)
-{
-  // Remote Media Port
-  eXosip_lock();
-  sdp_media_t *remote_med = eXosip_get_audio_media(remote_sdp);
-  eXosip_unlock();
-
-  if (remote_med == NULL || remote_med->m_port == NULL) {
-    // no audio media proposed
-    _debug("SIP Failure: unsupported media\n");
-    _debug("< Sending 415 Unsupported media type\n");
-    eXosip_lock();
-    eXosip_call_send_answer (tid, 415, NULL);
-    eXosip_unlock();
-    sdp_message_free (remote_sdp);
-    return 0;
-  }
-  return remote_med;
-}
-
 bool 
 SIPCall::setRemoteAudioFromSDP(pjmedia_sdp_session* remote_sdp, pjmedia_sdp_media *remote_med)
 {
@@ -538,9 +191,9 @@ void SIPCall::sdpAddOrigin( void )
     // Use Network Time Protocol format timestamp to ensure uniqueness.
     _localSDP->origin.id = tv.sec + 2208988800UL;
     // The type of network ( IN for INternet )
-    _localSDP->origin.net_type = pj_str("IN"); //STR_IN;
+    _localSDP->origin.net_type = pj_str((char*)"IN"); //STR_IN;
     // The type of address
-    _localSDP->origin.addr_type = pj_str("IP4"); //STR_IP4;
+    _localSDP->origin.addr_type = pj_str((char*)"IP4"); //STR_IP4;
     // The address of the machine from which the session was created
     _localSDP->origin.addr = pj_str( (char*)_ipAddr.c_str() );    
 }
@@ -562,10 +215,10 @@ void SIPCall::sdpAddMediaDescription(pj_pool_t* pool)
     //nbMedia = getSDPMediaList().size();
     _localSDP->media_count = 1;
     
-    med->desc.media = pj_str("audio");
+    med->desc.media = pj_str((char*)"audio");
     med->desc.port_count = 1;
     med->desc.port = getLocalExternAudioPort();
-    med->desc.transport = pj_str("RTP/AVP");
+    med->desc.transport = pj_str((char*)"RTP/AVP");
     
     CodecsMap::iterator itr;
     itr = _codecMap.getCodecsMap().begin();
@@ -642,7 +295,7 @@ bool SIPCall::createInitialOffer(pj_pool_t *pool)
   
   _localSDP->origin.version = 0;
   sdpAddOrigin();
-  _localSDP->name = pj_str("sflphone");
+  _localSDP->name = pj_str((char*)"sflphone");
   sdpAddConnectionInfo();
   _localSDP->time.start = _localSDP->time.stop = 0;
   sdpAddMediaDescription(pool);
diff --git a/src/sipcall.h b/src/sipcall.h
old mode 100755
new mode 100644
index d5b47a33aa9ac45a7b8869fca19d080ec52a7bc4..ab87d191825b4c4e25bdf1d12fccadee06f51fd3
--- a/src/sipcall.h
+++ b/src/sipcall.h
@@ -25,8 +25,6 @@
 #include "audio/codecDescriptor.h"
 #include "sipmanager.h"
 
-#include <eXosip2/eXosip.h>
-
 class AudioCodec;
 
 /**
@@ -52,37 +50,37 @@ class SIPCall : public Call
 
     /** 
      * Call Identifier
-     * @return int  SIP call id : protected by eXosip lock 
+     * @return int  SIP call id
      */
     int  getCid() { return _cid; }
     
     /** 
      * Call Identifier
-     * @param cid SIP call id : protected by eXosip lock 
+     * @param cid SIP call id
      */
     void setCid(int cid) { _cid = cid ; } 
     
     /** 
      * Domain identifier
-     * @return int  SIP domain id : protected by eXosip lock  
+     * @return int  SIP domain id
      */
     int  getDid() { return _did; }
     
     /** 
      * Domain identifier
-     * @param did SIP domain id : protected by eXosip lock 
+     * @param did SIP domain id
      */
     void setDid(int did) { _did = did; } 
     
     /** 
      * Transaction identifier
-     * @return int  SIP transaction id : protected by eXosip lock  
+     * @return int  SIP transaction id
      */
     int  getTid() { return _tid; }
     
     /** 
      * Transaction identifier
-     * @param tid SIP transaction id : protected by eXosip lock 
+     * @param tid SIP transaction id
      */
     void setTid(int tid) { _tid = tid; } 
 
@@ -95,31 +93,8 @@ class SIPCall : public Call
      */
     bool SIPCallInvite(pjsip_rx_data *rdata, pj_pool_t *pool);
 
-    /**
-     * newReinviteCall is called when the IP-Phone user receives a change in the call
-     * it's almost an newIncomingCall but we send a 200 OK
-     * See: 3.7.  Session with re-INVITE (IP Address Change)
-     * @param event eXosip Event
-     * @return bool True if ok
-     */
-    bool SIPCallReinvite(eXosip_event_t *event);
-
-    /**
-     * Peer answered to a call (on hold or not)
-     * @param event eXosip Event
-     * @return bool True if ok
-     */
-    bool SIPCallAnswered(eXosip_event_t *event);
-
-    /** No longer being used */
-    bool SIPCallAnsweredWithoutHold(eXosip_event_t *event);
-
     bool SIPCallAnsweredWithoutHold(pjsip_rx_data *rdata);
  
-    /** No longer being used */
-    int sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg);
-
-
     /**
      * Save IP Address
      * @param ip std::string 
@@ -155,30 +130,13 @@ class SIPCall : public Call
     pjsip_inv_session *getInvSession() {return _invSession;}
     
   private:
-
-    /** No longer being used */
-    int sdp_analyse_attribute (sdp_message_t * sdp, sdp_media_t * med);
-    
-    /**
-     * Set peer name and number with event->request->from
-     * @param event eXosip event
-     * @return bool False if the event is invalid
-     */
-    bool setPeerInfoFromRequest(eXosip_event_t *event);
-
     /**
      * Get a valid remote SDP or return a 400 bad request response if invalid
-     * @param event eXosip event
-     * @return sdp_message_t* A valid remote_sdp or 0
+     * @param
+     * @return
      */
     pjmedia_sdp_session* getRemoteSDPFromRequest(pjsip_rx_data *rdata);
 
-    /** No longer being used */
-    sdp_message_t *getRemoteSDPFromRequest(eXosip_event_t*&){return NULL;}
-
-    /** No longer being used */
-    sdp_media_t* getRemoteMedia(int tid, sdp_message_t* remote_sdp);
-
     /**
      * Get a valid remote media
      * @param remote_sdp pjmedia_sdp_session*
diff --git a/src/sipmanager.cpp b/src/sipmanager.cpp
old mode 100755
new mode 100644
index 27d443edf532bf4ba2f82a7255c8db97f0a66ea4..4356078c8edd8ffaa67760853b9b9cca1af47378
--- a/src/sipmanager.cpp
+++ b/src/sipmanager.cpp
@@ -622,7 +622,6 @@ void SIPManager::set_voicemail_info( AccountID account, pjsip_msg_body *body ){
 
     // We get the notification body
     msg_body = (char*)body->data;
-    std::cout << " body message " << msg_body.c_str() << std::endl;
 
     // We need the position of the first character of the string voice_str
     pos_begin = msg_body.find(voice_str); 
@@ -699,7 +698,6 @@ pj_bool_t SIPManager::mod_on_rx_request(pjsip_rx_data *rdata) {
 	method_name = "NOTIFY";
 	// Retrieve all the message. Should contains only the method name but ...
 	request =  rdata->msg_info.msg->line.req.method.name.ptr;
-	_debug("request = %s\n", request.c_str());
 	// Check if the message is a notification
 	if( request.find( method_name ) != -1 ) {
     		set_voicemail_info( account_id, rdata->msg_info.msg->body );
diff --git a/src/sipmanager.h b/src/sipmanager.h
old mode 100755
new mode 100644
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
old mode 100755
new mode 100644
index 12ea636697523a5bbf74f9ba08e4d44a704600e0..498008be267362c2d0a292d7f2d88f0b859834d8
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -27,7 +27,7 @@
 #include "sipaccount.h"
 #include "sipmanager.h"
 #include "audio/audiortp.h"
-
+        
 #include "manager.h"
 #include "user_cfg.h" // SIGNALISATION / PULSE #define
 
@@ -36,29 +36,16 @@
 #define RANDOM_SIP_PORT   rand() % 64000 + 1024
 #define RANDOM_LOCAL_PORT ((rand() % 27250) + 5250)*2
 
-#define EXOSIP_ERROR_NO   0
-#define EXOSIP_ERROR_STD -1
-#define EXOSIP_ERROR_BUILDING -2
-
 // 1XX responses
 #define DIALOG_ESTABLISHED 101
 // see: osip_const.h
 
-// FOR VOICE Message handling
-#define VOICE_MSG     "Voice-Message"
-#define LENGTH_VOICE_MSG  15
-
 // need for hold/unhold
 #define INVITE_METHOD "INVITE"
 
-
 SIPVoIPLink::SIPVoIPLink(const AccountID& accountID)
- : VoIPLink(accountID), _localExternAddress("") , eXosip_running( false )
+ : VoIPLink(accountID), _localExternAddress("") 
 {
-  _evThread = NULL;//new EventThread(this);
-
-  _nMsgVoicemail = 0;
-  _eXosipRegID = EXOSIP_ERROR_STD;
 
   _nbTryListenAddr = 2; // number of times to try to start SIP listener
   _localExternPort = 0;
@@ -71,87 +58,11 @@ SIPVoIPLink::SIPVoIPLink(const AccountID& accountID)
 SIPVoIPLink::~SIPVoIPLink()
 {
   terminate();
-  delete _evThread; _evThread = 0;
 }
 
 bool 
 SIPVoIPLink::init()
 {
-  /*if( eXosip_running ){
-    delete _evThread; 
-    _evThread=0;
-    _evThread=  new EventThread( this );
-    eXosip_quit();
-  }*/
-
-  /*if (!_initDone) {
-    if (0 != eXosip_init()) {
-      _debug("! SIP Failure: Could not initialize eXosip\n");
-      return false;
-    }
-
-    // Pour éviter qu'on refasse l'init sans avoir considéré l'erreur,
-    // s'il y en a une ?
-    _initDone = true;
-    // check networking capabilities
-    if ( !checkNetwork() ) {
-      _debug("! SIP FAILURE: Unable to determine network capabilities\n");
-      return false;
-    }
-  
-    // if we useStun and we failed to receive something on port 5060, we try a random port
-    // If use STUN server, firewall address setup
-    int errExosip = 0;
-    int port = DEFAULT_SIP_PORT;
-  
-    int iTry = 1;  // try number..
-  
-    do {
-      if (_useStun && !Manager::instance().behindNat(_stunServer, port)) { 
-        port = RANDOM_SIP_PORT; 
-        if (!Manager::instance().behindNat(_stunServer, port)) {
-         _debug("! SIP Failure: Unable to check NAT setting\n");
-          return false; // hoho we can't use the random sip port too...
-        }
-      }
-  
-      // second parameter, NULL is "::" for ipv6 and "0.0.0.0" for ipv4, we can put INADDR_ANY
-      errExosip = eXosip_listen_addr(IPPROTO_UDP, INADDR_ANY, port, AF_INET, 0);
-      if (errExosip != 0) {
-        _debug("* SIP Info: [%d/%d] could not initialize SIP listener on port %d\n", iTry, _nbTryListenAddr, port);
-        port = RANDOM_SIP_PORT;
-      }
-    } while ( errExosip != 0 && iTry < _nbTryListenAddr );
-  
-    if ( errExosip != 0 ) { // we didn't succeeded
-      _debug("! SIP Failure: SIP failed to listen on port %d\n", port);
-      return false;
-    }
-    _localPort = port;
-    _debug("  SIP Init: listening on port %d\n", port);
-    
-    if (_useStun) {
-      // This method is used to replace contact address with the public address of your NAT
-      // it should be call after eXosip_listen_addr
-      // set by last behindNat() call (ish)...
-      _localExternAddress  = Manager::instance().getFirewallAddress();
-      _localExternPort     = Manager::instance().getFirewallPort();
-      eXosip_masquerade_contact(_localExternAddress.data(), _localExternPort);
-    } else {
-      _localExternAddress = _localIPAddress;
-      _localExternPort    = _localPort;
-    }
-    
-    // Set user agent
-    std::string tmp = std::string(PROGNAME_GLOBAL) + "/" + std::string(SFLPHONED_VERSION);
-    eXosip_set_user_agent(tmp.data());
-  
-    _debug(" SIP Init: starting loop thread (SIP events)\n" );
-    _evThread->start();
-  }
-
-  _initDone = true;
-  eXosip_running = true;*/
   _regc = NULL;
   _initDone = true;
   return true;
@@ -160,12 +71,7 @@ SIPVoIPLink::init()
 void 
 SIPVoIPLink::terminate()
 {
-  //terminateSIPCall(); 
-    // TODO The next line makes the daemon crash on 
-    // account delete if at least one account is registered.
-    // It should called only when the last account 
-    // is deleted/unregistered.
-    _initDone = false;
+  _initDone = false;
 }
 
 void
@@ -178,10 +84,7 @@ SIPVoIPLink::terminateSIPCall()
   while( iter != _callMap.end() ) {
     call = dynamic_cast<SIPCall*>(iter->second);
     if (call) {
-      // Release SIP stack.
-      eXosip_lock();
-      eXosip_call_terminate(call->getCid(), call->getDid() );
-      eXosip_unlock();
+      //TODO terminate the sip call
       delete call; call = 0;
     }
     iter++;
@@ -218,239 +121,21 @@ SIPVoIPLink::loadSIPLocalIP()
 void
 SIPVoIPLink::getEvent()
 {
-#ifdef AAAAA
-	char* tmp2;
-	eXosip_event_t* event = eXosip_event_wait(0, 50);
-	eXosip_lock();
-	eXosip_automatic_action();
-	eXosip_unlock();
-
-	if ( event == NULL ) {
-		return;
-	}
-
-      
-	_debug("> SIP Event: [cdt=%4d:%4d:%4d] type=#%03d %s \n", event->cid, event->did, event->tid, event->type, event->textinfo);
-	switch (event->type) {
-	/* REGISTER related events */
-	case EXOSIP_REGISTRATION_NEW:         /** 00 < announce new registration.       */
-		_debugMid(" !EXOSIP_REGISTRATION_NEW event is not implemented\n");
-		break;
-	case EXOSIP_REGISTRATION_SUCCESS:     /** 01 < user is successfully registred.  */
-		_debugMid(" !EXOSIP_REGISTRATION_SUCCESS ---> %s\n" , getAccountID().c_str());
-		if(_eXosipRegID == EXOSIP_ERROR_STD){
-		  _debug("Successfully Unregister account ID = %s\n" , getAccountID().c_str());
-		  setRegistrationState(Unregistered);
-		}
-		else{
-		  _debug("Successfully Register account ID = %s\n" , getAccountID().c_str());
-		  setRegistrationState(Registered);
-		}
-		break;
-	case EXOSIP_REGISTRATION_FAILURE:     /** 02 < user is not registred.           */
-		SIPRegistrationFailure( event );
-		_debugMid(" !EXOSIP_REGISTRATION_FAILURE\n");
-		break;
-	case EXOSIP_REGISTRATION_REFRESHED:   /** 03 < registration has been refreshed. */
-		_debugMid(" !EXOSIP_REGISTRATION_REFRESHED event is not implemented\n");
-		break;
-	case EXOSIP_REGISTRATION_TERMINATED:  /** 04 < UA is not registred any more.    */
-		//setRegistrationState(Unregistered, "Registration terminated by remote host");
-		setRegistrationState(Unregistered);
-		_debugMid(" !EXOSIP_REGISTRATION_TERMINATED event is not implemented\n");
-		break;
-
-	/* INVITE related events within calls */
-	case EXOSIP_CALL_INVITE:          /** 05 < announce a new call                   */
-		_debugMid(" !EXOSIP_CALL_INVITE\n");
-		SIPCallInvite(event);
-		break;
-	case EXOSIP_CALL_REINVITE:        /** 06 < announce a new INVITE within call     */
-		SIPCallReinvite(event);
-		_debugMid(" !EXOSIP_REGISTRATION_TERMINATED event is not implemented\n");
-		break;
-
-	/* CALL related events */
-	case EXOSIP_CALL_NOANSWER:        /** 07 < announce no answer within the timeout */
-		_debugMid(" !EXOSIP_CALL_NOANSWER event is not implemented\n");
-		break;
-	case EXOSIP_CALL_PROCEEDING:      /** 08 < announce processing by a remote app   */
-		_debugMid(" !EXOSIP_CALL_PROCEEDING event is not implemented\n");
-		break;
-	case EXOSIP_CALL_RINGING:         /** 09 < announce ringback                     */
-		_debugMid(" !EXOSIP_CALL_RINGING\n");
-		SIPCallRinging(event);
-		break;
-	case EXOSIP_CALL_ANSWERED:        /** 10 < announce start of call                */
-		_debugMid(" !EXOSIP_CALL_ANSWERED\n");
-		SIPCallAnswered(event);
-		break;
-	case EXOSIP_CALL_REDIRECTED:      /** 11 < announce a redirection                */
-		_debugMid(" !EXOSIP_CALL_REDIRECTED event is not implemented\n");
-		break;
-	case EXOSIP_CALL_REQUESTFAILURE:  /** 12 < announce a request failure            */
-		_debugMid(" !EXOSIP_CALL_REQUESTFAILURE");
-		SIPCallRequestFailure(event);
-		break;
-	case EXOSIP_CALL_SERVERFAILURE:   /** 13 < announce a server failure             */
-		_debugMid(" !EXOSIP_CALL_SERVERFAILURE");
-		SIPCallServerFailure(event);
-		break;
-	case EXOSIP_CALL_GLOBALFAILURE:   /** 14 < announce a global failure             */
-		_debugMid(" !EXOSIP_CALL_GLOBALFAILURE\n");
-		SIPCallServerFailure(event);
-		break;
-	case EXOSIP_CALL_ACK:             /** 15 < ACK received for 200ok to INVITE      */
-		_debugMid(" !EXOSIP_CALL_ACK\n");
-		SIPCallAck(event);
-		break;
-	case EXOSIP_CALL_CANCELLED:       /** 16 < announce that call has been cancelled */
-		_debugMid(" !EXOSIP_CALL_CANCELLED\n");
-		break;
-	case EXOSIP_CALL_TIMEOUT:         /** 17 < announce that call has failed         */
-		_debugMid(" !EXOSIP_CALL_TIMEOUT\n");
-		break;
-
-	/* Request related events within calls (except INVITE) */
-	case EXOSIP_CALL_MESSAGE_NEW:            /** 18 < announce new incoming MESSAGE. */
-		_debugMid(" !EXOSIP_CALL_MESSAGE_NEW\n");
-		SIPCallMessageNew(event);
-		break;
-	case EXOSIP_CALL_MESSAGE_PROCEEDING:     /** 19 < announce a 1xx for MESSAGE. */
-		_debugMid(" !EXOSIP_CALL_MESSAGE_PROCEEDING\n");
-		break;
-	case EXOSIP_CALL_MESSAGE_ANSWERED:       /** 20 < announce a 200ok  */
-		// 200 OK
-		_debugMid(" !EXOSIP_CALL_MESSAGE_ANSWERED\n");
-		break;
-	case EXOSIP_CALL_MESSAGE_REDIRECTED:     /** 21 < announce a failure. */
-		_debugMid(" !EXOSIP_CALL_MESSAGE_REDIRECTED\n");
-		break;
-	case EXOSIP_CALL_MESSAGE_REQUESTFAILURE: /** 22 < announce a failure. */
-		_debugMid(" !EXOSIP_CALL_MESSAGE_REQUESTFAILURE\n");
-		break;
-	case EXOSIP_CALL_MESSAGE_SERVERFAILURE:  /** 23 < announce a failure. */
-		_debugMid(" !EXOSIP_CALL_MESSAGE_SERVERFAILURE\n");
-		break;
-	case EXOSIP_CALL_MESSAGE_GLOBALFAILURE:  /** 24 < announce a failure. */
-		_debugMid(" !EXOSIP_CALL_MESSAGE_GLOBALFAILURE\n");
-		break;
-
-	case EXOSIP_CALL_CLOSED:          /** 25 < a BYE was received for this call */
-		_debugMid(" !EXOSIP_CALL_CLOSED\n");
-		SIPCallClosed(event);
-		break;
-
-	/* For both UAS & UAC events */
-	case EXOSIP_CALL_RELEASED:           /** 26 < call context is cleared. */
-		_debugMid(" !EXOSIP_CALL_RELEASED\n");
-		SIPCallReleased(event);
-		break;
-
-	/* Response received for request outside calls */
-	case EXOSIP_MESSAGE_NEW:            /** 27 < announce new incoming MESSAGE. */
-		_debugMid(" !EXOSIP_MESSAGE_NEW\n");
-		if (event->request == NULL) { break; }
-		SIPMessageNew(event);
-		break;
-	case EXOSIP_MESSAGE_PROCEEDING:     /** 28 < announce a 1xx for MESSAGE. */
-		_debugMid(" !EXOSIP_MESSAGE_PROCEEDING\n");
-		break;
-	case EXOSIP_MESSAGE_ANSWERED:       /** 29 < announce a 200ok  */
-		_debugMid(" !EXOSIP_MESSAGE_ANSWERED\n");
-		break;
-	case EXOSIP_MESSAGE_REDIRECTED:     /** 30 < announce a failure. */
-		_debugMid(" !EXOSIP_MESSAGE_REDIRECTED\n");
-		break;
-
-	case EXOSIP_MESSAGE_REQUESTFAILURE: /** 31 < announce a failure. */
-		_debugMid(" !EXOSIP_MESSAGE_REQUESTFAILURE\n");
-		if (event->response !=0 && event->response->status_code == SIP_METHOD_NOT_ALLOWED) 
-			Manager::instance().incomingMessage(getAccountID(), "Message are not allowed");
-		break;
-	case EXOSIP_MESSAGE_SERVERFAILURE:  /** 32 < announce a failure. */
-		_debugMid(" !EXOSIP_MESSAGE_SERVERFAILURE\n");
-		break;
-	case EXOSIP_MESSAGE_GLOBALFAILURE:  /** 33 < announce a failure. */
-		_debugMid(" !EXOSIP_MESSAGE_GLOBALFAILURE\n");
-		break;
-
-	/* Presence and Instant Messaging */
-	case EXOSIP_SUBSCRIPTION_UPDATE:       /** 34 < announce incoming SUBSCRIBE.      */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_UPDATE\n");
-		break;
-	case EXOSIP_SUBSCRIPTION_CLOSED:       /** 35 < announce end of subscription.     */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_CLOSED\n");
-		break;
-
-	case EXOSIP_SUBSCRIPTION_NOANSWER:        /** 37 < announce no answer              */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_NOANSWER\n");
-		break;
-	case EXOSIP_SUBSCRIPTION_PROCEEDING:      /** 38 < announce a 1xx                  */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_PROCEEDING\n");
-		break;
-	case EXOSIP_SUBSCRIPTION_ANSWERED:        /** 39 < announce a 200ok                */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_ANSWERED\n");
-		eXosip_lock();
-		eXosip_automatic_action();
-		eXosip_unlock();
-		break;
-
-	case EXOSIP_SUBSCRIPTION_REDIRECTED:      /** 40 < announce a redirection          */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_REDIRECTED\n");
-		break;
-	case EXOSIP_SUBSCRIPTION_REQUESTFAILURE:  /** 41 < announce a request failure      */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_REQUESTFAILURE\n");
-		break;
-	case EXOSIP_SUBSCRIPTION_SERVERFAILURE:   /** 42 < announce a server failure       */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_REQUESTFAILURE\n");
-		break;
-	case EXOSIP_SUBSCRIPTION_GLOBALFAILURE:   /** 43 < announce a global failure       */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_GLOBALFAILURE\n");
-		break;
-	case EXOSIP_SUBSCRIPTION_NOTIFY:          /** 44 < announce new NOTIFY request     */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_NOTIFY\n");
-		osip_body_t* body;
-		osip_from_to_str(event->request->from, &tmp2);
-		osip_message_get_body(event->request, 0, &body);
-		if (body != NULL && body->body != NULL) {
-//			printf("\n---------------------------------\n");
-//			printf ("(%i) from: %s\n  %s\n", event->tid, tmp2, body->body);
-//			printf("---------------------------------\n");
-		}
-		osip_free(tmp2);
-		break;
-	case EXOSIP_SUBSCRIPTION_RELEASED:        /** 45 < call context is cleared.        */
-		_debugMid(" !EXOSIP_SUBSCRIPTION_RELEASED\n");
-		break;
-
-	case EXOSIP_IN_SUBSCRIPTION_NEW:          /** 46 < announce new incoming SUBSCRIBE.*/
-		_debugMid(" !EXOSIP_IN_SUBSCRIPTION_NEW\n");
-		break;
-	case EXOSIP_IN_SUBSCRIPTION_RELEASED:     /** 47 < announce end of subscription.   */
-		_debugMid(" !EXOSIP_IN_SUBSCRIPTION_RELEASED\n");
-		break;
-
-	case EXOSIP_EVENT_COUNT:               /** 48 < MAX number of events  */
-		_debugMid(" !EXOSIP_EVENT_COUNT : SHOULD NEVER HAPPEN!!!!!\n");
-		break;
-	default:
-		printf("received eXosip event (type, did, cid) = (%d, %d, %d)", event->type, event->did, event->cid);
-		break;
-	}
-	eXosip_event_free(event);
-#endif
+    // Nothing anymore. PJSIP is based on asynchronous events
 }
 
 bool
 SIPVoIPLink::sendRegister()
 {
-  AccountID id = getAccountID();
+  AccountID id;
   pj_status_t status;
   
+  id = getAccountID();
+
   if(_regc) {
-      pjsip_regc_destroy(_regc);
+      status = pjsip_regc_destroy(_regc);
       _regc = NULL;
+      PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 );
   }
 
   _bRegister = true;
@@ -481,11 +166,8 @@ SIPVoIPLink::sendSIPAuthentification()
     /** @todo Même chose ici  ? */
     return false;
   }
-  eXosip_lock();
-  int returnValue = eXosip_add_authentication_info(login.data(), login.data(), _password.data(), NULL, NULL);
-  eXosip_unlock();
 
-  return (returnValue != EXOSIP_ERROR_STD ? true : false);
+  return true;
 }
 
 bool
@@ -535,7 +217,6 @@ SIPVoIPLink::answer(const CallID& id)
   
   if (i != 0) {
     _debug("< SIP Building Error: send 400 Bad Request\n");
-    //eXosip_call_send_answer (call->getTid(), SIP_BAD_REQUEST, NULL);
   } else {
     // use exosip, bug locked
     i = 0;
@@ -559,12 +240,7 @@ SIPVoIPLink::hangup(const CallID& id)
   SIPCall* call = getSIPCall(id);
   if (call==0) { _debug("! SIP Error: Call doesn't exist\n"); return false; }  
 
-  //_debug("- SIP Action: Hang up call %s [cd: %3d %3d]\n", id.data(), call->getCid(), call->getDid()); 
-  // Release SIP stack.
-  //eXosip_lock();
-  //eXosip_call_terminate(call->getCid(), call->getDid());
-  //eXosip_unlock();
-  Manager::instance().getSipManager()->hangup(call);
+    Manager::instance().getSipManager()->hangup(call);
   
   // Release RTP thread
   if (Manager::instance().isCurrentCall(id)) {
@@ -582,12 +258,9 @@ SIPVoIPLink::cancel(const CallID& id)
   if (call==0) { _debug("! SIP Error: Call doesn't exist\n"); return false; }  
 
   _debug("- SIP Action: Cancel call %s [cid: %3d]\n", id.data(), call->getCid()); 
-  // Release SIP stack.
-  eXosip_lock();
-  eXosip_call_terminate(call->getCid(), -1);
-  eXosip_unlock();
 
   removeCall(id);
+
   return true;
 }
 
@@ -604,65 +277,8 @@ SIPVoIPLink::onhold(const CallID& id)
   _debug("* SIP Info: Stopping AudioRTP for onhold action\n");
   _audiortp->closeRtpSession();
 
-
-  //int did = call->getDid();
-
   Manager::instance().getSipManager()->onhold(call);
 
-/*
-  eXosip_lock ();
-  sdp_message_t *local_sdp = eXosip_get_local_sdp(did);
-  eXosip_unlock ();
-
-  if (local_sdp == NULL) {
-    _debug("! SIP Failure: unable to find local_sdp\n");
-    return false;
-  }
-
-  // Build INVITE_METHOD for put call on-hold
-  osip_message_t *invite = NULL;
-  eXosip_lock ();
-  int exosipErr = eXosip_call_build_request (did, INVITE_METHOD, &invite);
-  eXosip_unlock ();
-
-  if (exosipErr != 0) {
-    sdp_message_free(local_sdp);
-    _debug("! SIP Failure: unable to build invite method to hold call\n");
-    return false;
-  }
-*/
-  /* add sdp body */
-  /*
-  {
-    char *tmp = NULL;
-
-    int i = sdp_hold_call(local_sdp);
-    if (i != 0) {
-      sdp_message_free (local_sdp);
-      osip_message_free (invite);
-      _debug("! SIP Failure: Unable to hold call in SDP\n");
-      return false;
-    }
-    
-    i = sdp_message_to_str(local_sdp, &tmp);
-    sdp_message_free(local_sdp);
-    if (i != 0) {
-      osip_message_free (invite);
-      osip_free (tmp);
-      _debug("! SIP Failure: Unable to translate sdp message to string\n");
-      return false;
-    }
-    osip_message_set_body (invite, tmp, strlen (tmp));
-    osip_free (tmp);
-    osip_message_set_content_type (invite, "application/sdp");
-  }
-  
-  // send request
-  _debug("< SIP: Send on hold request\n");
-  eXosip_lock ();
-  exosipErr = eXosip_call_send_request (did, invite);
-  eXosip_unlock ();
-  */
   return true;
 }
 
@@ -674,59 +290,6 @@ SIPVoIPLink::offhold(const CallID& id)
 
   Manager::instance().getSipManager()->offhold(call);
 
-/*
-  int did = call->getDid();
-
-  eXosip_lock ();
-  sdp_message_t *local_sdp = eXosip_get_local_sdp(did);
-  eXosip_unlock ();
-
-  if (local_sdp == NULL) {
-    _debug("! SIP Failure: unable to find local_sdp\n");
-    return false;
-  }
-
-  // Build INVITE_METHOD for put call off-hold
-  osip_message_t *invite;
-  eXosip_lock ();
-  int exosipErr = eXosip_call_build_request (did, INVITE_METHOD, &invite);
-  eXosip_unlock ();
-
-  if (exosipErr != 0) {
-    sdp_message_free(local_sdp);
-    return EXOSIP_ERROR_STD;
-  }
-*/
-  /* add sdp body */
-/*
-  {
-    char *tmp = NULL;
-    
-    int i = sdp_off_hold_call (local_sdp);
-    if (i != 0) {
-      sdp_message_free (local_sdp);
-      osip_message_free (invite);
-      return false;
-    }
-    
-    i = sdp_message_to_str (local_sdp, &tmp);
-    sdp_message_free (local_sdp);
-    if (i != 0) {
-      osip_message_free (invite);
-      osip_free (tmp);
-      return false;
-    }
-    osip_message_set_body (invite, tmp, strlen (tmp));
-    osip_free (tmp);
-    osip_message_set_content_type (invite, "application/sdp");
-  }
-
-  // Send request
-  _debug("< Send off hold request\n");
-  eXosip_lock ();
-  exosipErr = eXosip_call_send_request (did, invite);
-  eXosip_unlock ();
-*/
   // Enable audio
   _debug("* SIP Info: Starting AudioRTP when offhold\n");
   call->setState(Call::Active);
@@ -750,17 +313,7 @@ SIPVoIPLink::transfer(const CallID& id, const std::string& to)
   }
 
   _debug("In transfer, tmp_to is %s\n", tmp_to.data());
-  /*osip_message_t *refer;
-  eXosip_lock();
-  // Build transfer request
-  int exosipErr = eXosip_call_build_refer(call->getDid(), (char*)tmp_to.data(), &refer);
-  if (exosipErr == 0) {
-    // Send transfer request
-    _debug("< SIP send transfer request to %s\n", tmp_to.data());
-    exosipErr = eXosip_call_send_request(call->getDid(), refer);
-  }
-  eXosip_unlock();*/
-  
+
   Manager::instance().getSipManager()->transfer(call, tmp_to);
 
   //_audiortp->closeRtpSession();
@@ -800,12 +353,10 @@ SIPVoIPLink::carryingDTMFdigits(const CallID& id, char code)
   if (call==0) { _debug("Call doesn't exist\n"); return false; }  
 
   int duration = Manager::instance().getConfigInt(SIGNALISATION, PULSE_LENGTH);
-  osip_message_t *info;
-  const int body_len = 1000;
-  int i;
 
-  char *dtmf_body = new char[body_len];
+  // TODO Add DTMF with pjsip - INFO method
 
+  /*
   eXosip_lock();
   // Build info request
   i = eXosip_call_build_info(call->getDid(), &info);
@@ -817,144 +368,22 @@ SIPVoIPLink::carryingDTMFdigits(const CallID& id, char code)
     i = eXosip_call_send_request(call->getDid(), info);
   }
   eXosip_unlock();
-  
-  delete[] dtmf_body; dtmf_body = NULL;
+  */
+
   return true;
 }
 
 bool
 SIPVoIPLink::sendMessage(const std::string& to, const std::string& body)
 {
-  bool returnValue = false;
-
-  // fast return
-  if (body.empty()) {return returnValue; }
-
-  osip_message_t* message = 0;
-  const char* method = "MESSAGE";
-
-  std::string sipFrom = getSipFrom();
-  std::string sipTo   = getSipTo(to);
-  std::string sipRoute = getSipRoute();
-
-  if (!SIPCheckUrl(sipFrom)) {
-    return returnValue;
-  }
-  if (!SIPCheckUrl(sipTo)) {
-    return returnValue;
-  }
-
-  int eXosipError = EXOSIP_ERROR_STD;
-  eXosip_lock();
-  if ( sipRoute.empty() ) {
-    eXosipError = eXosip_message_build_request(&message, method, sipTo.c_str(), sipFrom.c_str(), NULL);
-  } else {
-    eXosipError = eXosip_message_build_request(&message, method, sipTo.c_str(), sipFrom.c_str(), sipRoute.c_str());
-  }
-
-  if (eXosipError == EXOSIP_ERROR_NO) {
-    // add body
-    // add message
-    // src: http://www.atosc.org/pipermail/public/osip/2005-October/006007.html
-    osip_message_set_expires(message, "120");
-    osip_message_set_body(message, body.c_str(), body.length());
-    osip_message_set_content_type(message, "text/plain");
-
-    eXosipError = eXosip_message_send_request(message);
-    if (eXosipError == EXOSIP_ERROR_NO) {
-      // correctly send the message
-      returnValue = true;
-    }
-  }
-  eXosip_unlock();
-  return returnValue;
+    return true;
 }
 
 // NOW
 bool
 SIPVoIPLink::isContactPresenceSupported()
 {
-	return true;
-}
-
-/*
-void
-SIPVoIPLink::subscribePresenceForContact(Contact* contact)
-{
-	osip_message_t* subscription;
-	
-	int i;
-	
-	std::string to   = contact->getUrl().data();
-	std::ostringstream from;
-	
-	// Build URL of sender
-	from << "sip:" << _authname.data() << "@" << getHostName().data();
-
-	// Subscribe for changes on server but also polls at every 5000 interval
-	i = eXosip_subscribe_build_initial_request(&subscription,
-			to.data(),
-			from.str().c_str(),
-			NULL,
-			"presence", 5000);
-	if(i!=0) return;
-	
-	// We want to receive presence in the PIDF XML format in SIP messages
-	osip_message_set_accept(subscription, "application/pidf+xml");
-	
-	// Send subscription
-	eXosip_lock();
-	i = eXosip_subscribe_send_initial_request(subscription);
-	if(i!=0) _debug("Sending of subscription tp %s failed\n", to.data());
-	eXosip_unlock();
-}
-*/
-
-void
-SIPVoIPLink::publishPresenceStatus(std::string status)
-{
-	_debug("Publishing presence status\n");
-	char buf[4096];
-	int i;
-	osip_message_t* publication;
-	
-	std::ostringstream url;
-	std::string basic;
-	std::string note;
-	
-	// Build URL of sender
-	url << "sip:" << _authname.data() << "@" << getHostName().data();
-	
-	// TODO
-	// Call function to convert status in basic and note
-	// tags that are integrated in the publication
-	basic = "open";
-	note = "ready";
-	
-	snprintf(buf, 4096,
-"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
-<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
-          xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
-          entity=\"%s\">\n\
-	<tuple id=\"sg89ae\">\n\
-		<status>\n\
-			<basic>%s</basic>\n\
-			<es:activities>\n\
-				<es:activity>in-transit</es:activity>\n\
-			</es:activities>\n\
-		</status>\n\
-		<contact priority=\"0.8\">%s</contact>\n\
-		<note>%s</note>\n\
-	</tuple>\n\
-</presence>"
-			, url.str().c_str(), basic.data(), url.str().c_str(), note.data());
-	
-	// Build publish request in PIDF
-	i = eXosip_build_publish(&publication, url.str().c_str(), url.str().c_str(), NULL, "presence", "1800", "application/pidf+xml", buf);
-	
-	eXosip_lock();
-	i = eXosip_publish(publication, url.str().c_str());
-	eXosip_unlock();
+    return true;
 }
 
 bool
@@ -990,87 +419,7 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject)
   AccountID accId = getAccountID();
 
   Manager::instance().getSipManager()->makeOutgoingCall(to, call, accId);
-
-  /*osip_message_t *invite;
-  eXosip_lock();
-  int eXosipError = eXosip_call_build_initial_invite (&invite, (char*)to.data(),
-                                        (char*)from.data(),
-                                        (char*)route.data(),
-                                        (char*)subject.data());
-  
-  if (eXosipError != 0) {
-    eXosip_unlock();
-    return false; // error when building the invite
-  }
-
-  
-  std::ostringstream media_audio;
-  std::ostringstream rtpmap_attr;
-  AudioCodecType payload;
-  int nbChannel;
-  int iter;
-
-  // Set rtpmap according to the supported codec order
-  //CodecMap map = call->getCodecMap().getCodecMap();
-  CodecOrder map = call->getCodecMap().getActiveCodecs();
  
-  for(iter=0 ; iter < map.size() ; iter++){
-      if(map[iter] != -1){
-	payload = map[iter];
-        // add each payload in the list of payload
-        media_audio << payload << " ";
-
-        rtpmap_attr << "a=rtpmap:" << payload << " " << 
-        call->getCodecMap().getCodecName(payload) << "/" << call->getCodecMap().getSampleRate(payload);
-
-    	//TODO add channel infos
-        nbChannel = call->getCodecMap().getChannel(payload);
-        if (nbChannel!=1) {
-          rtpmap_attr << "/" << nbChannel;
-        }
-        rtpmap_attr << "\r\n";
-      }
-    // go to next codec
-    //*iter++;
-  }*/
-
-  // http://www.antisip.com/documentation/eXosip2/group__howto1__initialize.html
-  // tell sip if we support SIP extension like 100rel
-  // osip_message_set_supported (invite, "100rel");
-
-  /* add sdp body */
-  /*{
-    char tmp[4096];
-    snprintf (tmp, 4096,
-              "v=0\r\n"
-              "o=SFLphone 0 0 IN IP4 %s\r\n"
-              "s=call\r\n"
-              "c=IN IP4 %s\r\n"
-              "t=0 0\r\n"
-              "m=audio %d RTP/AVP %s\r\n"
-              "%s",
-              _localExternAddress.c_str(), _localExternAddress.c_str(), call->getLocalExternAudioPort(), media_audio.str().c_str(), rtpmap_attr.str().c_str());
-    // media_audio should be one, two or three numbers?
-    osip_message_set_body (invite, tmp, strlen (tmp));
-    osip_message_set_content_type (invite, "application/sdp");
-    _debug("SDP send: %s", tmp);
-  }
-  
-  _debug("> INVITE To <%s>\n", to.data());
-  int cid = eXosip_call_send_initial_invite(invite);
-
-  // Keep the cid in case of cancelling
-  call->setCid(cid);
-
-  if (cid <= 0) {
-    eXosip_unlock();
-    return false ;
-  } else {
-    _debug("* SIP Info: Outgoing callID is %s, cid=%d\n", call->getCallId().data(), cid);
-    eXosip_call_set_reference (cid, NULL);
-  }
-  eXosip_unlock();*/
-
   return true;
 }
 
@@ -1122,22 +471,6 @@ SIPVoIPLink::SIPToHeader(const std::string& to)
 bool
 SIPVoIPLink::SIPCheckUrl(const std::string& url)
 {
-  int i;
-
-  osip_from_t *to;
-  i = osip_from_init(&to);
-  if (i != 0) {
-    _debug("! SIP Warning: Cannot initialize osip parser\n");
-    return false;
-  }
-  i = osip_from_parse(to, url.data());
-  if (i != 0) {
-    _debug("! SIP Warning: Cannot parse url %s\n", url.data());
-    return false;
-  }
-
-  // Free memory
-  osip_from_free (to);
   return true;
 }
 
@@ -1164,143 +497,6 @@ SIPVoIPLink::setCallAudioLocal(SIPCall* call)
   return true;
 }
 
-void
-SIPVoIPLink::SIPCallInvite(eXosip_event_t *event)
-{
-}
-
-void
-SIPVoIPLink::SIPCallReinvite(eXosip_event_t *event)
-{
-  _debug("> REINVITE (receive)\n");
-  SIPCall* call = findSIPCallWithCidDid(event->cid, event->did);
-  if (call == 0) {
-    _debug("! SIP Failure: unknown call\n");
-    _debug("< Send 488 Not Acceptable Here");
-    eXosip_lock();
-    eXosip_call_send_answer(event->tid, 488, NULL);
-    eXosip_unlock();
-    return;
-  }
-  if ( call->getCallId() == Manager::instance().getCurrentCallId()) {
-    // STOP tone
-    Manager::instance().stopTone(true);
-    // STOP old rtp session
-    _debug("* SIP Info: Stopping AudioRTP when reinvite\n");
-    _audiortp->closeRtpSession();
-    call->setAudioStart(false);
-  }
-  call->SIPCallReinvite(event);
-}
-
-void
-SIPVoIPLink::SIPCallRinging(eXosip_event_t *event)
-{
-  
-  SIPCall* call = findSIPCallWithCid(event->cid);
-  if (!call) {
-    _debug("! SIP Failure: unknown call\n");
-    return;
-  }
-  // we could set the cid/did/tid and get the FROM here...
-  // but we found the call with the cid/did already, why setting it again?
-  // call->ringingCall(event);
-  call->setDid(event->did);
-  call->setConnectionState(Call::Ringing);
-  Manager::instance().peerRingingCall(call->getCallId());
-}
-
-void
-SIPVoIPLink::SIPCallAnswered(SIPCall *call, pjsip_rx_data *rdata)
-{
-  //SIPCall* call = dynamic_cast<SIPCall *>(theCall);//findSIPCallWithCid(event->cid);
-  if (!call) {
-    _debug("! SIP Failure: unknown call\n");
-    return;
-  }
-  //call->setDid(event->did);
-
-  if (call->getConnectionState() != Call::Connected) {
-    //call->SIPCallAnswered(event);
-    call->SIPCallAnsweredWithoutHold(rdata);
-
-    call->setConnectionState(Call::Connected);
-    call->setState(Call::Active);
-
-    Manager::instance().peerAnsweredCall(call->getCallId());
-    if (Manager::instance().isCurrentCall(call->getCallId())) {
-      _debug("* SIP Info: Starting AudioRTP when answering\n");
-      if ( _audiortp->createNewSession(call) < 0) {
-        _debug("RTP Failure: unable to create new session\n");
-      } else {
-        call->setAudioStart(true);
-      }
-    }
-  } else {
-     _debug("* SIP Info: Answering call (on/off hold to send ACK)\n");
-     //call->SIPCallAnswered(event);
-  }
-}
-
-void
-SIPVoIPLink::SIPCallRequestFailure(eXosip_event_t *event)
-{
-  if (!event->response) { return; }
-  // 404 error
-  _debug("  Request Failure, receive code %d\n", event->response->status_code);
-  // Handle 4XX errors
-  switch (event->response->status_code) {
-  case SIP_PROXY_AUTHENTICATION_REQUIRED: 
-    _debug("- SIP Action: Server ask required authentification: logging...\n");
-    sendSIPAuthentification();
-    eXosip_lock();
-    eXosip_automatic_action();
-    eXosip_unlock();
-    break;
-  case SIP_UNAUTHORIZED:
-    _debug("- SIP Action: Request is unauthorized. SIP Server ask authentification: logging...\n");
-    sendSIPAuthentification();
-    break;
-
-  case SIP_BUSY_HERE:  // 486
-    {
-      SIPCall* call = findSIPCallWithCid(event->cid);
-      if (call!=0) {
-        CallID& id = call->getCallId();
-        call->setConnectionState(Call::Connected);
-        call->setState(Call::Busy);
-        Manager::instance().callBusy(id);
-        removeCall(id);
-      }
-    }
-    break;
-  case SIP_REQUEST_TERMINATED: // 487
-    break;
-
-  default:
-  /*case SIP_BAD_REQUEST:
-  case SIP_FORBIDDEN:
-  case SIP_NOT_FOUND:
-  case SIP_METHOD_NOT_ALLOWED:
-  case SIP_406_NOT_ACCEPTABLE:
-  case SIP_REQ_TIME_OUT:
-  case SIP_TEMPORARILY_UNAVAILABLE:
-  case SIP_ADDRESS_INCOMPLETE:
-  case SIP_NOT_ACCEPTABLE_HERE: // 488 */
-    // Display error on the screen phone
-    {
-      SIPCall* call = findSIPCallWithCid(event->cid);
-      if (call!=0) {
-        CallID& id = call->getCallId();
-        call->setConnectionState(Call::Connected);
-        call->setState(Call::Error);
-        Manager::instance().callFailure(id);
-        removeCall(id);
-      }
-    }
-  }
-}
-
 void
 SIPVoIPLink::SIPCallServerFailure(SIPCall *call) 
 {
@@ -1320,75 +516,6 @@ SIPVoIPLink::SIPCallServerFailure(SIPCall *call)
   //}
 }
 
-void
-SIPVoIPLink::SIPRegistrationFailure( eXosip_event_t* event )
-{
-  if(!event->response){
-    setRegistrationState(ErrorHost);
-    return ;
-  }
-
-  switch(  event->response->status_code ) {
-    case SIP_FORBIDDEN:
-      _debug("SIP forbidden\n");
-      setRegistrationState(ErrorAuth);
-      break;
-    case SIP_UNAUTHORIZED:
-      _debug("SIP unauthorized\n");
-      setRegistrationState(Error);
-      break;
-    default:
-      setRegistrationState(ErrorAuth);
-      //_debug("Unknown error: %s\n" , event->response->status_code);
-  }
-}
-
-void
-SIPVoIPLink::SIPCallAck(eXosip_event_t *event) 
-{
-  SIPCall* call = findSIPCallWithCidDid(event->cid, event->did);
-  if (!call) { return; }
-  if (!call->isAudioStarted()) {
-    if (Manager::instance().isCurrentCall(call->getCallId())) {
-      _debug("* SIP Info: Starting AudioRTP when ack\n");
-      if ( _audiortp->createNewSession(call) ) {
-        call->setAudioStart(true);
-      }
-    }
-  }
-}
-
-void
-SIPVoIPLink::SIPCallMessageNew(eXosip_event_t *event) 
-{
-  if (0 == event->request) return;
-
-  _debug("  > SIP Event: Receive a call message\n");
-
-  if (MSG_IS_INFO(event->request)) {
-    _debug("* SIP Info: It's a Request Info\n");
-    osip_content_type_t* c_t = event->request->content_type;
-    if (c_t != 0 && c_t->type != 0 && c_t->subtype != 0 ) {
-      _debug("* SIP Info: Content Type of the message: %s/%s\n", c_t->type, c_t->subtype);
-      // application/dtmf-relay
-      if (strcmp(c_t->type, "application") == 0 && strcmp(c_t->subtype, "dtmf-relay") == 0) {
-         handleDtmfRelay(event);
-      }
-    }
-  }
-
-  osip_message_t *answerOKNewMessage;
-  eXosip_lock();
-  if ( 0 == eXosip_call_build_answer(event->tid, SIP_OK, &answerOKNewMessage)) {
-    _debug("< SIP Sending 200 OK\n");
-    eXosip_call_send_answer(event->tid, SIP_OK, answerOKNewMessage);
-  } else {
-    _debug("! SIP Failure: Could not sent an OK message\n");
-  }
-  eXosip_unlock();
-
-}
-
 void
 SIPVoIPLink::SIPCallClosed(SIPCall *call) 
 {
@@ -1425,83 +552,35 @@ SIPVoIPLink::SIPCallReleased(SIPCall *call)
 }
 
 void
-SIPVoIPLink::SIPMessageNew(eXosip_event_t *event)
+SIPVoIPLink::SIPCallAnswered(SIPCall *call, pjsip_rx_data *rdata)
 {
-  if (MSG_IS_OPTIONS(event->request)) {
-    // old handling was
-    // - send 200 OK if call id is not found
-    // - send nothing if call id is found
-    eXosip_lock();
-    eXosip_options_send_answer (event->tid, SIP_OK, NULL);
-    eXosip_unlock();
+  //SIPCall* call = dynamic_cast<SIPCall *>(theCall);//findSIPCallWithCid(event->cid);
+  if (!call) {
+    _debug("! SIP Failure: unknown call\n");
+    return;
   }
-  // Voice message 
-  else if (MSG_IS_NOTIFY(event->request)){
-    int ii;
-    osip_body_t *body = NULL;
-    // Get the message body
-    ii = osip_message_get_body(event->request, 0, &body);
-    if (ii != 0) {
-      _debug("! SIP Error: Cannot get body in a new EXOSIP_MESSAGE_NEW event\n");
-      return;
-    }
+  //call->setDid(event->did);
 
-    // Analyse message body
-    if (!body || !body->body) {
-       return;
-    }
-    std::string str(body->body);
-    std::string::size_type pos;
-    std::string::size_type pos_slash;
-    pos = str.find(VOICE_MSG);
-
-    if (pos == std::string::npos) {
-      // If the string is not found
-      return;
-    } 
-
-    pos_slash = str.find ("/");
-    std::string nb_msg = str.substr(pos + LENGTH_VOICE_MSG, 
-    pos_slash - (pos + LENGTH_VOICE_MSG));
-
-    // Set the number of voice-message
-    int msgVoicemail = atoi(nb_msg.data());
-    _debug("  > NOTIFY ->  %i voice message for account %s\n" , msgVoicemail , getAccountID().c_str());
-
-    if (msgVoicemail != 0) {
-      // If there is at least one voice-message, start notification
-      //Manager::instance().startVoiceMessageNotification(getAccountID(), nb_msg);
-    }
-  // http://www.jdrosen.net/papers/draft-ietf-simple-im-session-00.txt
-  } else if (MSG_IS_MESSAGE(event->request)) {
-    _debug("> MESSAGE received\n");
-    // osip_content_type_t* osip_message::content_type
-    osip_content_type_t* c_t = event->request->content_type;
-    if (c_t != 0 &&  c_t->type != 0 && c_t->subtype != 0 ) {
-      _debug("* SIP Info: Content Type of the message: %s/%s\n", c_t->type, c_t->subtype);
-
-      osip_body_t *body = NULL;
-      // Get the message body
-      if (0 == osip_message_get_body(event->request, 0, &body)) {
-        _debug("* SIP Info: Body length: %d\n", body->length);
-        if (body->body!=0 && 
-            strcmp(c_t->type,"text") == 0 && 
-            strcmp(c_t->subtype,"plain") == 0
-          ) {
-          _debug("* SIP Info: Text body: %s\n", body->body);
-          Manager::instance().incomingMessage(getAccountID(), body->body);
-        }
+  if (call->getConnectionState() != Call::Connected) {
+    //call->SIPCallAnswered(event);
+    call->SIPCallAnsweredWithoutHold(rdata);
+
+    call->setConnectionState(Call::Connected);
+    call->setState(Call::Active);
+
+    Manager::instance().peerAnsweredCall(call->getCallId());
+    if (Manager::instance().isCurrentCall(call->getCallId())) {
+      _debug("* SIP Info: Starting AudioRTP when answering\n");
+      if ( _audiortp->createNewSession(call) < 0) {
+        _debug("RTP Failure: unable to create new session\n");
+      } else {
+        call->setAudioStart(true);
       }
     }
-    osip_message_t *answerOK;
-    eXosip_lock();
-    if ( 0 == eXosip_message_build_answer(event->tid, SIP_OK, &answerOK)) {
-        _debug("< Sending 200 OK\n");
-        eXosip_message_send_answer(event->tid, SIP_OK, answerOK);
-    }
-    eXosip_unlock();
+  } else {
+     _debug("* SIP Info: Answering call (on/off hold to send ACK)\n");
+     //call->SIPCallAnswered(event);
   }
-
 }
 
 SIPCall* 
@@ -1553,7 +632,7 @@ SIPVoIPLink::getSIPCall(const CallID& id)
   }
   return NULL;
 }
-
+/*
 bool
 SIPVoIPLink::handleDtmfRelay(eXosip_event_t* event) {
 
@@ -1588,7 +667,7 @@ SIPVoIPLink::handleDtmfRelay(eXosip_event_t* event) {
           returnValue = true;
         }
       }
-/*
+
  // we receive the duration, but we use our configuration...
 
       posStart = dtmfBody.find("Duration=");
@@ -1602,98 +681,15 @@ SIPVoIPLink::handleDtmfRelay(eXosip_event_t* event) {
         _debug("Duration value: %s\n", duration.c_str());
         returnValue = true;
       }
-*/
+
     }
   }
   return returnValue;
 }
-
+*/
 ///////////////////////////////////////////////////////////////////////////////
 // Private functions
 ///////////////////////////////////////////////////////////////////////////////
-int
-SIPVoIPLink::sdp_hold_call (sdp_message_t * sdp)
-{
-  int pos;
-  int pos_media = -1;
-  char *rcvsnd;
-  int recv_send = -1;
-
-  pos = 0;
-  rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-  while (rcvsnd != NULL) {
-    if (rcvsnd != NULL && 0 == strcmp (rcvsnd, "sendonly")) {
-      recv_send = 0;
-    } else if (rcvsnd != NULL && (0 == strcmp (rcvsnd, "recvonly")
-          || 0 == strcmp (rcvsnd, "sendrecv"))) {
-      recv_send = 0;
-      sprintf (rcvsnd, "sendonly");
-    }
-    pos++;
-    rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-  }
-
-  pos_media = 0;
-  while (!sdp_message_endof_media (sdp, pos_media)) {
-    pos = 0;
-    rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-    while (rcvsnd != NULL) {
-      if (rcvsnd != NULL && 0 == strcmp (rcvsnd, "sendonly")) {
-        recv_send = 0;
-      } else if (rcvsnd != NULL && (0 == strcmp (rcvsnd, "recvonly")
-            || 0 == strcmp (rcvsnd, "sendrecv"))) {
-        recv_send = 0;
-        sprintf (rcvsnd, "sendonly");
-      }
-      pos++;
-      rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-    }
-    pos_media++;
-  }
-
-  if (recv_send == -1) {
-    /* we need to add a global attribute with a field set to "sendonly" */
-    sdp_message_a_attribute_add (sdp, -1, osip_strdup ("sendonly"), NULL);
-  }
-
-  return 0;
-}
-
-int
-SIPVoIPLink::sdp_off_hold_call (sdp_message_t * sdp)
-{
-  int pos;
-  int pos_media = -1;
-  char *rcvsnd;
-
-  pos = 0;
-  rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-  while (rcvsnd != NULL) {
-    if (rcvsnd != NULL && (0 == strcmp (rcvsnd, "sendonly")
-         || 0 == strcmp (rcvsnd, "recvonly"))) {
-      sprintf (rcvsnd, "sendrecv");
-    }
-    pos++;
-    rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-  }
-
-  pos_media = 0;
-  while (!sdp_message_endof_media (sdp, pos_media)) {
-    pos = 0;
-    rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-    while (rcvsnd != NULL) {
-      if (rcvsnd != NULL && (0 == strcmp (rcvsnd, "sendonly")
-           || 0 == strcmp (rcvsnd, "recvonly"))) {
-        sprintf (rcvsnd, "sendrecv");
-      }
-      pos++;
-      rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
-    }
-    pos_media++;
-  }
-
-  return 0;
-}
 
 void SIPVoIPLink::setAuthName(const std::string& authname)
 {
diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h
old mode 100755
new mode 100644
index 6ff0fc81b1feeb13a87170f1184291c932939f7d..265c6366e79c001e66ebbcedd010cb7b07373194
--- a/src/sipvoiplink.h
+++ b/src/sipvoiplink.h
@@ -23,12 +23,18 @@
 
 #include "voiplink.h"
 #include <string>
-#include <eXosip2/eXosip.h>
-#include <osip2/osip_mt.h>
 
-struct pjsip_regc;
-struct pj_str_t;
-struct pjmedia_sdp_session;
+#include <pjsip.h>
+#include <pjlib-util.h>
+#include <pjlib.h>
+#include <pjnath/stun_config.h>
+
+//TODO Remove this include if we don't need anything from it
+#include <pjsip_simple.h>
+
+#include <pjsip_ua.h>
+#include <pjmedia/sdp.h>
+#include <pjmedia/sdp_neg.h>
 
 class EventThread;
 class SIPCall;
@@ -54,10 +60,8 @@ class SIPVoIPLink : public VoIPLink
      */
     ~SIPVoIPLink();
 
-    int eXosip_running;
-
     /** 
-     * Try to initiate the eXosip engine/thread and set config 
+     * Try to initiate the pjsip engine/thread and set config 
      * @return bool True if OK
      */
     bool init(void);
@@ -165,10 +169,6 @@ class SIPVoIPLink : public VoIPLink
 
     bool isContactPresenceSupported();
 
-    //void subscribePresenceForContact(Contact* contact);
-
-    void publishPresenceStatus(std::string status);
-
     // TODO Not used yet
     void sendMessageToContact(const CallID& id, const std::string& message);
 
@@ -214,7 +214,7 @@ class SIPVoIPLink : public VoIPLink
     void terminateSIPCall(); 
 
     /**
-     * Get the local Ip by eXosip 
+     * Get the local Ip  
      * only if the local ip address is to his default value: 127.0.0.1
      * setLocalIpAdress
      * @return bool false if not found
@@ -293,89 +293,33 @@ class SIPVoIPLink : public VoIPLink
      */
     bool setCallAudioLocal(SIPCall* call);
 
-    /**
-     * Create a new call and send a incoming call notification to the user
-     * @param event eXosip Event
-     */
-    void SIPCallInvite(eXosip_event_t *event);
-
-    /**
-     * Use a exisiting call to restart the audio
-     * @param event eXosip Event
-     */
-    void SIPCallReinvite(eXosip_event_t *event);
-
-    /**
-     * Tell the user that the call is ringing
-     * @param event eXosip Event
-     */
-    void SIPCallRinging(eXosip_event_t *event);
-
     /**
      * Tell the user that the call was answered
-     * @param event eXosip Event
+     * @param
      */
-    void SIPCallAnswered(eXosip_event_t *event);
     void SIPCallAnswered(SIPCall *call, pjsip_rx_data *rdata);
     
-    /**
-     * Handling 4XX error
-     * @param event eXosip Event
-     */
-    void SIPCallRequestFailure(eXosip_event_t *event);
-
     /**
      * Handling 5XX/6XX error
-     * @param event eXosip Event
+     * @param 
      */
     void SIPCallServerFailure(SIPCall *call);
 
-    /**
-     * Handle registration failure cases ( SIP_FORBIDDEN , SIP_UNAUTHORIZED )
-     * @param event eXosip event
-     */
-    void SIPRegistrationFailure( eXosip_event_t *event );
-
-    /**
-     * Handling ack (restart audio if reinvite)
-     * @param event eXosip Event
-     */
-    void SIPCallAck(eXosip_event_t *event);
-
-    /**
-     * Handling message inside a call (like dtmf)
-     * @param event eXosip Event
-     */
-    void SIPCallMessageNew(eXosip_event_t *event);
-
-    /**
-     * Handle an INFO with application/dtmf-relay content-type
-     * @param event eXosip Event
-     */
-    bool handleDtmfRelay(eXosip_event_t *event);
-
     /**
      * Peer close the connection
-     * @param event eXosip Event
+     * @param
      */
     void SIPCallClosed(SIPCall *call);
 
     /**
      * The call pointer was released
      * If the call was not cleared before, report an error
-     * @param event eXosip Event
+     * @param
      */
     void SIPCallReleased(SIPCall *call);
 
     /**
-     * Receive a new Message request
-     * Option/Notify/Message
-     * @param event eXosip Event
-     */
-    void SIPMessageNew(eXosip_event_t *event);
-
-    /**
-     * Find a SIPCall with cid from eXosip Event
+     * Find a SIPCall with cid
      * Explication there is no DID when the dialog is not establish...
      * @param cid call ID
      * @return SIPCall*	SIPCall pointer or 0
@@ -383,7 +327,7 @@ class SIPVoIPLink : public VoIPLink
     SIPCall* findSIPCallWithCid(int cid);
 
     /**
-     * Find a SIPCall with cid and did from eXosip Event
+     * Find a SIPCall with cid and did
      * @param cid call ID
      * @param did domain ID
      * @return SIPCall*	SIPCall pointer or 0
@@ -397,24 +341,9 @@ class SIPVoIPLink : public VoIPLink
      */
     SIPCall* getSIPCall(const CallID& id);
 
-    /** To build sdp when call is on-hold */
-    int sdp_hold_call (sdp_message_t * sdp);
-
-    /** To build sdp when call is off-hold */
-    int sdp_off_hold_call (sdp_message_t * sdp);
-    
-    /** EventThread get every incoming events */
-    EventThread* _evThread;
-
-    /** Tell if eXosip was stared (eXosip_init) */
+    /** Tell if the initialisation was done */
     bool _initDone;
 
-    /** Registration identifier, needed by unregister to build message */
-    int _eXosipRegID;
-
-    /** Number of voicemail */
-    int _nMsgVoicemail;
-
     /** when we init the listener, how many times we try to bind a port? */
     int _nbTryListenAddr;
 
diff --git a/src/voiplink.h b/src/voiplink.h
index be69aaefbf3e520679b037a10828464c141432e2..c260cdee4ae8787f88935272e8628e59e73cfd9c 100644
--- a/src/voiplink.h
+++ b/src/voiplink.h
@@ -66,7 +66,7 @@ class VoIPLink {
 
     /** 
      * Virtual method
-     * Try to initiate the eXosip engine/thread and set config 
+     * Try to initiate the pjsip engine/thread and set config 
      * @return bool True if OK
      */
     virtual bool init (void) = 0;