Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
10458ff9
Commit
10458ff9
authored
Nov 23, 2015
by
Sylvain Berfini
🐮
Browse files
Added method to find call log from call id
parent
f1a872ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletion
+47
-1
coreapi/call_log.c
coreapi/call_log.c
+32
-0
coreapi/linphonecore.h
coreapi/linphonecore.h
+8
-0
tester/call_tester.c
tester/call_tester.c
+7
-1
No files found.
coreapi/call_log.c
View file @
10458ff9
...
...
@@ -637,6 +637,34 @@ LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
return
result
;
}
LinphoneCallLog
*
linphone_core_find_call_log_from_call_id
(
LinphoneCore
*
lc
,
const
char
*
call_id
)
{
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 call_id = '%q' ORDER BY id DESC LIMIT 1"
,
call_id
);
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
;
}
if
(
lc
->
call_logs
&&
result
)
{
copy_user_data_from_existing_log
(
lc
->
call_logs
,
result
);
}
return
result
;
}
#else
void
linphone_core_call_log_storage_init
(
LinphoneCore
*
lc
)
{
...
...
@@ -670,4 +698,8 @@ LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
return
NULL
;
}
LinphoneCallLog
*
linphone_core_find_call_log_from_call_id
(
LinphoneCore
*
lc
,
const
char
*
call_id
)
{
return
NULL
;
}
#endif
\ No newline at end of file
coreapi/linphonecore.h
View file @
10458ff9
...
...
@@ -3276,6 +3276,14 @@ LINPHONE_PUBLIC MSList * linphone_core_get_call_history_for_address(LinphoneCore
**/
LINPHONE_PUBLIC
LinphoneCallLog
*
linphone_core_get_last_outgoing_call_log
(
LinphoneCore
*
lc
);
/**
* Get the call log matching the call id, or NULL if can't be found.
* @param[in] lc LinphoneCore object
* @param[in] call_id Call id of the call log to find
* @return {LinphoneCallLog}
**/
LINPHONE_PUBLIC
LinphoneCallLog
*
linphone_core_find_call_log_from_call_id
(
LinphoneCore
*
lc
,
const
char
*
call_id
);
/**
* Erase the call log.
* @param[in] lc LinphoneCore object
...
...
tester/call_tester.c
View file @
10458ff9
...
...
@@ -5314,6 +5314,7 @@ static void call_logs_sqlite_storage(void) {
logs
=
linphone_core_get_call_history_for_address
(
marie
->
lc
,
linphone_proxy_config_get_identity_address
(
linphone_core_get_default_proxy_config
(
pauline
->
lc
)));
if
(
BC_ASSERT_TRUE
(
ms_list_size
(
logs
)
==
1
))
{
const
char
*
call_id
;
const
char
*
ref_key
=
linphone_call_log_get_ref_key
(
call_log
);
call_log
=
logs
->
data
;
BC_ASSERT_EQUAL
(
linphone_call_log_get_dir
(
call_log
),
LinphoneCallOutgoing
,
int
,
"%d"
);
...
...
@@ -5331,7 +5332,11 @@ static void call_logs_sqlite_storage(void) {
BC_ASSERT_STRING_EQUAL
(
ref_key
,
"ref_key"
);
}
BC_ASSERT_PTR_EQUAL
(
linphone_call_log_get_user_data
(
call_log
),
&
start_time
);
BC_ASSERT_PTR_NOT_NULL
(
linphone_call_log_get_call_id
(
call_log
));
call_id
=
linphone_call_log_get_call_id
(
call_log
);
BC_ASSERT_PTR_NOT_NULL
(
call_id
);
BC_ASSERT_PTR_NOT_NULL
(
linphone_core_find_call_log_from_call_id
(
marie
->
lc
,
call_id
));
BC_ASSERT_TRUE
(
linphone_address_equal
(
linphone_call_log_get_remote_address
(
call_log
),
linphone_proxy_config_get_identity_address
(
linphone_core_get_default_proxy_config
(
pauline
->
lc
))));
...
...
@@ -5339,6 +5344,7 @@ static void call_logs_sqlite_storage(void) {
BC_ASSERT_GREATER
(
linphone_call_log_get_start_date
(
call_log
),
start_time
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
linphone_call_log_get_status
(
call_log
),
LinphoneCallSuccess
,
int
,
"%d"
);
}
linphone_core_delete_call_log
(
marie
->
lc
,
(
LinphoneCallLog
*
)
ms_list_nth_data
(
logs
,
0
));
ms_list_free_with_data
(
logs
,
(
void
(
*
)(
void
*
))
linphone_call_log_unref
);
BC_ASSERT_TRUE
(
linphone_core_get_call_history_size
(
marie
->
lc
)
==
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment