]> sjero.net Git - linphone/commitdiff
add call id to LinphoneCallLogs
authorJehan Monnier <jehan.monnier@linphone.org>
Tue, 2 Oct 2012 13:30:06 +0000 (15:30 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Tue, 2 Oct 2012 13:30:06 +0000 (15:30 +0200)
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/sal.c
coreapi/sal.h
coreapi/sal_eXosip2.c
java/common/org/linphone/core/LinphoneCallLog.java

index b2f53e5a5d898dd324e4bda41857156283d1dd0d..1351f0eb90dd039a299c5d468e7e0bb6a1163403 100644 (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));
index 93c1a8cf3d6642ae53b62e4f4dd64282d17e9ab0..66cb26eff35b5793bf349337cd3c97a87890c24e 100644 (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;
index 179ff0ce9c769220ccd9efb6504018a62f1a831a..735f1a04857a9832745e1a747bc8b118ff1f03e7 100644 (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;
 
 
index a7bb00e3e816d32c01433e75eef7d16c4be10af7..b349ad0a4e4efd002dbd701d607415a88c843fff 100644 (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);
 }
 
index 751cc653309df69c99762dc1a0fb9993c4704b6f..1bce846c660986505452a5d58b5d62a87246a764 100644 (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);
index b09cae4ffc3da254eef78fd9d309219eb53caaff..4b5c2053947192cd7014fcb18b59dccf18f6155e 100644 (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);
 }
index 40299e6d95bdc3c129aeadb85702469ca4348371..1abdb7bed9acbcf3dbfb57d00b33942956276c92 100644 (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();
 }