mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 03:28:07 +00:00
Added method to get latest outgoing call log
This commit is contained in:
parent
ee187d4cb5
commit
27fbc3dbb9
3 changed files with 45 additions and 0 deletions
|
|
@ -571,6 +571,30 @@ MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const Linp
|
|||
return result;
|
||||
}
|
||||
|
||||
LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
|
||||
char *buf;
|
||||
uint64_t begin,end;
|
||||
MSList *list = NULL;
|
||||
LinphoneCallLog* result = NULL;
|
||||
|
||||
if (!lc || lc->logs_db == NULL) return NULL;
|
||||
|
||||
/*since we want to append query parameters depending on arguments given, we use malloc instead of sqlite3_mprintf*/
|
||||
buf = sqlite3_mprintf("SELECT * FROM call_history WHERE direction = 0 ORDER BY id DESC LIMIT 1");
|
||||
|
||||
begin = ortp_get_cur_time_ms();
|
||||
linphone_sql_request_call_log(lc->logs_db, buf, &list);
|
||||
end = ortp_get_cur_time_ms();
|
||||
ms_message("%s(): completed in %i ms",__FUNCTION__, (int)(end-begin));
|
||||
sqlite3_free(buf);
|
||||
|
||||
if (list) {
|
||||
result = (LinphoneCallLog*)list->data;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void linphone_core_call_log_storage_init(LinphoneCore *lc) {
|
||||
|
|
@ -600,4 +624,8 @@ MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const Linp
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -3245,6 +3245,13 @@ LINPHONE_PUBLIC const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
|
|||
**/
|
||||
LINPHONE_PUBLIC MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr);
|
||||
|
||||
/**
|
||||
* Get the latest outgoing call log.
|
||||
* @param[in] lc LinphoneCore object
|
||||
* @return {LinphoneCallLog}
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* Erase the call log.
|
||||
* @param[in] lc LinphoneCore object
|
||||
|
|
|
|||
|
|
@ -5007,6 +5007,16 @@ static void call_logs_migrate(void) {
|
|||
BC_ASSERT_TRUE(aborted_count == 3);
|
||||
BC_ASSERT_TRUE(decline_count == 2);
|
||||
BC_ASSERT_TRUE(video_enabled_count == 3);
|
||||
|
||||
{
|
||||
LinphoneCallLog *log = linphone_core_get_last_outgoing_call_log(laure->lc);
|
||||
BC_ASSERT_PTR_NOT_NULL(log);
|
||||
if (log) {
|
||||
BC_ASSERT_EQUAL((int)log->start_date_time, 1441738272, int, "%d");
|
||||
linphone_call_log_unref(log);
|
||||
log = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
laure->lc->call_logs = ms_list_free_with_data(laure->lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
call_logs_read_from_config_file(laure->lc);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue