diff --git a/.gitignore b/.gitignore
index 1525a6ecc1d335a1aa6d7c53c7d1ffb691544c8f..7fe1d65caaba9365f636aa817de17497b3886575 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,6 +98,8 @@ sflphone-gtk/pixmaps/Makefile
 /sflphone-gtk/src/sflphone-gtk
 /sflphone-gtk/autom4te*
 /sflphone-gtk/sflphone.desktop
+/sflphone-gtk/confdefs.h
+/sflphone-gtk/conftest.dir
 
 # Ignore sub-modules stuff
 ## libiax2
diff --git a/configure.ac b/configure.ac
index 988fc35e537e21c1680ba68c5e02b282227e57d0..fae72a0707c0e75f534310554c75aa8814171e09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,6 +150,12 @@ if test "x${have_libpj}" = "xfalse" ; then
 fi
 AC_SUBST(SIP_CFLAGS)
 
+dnl Check for uuid development package - name: uuid-dev 
+UUID_MIN_VERSION=1.0
+PKG_CHECK_MODULES(UUID, uuid >= ${UUID_MIN_VERSION})
+AC_SUBST(UUID_CFLAGS)
+AC_SUBST(UUID_LIBS)
+
 dnl Check for alsa development package - name: libasound2-dev 
 LIBASOUND2_MIN_VERSION=1.0
 PKG_CHECK_MODULES(ALSA, alsa >= ${LIBASOUND2_MIN_VERSION})
@@ -188,18 +194,11 @@ PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1 >= ${LIBDBUSCPP_MIN_VERSION})
 AC_SUBST(DBUSCPP_LIBS)
 AC_SUBST(DBUSCPP_CFLAGS)
 
-LIBOPENSSL_MIN_VERSION=0.9.8
-PKG_CHECK_MODULES(LIBOPENSSL, libssl >= ${LIBOPENSSL_MIN_VERSION})
-AC_SUBST(LIBOPENSSL_LIBS)
-AC_SUBST(LIBOPENSSL_CFLAGS)
-
 dnl Check for libcppunit-dev
 CPPUNIT_MIN_VERSION=1.12
 PKG_CHECK_MODULES(CPPUNIT, cppunit >= ${CPPUNIT_MIN_VERSION})
 AC_SUBST(CPPUNIT_LIBS)
 
-LIBSSL_MIN_VERSION=0.9.8
-
 # check for libgsm1 (doesn't use pkg-config)
 dnl Check for libgsm
 AC_ARG_WITH([gsm],
@@ -270,14 +269,14 @@ AC_ARG_WITH([iax2],
 
 LIBIAX2=
 AS_IF([test "x$with_iax2" != xno],
-  [AC_CHECK_LIB([iax2], [iax_init],
+    [AC_CHECK_HEADER([iax2/iax.h], , AC_MSG_FAILURE([Unable to find the libiax2 headers. You may need to install sflphone-iax2-dev package. You may use --without-iax2 to compile without iax2 protocol support.]))]
+    [AC_CHECK_LIB([iax2], [iax_init],
     [],
     [AC_MSG_FAILURE(
-       [libiax2 link test failed. You need the sflphone-iax2 package.  You may use --without-iax2 to compile without iax2 protocol support.])]
+       [libiax2 link test failed. You may use --without-iax2 to compile without iax2 protocol support.])]
        )
-   ]
-  [AC_CHECK_HEADER([iax2/iax.h], , AC_MSG_FAILURE([Unable to find the libiax2 headers. You may need to install sflphone-iax2-dev package. You may use --without-iax2 to compile without iax2 protocol support.]))]
-   )
+    ]
+)
     
 AC_DEFINE([HAVE_IAX], test "x$with_iax2" = "xyes", [Define if you have libiax2])
 AM_CONDITIONAL(USE_IAX, test "x$with_iax2" = "xyes" )
diff --git a/debian/control.intrepid b/debian/control.intrepid
index efcff9811b55723f4e4cf5e7ea66d40fd9a1a374..737fc36b64c051d0cbee4f8b4dff548f014d2234 100644
--- a/debian/control.intrepid
+++ b/debian/control.intrepid
@@ -2,7 +2,7 @@ Source: sflphone
 Maintainer: SavoirFaireLinux Inc <emmanuel.milou@savoirfairelinux.com>
 Section: gnome
 Priority: optional
-Build-Depends: debhelper (>= 5), autoconf, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev
+Build-Depends: debhelper (>= 5), autoconf, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev, uuid-dev
 Standards-Version: 3.8.0
 
 Package: sflphone
diff --git a/debian/control.jaunty b/debian/control.jaunty
index e1d859266bfa82acbb19c706427ce25bd8f3680f..b88584932302734a1bd1de6494b94d9040584f73 100644
--- a/debian/control.jaunty
+++ b/debian/control.jaunty
@@ -2,7 +2,7 @@ Source: sflphone
 Maintainer: SavoirFaireLinux Inc <emmanuel.milou@savoirfairelinux.com>
 Section: gnome
 Priority: optional
-Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev
+Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev, uuid-dev
 Standards-Version: 3.7.3
 
 Package: sflphone
diff --git a/libs/libiax2/iax2-config.in b/libs/libiax2/iax2-config.in
index 360b79f6d7b96c8b485d6a07e13d8e04b962bd4d..295e69a97b706bb34ce8a97b870708222643fc55 100644
--- a/libs/libiax2/iax2-config.in
+++ b/libs/libiax2/iax2-config.in
@@ -1,11 +1,11 @@
 #!/bin/sh
-iax_libs="-L/usr/lib -liax2"
-iax_cflags=""
-
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 exec_prefix_set=no
 
+iax_libs="-L$prefix -liax2"
+iax_cflags=""
+
 usage="\
 Usage: iax2-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]"
 
diff --git a/po/fr.po b/po/fr.po
index 95c7c9f0c8cc68fe42ac5ecc15363a152692c706..0d95e0cefa7ea67399ed6961240c2d8afd0e9365 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -45,7 +45,7 @@ msgstr "Réseau non trouvé"
 
 #: ../sflphone-gtk/src/accountlist.c:176
 msgid "Host unreachable"
-msgstr "_Serveur introuvable"
+msgstr "Serveur introuvable"
 
 #: ../sflphone-gtk/src/accountlist.c:179
 msgid "Stun configuration error"
diff --git a/sflphone-gtk/pixmaps/Makefile.am b/sflphone-gtk/pixmaps/Makefile.am
index 9a2a423f663b9d0f42807b366af692eceb72089b..ad647489534e07fd5adbab90ac802d96b0d8b52e 100644
--- a/sflphone-gtk/pixmaps/Makefile.am
+++ b/sflphone-gtk/pixmaps/Makefile.am
@@ -2,6 +2,6 @@ icondir   = $(datadir)/pixmaps
 
 icon_DATA = sflphone.png
 
-buttons_DATA = accept.svg current.svg transfert.svg hang_up.svg hold.svg unhold.svg refuse.svg call.svg ring.svg dial.svg mic.svg mic_25.svg mic_50.svg mic_75.svg speaker.svg speaker_25.svg speaker_50.svg speaker_75.svg fail.svg incoming.svg outgoing.svg missed.svg mailbox.svg busy.svg icon_accept.svg icon_hold.svg icon_unhold.svg icon_hangup.svg icon_call.svg icon_dialpad.svg icon_volume.svg icon_dialpad_off.svg icon_volume_off.svg history.svg history2.svg sflphone.png stock_person.svg icon_rec.svg rec_call.svg addressbook.svg contact_default.svg face-monkey.svg users.svg home.svg
+buttons_DATA = accept.svg current.svg transfert.svg hang_up.svg hold.svg unhold.svg refuse.svg call.svg ring.svg dial.svg mic.svg mic_25.svg mic_50.svg mic_75.svg speaker.svg speaker_25.svg speaker_50.svg speaker_75.svg fail.svg incoming.svg outgoing.svg missed.svg mailbox.svg busy.svg icon_accept.svg icon_hold.svg icon_unhold.svg icon_hangup.svg icon_call.svg icon_dialpad.svg icon_volume.svg icon_dialpad_off.svg icon_volume_off.svg history.svg history2.svg sflphone.png stock_person.svg icon_rec.svg rec_call.svg addressbook.svg contact_default.svg face-monkey.svg users.svg home.svg wait-on.gif wait-off.gif
 buttonsdir   = $(datadir)/sflphone
 EXTRA_DIST   = $(buttons_DATA) $(icon_DATA)
diff --git a/sflphone-gtk/pixmaps/wait-off.gif b/sflphone-gtk/pixmaps/wait-off.gif
new file mode 100644
index 0000000000000000000000000000000000000000..14d50e9fac6d8611ff87922a7af51a9065e5d710
Binary files /dev/null and b/sflphone-gtk/pixmaps/wait-off.gif differ
diff --git a/sflphone-gtk/pixmaps/wait-on.gif b/sflphone-gtk/pixmaps/wait-on.gif
new file mode 100644
index 0000000000000000000000000000000000000000..1c72ebb554be018511ae972c3f2361dff02dce02
Binary files /dev/null and b/sflphone-gtk/pixmaps/wait-on.gif differ
diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c
index f1882c2364aa3a1d8672cb74951fa7fb4565ceab..4e850958329d331bf6b2c030b496f1a8a426a722 100644
--- a/sflphone-gtk/src/actions.c
+++ b/sflphone-gtk/src/actions.c
@@ -230,10 +230,11 @@ gboolean sflphone_init()
     else
     {
         dbus_register(getpid(), "Gtk+ Client");
-        current_calls = calltab_init();
-        history = calltab_init();
-        contacts = calltab_init();
-        //if(SHOW_SEARCHBAR)  histfilter = create_filter(GTK_TREE_MODEL(history->store));
+        current_calls = calltab_init(NULL);
+        // history = calltab_init("history");
+        contacts = calltab_init("contacts");
+        history = calltab_init("history");
+        histfilter = create_filter(GTK_TREE_MODEL(history->store));
         init();
         account_list_init ();
         codec_list_init();
@@ -295,6 +296,7 @@ sflphone_hang_up()
     void
 sflphone_pick_up()
 {
+  
     call_t * selectedCall = call_get_selected(active_calltree);
     if(selectedCall)
     {
@@ -373,7 +375,6 @@ sflphone_off_hold ()
         g_print("Currently recording! \n");
     else
         g_print("Not recording currently \n");
-    
 }
 
 
@@ -529,7 +530,7 @@ process_dialing(call_t * c, guint keyval, gchar * key)
     call_t *
 sflphone_new_call()
 {
-
+    
     call_t *c;
     gchar *from, *to;
 
@@ -680,10 +681,11 @@ sflphone_keypad( guint keyval, gchar * key)
 sflphone_place_call ( call_t * c )
 {
 
+
     if(c->state == CALL_STATE_DIALING && strcmp(c->to, "") != 0)
     {
-    
-        format_phone_number (&c->to); 
+        
+        //format_phone_number (&c->to); 
         
         if( account_list_get_size() == 0 )
         {
@@ -699,19 +701,23 @@ sflphone_place_call ( call_t * c )
 
         else
         {
+             
+            
             account_t * current;
 
-            if(c->accountID != 0)
+            if(g_strcasecmp(c->accountID, "") != 0) {
                 current = account_list_get_by_id(c->accountID);
-            else
+            } else {
                 current = account_list_get_current();
-
+            }
             // printf("sflphone_place_call :: c->accountID : %i \n",c->accountID);
 
             // account_t * current = c->accountID;
-
+            
+            
             if( current )
             {
+                
                 if(g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0)
                 {
                     // OK, everything alright - the call is made with the current account
@@ -734,6 +740,7 @@ sflphone_place_call ( call_t * c )
             }
             else
             {
+   
                 // No current accounts have been setup.
                 // So we place a call with the first registered account
                 // and we change the current account
@@ -756,6 +763,7 @@ sflphone_place_call ( call_t * c )
     void
 sflphone_display_selected_codec (const gchar* codecName)
 {
+  
     call_t * selectedCall = call_get_selected(current_calls);
     gchar* msg;
     account_t* acc;
@@ -872,6 +880,4 @@ void format_phone_number (gchar **number) {
     _number = *number;
 
     //strip_spaces (&_number);
-    
-
 }
diff --git a/sflphone-gtk/src/calllist.h b/sflphone-gtk/src/calllist.h
index bfd773263bc7bf227f8341f15878723092b3ffd6..a4f63806eba764779f2b7646027b7e2b116d7cb3 100644
--- a/sflphone-gtk/src/calllist.h
+++ b/sflphone-gtk/src/calllist.h
@@ -119,6 +119,9 @@ typedef struct {
 	GtkWidget* view;
 	GtkWidget* tree;
 
+        GtkWidget* searchbar;
+        // GtkTreeModel* histfilter;
+
 	// Calllist vars
 	GQueue* callQueue;
 	call_t* selectedCall;
diff --git a/sflphone-gtk/src/calltab.c b/sflphone-gtk/src/calltab.c
index 1ec9a9a95d357d03fa90fc93a8729924d0a6b020..8ed40db848251de1bc8b5fc8a4a9c94c07685649 100644
--- a/sflphone-gtk/src/calltab.c
+++ b/sflphone-gtk/src/calltab.c
@@ -24,7 +24,7 @@
 #include <calltab.h>
 
 calltab_t*
-calltab_init()
+calltab_init(gchar* searchbar_type)
 {
 	calltab_t* ret;
 
@@ -33,11 +33,14 @@ calltab_init()
 	ret->store = NULL;
 	ret->view = NULL;
 	ret->tree = NULL;
+        ret->searchbar = NULL;
 	ret->callQueue = NULL;
 	ret->selectedCall = NULL;
+        // ret->histfilter = NULL;
 
-	create_call_tree(ret);
+	create_call_tree(ret, searchbar_type);
 	call_list_init(ret);
 
+
 	return ret;
 }
diff --git a/sflphone-gtk/src/calltab.h b/sflphone-gtk/src/calltab.h
index d3b85ca977f85f159ae9e13dafb44d1a25f09d9b..4438d3d8fcb2810be0948c3a4f0144f0698edc71 100644
--- a/sflphone-gtk/src/calltab.h
+++ b/sflphone-gtk/src/calltab.h
@@ -23,8 +23,8 @@
 #include <calllist.h>
 #include <gtk/gtk.h>
 
-//GtkTreeModel* histfilter;
+GtkTreeModel* histfilter;
 
-calltab_t* calltab_init();
+calltab_t* calltab_init(gchar* searchbar_type);
 
 #endif
diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c
index f0f1fdfdeca03d9fb872b338d7771a7d57edfc3a..ab6cbfa05cc68149bd19ebc4d2a737e61d6fe65c 100644
--- a/sflphone-gtk/src/calltree.c
+++ b/sflphone-gtk/src/calltree.c
@@ -25,6 +25,7 @@
 #include <actions.h>
 #include <calltree.h>
 #include <calllist.h>
+#include <calltab.h>
 #include <menus.h>
 #include <dbus.h>
 #include <contactlist/eds.h>
@@ -95,6 +96,7 @@ button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data UNUS
   static void
 call_button( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 {
+  g_print("------ call_button ----- \n");
   call_t * selectedCall;
   call_t* new_call;
   gchar *to, *from;
@@ -377,6 +379,7 @@ toolbar_update_buttons ()
   static void
 selected(GtkTreeSelection *sel, void* data UNUSED )
 {
+  g_print("---- selected --- \n");
   GtkTreeIter  iter;
   GValue val;
   GtkTreeModel *model = (GtkTreeModel*)active_calltree->store;
@@ -604,7 +607,7 @@ reset_call_tree (calltab_t* tab)
 }
 
   void
-create_call_tree (calltab_t* tab)
+  create_call_tree (calltab_t* tab, gchar* searchbar_type)
 {
   GtkWidget *sw;
   GtkCellRenderer *rend;
@@ -665,13 +668,24 @@ create_call_tree (calltab_t* tab)
       NULL);
 
   gtk_box_pack_start(GTK_BOX(tab->tree), sw, TRUE, TRUE, 0);
+ 
+  // no search bar if tab is either "history" or "addressbook"
+  if(searchbar_type){
+      create_searchbar(tab,searchbar_type);
+      gtk_box_pack_start(GTK_BOX(tab->tree), tab->searchbar, FALSE, TRUE, 0);
+  }
 
   gtk_widget_show(tab->tree);
 
+
+  // gtk_widget_show(tab->searchbar);
+
   //toolbar_update_buttons();
 
 }
 
+
+
   void
 update_call_tree_remove (calltab_t* tab, call_t * c)
 {
@@ -826,6 +840,21 @@ update_call_tree (calltab_t* tab, call_t * c)
   toolbar_update_buttons();
 }
 
+void
+create_searchbar(calltab_t* tab, gchar* searchbar_type)
+{
+  // g_strcmp0 returns 0 if str1 == str2
+  if(g_strcmp0(searchbar_type,"history") == 0){      
+
+      tab->searchbar = create_filter_entry_history();
+
+  }
+
+  else if(g_strcmp0(searchbar_type,"contacts") == 0)
+      tab->searchbar = create_filter_entry_contact();
+
+}
+
   void
 update_call_tree_add (calltab_t* tab, call_t * c)
 {
diff --git a/sflphone-gtk/src/calltree.h b/sflphone-gtk/src/calltree.h
index f307116040084dc7f11aaca0681bf7feb7e41b9c..dd1de4d91a467c2f919f84376b53586e1e6462d6 100644
--- a/sflphone-gtk/src/calltree.h
+++ b/sflphone-gtk/src/calltree.h
@@ -31,7 +31,8 @@
   * @brief The GtkTreeView that list calls in the main window.
   */
 
-GtkWidget * filter_entry;
+GtkWidget * filter_entry_contact;
+GtkWidget * filter_entry_history;
 
 calltab_t* active_calltree;
 
@@ -41,7 +42,7 @@ void free_call_t (call_t *c);
  * Create a new widget calltree
  * @return GtkWidget* A new widget
  */
-void create_call_tree(calltab_t* tab);
+void create_call_tree(calltab_t* tab, gchar* searchbar_type);
 
 /**
  * Update the toolbar's buttons state, according to the call state
@@ -73,8 +74,14 @@ void reset_call_tree (calltab_t* tab);
  */
 GtkWidget * create_toolbar();
 
+GtkWidget * create_filter_entry();
+
+GtkTreeModel * create_filter (GtkTreeModel* child);
+
 void display_calltree (calltab_t *tab);
 
+void create_searchbar(calltab_t* tab, gchar* searchbar_type);
+
 void create_new_entry_in_contactlist (gchar *contact_name, gchar *contact_phone, contact_type_t type, GdkPixbuf *photo);
 
 #endif
diff --git a/sflphone-gtk/src/configwindow.c b/sflphone-gtk/src/configwindow.c
index 43bb009ea6c9f42be31192e6a8813c83093c6c53..60e6787c828aa7f6a901a387673c170fed5baaac 100644
--- a/sflphone-gtk/src/configwindow.c
+++ b/sflphone-gtk/src/configwindow.c
@@ -480,7 +480,7 @@ void update_registration( void )
 GtkWidget* create_stun_tab()
 {
     GtkWidget * tableNat;
-    gchar * stun_server= "stun.fwdnet.net:3478";
+    gchar * stun_server= "stun.ekiga.net:3478";
     gchar * stun_enabled = "FALSE";
     GtkWidget * label;
 
diff --git a/sflphone-gtk/src/contactlist/eds.c b/sflphone-gtk/src/contactlist/eds.c
index 6071f27e96b2828284c850c8ffd05cabbff94cef..6444a6ca2a6edb15610484d999392e1a2bbdaddf 100644
--- a/sflphone-gtk/src/contactlist/eds.c
+++ b/sflphone-gtk/src/contactlist/eds.c
@@ -31,6 +31,7 @@
 #include "eds.h"
 
 typedef struct _Handler_And_Data {
+    int                 search_id;
     SearchAsyncHandler  handler;
     gpointer            user_data;
     GList              *hits;
@@ -95,6 +96,7 @@ create_query (const char* s)
     GArray *parts = split_query_string (s);
     EBookQuery ***field_queries;
     EBookQuery **q;
+    EBookQuery **phone;
     guint j;
     int i;
 
@@ -110,13 +112,19 @@ create_query (const char* s)
     }
     g_array_free (parts, TRUE);
 
-    query = e_book_query_or (n_search_fields, q, TRUE);
+    phone = g_new0 (EBookQuery *, 3);
+    phone[0] = e_book_query_field_exists (E_CONTACT_PHONE_BUSINESS);
+    phone[1] = e_book_query_field_exists (E_CONTACT_PHONE_HOME);
+    phone[2] = e_book_query_field_exists (E_CONTACT_PHONE_MOBILE);
+
+    query = e_book_query_andv (e_book_query_or (n_search_fields, q, FALSE), e_book_query_or (3, phone, FALSE));
 
     for (i = 0; i < n_search_fields; i++) {
         g_free (field_queries[i]);
     }
     g_free (field_queries);
     g_free (q);
+    g_free (phone);
 
     return query;
 }
@@ -188,30 +196,66 @@ init (void)
         }
     }
 
+    current_search_id = 0;
+
     g_object_unref (source_list);
 }
 
+/**
+ * Final callback after all books have been processed.
+ */
     static void
 view_finish (EBookView *book_view, Handler_And_Data *had)
 {
+    GList *i;
     SearchAsyncHandler had_handler = had->handler;
     GList *had_hits = had->hits;
     gpointer had_user_data = had->user_data;
+    int search_id = had->search_id;
     g_free (had);
 
     g_return_if_fail (book_view != NULL);
     g_object_unref (book_view);
 
-    had_handler (had_hits, had_user_data);
+    if(search_id == current_search_id)
+    {
+      // Reinitialize search id to prevent overflow
+      if(current_search_id > 5000)
+        current_search_id = 0;
+
+      // Call display callback
+      had_handler (had_hits, had_user_data);
+    }
+    else
+    {
+      // Some hits could have been processed but will not be used
+      for (i = had_hits; i != NULL; i = i->next)
+      {
+          Hit *entry;
+          entry = i->data;
+          free_hit(entry);
+      }
+      g_list_free(had_hits);
+    }
 }
 
+/**
+ * Callback called after each ebook search completed.
+ * Used to store book search results.
+ */
     static void
 view_contacts_added_cb (EBookView *book_view, GList *contacts, gpointer user_data)
 {
-    
     GdkPixbuf *photo;
 
     Handler_And_Data *had = (Handler_And_Data *) user_data;
+
+    if(had->search_id != current_search_id)
+    {
+      e_book_view_stop (book_view);
+      return;
+    }
+
     if (had->max_results_remaining <= 0) {
         e_book_view_stop (book_view);
         had->book_views_remaining--;
@@ -261,6 +305,10 @@ view_contacts_added_cb (EBookView *book_view, GList *contacts, gpointer user_dat
     }
 }
 
+/**
+ * Callback called after each ebook search completed.
+ * Used to call final callback when all books have been read.
+ */
     static void
 view_completed_cb (EBookView *book_view, EBookViewStatus status, gpointer user_data)
 {
@@ -271,17 +319,30 @@ view_completed_cb (EBookView *book_view, EBookViewStatus status, gpointer user_d
     }
 }
 
+
     void
 search_async (const char         *query,
         int                 max_results,
         SearchAsyncHandler  handler,
         gpointer            user_data)
 {
-    GSList *iter;
+    // Increment search id
+    current_search_id++;
 
-    EBookQuery* book_query = create_query (query);
+    // If query is null
+    if(strlen(query) < 1)
+    {
+      // If data displayed (from previous search), directly call callback
+      handler(NULL, user_data);
 
+      return;
+    }
+
+    GSList *iter;
+    EBookQuery* book_query = create_query (query);
     Handler_And_Data *had = g_new (Handler_And_Data, 1);
+
+    had->search_id = current_search_id;
     had->handler = handler;
     had->user_data = user_data;
     had->hits = NULL;
diff --git a/sflphone-gtk/src/contactlist/eds.h b/sflphone-gtk/src/contactlist/eds.h
index c0e411dc797f7be5edee7a6f0cfd7be84627b49c..64d464e04f70c044111d2ba898e37993a5f5da2f 100644
--- a/sflphone-gtk/src/contactlist/eds.h
+++ b/sflphone-gtk/src/contactlist/eds.h
@@ -35,8 +35,10 @@
 
 G_BEGIN_DECLS
 
+int current_search_id;
+
 /**
- * Reprsent a contact entry 
+ * Reprsent a contact entry
  */
 typedef struct _Hit
 {
@@ -48,7 +50,7 @@ typedef struct _Hit
 } Hit;
 
 /**
- * Free a contact entry 
+ * Free a contact entry
  */
 void free_hit (Hit *h);
 
diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c
index 2af40dcd06fee84db517b95c3c9c3a5cef28ab79..580c50dc284d0cef71ad5358ea7549f5f61be4f7 100644
--- a/sflphone-gtk/src/dbus.c
+++ b/sflphone-gtk/src/dbus.c
@@ -1138,7 +1138,7 @@ dbus_get_is_recording(const call_t * c)
 	    {
 		    g_error_free(error);
 	    }
-            g_print("RECORDING: %i \n",isRecording);
+            //g_print("RECORDING: %i \n",isRecording);
             return isRecording;
 }
 
diff --git a/sflphone-gtk/src/mainwindow.c b/sflphone-gtk/src/mainwindow.c
index 02d274ceeaace8181fd2ab4c1e8918707054f69e..595d3fea889f5104df2c52e21cb3068d13fd6a37 100644
--- a/sflphone-gtk/src/mainwindow.c
+++ b/sflphone-gtk/src/mainwindow.c
@@ -135,13 +135,19 @@ create_main_window ()
   gtk_box_pack_start (GTK_BOX (vbox), history->tree, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
   gtk_box_pack_start (GTK_BOX (vbox), contacts->tree, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
 
+  // gtk_box_pack_start (GTK_BOX (vbox), current_calls->searchbar, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
+  // gtk_box_pack_start (GTK_BOX (vbox), history->searchbar, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
+  // gtk_box_pack_start (GTK_BOX (vbox), contacts ->searchbar, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
+
   gtk_box_pack_start (GTK_BOX (vbox), subvbox, FALSE /*expand*/, FALSE /*fill*/, 0 /*padding*/);
 
-  if( SHOW_SEARCHBAR ){
-    filterEntry = create_filter_entry();
-    gtk_box_pack_start (GTK_BOX (subvbox), filterEntry, FALSE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
-    gtk_widget_show_all ( filterEntry );
-  }
+  
+  // if( SHOW_SEARCHBAR ){
+  //   filterEntry = create_filter_entry();
+  //   gtk_box_pack_start (GTK_BOX (subvbox), filterEntry, FALSE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
+  //   gtk_widget_show_all ( filterEntry );
+  // }
+  
 
  if( SHOW_VOLUME ){
     speaker_control = create_slider("speaker");
@@ -172,7 +178,7 @@ create_main_window ()
   /* dont't show the contact list */
   gtk_widget_hide(contacts->tree);
 
-  //gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter));
+  gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter));
   // Configuration wizard
   if (account_list_get_size() == 0)
   {
@@ -277,15 +283,15 @@ void
 main_window_searchbar( gboolean *state ){
   if( !SHOW_SEARCHBAR )
   {
-    filterEntry = create_filter_entry();
-    gtk_box_pack_start (GTK_BOX (subvbox), filterEntry, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
-    gtk_widget_show_all (filterEntry);
-    *state = TRUE;
+    // filterEntry = create_filter_entry();
+    // gtk_box_pack_start (GTK_BOX (subvbox), filterEntry, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
+    // gtk_widget_show_all (filterEntry);
+    // *state = TRUE;
   }
   else
   {
-    gtk_container_remove( GTK_CONTAINER(subvbox) , filterEntry );
-    *state = FALSE;
+    // gtk_container_remove( GTK_CONTAINER(subvbox) , filterEntry );
+    // *state = FALSE;
   }
 }
 
diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c
index e32bb3e7da16d2633925f61afde33bae05f665f8..fa9f1c0848fb4486a9ea7b063414b16f0edcc242 100644
--- a/sflphone-gtk/src/menus.c
+++ b/sflphone-gtk/src/menus.c
@@ -120,6 +120,7 @@ help_about ( void * foo UNUSED)
     "Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>", 
     "Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>",
     "Yun Liu <yun.liu@savoirfairelinux.com>"
+    "Alexandre Savard <alexandre.savard@savoirfairelinux.com>",
     "Jean-Philippe Barrette-LaPierre",
     "Laurielle Lea",
     NULL};
@@ -324,7 +325,7 @@ create_call_menu()
       NULL);
   gtk_widget_show (menu_items);
 
-  image = gtk_tool_button_new_from_stock (GTK_STOCK_MEDIA_RECORD);
+  image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_RECORD, GTK_ICON_SIZE_MENU);
   recordMenu = gtk_image_menu_item_new_with_mnemonic(_("_Record"));
   gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( recordMenu ), image );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), recordMenu);
@@ -812,7 +813,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
    if(record)
   {
     menu_items = gtk_image_menu_item_new_with_mnemonic(_("_Record"));
-    image = gtk_tool_button_new_from_stock (GTK_STOCK_MEDIA_RECORD);
+    image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_RECORD, GTK_ICON_SIZE_MENU);
     gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_items), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
     g_signal_connect (G_OBJECT (menu_items), "activate",
diff --git a/sflphone-gtk/src/searchfilter.c b/sflphone-gtk/src/searchfilter.c
index 4df4b3d49f18798b8bd919cd8c5b5e4865229cac..3c1992802088ed6285a3faee81a49586b9ce5b32 100644
--- a/sflphone-gtk/src/searchfilter.c
+++ b/sflphone-gtk/src/searchfilter.c
@@ -31,7 +31,7 @@ static void handler_async_search (GList *hits, gpointer user_data UNUSED);
 GtkTreeModel* create_filter (GtkTreeModel* child) {
 
     GtkTreeModel* ret;
-    
+
     ret = gtk_tree_model_filter_new(child, NULL);
     gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(ret), is_visible, NULL, NULL);
     return GTK_TREE_MODEL(ret);
@@ -45,7 +45,7 @@ gboolean is_visible (GtkTreeModel* model, GtkTreeIter* iter, gpointer data UNUSE
         GValue val;
 
         gchar* text = NULL;
-        gchar* search = (gchar*)gtk_entry_get_text(GTK_ENTRY(filter_entry));
+        gchar* search = (gchar*)gtk_entry_get_text(GTK_ENTRY(filter_entry_history));
         memset (&val, 0, sizeof(val));
         gtk_tree_model_get_value(GTK_TREE_MODEL(model), iter, 1, &val);
         if(G_VALUE_HOLDS_STRING(&val)){
@@ -76,7 +76,7 @@ static void handler_async_search (GList *hits, gpointer user_data) {
 
     // Retrieve the address book parameters
     addressbook_config = (AddressBook_Config*) user_data;
-        
+
     // reset previous results
     reset_call_tree(contacts);
     call_list_reset(contacts);
@@ -104,23 +104,29 @@ static void handler_async_search (GList *hits, gpointer user_data) {
     }
     g_list_free(hits);
 
+    // Deactivate waiting image
+    deactivateWaitingLayer();
 }
 
 void filter_entry_changed (GtkEntry* entry, gchar* arg1 UNUSED, gpointer data UNUSED) {
 
     AddressBook_Config *addressbook_config;
-    
+
     /* Switch to the address book when the focus is on the search bar */
-    if (active_calltree != contacts)
-        display_calltree (contacts);
+    // if (active_calltree != contacts)
+    //     display_calltree (contacts);
 
 
     /* We want to search in the contact list */
     if (active_calltree == contacts) {
+        // Activate waiting layer
+        activateWaitingLayer();
+
         // Load the address book parameters
         addressbook_load_parameters (&addressbook_config);
-        // Start the asynchronous search as soon as we have an entry */ 
-        search_async (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, addressbook_config); 
+
+        // Start the asynchronous search as soon as we have an entry */
+        search_async (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, addressbook_config);
     }
 
     else if (active_calltree == history) {
@@ -130,27 +136,87 @@ void filter_entry_changed (GtkEntry* entry, gchar* arg1 UNUSED, gpointer data UN
 
 }
 
-void clear_filter_entry_if_default (GtkWidget* widget UNUSED, gpointer user_data UNUSED) {
+void
+filter_entry_changed_history(GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED)
+{ 
+  g_print("--- filter_entry_changed_history --- \n");
 
-    if(g_ascii_strncasecmp(gtk_entry_get_text(GTK_ENTRY(filter_entry)), _("Search"), 6) == 0)
-        gtk_entry_set_text(GTK_ENTRY(filter_entry), "");
+  if (active_calltree != history)
+        display_calltree (history);
 
+  // gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE);
+  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter));
+  // gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter));
 }
 
-GtkWidget* create_filter_entry() {
+
+void clear_filter_entry_if_default (GtkWidget* widget, gpointer user_data UNUSED) {
+
+    if(g_ascii_strncasecmp(gtk_entry_get_text(GTK_ENTRY(widget)), _("Search"), 6) == 0)
+        gtk_entry_set_text(GTK_ENTRY(widget), "");
+
+}
+
+GtkWidget* create_filter_entry_contact() {
 
     GtkWidget* image;
     GtkWidget* ret = gtk_hbox_new(FALSE, 0);
 
-    filter_entry = sexy_icon_entry_new();
+    filter_entry_contact = sexy_icon_entry_new();
     image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR);
-    sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
-    sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(filter_entry) );
-    gtk_entry_set_text(GTK_ENTRY(filter_entry), _("Search"));
-    g_signal_connect(GTK_ENTRY(filter_entry), "changed", G_CALLBACK(filter_entry_changed), NULL);
-    g_signal_connect(GTK_ENTRY(filter_entry), "grab-focus", G_CALLBACK(clear_filter_entry_if_default), NULL);
+    sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry_contact), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
+    sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(filter_entry_contact) );
+    gtk_entry_set_text(GTK_ENTRY(filter_entry_contact), _("Search"));
+    g_signal_connect(GTK_ENTRY(filter_entry_contact), "changed", G_CALLBACK(filter_entry_changed), NULL);
+    g_signal_connect(GTK_ENTRY(filter_entry_contact), "grab-focus", G_CALLBACK(clear_filter_entry_if_default), NULL);
+
+    gtk_box_pack_start(GTK_BOX(ret), filter_entry_contact, TRUE, TRUE, 0);
+
+    // Create waiting icon
+    waitingPixOn = gdk_pixbuf_animation_new_from_file(ICONS_DIR "/wait-on.gif", NULL);
+    waitingPixOff = gdk_pixbuf_new_from_file(ICONS_DIR "/wait-off.gif", NULL);
+    waitingLayer = gtk_image_new_from_pixbuf(waitingPixOff);
+
+    gtk_box_pack_end(GTK_BOX(ret), waitingLayer, TRUE, TRUE, 0);
 
-    gtk_box_pack_start(GTK_BOX(ret), filter_entry, TRUE, TRUE, 0);
     return ret;
 
 }
+
+
+GtkWidget* create_filter_entry_history() {
+
+    g_print("--- create_filter_entry_history --- \n");
+
+    GtkWidget* image;
+    GtkWidget* ret = gtk_hbox_new(FALSE, 0);
+
+    filter_entry_history = sexy_icon_entry_new();
+    image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR);
+    sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry_history), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
+    sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(filter_entry_history) );
+    gtk_entry_set_text(GTK_ENTRY(filter_entry_history), _("Search"));
+    g_signal_connect(GTK_ENTRY(filter_entry_history), "changed", G_CALLBACK(filter_entry_changed_history), NULL);
+    g_signal_connect(GTK_ENTRY(filter_entry_history), "grab-focus", G_CALLBACK(clear_filter_entry_if_default), NULL);
+
+    gtk_box_pack_start(GTK_BOX(ret), filter_entry_history, TRUE, TRUE, 0);
+
+    // Create waiting icon
+    //waitingPixOn = gdk_pixbuf_animation_new_from_file(ICONS_DIR "/wait-on.gif", NULL);
+    //waitingPixOff = gdk_pixbuf_new_from_file(ICONS_DIR "/wait-off.gif", NULL);
+    //waitingLayer = gtk_image_new_from_pixbuf(waitingPixOff);
+
+    //gtk_box_pack_end(GTK_BOX(ret), waitingLayer, TRUE, TRUE, 0);
+
+
+    return ret;
+
+}
+
+void activateWaitingLayer() {
+  gtk_image_set_from_animation(GTK_IMAGE(waitingLayer),waitingPixOn);
+}
+
+void deactivateWaitingLayer() {
+  gtk_image_set_from_pixbuf (GTK_IMAGE(waitingLayer),waitingPixOff);
+}
diff --git a/sflphone-gtk/src/searchfilter.h b/sflphone-gtk/src/searchfilter.h
index 6a85eda4ae7b3b3af7bd6792dce7c0cd0a20d61b..5023956bf2a012cf9d171f556c27bd90cd8bc85e 100644
--- a/sflphone-gtk/src/searchfilter.h
+++ b/sflphone-gtk/src/searchfilter.h
@@ -3,22 +3,22 @@
  *
  *  Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com>
  *  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.
  */
- 
+
 #ifndef __SEARCH_FILTER_H__
 #define __SEARCH_FILTER_H__
 
@@ -26,10 +26,22 @@
 #include <gtk/gtk.h>
 #include <libsexy/sexy-icon-entry.h>
 
+GtkWidget *waitingLayer;
+
+GdkPixbufAnimation *waitingPixOn;
+
+GdkPixbuf *waitingPixOff;
+
 GtkTreeModel* create_filter(GtkTreeModel* child);
 
 gboolean is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data);
 
-GtkWidget* create_filter_entry();
+GtkWidget* create_filter_entry_contact();
+
+GtkWidget* create_filter_entry_history();
+
+void activateWaitingLayer();
+
+void deactivateWaitingLayer();
 
 #endif
diff --git a/sflphone-gtk/view b/sflphone-gtk/view
new file mode 100644
index 0000000000000000000000000000000000000000..1552fda6f631d91a7db39092156ab4fc51ff47b1
--- /dev/null
+++ b/sflphone-gtk/view
@@ -0,0 +1,6 @@
+src/actions.c:	    if(SHOW_SEARCHBAR)  histfilter = create_filter(GTK_TREE_MODEL(history->store));
+src/calltree.c:		gtk_widget_hide(history->tree);
+src/calltree.c:		gtk_widget_show(history->tree);
+src/mainwindow.c:  gtk_box_pack_start (GTK_BOX (vbox), history->tree, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
+src/mainwindow.c:  gtk_widget_hide(history->tree);
+src/mainwindow.c:  gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter));
diff --git a/src/Makefile.am b/src/Makefile.am
index 62b16508816ef09325ff14cbc183059016e7c9b7..7cdecfa7bb9e32b97b7526be2a0dc3731243142b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,8 +50,7 @@ sflphoned_LDADD = \
 		@CCRTP_LIBS@ \
 		@ALSA_LIBS@ \
 		@PULSEAUDIO_LIBS@ \
-		@SAMPLERATE_LIBS@ \
-		@LIBOPENSSL_LIBS@
+		@SAMPLERATE_LIBS@ 
 
 # sflphoned_LDFLAGS= -pg -luuid
 sflphoned_LDFLAGS= -luuid
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index 553a58036112f911ddc4fb304e8949d5bf93d609..9804f11620a33a2e61648d4fbee8203529e2e551 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -445,9 +445,9 @@ ManagerImpl::offHoldCall(const CallID& id)
   
     switchCall(id);
 
-    // codecName = getCurrentCodecName(id);
+    codecName = getCurrentCodecName(id);
     // _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str());
-    // if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str());
+    if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str());
 
     return returnValue;
 }
@@ -739,7 +739,9 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
     */
   
     /* Broadcast a signal over DBus */
-    _dbus->getCallManager()->incomingCall(accountId, call->getCallId(), from);
+    if (_dbus) _dbus->getCallManager()->incomingCall(accountId, call->getCallId(), from);
+
+    //if (_dbus) _dbus->getCallManager()->callStateChanged(call->getCallId(), "INCOMING");
   
     // Reduce volume of the other pulseaudio-connected audio applications
     if( _audiodriver->getLayerType() == PULSEAUDIO && getConfigInt( PREFERENCES , CONFIG_PA_VOLUME_CTRL ) ) {
@@ -787,7 +789,6 @@ ManagerImpl::peerRingingCall(const CallID& id)
   void
 ManagerImpl::peerHungupCall(const CallID& id)
 {
-    _debug("ManagerImpl::peerHungupCall():this function is called when peer hangup \n");
     PulseLayer *pulselayer;
     AccountID accountid;
     bool returnValue;
@@ -977,15 +978,12 @@ ManagerImpl::ringtone()
     {
         //TODO Comment this because it makes the daemon crashes since the main thread
         //synchronizes the ringtone thread.
-        _debug("RINGING!!! 1\n");
         
         ringchoice = getConfigString(AUDIO, RING_CHOICE);
         //if there is no / inside the path
         if ( ringchoice.find(DIR_SEPARATOR_CH) == std::string::npos ) {
             // check inside global share directory
             ringchoice = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR + RINGDIR + DIR_SEPARATOR_STR + ringchoice; 
-
-            _debug("RINGING!!! 2\n");
         }
 
         audiolayer = getAudioDriver();
@@ -993,7 +991,6 @@ ManagerImpl::ringtone()
         if (audiolayer == 0)
             return;
 
-        _debug("RINGING!!! 3\n");
 
         samplerate  = audiolayer->getSampleRate();
         codecForTone = _codecDescriptorMap.getFirstCodecAvailable();
@@ -1004,7 +1001,6 @@ ManagerImpl::ringtone()
 
         if (loadFile) {
             
-            _debug("RINGING!!! 5\n");
             _toneMutex.enterMutex(); 
             _audiofile.start();
             _toneMutex.leaveMutex(); 
@@ -1014,18 +1010,15 @@ ManagerImpl::ringtone()
             }
             else{
                 audiolayer->startStream();
-                _debug("RINGING!!! 6\n");
             }
         } else {
             ringback();
-            _debug("RINGING!!! 7\n");
         }
     
     }
     else
     {
         ringback();
-        _debug("RINGING!!! 8\n");
     }
 }
 
@@ -2531,7 +2524,7 @@ void ManagerImpl::registerCurSIPAccounts(VoIPLink *link)
         current = iter->second;
         
         if (current) {
-            if ( current->isEnabled() && current->getType() == "sip") {
+            if (current->isEnabled() && current->getType() == "sip") {
                 //current->setVoIPLink(link);
 	            current->registerVoIPLink();
             }
diff --git a/src/sdp.cpp b/src/sdp.cpp
index 63a5b69d58da240126aa7ebe7bc8b140e0660fcd..2c623f8d46e2f9763731c0dc6f07c93ad1927e34 100644
--- a/src/sdp.cpp
+++ b/src/sdp.cpp
@@ -379,7 +379,6 @@ void Sdp::set_local_media_capabilities () {
         }
     } 
     _local_media_cap.push_back (audio);
-    _debug ("%s\n", audio->to_string ().c_str());
 }
 
 void Sdp::attribute_port_to_all_media (int port) {
@@ -408,7 +407,6 @@ void Sdp::fetch_remote_ip_from_sdp (pjmedia_sdp_session *r_sdp) {
     std::string remote_ip;
 
     remote_ip = r_sdp->conn->addr.ptr;
-    _debug("**************************************************            Remote Audio IP: %s\n", remote_ip.c_str());
     this->set_remote_ip(remote_ip);
 }
 
diff --git a/src/sipaccount.cpp b/src/sipaccount.cpp
index fc77c0450de4814c82d05b29aea2d5072e82b425..0dceb51243d46872583ee509a55f79bcdc6b5647 100644
--- a/src/sipaccount.cpp
+++ b/src/sipaccount.cpp
@@ -69,14 +69,14 @@ int SIPAccount::registerVoIPLink()
 
 int SIPAccount::unregisterVoIPLink()
 {
-  _debug("unregister account %s\n" , getAccountID().c_str());
-
-  _regc = NULL;
-
-  if(_link->sendUnregister( _accountID ))
-      return true;
-  else
-      return false;
+    _debug("unregister account %s\n" , getAccountID().c_str());
+  
+    if(_link->sendUnregister( _accountID )){
+        setRegistrationInfo (NULL);
+        return true;
+    }
+    else
+        return false;
   
 }
 
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index 4053df3cc63f12e1942380599078762cb8bfa958..037686ab0fabd2fc87780dd9d2cfff8a80c10078 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -49,6 +49,8 @@ int getModId();
  *      */
 bool setCallAudioLocal(SIPCall* call, std::string localIP, bool stun, std::string server);
 
+void handle_incoming_options (pjsip_rx_data *rxdata);
+
 /*
  *  The global pool factory
  */
@@ -101,7 +103,7 @@ void call_on_state_changed( pjsip_inv_session *inv, pjsip_event *e);
 void call_on_media_update( pjsip_inv_session *inv UNUSED, pj_status_t status UNUSED);
 
 /*
- * Called when the invote usage module has created a new dialog and invite
+ * Called when the invite usage module has created a new dialog and invite
  * because of forked outgoing request.
  *
  * @param	inv	A pointer on a pjsip_inv_session structure
@@ -258,6 +260,7 @@ SIPVoIPLink::terminateOneCall(const CallID& id)
 }
 
 void get_remote_sdp_from_offer( pjsip_rx_data *rdata, pjmedia_sdp_session** r_sdp ){
+
     pjmedia_sdp_session *sdp;
     pjsip_msg *msg;
     pjsip_msg_body *body;
@@ -268,9 +271,13 @@ void get_remote_sdp_from_offer( pjsip_rx_data *rdata, pjmedia_sdp_session** r_sd
     body = msg->body;
 
     // Parse the remote request to get the sdp session
-    pjmedia_sdp_parse( rdata->tp_info.pool, (char*)body->data, body->len, &sdp );
+    if (body) {   
+        pjmedia_sdp_parse( rdata->tp_info.pool, (char*)body->data, body->len, &sdp );
+        *r_sdp = sdp;
+    }
 
-    *r_sdp = sdp;
+    else
+        *r_sdp = NULL;
 }
 
     void
@@ -307,14 +314,12 @@ int SIPVoIPLink::sendRegister( AccountID id )
 
     /* Get the client registration information for this particular account */
     regc = account->getRegistrationInfo();
-    /* If the registration already exists, delete it */
-    if(regc) {
-        
+    /* TODO If the registration already exists, delete it */
+    /*if(regc) {
         status = pjsip_regc_destroy(regc);
         regc = NULL;
         PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 );
-    }
-
+    }*/
 
     account->setRegister(true);
 
@@ -324,7 +329,6 @@ int SIPVoIPLink::sendRegister( AccountID id )
     /* Update the state of the voip link */
     account->setRegistrationState(Trying);
 
-
     if (!validStunServer) {
         account->setRegistrationState(ErrorExistStun);
         account->setRegister(false);
@@ -380,7 +384,6 @@ int SIPVoIPLink::sendRegister( AccountID id )
         return false;
     }
 
-    
     status = pjsip_regc_send(regc, tdata);
     if (status != PJ_SUCCESS) {
         _debug("UserAgent: Unable to send regc request.\n");
@@ -396,7 +399,7 @@ int SIPVoIPLink::sendRegister( AccountID id )
 }
 
     int 
-SIPVoIPLink::sendUnregister( AccountID id )
+SIPVoIPLink::sendUnregister (AccountID id)
 {
     pj_status_t status = 0;
     pjsip_tx_data *tdata = NULL;
@@ -428,7 +431,7 @@ SIPVoIPLink::sendUnregister( AccountID id )
         return false;
     }
 
-    account->setRegistrationInfo(regc);
+    //account->setRegistrationInfo(regc);
     account->setRegister(false);
 
     return true;
@@ -970,7 +973,10 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject UNUSED)
             &to,
             NULL,
             &dialog);
-    PJ_ASSERT_RETURN(status == PJ_SUCCESS, false);
+    if (status != PJ_SUCCESS){
+        _debug ("UAC creation failed\n");
+        return false;
+    }
 
     // Create the invite session for this call
     status = pjsip_inv_create_uac(dialog, call->getLocalSDP()->get_local_sdp_session(), 0, &inv);
@@ -1376,7 +1382,7 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
         _debug("UserAgent: VOIP callbacks initialized\n");
 
         // Add endpoint capabilities (INFO, OPTIONS, etc) for this UA
-        pj_str_t allowed[] = { {(char*)"INFO", 4}, {(char*)"REGISTER", 8} }; //  //{"INVITE", 6}, {"ACK",3}, {"BYE",3}, {"CANCEL",6},  {"OPTIONS", 7}, 
+        pj_str_t allowed[] = { {(char*)"INFO", 4}, {(char*)"REGISTER", 8}, {(char*)"OPTIONS", 7} }; //  //{"INVITE", 6}, {"ACK",3}, {"BYE",3}, {"CANCEL",6} 
         accepted = pj_str((char*)"application/sdp");
 
         // Register supported methods
@@ -1619,8 +1625,6 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
         SIPVoIPLink *link;
         pjsip_rx_data *rdata;
 
-        _debug (" *****************************  NEW CALL STATE %i **************************\n", inv->state);        
-
         /* Retrieve the call information */
         call = reinterpret_cast<SIPCall*> (inv->mod_data[_mod_ua.id]);
         if(!call)
@@ -1688,16 +1692,14 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
         }
         else {
 
-            // The call is ringing
-            if (inv->state == PJSIP_INV_STATE_EARLY){
-                _debug ("*************************** PJSIP_INV_STATE_EARLY - PEER RINGING ***********************************\n");
+            // The call is ringing - We need to handle this case only on outgoing call
+            if (inv->state == PJSIP_INV_STATE_EARLY && e->body.tsx_state.tsx->role == PJSIP_ROLE_UAC){
                 call->setConnectionState(Call::Ringing);
                 Manager::instance().peerRingingCall(call->getCallId());
             }
 
             // We receive a ACK - The connection is established
             else if( inv->state == PJSIP_INV_STATE_CONFIRMED ){
-                _debug ("*************************** PJSIP_INV_STATE_CONFIRMED ***********************************\n");
                     
                 /* If the call is a direct IP-to-IP call */
                 if (call->getCallConfiguration () == Call::IPtoIP) {
@@ -1713,7 +1715,6 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
             }
 
             else if( inv->state == PJSIP_INV_STATE_DISCONNECTED ){
-                _debug ("*************************** PJSIP_INV_STATE_DISCONNECTED  %i***********************************\n", inv->cause);
                 switch( inv->cause )
                 {
                     /* The call terminates normally - BYE / CANCEL */
@@ -1794,11 +1795,11 @@ void call_on_tsx_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_e
                  */
                 _debug("UserAgent: The error is: %d\n", param->code);
                 switch(param->code) {
-                    case 408:
                     case 606:
                         account->setRegistrationState(ErrorConfStun);
                         break;
                     case 503:
+                    case 408:
                         account->setRegistrationState(ErrorHost);
                         break;
                     case 401:
@@ -1912,6 +1913,12 @@ void call_on_tsx_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_e
                 return true;
             }
 
+            // Handle an OPTIONS message
+            if (rdata->msg_info.msg->line.req.method.id == PJSIP_OPTIONS_METHOD) {
+                handle_incoming_options (rdata);
+                return true;
+            }
+
             // Respond statelessly any non-INVITE requests with 500
             if (rdata->msg_info.msg->line.req.method.id != PJSIP_INVITE_METHOD) {
                 if (rdata->msg_info.msg->line.req.method.id != PJSIP_ACK_METHOD) {
@@ -2429,8 +2436,6 @@ void call_on_tsx_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_e
 
     void on_rx_offer( pjsip_inv_session *inv, const pjmedia_sdp_session *offer ){
 
-        _debug ( "********************************* REINVITE RECEIVED *******************************\n" );
-
 #ifdef CAN_REINVITE
         _debug ("reinvite                                                  SIP\n");
 
@@ -2454,6 +2459,50 @@ void call_on_tsx_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_e
 
     }
 
+    void handle_incoming_options (pjsip_rx_data *rdata) {
+        
+        pjsip_tx_data *tdata;
+        pjsip_response_addr res_addr;
+        const pjsip_hdr *cap_hdr;
+        pj_status_t status;
+
+        /* Create basic response. */
+        status = pjsip_endpt_create_response(_endpt, rdata, PJSIP_SC_OK, NULL, &tdata);
+        if (status != PJ_SUCCESS) {
+            return;
+        }
+        
+        /* Add Allow header */
+        cap_hdr = pjsip_endpt_get_capability(_endpt, PJSIP_H_ALLOW, NULL);
+        if (cap_hdr) {
+            pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, cap_hdr));
+        }
+
+        /* Add Accept header */
+        cap_hdr = pjsip_endpt_get_capability(_endpt, PJSIP_H_ACCEPT, NULL);
+        if (cap_hdr) {
+            pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, cap_hdr));
+        }
+
+        /* Add Supported header */
+        cap_hdr = pjsip_endpt_get_capability(_endpt, PJSIP_H_SUPPORTED, NULL);
+        if (cap_hdr) {
+            pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, cap_hdr));
+        }
+
+        /* Add Allow-Events header from the evsub module */
+        cap_hdr = pjsip_evsub_get_allow_events_hdr(NULL);
+        if (cap_hdr) {
+            pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, cap_hdr));
+        }
+
+        /* Send response statelessly */
+        pjsip_get_response_addr(tdata->pool, rdata, &res_addr);
+        status = pjsip_endpt_send_response(_endpt, &res_addr, tdata, NULL, NULL);
+        if (status != PJ_SUCCESS)
+            pjsip_tx_data_dec_ref(tdata);
+    }
+
     /*****************************************************************************************************************/
 
 
diff --git a/src/user_cfg.h b/src/user_cfg.h
index 6b078eee51cd0e7dd50a1f4f68086f2d4a8bb2d0..76b98da8fb1188cd45b4e8748519959bd8c95cd6 100644
--- a/src/user_cfg.h
+++ b/src/user_cfg.h
@@ -83,7 +83,7 @@
 #define URLHOOK_COMMAND                 "Hooks.url_command"      
 
 #define EMPTY_FIELD		""			/** Default value for empty field */
-#define DFT_STUN_SERVER 	"stun.fwdnet.net:3478"	/** Default STUN server address */
+#define DFT_STUN_SERVER 	"stun.ekiga.net"	/** Default STUN server address */
 #define	YES_STR			"1"			/** Default YES value */   
 #define	NO_STR			"0"			/** Default NO value */
 #define DFT_PULSE_LENGTH_STR	"250"			/** Default DTMF lenght */