From: Jehan Monnier Date: Tue, 2 Oct 2012 13:30:06 +0000 (+0200) Subject: add call id to LinphoneCallLogs X-Git-Url: http://sjero.net/git/?p=linphone;a=commitdiff_plain;h=a977e46cbce85aeae1e26824e7e096b377346009 add call id to LinphoneCallLogs --- diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b2f53e5a..1351f0eb 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -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)); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 93c1a8cf..66cb26ef 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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(;imax_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; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 179ff0ce..735f1a04 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -146,7 +146,7 @@ typedef struct _LinphoneCallLog{ LinphoneCallStatus status; /**< The status of the call*/ LinphoneAddress *from; /**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); } diff --git a/coreapi/sal.h b/coreapi/sal.h index 751cc653..1bce846c 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -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); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index b09cae4f..4b5c2053 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -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); } diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 40299e6d..1abdb7be 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -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(); }