]> sjero.net Git - linphone/commitdiff
fix publish request, whose request uri must identify the resources for which the...
authorSimon Morlat <simon.morlat@linphone.org>
Wed, 17 Apr 2013 13:49:34 +0000 (15:49 +0200)
committerSimon Morlat <simon.morlat@linphone.org>
Wed, 17 Apr 2013 13:49:34 +0000 (15:49 +0200)
coreapi/sal_eXosip2.c
coreapi/sal_eXosip2.h
coreapi/sal_eXosip2_presence.c

index 75ee46298c5ced1d3c102d5cb0121de670f690b0..e577b6422ad43b4de8802e232456eae23eb7c477 100644 (file)
@@ -2317,7 +2317,7 @@ static void register_set_contact(osip_message_t *msg, const char *contact){
        osip_uri_uparam_add(ct->url,osip_strdup("line"),line);\r
 }\r
 \r
        osip_uri_uparam_add(ct->url,osip_strdup("line"),line);\r
 }\r
 \r
-static void sal_register_add_route(osip_message_t *msg, const char *proxy){\r
+void sal_message_add_route(osip_message_t *msg, const char *proxy){\r
        osip_route_t *route;\r
 \r
        osip_list_special_free(&msg->routes,(void (*)(void*))osip_route_free);\r
        osip_route_t *route;\r
 \r
        osip_list_special_free(&msg->routes,(void (*)(void*))osip_route_free);\r
@@ -2364,7 +2364,7 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
                h->rid=eXosip_register_build_initial_register(from,domain,NULL,expires,&msg);\r
                if (msg){\r
                        if (contact) register_set_contact(msg,contact);\r
                h->rid=eXosip_register_build_initial_register(from,domain,NULL,expires,&msg);\r
                if (msg){\r
                        if (contact) register_set_contact(msg,contact);\r
-                       sal_register_add_route(msg,proxy);\r
+                       sal_message_add_route(msg,proxy);\r
                        sal_add_register(h->base.root,h);\r
                }else{\r
                        ms_error("Could not build initial register.");\r
                        sal_add_register(h->base.root,h);\r
                }else{\r
                        ms_error("Could not build initial register.");\r
@@ -2374,7 +2374,7 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
        }else{\r
                eXosip_lock();\r
                eXosip_register_build_register(h->rid,expires,&msg);\r
        }else{\r
                eXosip_lock();\r
                eXosip_register_build_register(h->rid,expires,&msg);\r
-               sal_register_add_route(msg,proxy);\r
+               sal_message_add_route(msg,proxy);\r
        }\r
        if (msg){\r
                eXosip_register_send_register(h->rid,msg);\r
        }\r
        if (msg){\r
                eXosip_register_send_register(h->rid,msg);\r
@@ -2412,7 +2412,7 @@ int sal_register_refresh(SalOp *op, int expires){
        eXosip_register_build_register(op->rid,expires,&msg);\r
        if (msg!=NULL){\r
                if (contact) register_set_contact(msg,contact);\r
        eXosip_register_build_register(op->rid,expires,&msg);\r
        if (msg!=NULL){\r
                if (contact) register_set_contact(msg,contact);\r
-               sal_register_add_route(msg,sal_op_get_route(op));\r
+               sal_message_add_route(msg,sal_op_get_route(op));\r
                eXosip_register_send_register(op->rid,msg);\r
        }else ms_error("Could not build REGISTER refresh message.");\r
        eXosip_unlock();\r
                eXosip_register_send_register(op->rid,msg);\r
        }else ms_error("Could not build REGISTER refresh message.");\r
        eXosip_unlock();\r
index 68a2d05ef845e5efc0063d0ab9acbf3d3f0bfd42..e00dd64d99722fb21851b77f8ac9dd60b04e0da1 100644 (file)
@@ -99,4 +99,6 @@ SalCustomHeader * sal_exosip_get_custom_headers(osip_message_t *msg);
 
 void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*));
 
 
 void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*));
 
+void sal_message_add_route(osip_message_t *msg, const char *proxy);
+
 #endif
 #endif
index 1b64fe42970884ce0fdfe253067aa69187a4efa6..c8191098649343f2bb6ebf8689d06e881efd557f 100644 (file)
@@ -637,23 +637,26 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p
        osip_message_t *pub;
        int i;
        char buf[1024];
        osip_message_t *pub;
        int i;
        char buf[1024];
+       const char *route=sal_op_get_route(op);
 
        mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
 
 
        mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
 
-       i = eXosip_build_publish(&pub,from, to, sal_op_get_route(op), "presence", "300", 
+       i = eXosip_build_publish(&pub,to, from, NULL, "presence", "600", 
                presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
        if (i<0){
                ms_warning("Failed to build publish request.");
                return -1;
        }
                presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
        if (i<0){
                ms_warning("Failed to build publish request.");
                return -1;
        }
-
+       if (route)
+               sal_message_add_route(pub,route);
+       
        eXosip_lock();
        i = eXosip_publish(pub, to); /* should update the sip-if-match parameter
                                    from sip-etag  from last 200ok of PUBLISH */
        eXosip_unlock();
        if (i<0){
        eXosip_lock();
        i = eXosip_publish(pub, to); /* should update the sip-if-match parameter
                                    from sip-etag  from last 200ok of PUBLISH */
        eXosip_unlock();
        if (i<0){
-         ms_message("Failed to send publish request.");
-         return -1;
+               ms_message("Failed to send publish request.");
+               return -1;
        }
        sal_add_other(sal_op_get_sal(op),op,pub);
        return 0;
        }
        sal_add_other(sal_op_get_sal(op),op,pub);
        return 0;