add call id to LinphoneCallLogs

This commit is contained in:
Jehan Monnier 2012-10-02 15:30:06 +02:00
parent fd97457fe7
commit a977e46cbc
7 changed files with 24 additions and 3 deletions

View file

@ -411,6 +411,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
linphone_address_clean(from);
linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip);
linphone_call_init_common(call, from, to);
call->log->call_id=ms_strdup(sal_op_get_call_id(op)); /*must be known at that time*/
linphone_core_init_default_params(lc, &call->params);
call->params.has_video &= !!lc->video_policy.automatically_accept;
call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(op));

View file

@ -139,6 +139,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc){
if (cl->refkey) lp_config_set_string(cfg,logsection,"refkey",cl->refkey);
lp_config_set_float(cfg,logsection,"quality",cl->quality);
lp_config_set_int(cfg,logsection,"video_enabled", cl->video_enabled);
lp_config_set_string(cfg,logsection,"call_id",cl->call_id);
}
for(;i<lc->max_call_logs;++i){
snprintf(logsection,sizeof(logsection),"call_log_%i",i);
@ -189,6 +190,8 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){
if (tmp) cl->refkey=ms_strdup(tmp);
cl->quality=lp_config_get_float(cfg,logsection,"quality",-1);
cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0);
cl->call_id=lp_config_get_string(cfg,logsection,"call_id",NULL);
if(cl->call_id) cl->call_id=ms_strdup(cl->call_id);
lc->call_logs=ms_list_append(lc->call_logs,cl);
}else break;
}
@ -296,6 +299,7 @@ void linphone_call_log_destroy(LinphoneCallLog *cl){
if (cl->from!=NULL) linphone_address_destroy(cl->from);
if (cl->to!=NULL) linphone_address_destroy(cl->to);
if (cl->refkey!=NULL) ms_free(cl->refkey);
if (cl->call_id) ms_free((void*)cl->call_id);
ms_free(cl);
}
@ -2212,6 +2216,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){
real_url=linphone_address_as_string(call->log->to);
from=linphone_address_as_string(call->log->from);
err=sal_call(call->op,from,real_url);
call->log->call_id=ms_strdup(sal_op_get_call_id(call->op)); /*must be known at that time*/
if (lc->sip_conf.sdp_200_ack){
call->media_pending=TRUE;

View file

@ -146,7 +146,7 @@ typedef struct _LinphoneCallLog{
LinphoneCallStatus status; /**< The status of the call*/
LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
char start_date[128]; /**<Human readable string containg the start date*/
char start_date[128]; /**<Human readable string containing the start date*/
int duration; /**<Duration of the call in seconds*/
char *refkey;
void *user_pointer;
@ -156,6 +156,7 @@ typedef struct _LinphoneCallLog{
int video_enabled;
struct _LinphoneCore *lc;
time_t start_date_time; /**Start date of the call in seconds as expressed in a time_t */
const char* call_id; /**unique id of a call*/
} LinphoneCallLog;

View file

@ -269,7 +269,9 @@ const char *sal_op_get_proxy(const SalOp *op){
const char *sal_op_get_network_origin(const SalOp *op){
return ((SalOpBase*)op)->origin;
}
const char* sal_op_get_call_id(const SalOp *op) {
return ((SalOpBase*)op)->call_id;
}
void __sal_op_init(SalOp *b, Sal *sal){
memset(b,0,sizeof(SalOpBase));
((SalOpBase*)b)->root=sal;
@ -310,6 +312,8 @@ void __sal_op_free(SalOp *op){
sal_media_description_unref(b->local_media);
if (b->remote_media)
sal_media_description_unref(b->remote_media);
if (b->call_id)
ms_free((void*)b->call_id);
ms_free(op);
}

View file

@ -207,6 +207,7 @@ typedef struct SalOpBase{
SalMediaDescription *local_media;
SalMediaDescription *remote_media;
void *user_pointer;
const char* call_id;
} SalOpBase;
@ -373,6 +374,7 @@ const char *sal_op_get_network_origin(const SalOp *op);
/*returns far-end "User-Agent" string */
const char *sal_op_get_remote_ua(const SalOp *op);
void *sal_op_get_user_pointer(const SalOp *op);
const char* sal_op_get_call_id(const SalOp *op);
/*Call API*/
int sal_call_set_local_media_description(SalOp *h, SalMediaDescription *desc);

View file

@ -603,6 +603,7 @@ int sal_call(SalOp *h, const char *from, const char *to){
int err;
const char *route;
osip_message_t *invite=NULL;
osip_call_id_t *callid;
sal_op_set_from(h,from);
sal_op_set_to(h,to);
sal_exosip_fix_route(h);
@ -643,6 +644,8 @@ int sal_call(SalOp *h, const char *from, const char *to){
ms_error("Fail to send invite ! Error code %d", err);
return -1;
}else{
callid=osip_message_get_call_id(invite);
osip_call_id_to_str(callid,(char **)(&h->base.call_id));
sal_add_call(h->base.root,h);
}
return 0;
@ -1018,6 +1021,8 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){
osip_call_info_t *call_info;
char *tmp;
sdp_message_t *sdp=eXosip_get_sdp_info(ev->request);
osip_call_id_t *callid=osip_message_get_call_id(ev->request);
osip_call_id_to_str(callid,(char**)(&op->base.call_id));
set_network_origin(op,ev->request);
set_remote_ua(op,ev->request);
@ -1054,7 +1059,6 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){
op->tid=ev->tid;
op->cid=ev->cid;
op->did=ev->did;
sal_add_call(op->base.root,op);
sal->callbacks.call_received(op);
}

View file

@ -104,4 +104,8 @@ public interface LinphoneCallLog {
* @return the call duration, in seconds
*/
public int getCallDuration();
/**
* @return the call id from signaling
*/
public int getCallId();
}