Пример #1
0
callable_obj_t *
sflphone_new_call(SFLPhoneClient *client)
{
    // Disable screensaver if the list is empty call
    guint nbcall = calllist_get_size(current_calls_tab);
    if(nbcall == 0)
        dbus_screensaver_inhibit();

    callable_obj_t *selected_call = calllist_empty(current_calls_tab) ? NULL :
        calltab_get_selected_call(current_calls_tab);

    if (selected_call != NULL && selected_call->_callID) {
        gchar *confID = dbus_get_conference_id(selected_call->_callID);
        if (g_strcmp0(confID, "") != 0)
            sflphone_on_hold();
        g_free(confID);
    }

    // Play a tone when creating a new call
    if (calllist_empty(current_calls_tab))
        dbus_start_tone(TRUE , (current_account_has_new_message()  > 0) ? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ;

    callable_obj_t *c = create_new_call(CALL, CALL_STATE_DIALING, "", "", "", "");

    c->_history_state = g_strdup(OUTGOING_STRING);

    calllist_add_call(current_calls_tab, c);
    calltree_add_call(current_calls_tab, c, NULL);
    update_actions(client);

    return c;
}
Пример #2
0
callable_obj_t *create_new_call_from_details (const gchar *call_id, GHashTable *details)
{
    call_state_t state;

    const gchar * const accountID = g_hash_table_lookup (details, "ACCOUNTID");
    const gchar * const peer_number = g_hash_table_lookup (details, "PEER_NUMBER");
    const gchar * const peer_name = g_hash_table_lookup (details, "DISPLAY_NAME");
    const gchar * const state_str = g_hash_table_lookup (details, "CALL_STATE");

    if (g_strcasecmp (state_str, "CURRENT") == 0)
        state = CALL_STATE_CURRENT;

    else if (g_strcasecmp (state_str, "RINGING") == 0)
        state = CALL_STATE_RINGING;

    else if (g_strcasecmp (state_str, "INCOMING") == 0)
        state = CALL_STATE_INCOMING;

    else if (g_strcasecmp (state_str, "HOLD") == 0)
        state = CALL_STATE_HOLD;

    else if (g_strcasecmp (state_str, "BUSY") == 0)
        state = CALL_STATE_BUSY;

    else
        state = CALL_STATE_FAILURE;

    return create_new_call (CALL, state, call_id, accountID, peer_name, call_get_peer_number (peer_number));
}
Пример #3
0
callable_obj_t *create_history_entry_from_serialized_form (const gchar *entry)
{
    const gchar *peer_name = "";
    const gchar *peer_number = "";
    const gchar *callID = "";
    const gchar *accountID = "";
    const gchar *time_start = "";
    const gchar *time_stop = "";
    const gchar *recordfile = "";
    const gchar *confID = "";
    const gchar *time_added = "";
    callable_obj_t *new_call;
    history_state_t history_state = MISSED;
    gint token = 0;
    gchar ** ptr;
    gchar ** ptr_orig;
    static const gchar * const delim = "|";

    ptr = g_strsplit(entry, delim, 10);
    ptr_orig = ptr;
    while (ptr != NULL && token < 10) {
        switch (token) {
            case 0:
                history_state = get_history_state_from_id (*ptr);
                break;
            case 1:
                peer_number = *ptr;
                break;
            case 2:
                peer_name = *ptr;
                break;
            case 3:
		time_start = *ptr;
		break;
	    case 4:
                time_stop = *ptr;
                break;
	    case 5:
		callID = *ptr;
		break;
            case 6:
                accountID = *ptr;
                break;
            case 7:
		recordfile = *ptr;
		break;
	    case 8:
		confID = *ptr;
		break;
	    case 9:
		time_added = *ptr;
		break;
            default:
                break;
        }

        token++;
        ptr++;
    }

    if (g_strcasecmp (peer_name, "empty") == 0)
        peer_name = "";

    new_call = create_new_call (HISTORY_ENTRY, CALL_STATE_DIALING, callID, accountID, peer_name, peer_number);
    new_call->_history_state = history_state;
    new_call->_time_start = convert_gchar_to_timestamp (time_start);
    new_call->_time_stop = convert_gchar_to_timestamp (time_stop);
    new_call->_recordfile = g_strdup(recordfile);
    new_call->_confID = g_strdup(confID);
    new_call->_historyConfID = g_strdup(confID);
    new_call->_time_added = convert_gchar_to_timestamp(time_start);
    new_call->_record_is_playing = FALSE;

    g_strfreev(ptr_orig);
    return new_call;
}