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..8d6672d4885d5a9215cbe41f7fec2cafd4a2808d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,14 +270,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/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/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 3702ba61b274e275b86c83025597bebcccd5dee4..f3275f017b2b899ed41b7730c57296f4f258cfbe 100644
--- a/sflphone-gtk/src/actions.c
+++ b/sflphone-gtk/src/actions.c
@@ -233,7 +233,7 @@ gboolean sflphone_init()
         current_calls = calltab_init();
         history = calltab_init();
         contacts = calltab_init();
-        if(SHOW_SEARCHBAR)  histfilter = create_filter(GTK_TREE_MODEL(history->store));
+        //if(SHOW_SEARCHBAR)  histfilter = create_filter(GTK_TREE_MODEL(history->store));
         init();
         account_list_init ();
         codec_list_init();
@@ -530,23 +530,18 @@ process_dialing(call_t * c, guint keyval, gchar * key)
 sflphone_new_call()
 {
 
+    call_t *c;
+    gchar *from, *to;
+
     sflphone_on_hold();
 
     // Play a tone when creating a new call
     if( call_list_get_size(current_calls) == 0 )
         dbus_start_tone( TRUE , ( voice_mails > 0 )? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ;
 
-    call_t * c = g_new0 (call_t, 1);
-    c->state = CALL_STATE_DIALING;
-    c->from = g_strconcat("\"\" <>", NULL);
-
-    c->callID = g_new0(gchar, 30);
-    g_sprintf(c->callID, "%d", rand());
-
-    c->to = g_strdup("");
-
-    c->_start = 0;
-    c->_stop = 0;
+    to = g_strdup("");
+    from = g_strconcat("\"\" <>", NULL);
+    create_new_call (to, from, CALL_STATE_DIALING, "", &c);
 
     call_list_add(current_calls,c);
     update_call_tree_add(current_calls,c);
@@ -687,6 +682,9 @@ sflphone_place_call ( call_t * c )
 
     if(c->state == CALL_STATE_DIALING && strcmp(c->to, "") != 0)
     {
+    
+        //format_phone_number (&c->to); 
+        
         if( account_list_get_size() == 0 )
         {
             notify_no_accounts();
@@ -749,6 +747,7 @@ sflphone_place_call ( call_t * c )
         }
         // Update history
         c->history_state = OUTGOING;
+        g_print ("add in history\n");
         call_list_add(history, c);
     }
 }
@@ -866,3 +865,11 @@ sflphone_fill_codec_list()
     }
 }
 
+void format_phone_number (gchar **number) {
+
+    gchar *_number;
+
+    _number = *number;
+
+    //strip_spaces (&_number);
+}
diff --git a/sflphone-gtk/src/calltab.h b/sflphone-gtk/src/calltab.h
index 7d84696df2fa4f4471455b09859b54ccb75d5a79..d3b85ca977f85f159ae9e13dafb44d1a25f09d9b 100644
--- a/sflphone-gtk/src/calltab.h
+++ b/sflphone-gtk/src/calltab.h
@@ -23,7 +23,7 @@
 #include <calllist.h>
 #include <gtk/gtk.h>
 
-GtkTreeModel* histfilter;
+//GtkTreeModel* histfilter;
 
 calltab_t* calltab_init();
 
diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c
index 24d2001f290365dbfbfd6afb202478e8d49a08c5..f0f1fdfdeca03d9fb872b338d7771a7d57edfc3a 100644
--- a/sflphone-gtk/src/calltree.c
+++ b/sflphone-gtk/src/calltree.c
@@ -295,80 +295,80 @@ toolbar_update_buttons ()
   gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
 
   call_t * selectedCall = call_get_selected(active_calltree);
-  if (selectedCall)
-  {
-    switch(selectedCall->state)
-    {
-      case CALL_STATE_INCOMING:
-	gtk_widget_set_sensitive( GTK_WIDGET(pickupButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),	TRUE);
-	g_object_ref(callButton);
-	gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
-	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0);
-	break;
-      case CALL_STATE_HOLD:
-	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(unholdButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
-	g_object_ref(holdButton);
-	gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
-	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), unholdButton, 3);
-	break;
-      case CALL_STATE_RINGING:
-	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(callButton),     TRUE);
-	break;
-      case CALL_STATE_DIALING:
-	if( active_calltree != history )  gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(pickupButton),       TRUE);
-	g_object_ref(callButton);
-	gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
-	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0);
-	break;
-      case CALL_STATE_CURRENT:
-	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(holdButton),       TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(transfertButton),  TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
-        gtk_widget_set_sensitive( GTK_WIDGET(recButton),        TRUE);
-	break;
-      case CALL_STATE_BUSY:
-      case CALL_STATE_FAILURE:
-	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	break;
-      case CALL_STATE_TRANSFERT:
-	gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
-	gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE);
-	gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
-	gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(holdButton),       TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(transfertButton),  TRUE);
-	break;
-      case CALL_STATE_RECORD:
-	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(holdButton),       TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(transfertButton),  TRUE);
-	gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
-        gtk_widget_set_sensitive( GTK_WIDGET(recButton),        TRUE);
-	break;
-      default:
-	g_warning("Toolbar update - Should not happen!");
-	break;
-    }
-  }
-  else
-  {
-    if( account_list_get_size() > 0 )
+    if (selectedCall)
     {
-      gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE );
-      gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton), TRUE );
+        switch(selectedCall->state)
+        {
+            case CALL_STATE_INCOMING:
+	            gtk_widget_set_sensitive( GTK_WIDGET(pickupButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),	TRUE);
+	            g_object_ref(callButton);
+	            gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
+	            gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0);
+	        break;
+            case CALL_STATE_HOLD:
+	            gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(unholdButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
+	            g_object_ref(holdButton);
+	            gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
+	            gtk_toolbar_insert(GTK_TOOLBAR(toolbar), unholdButton, 3);
+	        break;
+            case CALL_STATE_RINGING:
+	            gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(callButton),     TRUE);
+	        break;
+            case CALL_STATE_DIALING:
+	            if( active_calltree == current_calls )  gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(pickupButton),       TRUE);
+	            g_object_ref(callButton);
+	            gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
+	            gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0);
+	        break;
+            case CALL_STATE_CURRENT:
+	            gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(holdButton),       TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(transfertButton),  TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
+                gtk_widget_set_sensitive( GTK_WIDGET(recButton),        TRUE);
+	        break;
+            case CALL_STATE_BUSY:
+            case CALL_STATE_FAILURE:
+	            gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
+	            break;
+            case CALL_STATE_TRANSFERT:
+	            gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
+            	gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE);
+	            gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
+	            gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(holdButton),       TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(transfertButton),  TRUE);
+	            break;
+            case CALL_STATE_RECORD:
+	            gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(holdButton),       TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(transfertButton),  TRUE);
+	            gtk_widget_set_sensitive( GTK_WIDGET(callButton),       TRUE);
+                gtk_widget_set_sensitive( GTK_WIDGET(recButton),        TRUE);
+	        break;
+            default:
+	            g_warning("Toolbar update - Should not happen!");
+	        break;
+        }
     }
     else
     {
-      gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
+        if( account_list_get_size() > 0 )
+        {
+            gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE );
+            gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton), TRUE );
+        }
+        else
+        {
+            gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
+        }
     }
-  }
 }
 
 
@@ -399,55 +399,58 @@ void  row_activated(GtkTreeView       *tree_view UNUSED,
     GtkTreeViewColumn *column UNUSED,
     void * data UNUSED)
 {
-  g_print("double click action\n");
-  call_t* selectedCall;
-  call_t* new_call;
-  gchar *to, *from, *account_id;
-  selectedCall = call_get_selected( active_calltree );
+    call_t* selectedCall;
+    call_t* new_call;
+    gchar *to, *from, *account_id;
+    
+    g_print("double click action\n");
+  
+    selectedCall = call_get_selected( active_calltree );
 
-  if (selectedCall)
-  {
-    g_print("is selected call? Current state: %i \n",selectedCall->state);
-    // Get the right event from the right calltree
-    if( active_calltree == current_calls )
+    if (selectedCall)
     {
-      switch(selectedCall->state)
-      {
-        case CALL_STATE_INCOMING:
-	  dbus_accept(selectedCall);
-          stop_notification();
-	  break;
-	case CALL_STATE_HOLD:
-	  dbus_unhold(selectedCall);
-	  break;
-        case CALL_STATE_RINGING:
-	case CALL_STATE_CURRENT:
-	case CALL_STATE_BUSY:
-	case CALL_STATE_FAILURE:
-	  break;
-	case CALL_STATE_DIALING:
-	  sflphone_place_call (selectedCall);
-	  break;
-	default:
-	  g_warning("Row activated - Should not happen!");
-	  break;
-      }
-    }
-    // if history
-    else
-    {
-      to = g_strdup(call_get_number(selectedCall));
-      from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
-      account_id = g_strdup (selectedCall->accountID);
-
-      create_new_call (to, from, CALL_STATE_DIALING, account_id, &new_call);
-
-      call_list_add(current_calls, new_call);
-      update_call_tree_add(current_calls, new_call);
-      sflphone_place_call(new_call);
-      display_calltree(current_calls);
+        // Get the right event from the right calltree
+        if( active_calltree == current_calls )
+        {
+            switch(selectedCall->state)
+            {
+                case CALL_STATE_INCOMING:
+	                dbus_accept(selectedCall);
+                    stop_notification();
+	                break;
+	            case CALL_STATE_HOLD:
+	                dbus_unhold(selectedCall);
+	                break;
+	            case CALL_STATE_RINGING:
+	            case CALL_STATE_CURRENT:
+	            case CALL_STATE_BUSY:
+	            case CALL_STATE_FAILURE:
+	                break;
+	            case CALL_STATE_DIALING:
+	                sflphone_place_call (selectedCall);
+	            break;
+	            default:
+	                g_warning("Row activated - Should not happen!");
+	                break;
+            }
+        }
+    
+        // If history or contact: double click action places a new call
+        else
+        {
+            to = g_strdup(call_get_number(selectedCall));
+            from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
+            account_id = g_strdup (selectedCall->accountID);
+
+            // Create a new call
+            create_new_call (to, from, CALL_STATE_DIALING, account_id, &new_call);
+
+            call_list_add(current_calls, new_call);
+            update_call_tree_add(current_calls, new_call);
+            sflphone_place_call(new_call);
+            display_calltree(current_calls);
+        }
     }
-  }
 }
 
   GtkWidget *
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 52902adeb15a6142af5a8ab109db077b012b3c32..c1def3f9b629a24a81ff406b5c286e12585d7dd6 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/historyfilter.c b/sflphone-gtk/src/historyfilter.c
deleted file mode 100644
index db1d405246aa83a8dd83ea1d07a243c898763d64..0000000000000000000000000000000000000000
--- a/sflphone-gtk/src/historyfilter.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Copyright (C) 2008 Savoir-Faire Linux inc.
- *  Author: Antoine Reversat <antoine.reversat@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.
- */
-
-#include <string.h>
-
-#include <historyfilter.h>
-#include <calltree.h>
-
-GtkWidget * filter_entry;
-
-GtkTreeModel*
-create_filter(GtkTreeModel* child)
-{
-	GtkTreeModel* 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);
-} 
-
-gboolean
-is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data UNUSED)
-{
-  if( SHOW_SEARCHBAR )
-  {
-	GValue val;
-
-	gchar* text = NULL;
-	gchar* search = (gchar*)gtk_entry_get_text(GTK_ENTRY(filter_entry));
-    memset (&val, 0, sizeof(val));
-	gtk_tree_model_get_value(GTK_TREE_MODEL(model), iter, 1, &val);
-	if(G_VALUE_HOLDS_STRING(&val)){
-		text = (gchar *)g_value_get_string(&val);
- 	}
-	if(text != NULL && g_ascii_strncasecmp(search, _("Search"), 6) != 0){
-		return g_regex_match_simple(search, text, G_REGEX_CASELESS, 0);
- 	}
-    g_value_unset (&val);
-	return TRUE;
-  }
-  return TRUE;
-} 
-
-void
-filter_entry_changed(GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED)
-{ 
-	gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE);
-	gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter));
-}
-
-void
-clear_filter_entry_if_default(GtkWidget* widget UNUSED, gpointer user_data UNUSED)
-{
-	if(g_ascii_strncasecmp(gtk_entry_get_text(GTK_ENTRY(filter_entry)), _("Search"), 6) == 0)
-		gtk_entry_set_text(GTK_ENTRY(filter_entry), "");
-}
-
-GtkWidget*
-create_filter_entry() 
-{
-	GtkWidget* image;
-	GtkWidget* ret = gtk_hbox_new(FALSE, 0);
-      
-	filter_entry = sexy_icon_entry_new();
-	//filter_entry = gtk_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);
-
-	gtk_box_pack_start(GTK_BOX(ret), filter_entry, TRUE, TRUE, 0);
-	return ret;
-}
diff --git a/sflphone-gtk/src/historyfilter.h b/sflphone-gtk/src/historyfilter.h
deleted file mode 100644
index 72d46b8ce7d640dbd5ae0f1c9b9adb2eb2462b66..0000000000000000000000000000000000000000
--- a/sflphone-gtk/src/historyfilter.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Copyright (C) 2007 Savoir-Faire Linux inc.
- *  Author: Antoine Reversat <antoine.reversat@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 __HFILTER_H__
-#define __HFILTER_H__
-
-#include <calllist.h>
-#include <gtk/gtk.h>
-#include <libsexy/sexy-icon-entry.h>
-
-GtkTreeModel* create_filter(GtkTreeModel* child);
-
-gboolean is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data);
-GtkWidget* create_filter_entry();
-#endif
diff --git a/sflphone-gtk/src/mainwindow.c b/sflphone-gtk/src/mainwindow.c
index 25097dce2b1cbcd8e862e4b23aee3197d6c83039..2d73879aa32603a1dec262aa5460de2ec3fb1c85 100644
--- a/sflphone-gtk/src/mainwindow.c
+++ b/sflphone-gtk/src/mainwindow.c
@@ -174,7 +174,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)
   {
diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c
index 2030f12ccef32560ea4b0d72b016d80b6eeca1fa..6a0a17ea7ed6685e93f951995c705dc5e2b8dc08 100644
--- a/sflphone-gtk/src/menus.c
+++ b/sflphone-gtk/src/menus.c
@@ -324,7 +324,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);
@@ -650,7 +650,7 @@ create_view_menu()
   gtk_widget_show (volumeMenu);
 
   image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_MENU );
-  searchbarMenu = gtk_image_menu_item_new_with_mnemonic (_("_Search history"));
+  searchbarMenu = gtk_image_menu_item_new_with_mnemonic (_("_Search contact"));
   gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( searchbarMenu ), image );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), searchbarMenu);
   g_signal_connect(G_OBJECT (searchbarMenu), "activate",
@@ -812,7 +812,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 8cc99aba8bb27ced019d15fc4030cb07da94540c..92988c519a8ee1a1aea8bc1909ad5e8b91b1c2ec 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);
@@ -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,34 @@ static void handler_async_search (GList *hits, gpointer user_data) {
     }
     g_list_free(hits);
 
+    // Deactivate waiting image
+    deactivateWaitingLayer();
 }
 
-void filter_entry_changed (GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED) {
+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 == current_calls)
+    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 (filter_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) {
+        // Filter the displayed calls
+
     }
 
 }
@@ -138,7 +149,6 @@ GtkWidget* create_filter_entry() {
     GtkWidget* ret = gtk_hbox_new(FALSE, 0);
 
     filter_entry = sexy_icon_entry_new();
-    //filter_entry = gtk_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) );
@@ -147,6 +157,22 @@ GtkWidget* create_filter_entry() {
     g_signal_connect(GTK_ENTRY(filter_entry), "grab-focus", G_CALLBACK(clear_filter_entry_if_default), NULL);
 
     gtk_box_pack_start(GTK_BOX(ret), filter_entry, 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..c22109635b98dda14046c583e63585a9ff38c7ad 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,20 @@
 #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();
 
+void activateWaitingLayer();
+
+void deactivateWaitingLayer();
+
 #endif
diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp
index 02972a3058afc50dc73fc175fd7aba350e9732f0..e483830cce819875d72de31937997a7c294244a5 100644
--- a/src/audio/audiortp.cpp
+++ b/src/audio/audiortp.cpp
@@ -190,6 +190,9 @@ AudioRtpRTX::initAudioRtpSession (void)
     try {
         if (_ca == 0) { return; }
         _audiocodec = _ca->getLocalSDP()->get_session_media ();
+
+        if (_audiocodec == NULL) { return; }
+
         _codecSampleRate = _audiocodec->getClockRate(); 
 
         ost::InetHostAddress remote_ip(_ca->getLocalSDP()->get_remote_ip().c_str());
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index fb7fd32d282133ff318afbafe042797429fc1077..16d22b136ad57236ccf1089911bc9c96265f0d2b 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -741,7 +741,7 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
     /* Broadcast a signal over DBus */
     if (_dbus) _dbus->getCallManager()->incomingCall(accountId, call->getCallId(), from);
 
-    if (_dbus) _dbus->getCallManager()->callStateChanged(call->getCallId(), "INCOMING");
+    //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 ) ) {
@@ -782,7 +782,7 @@ ManagerImpl::peerRingingCall(const CallID& id)
   if (isCurrentCall(id)) {
     ringback();
   }
-  // if (_dbus) _dbus->getCallManager()->callStateChanged(id, "RINGING");
+  if (_dbus) _dbus->getCallManager()->callStateChanged(id, "RINGING");
 }
 
 //THREAD=VoIP Call=Outgoing/Ingoing
diff --git a/src/sdp.cpp b/src/sdp.cpp
index 011875e2ef90491bac7b74e8f51711e5f600a5c7..63a5b69d58da240126aa7ebe7bc8b140e0660fcd 100644
--- a/src/sdp.cpp
+++ b/src/sdp.cpp
@@ -303,14 +303,20 @@ AudioCodec* Sdp::get_session_media( void ){
 
     int nb_media;
     int nb_codec;
+    AudioCodec *codec = NULL;
 
     nb_media = _session_media.size();
-    nb_codec = _session_media[0]->get_media_codec_list().size();
-
-    return _session_media[0]->get_media_codec_list()[0];
+    if (nb_media > 0) {
+        nb_codec = _session_media[0]->get_media_codec_list().size();
+        if (nb_codec > 0) {
+            codec = _session_media[0]->get_media_codec_list()[0];
+        }
+    }
+    return codec;
 }
 
 
+
 void Sdp::toString (void) {
 
     std::ostringstream sdp;
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index d03acaeda31b3405514f50535cd2a167dbf33778..f7bd90921c27f63d7e2fcbe17e588e1d55b5b687 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
@@ -850,11 +857,17 @@ SIPVoIPLink::isRecording(const CallID& id)
 SIPVoIPLink::getCurrentCodecName()
 {
 
-    SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId());  
+    SIPCall *call;
+    AudioCodec *ac;
+    std::string name = "";
+    
+    call = getSIPCall(Manager::instance().getCurrentCallId());  
+    ac = call->getLocalSDP()->get_session_media();
 
-    AudioCodec *ac = call->getLocalSDP()->get_session_media();
+    if (ac)
+        name = ac->getCodecName();
 
-    return ac->getCodecName();
+    return name;
 }
 
     bool 
@@ -957,14 +970,17 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject UNUSED)
     pj_strdup2(_pool, &to, strTo.data());
     pj_strdup2(_pool, &contact, account->getContact().data());
 
-    _debug("%s %s %s\n", from.ptr, contact.ptr, to.ptr);
+    //_debug("%s %s %s\n", from.ptr, contact.ptr, to.ptr);
     // create the dialog (UAC)
     status = pjsip_dlg_create_uac(pjsip_ua_instance(), &from,
             &contact,
             &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);
@@ -1370,7 +1386,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
@@ -1613,8 +1629,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)
@@ -1682,8 +1696,8 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
         }
         else {
 
-            // The call is ringing
-            if (inv->state == PJSIP_INV_STATE_EARLY){
+            // 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){
                 _debug ("*************************** PJSIP_INV_STATE_EARLY - PEER RINGING ***********************************\n");
                 call->setConnectionState(Call::Ringing);
                 Manager::instance().peerRingingCall(call->getCallId());
@@ -1906,6 +1920,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) {
@@ -2448,6 +2468,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);
+    }
+
     /*****************************************************************************************************************/