mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Added API to create and store a fake LinphoneCallLog
This commit is contained in:
parent
5817cb363e
commit
dde2e3009f
5 changed files with 61 additions and 1 deletions
|
|
@ -168,6 +168,23 @@ bctbx_list_t * call_logs_read_from_config_file(LinphoneCore *lc){
|
|||
* Public functions *
|
||||
******************************************************************************/
|
||||
|
||||
LinphoneCallLog *linphone_core_create_call_log(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, LinphoneCallDir dir,
|
||||
int duration, time_t start_time, time_t connected_time, LinphoneCallStatus status, bool_t video_enabled, float quality) {
|
||||
LinphoneCallLog *log = linphone_call_log_new(dir, linphone_address_ref(from), linphone_address_ref(to));
|
||||
|
||||
log->duration = duration;
|
||||
log->start_date_time = start_time;
|
||||
set_call_log_date(log,log->start_date_time);
|
||||
log->connected_date_time = connected_time;
|
||||
log->status = status;
|
||||
log->video_enabled = video_enabled;
|
||||
log->quality = quality;
|
||||
|
||||
linphone_core_store_call_log(lc, log);
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
const char *linphone_call_log_get_call_id(const LinphoneCallLog *cl){
|
||||
return cl->call_id;
|
||||
}
|
||||
|
|
@ -317,7 +334,7 @@ LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *fr
|
|||
set_call_log_date(cl,cl->start_date_time);
|
||||
cl->from=from;
|
||||
|
||||
cl->to=to;
|
||||
cl->to=to;
|
||||
|
||||
cl->status=LinphoneCallAborted; /*default status*/
|
||||
cl->quality=-1;
|
||||
|
|
|
|||
|
|
@ -8890,3 +8890,15 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getTlsKeyPath(JNIEnv
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createCallLog(JNIEnv *env, jobject, jlong jcore, jlong jfrom, jlong jto, jint jdir, jint duration, jlong start_time, jlong connected_time, jint jstatus, jboolean video_enabled, jfloat quality) {
|
||||
LinphoneCore *core = (LinphoneCore*)jcore;
|
||||
LinphoneAddress *from = (LinphoneAddress *)jfrom;
|
||||
LinphoneAddress *to = (LinphoneAddress *)jto;
|
||||
LinphoneCallDir dir = (LinphoneCallDir)jdir;
|
||||
time_t start = (time_t) start_time;
|
||||
time_t connected = (time_t) connected_time;
|
||||
LinphoneCallStatus status = (LinphoneCallStatus)jstatus;
|
||||
LinphoneCallLog *log = linphone_core_create_call_log(core, from, to, dir, duration, start, connected, status, video_enabled, quality);
|
||||
return (jlong) log;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,6 +197,23 @@ LINPHONE_PUBLIC LinphoneCallLog * linphone_call_log_ref(LinphoneCallLog *cl);
|
|||
**/
|
||||
LINPHONE_PUBLIC void linphone_call_log_unref(LinphoneCallLog *cl);
|
||||
|
||||
/**
|
||||
* Creates a fake LinphoneCallLog.
|
||||
* @param[in] lc LinphoneCore object
|
||||
* @param[in] from LinphoneAddress of caller
|
||||
* @param[in] to LinphoneAddress of callee
|
||||
* @param[in] dir LinphoneCallDir of call
|
||||
* @param[in] duration call length in seconds
|
||||
* @param[in] start_time timestamp of call start time
|
||||
* @param[in] connected_time timestamp of call connection
|
||||
* @param[in] status LinphoneCallStatus of call
|
||||
* @param[in] video_enabled whether video was enabled or not for this call
|
||||
* @param[in] quality call quality
|
||||
* @return LinphoneCallLog object
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneCallLog *linphone_core_create_call_log(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, LinphoneCallDir dir,
|
||||
int duration, time_t start_time, time_t connected_time, LinphoneCallStatus status, bool_t video_enabled, float quality);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* DEPRECATED *
|
||||
|
|
|
|||
|
|
@ -2549,4 +2549,10 @@ public interface LinphoneCore {
|
|||
* @return a new LinphoneFriend with the given address link with this LinphoneCore
|
||||
*/
|
||||
public LinphoneFriend createFriendWithAddress(String address);
|
||||
|
||||
/**
|
||||
* Creates and stores a fake LinphoneCallLog
|
||||
* @return the LinphoneCallLog created and stored
|
||||
*/
|
||||
public LinphoneCallLog createCallLog(LinphoneAddress from, LinphoneAddress to, CallDirection dir, int duration, long start, long connected, LinphoneCallLog.CallStatus status, boolean videoEnabled, float quality);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1824,4 +1824,12 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public LinphoneFriend createFriendWithAddress(String address) {
|
||||
return (LinphoneFriend) createFriendWithAddress(nativePtr, address);
|
||||
}
|
||||
|
||||
private native long createCallLog(long ptr, long from, long to, int dir, int duration, long start, long connected, int status, boolean videoEnabled, float quality);
|
||||
@Override
|
||||
public LinphoneCallLog createCallLog(LinphoneAddress from, LinphoneAddress to, CallDirection dir, int duration, long start, long connected, LinphoneCallLog.CallStatus status, boolean videoEnabled, float quality) {
|
||||
long logPtr = createCallLog(nativePtr, ((LinphoneAddressImpl) from).nativePtr, ((LinphoneAddressImpl) to).nativePtr, dir == CallDirection.Incoming ? 1 : 0, duration, start, connected, status.toInt(), videoEnabled, quality);
|
||||
LinphoneCallLog log = new LinphoneCallLogImpl(logPtr);
|
||||
return log;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue