*/
static void linphone_call_set_terminated(LinphoneCall *call){
- LinphoneCallStatus status=LinphoneCallAborted;
LinphoneCore *lc=call->core;
linphone_core_update_allocated_audio_bandwidth(lc);
- if (call->state==LinphoneCallEnd){
- if (call->reason==LinphoneReasonDeclined){
- status=LinphoneCallDeclined;
- }
- else status=LinphoneCallSuccess;
-
- }
+
call->owns_call_log=FALSE;
- linphone_call_log_completed(call->log,call, status);
+ linphone_call_log_completed(call);
if (call == lc->current_call){
call->state=cstate;
}
if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){
- linphone_call_set_terminated (call);
+ if (call->reason==LinphoneReasonDeclined){
+ call->log->status=LinphoneCallDeclined;
+ }
+ linphone_call_set_terminated (call);
}
+ if (cstate == LinphoneCallConnected) {
+ call->log->status=LinphoneCallSuccess;
+ }
if (lc->vtable.call_state_changed)
lc->vtable.call_state_changed(lc,call,cstate,message);
linphone_core_disconnected(call->core,call);
}
+void linphone_call_log_completed(LinphoneCall *call){
+ LinphoneCore *lc=call->core;
+
+ call->log->duration=time(NULL)-call->start_time;
+
+ if (call->log->status==LinphoneCallMissed){
+ char *info;
+ lc->missed_calls++;
+ info=ortp_strdup_printf(ngettext("You have missed %i call.",
+ "You have missed %i calls.", lc->missed_calls),
+ lc->missed_calls);
+ if (lc->vtable.display_status!=NULL)
+ lc->vtable.display_status(lc,info);
+ ms_free(info);
+ }
+ lc->call_logs=ms_list_prepend(lc->call_logs,(void *)call->log);
+ if (ms_list_size(lc->call_logs)>lc->max_call_logs){
+ MSList *elem,*prevelem=NULL;
+ /*find the last element*/
+ for(elem=lc->call_logs;elem!=NULL;elem=elem->next){
+ prevelem=elem;
+ }
+ elem=prevelem;
+ linphone_call_log_destroy((LinphoneCallLog*)elem->data);
+ lc->call_logs=ms_list_remove_link(lc->call_logs,elem);
+ }
+ if (lc->vtable.call_log_updated!=NULL){
+ lc->vtable.call_log_updated(lc,call->log);
+ }
+ call_logs_write_to_config_file(lc);
+}
+
set_call_log_date(cl,&loctime);
cl->from=from;
cl->to=to;
+ cl->status=LinphoneCallAborted; /*default status*/
return cl;
}
-static void call_logs_write_to_config_file(LinphoneCore *lc){
+void call_logs_write_to_config_file(LinphoneCore *lc){
MSList *elem;
char logsection[32];
int i;
}
-void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call, LinphoneCallStatus status){
- LinphoneCore *lc=call->core;
-
- calllog->duration=time(NULL)-call->start_time;
-
- if (status==LinphoneCallMissed){
- char *info;
- lc->missed_calls++;
- info=ortp_strdup_printf(ngettext("You have missed %i call.",
- "You have missed %i calls.", lc->missed_calls),
- lc->missed_calls);
- if (lc->vtable.display_status!=NULL)
- lc->vtable.display_status(lc,info);
- ms_free(info);
- }else calllog->status=status;
- lc->call_logs=ms_list_prepend(lc->call_logs,(void *)calllog);
- if (ms_list_size(lc->call_logs)>lc->max_call_logs){
- MSList *elem,*prevelem=NULL;
- /*find the last element*/
- for(elem=lc->call_logs;elem!=NULL;elem=elem->next){
- prevelem=elem;
- }
- elem=prevelem;
- linphone_call_log_destroy((LinphoneCallLog*)elem->data);
- lc->call_logs=ms_list_remove_link(lc->call_logs,elem);
- }
- if (lc->vtable.call_log_updated!=NULL){
- lc->vtable.call_log_updated(lc,calllog);
- }
- call_logs_write_to_config_file(lc);
-}
/**
* @addtogroup call_logs
lc->vtable.global_state_changed(lc,gstate,message);
}
}
+static void misc_config_read (LinphoneCore *lc) {
+ LpConfig *config=lc->config;
+ lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15);
+}
static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path,
const char *factory_config_path, void * userdata)
video_config_read(lc);
//autoreplier_config_init(&lc->autoreplier_conf);
lc->presence_mode=LinphoneStatusOnline;
- lc->max_call_logs=15;
+ misc_config_read(lc);
ui_config_read(lc);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Ready"));
/* private: */
LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *local, LinphoneAddress * remote);
-void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call, LinphoneCallStatus status);
+void linphone_call_log_completed(LinphoneCall *call);
void linphone_call_log_destroy(LinphoneCallLog *cl);
void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);
#ifndef NB_MAX_CALLS
#define NB_MAX_CALLS (10)
#endif
-
+void call_logs_write_to_config_file(LinphoneCore *lc);
#endif /* _PRIVATE_H */