]> sjero.net Git - linphone/blobdiff - coreapi/sal_eXosip2_presence.c
fix sending of PUBLISH requests (was not set to the proxy address actually)
[linphone] / coreapi / sal_eXosip2_presence.c
index 1e49970bfd4a3d05c4f177100b731d5d7b1447f0..ffa7ed92066801ddfd37cbe50398674671ee0898 100644 (file)
@@ -94,8 +94,10 @@ static inline char *my_ctime_r(const time_t *t, char *buf){
 
 int sal_message_send(SalOp *op, const char *from, const char *to, const char* content_type, const char *msg){
        osip_message_t *sip=NULL;
-       time_t t=time(NULL);
-       char buf[26];
+       char t[26];
+       time_t curtime=time(NULL);
+       
+       my_ctime_r(&curtime,t);
 
        if(op->cid == -1)
        {
@@ -111,7 +113,7 @@ int sal_message_send(SalOp *op, const char *from, const char *to, const char* co
                        sal_op_get_from(op),sal_op_get_route(op));
                if (sip!=NULL){
                        sal_exosip_add_custom_headers(sip,op->base.custom_headers);
-                       osip_message_set_date(sip,my_ctime_r(&t,buf));
+                       osip_message_set_date(sip,t);
                        osip_message_set_content_type(sip,content_type);
                        if (msg) osip_message_set_body(sip,msg,strlen(msg));
                        sal_add_other(op->base.root,op,sip);
@@ -133,6 +135,8 @@ int sal_message_send(SalOp *op, const char *from, const char *to, const char* co
                        eXosip_unlock();
                        return -1;
                }
+               sal_exosip_add_custom_headers(sip,op->base.custom_headers);
+               osip_message_set_date(sip,t);
                osip_message_set_content_type(sip,content_type);
                if (msg) osip_message_set_body(sip,msg,strlen(msg));
                eXosip_call_send_request(op->did,sip);
@@ -631,7 +635,7 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p
 
        mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
 
-       i = eXosip_build_publish(&pub,from, to, NULL, "presence", "300", 
+       i = eXosip_build_publish(&pub,from, to, sal_op_get_route(op), "presence", "300", 
                presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
        if (i<0){
                ms_warning("Failed to build publish request.");