diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index d01744c1edee66e5859ca7da0e7a41d2cc35ee39..bf1d5ca4d8de72aec31971405f66a6a30c5b8a49 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -216,7 +216,6 @@ sflphone_hang_up() { call_t * selectedCall = call_get_selected(current_calls); (void) time(&selectedCall->_stop); - update_call_tree( history , selectedCall ); if(selectedCall) { switch(selectedCall->state) @@ -224,9 +223,13 @@ sflphone_hang_up() case CALL_STATE_DIALING: dbus_hang_up (selectedCall); break; + case CALL_STATE_RINGING: + dbus_hang_up (selectedCall); + selectedCall->state = CALL_STATE_DIALING; + selectedCall->_stop = 0; + break; case CALL_STATE_CURRENT: case CALL_STATE_HOLD: - case CALL_STATE_RINGING: case CALL_STATE_BUSY: case CALL_STATE_FAILURE: dbus_hang_up (selectedCall); @@ -245,6 +248,7 @@ sflphone_hang_up() break; } } + update_call_tree( history , selectedCall ); } @@ -469,6 +473,9 @@ sflphone_new_call() c->to = g_strdup(""); + c->_start = 0; + c->_stop = 0; + call_list_add(current_calls,c); update_call_tree_add(current_calls,c); update_menus(); @@ -495,6 +502,8 @@ sflphone_keypad( guint keyval, gchar * key) { case 65307: /* ESCAPE */ dbus_hang_up(c); + (void) time(&c->_stop); + update_call_tree( history , c ); break; default: // To play the dtmf when calling mail box for instance @@ -563,8 +572,10 @@ sflphone_keypad( guint keyval, gchar * key) switch (keyval) { case 65307: /* ESCAPE */ - dbus_hang_up(c); - break; + dbus_hang_up(c); + c->_stop = 0; + update_call_tree( history , c ); + break; } break; default: diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c index e99b5b194a3b1fdcf16e66ce893233eb19f9d5ef..1e6b565ac13fe8785abd7c700bde4b85c0204329 100644 --- a/sflphone-gtk/src/calltree.c +++ b/sflphone-gtk/src/calltree.c @@ -169,6 +169,8 @@ call_mailbox( GtkWidget* widget , gpointer data ) mailboxCall->callID = g_new0(gchar, 30); g_sprintf(mailboxCall->callID, "%d", rand()); mailboxCall->accountID = g_strdup(current->accountID); + mailboxCall->_start = 0; + mailboxCall->_stop = 0; g_print("TO : %s\n" , mailboxCall->to); call_list_add( current_calls , mailboxCall ); update_call_tree_add( current_calls , mailboxCall ); @@ -426,6 +428,7 @@ create_call_tree (calltab_t* tab) tab->store = gtk_list_store_new (3, GDK_TYPE_PIXBUF,// Icon + G_TYPE_STRING, // Description G_TYPE_POINTER // Pointer to the Object ); diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index 20b2683a6cb2ba622f2d3e71cc6b751e336c713f..c1b85189e3fdd553d1b89f201632bc8270717e6a 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -104,6 +104,12 @@ call_state_cb (DBusGProxy *proxy, { if ( strcmp(state, "HUNGUP") == 0 ) { + if(c->state==CALL_STATE_CURRENT) + { + // peer hung up, the conversation was established, so _start has been initialized with the current time value + (void) time(&c->_stop); + update_call_tree( history, c ); + } g_print("from dbus: "); stop_notification(); sflphone_hung_up (c); } diff --git a/sflphone-gtk/src/timestamp.c b/sflphone-gtk/src/timestamp.c index 9e638e734250b03a83f189ff35fcd50f79518985..f42eaa9df6c14fc682f31848d0ff5210cc2f9e10 100644 --- a/sflphone-gtk/src/timestamp.c +++ b/sflphone-gtk/src/timestamp.c @@ -42,16 +42,22 @@ what_time_is_it( void ) process_call_duration( call_t* c ) { gchar * res; - g_print("Call duration = %i\n", (int)c->_stop - c->_start); + g_print("Start = %i - Stop = %i - Call duration = %i\n", c->_start , c->_stop , (int)(c->_stop - c->_start)); int duration = c->_stop - c->_start; if( duration / 60 == 0 ) { - res = g_markup_printf_escaped("\n00:%i", duration); + if( duration < 10 ) + res = g_markup_printf_escaped("\t00:0%i", duration); + else + res = g_markup_printf_escaped("\t00:%i", duration); } else { - res = g_markup_printf_escaped("\n%i:%i" , duration/60 , duration%60); + if( duration%60 < 10 ) + res = g_markup_printf_escaped("\t%i:0%i" , duration/60 , duration%60); + else + res = g_markup_printf_escaped("\t%i:%i" , duration/60 , duration%60); } return res; }